Advertisement
Guest User

Untitled

a guest
Apr 30th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.71 KB | None | 0 0
  1. { config, pkgs, ... }:
  2.  
  3. let
  4. lowBatteryNotifier = pkgs.writeScript "lowBatteryNotifier"
  5. ''
  6. DISPLAY=:0.0
  7. BAT=`${pkgs.acpi}/bin/acpi -b | ${pkgs.gnugrep}/bin/grep -P -o '[0-9]+(?=%)'`
  8. STAT=`${pkgs.acpi}/bin/acpi -b | ${pkgs.gnugrep}/bin/grep -P -o '\S+(harging)'`
  9. test $STAT = "Discharging" -a $BAT -le 15 -a $BAT -gt 7 && DISPLAY=:0.0 ${pkgs.libnotify}/bin/notify-send 'Low Battery'
  10. test $STAT = "Discharging" -a $BAT -le 7 && DISPLAY=:0.0 ${pkgs.libnotify}/bin/notify-send 'OMG I am dying'
  11. '';
  12. in
  13. {
  14. imports =
  15. [
  16. ./hardware-configuration.nix # Include the results of the hardware scan.
  17. ./packages.nix # more environment.systemPackages
  18. ];
  19.  
  20. boot.loader.systemd-boot.enable = true;
  21. boot.loader.efi.canTouchEfiVariables = true;
  22.  
  23. networking.hostName = "ckopo-nix";
  24. networking.wireless = {
  25. enable = true;
  26. userControlled.enable = true;
  27. userControlled.group = "wheel";
  28. networks = {
  29. # not important and sensitive
  30. };
  31. };
  32.  
  33. networking.extraHosts = ''
  34. 127.0.0.1 localhost
  35. '';
  36.  
  37. networking.firewall = {
  38. enable = true;
  39. allowedTCPPorts = [ 22 80 8055 8082 8080 24000 26000 ];
  40. allowedUDPPorts = [ 26000 ];
  41. };
  42.  
  43. i18n = {
  44. consoleFont = "ruscii-8x16";
  45. # consoleKeyMap = "us";
  46. defaultLocale = "ru_RU.UTF-8";
  47. };
  48.  
  49. time.timeZone = "Asia/Irkutsk";
  50.  
  51. powerManagement.enable = true;
  52.  
  53. # hardware.pulseaudio.enable = true;
  54. # hardware.pulseaudio.support32Bit = true;
  55.  
  56. # hardware.bluetooth = {
  57. # enable = true;
  58. # powerOnBoot = false;
  59. # };
  60.  
  61. hardware.opengl = {
  62. driSupport = true;
  63. driSupport32Bit = true;
  64. };
  65.  
  66. # VirtualBox with Extension Pack
  67. virtualisation.virtualbox.host.enable = true;
  68. nixpkgs.config.virtualbox.enableExtensionPack = true;
  69.  
  70. # Moar packages!
  71. nixpkgs.config.allowUnfree = true;
  72.  
  73. # List packages installed in system profile. To search by name, run:
  74. # $ nix-env -qaP | grep wget
  75. environment = {
  76.  
  77. systemPackages = with pkgs; [
  78. nox
  79.  
  80. # wicd
  81. # networkmanager
  82. # networkmanagerapplet
  83.  
  84. # acpi pciutils
  85. acpi gnugrep
  86. zip unzip
  87.  
  88. wget mc
  89. w3m tmux byobu
  90.  
  91. git gnumake
  92. # emacs # let's leave them both for this moment
  93. mdp
  94.  
  95. vim xkb_switch vimPlugins.vim-xkbswitch
  96.  
  97. gcc binutils
  98. zlib zlibStatic cmark # temp slibs
  99.  
  100. python36Full
  101. jetbrains.pycharm-professional
  102. jetbrains.idea-ultimate
  103.  
  104. aalib
  105. # android-studio
  106. acpi
  107. atom love
  108. bind
  109. blender
  110. cabal-install cabal2nix
  111. cmatrix
  112. codeblocks
  113. ctodo
  114. desmume
  115. dropbox
  116. # elm #
  117. # emem # Markdown to HTML
  118. file # file types
  119. freeglut
  120. freetype
  121. mesa_glu
  122. gnome3.gnome_terminal
  123. # gnum4 # m4 macro processor
  124. # guitarix
  125. gutenprint # ?
  126. gxmessage
  127. gzdoom
  128. # <> haxe
  129. # hedgewars
  130. # ies2-bus-arbiter
  131. imv
  132. # inotify-tools
  133. # ioquake3
  134. libcdio
  135. libnotify
  136. xorg.libSM
  137. lm_sensors
  138. mtools
  139. # mesa_noglu
  140. # mysql-workbench
  141. # netbeans
  142. netbeans
  143. # <> nexuiz
  144. # nix-repl
  145. nmap
  146. nodejs
  147. p7zip
  148. patchelf
  149. pciutils
  150. # pidgin
  151. psmisc
  152. pv
  153. # pypi2nix
  154. # python2nix
  155. python36Packages.tkinter
  156. python36Packages.numpy # matplotlib Pillow pip
  157. python36Packages.pyqt5 # requests setuptools sympy
  158. qtcreator
  159. # steam
  160. # screen
  161. sqlite
  162. sshpass
  163. sysstat
  164. system-config-printer
  165. tcpdump
  166. traceroute
  167. translate-shell
  168. unar
  169. usbutils
  170. xfce.xfce4notifyd
  171. # xfontsel
  172. xlsfonts
  173. xsel
  174. zlib
  175.  
  176. ghc stack
  177.  
  178. mesa_drivers mesa_glu
  179. xorg_sys_opengl glmark2
  180.  
  181. # love # is user-space installed by now
  182. # busybox
  183.  
  184. gksu
  185. scrot
  186.  
  187. # moc
  188. # xdotool xlaunch
  189. # stalonetray xclip volumeicon
  190.  
  191. libreoffice # do not ask
  192. vlc firefox gimp
  193.  
  194. # haskellPackages.hmenu
  195. # haskellPackages.yeganesh
  196. # haskellPackages.xmobar
  197.  
  198. # i3status
  199. python36Packages.i3-py
  200. # python35Packages.i3ipc
  201. # gnome2.zenity
  202. xorg.xmessage
  203. xorg.xbacklight
  204. # mpc_cli mpd ncmpcpp
  205. bar-xft conky
  206. dmenu
  207.  
  208. # xfce
  209. # gtk # To get GTK+'s themes
  210. # gnome.gnomeicontheme # more icons
  211. hicolor_icon_theme # icons for thunar
  212. shared_mime_info
  213.  
  214. xorg.xsetroot nitrogen # wallpapers
  215. # lxappearance gtk-engine-murrine
  216. # gtk_engines
  217.  
  218. gnome2.gnome_icon_theme
  219. desktop_file_utils
  220. xfce.garcon
  221. xfce.thunar_volman
  222. xfce.gvfs
  223. xfce.xfce4_appfinder
  224.  
  225. xfce.exo
  226. xfce.gtk_xfce_engine
  227. xfce.gvfs # auto mounting
  228. xfce.libxfce4ui
  229. xfce.libxfcegui4
  230. # xfce.thunar # file manager
  231. # xfce.thunar_volman # auto mounting
  232. # xfce.xfceutils # this should be deleted
  233. xfce.xfce4icontheme # for thunar
  234. xfce.xfce4settings
  235. xfce.xfconf
  236. xfce.mousepad
  237. xfce.terminal
  238.  
  239. # zathura # pdf viewer
  240. ];
  241.  
  242. shellAliases = {
  243. # g = "git";
  244. # gl = "git log --pretty=format:\"%an, %ar, %h: %s\"";
  245. # gs = "git status";
  246. # gf = "git fetch";
  247. # ga = "git add";
  248. # gcl = "git clone";
  249. # gc = "git commit -m";
  250. # gca = "git commit -a -m";
  251. # gm = "git merge";
  252. # gb = "git branch";
  253. # gco = "git checkout";
  254. # gd = "git diff";
  255. gp = "git pull --rebase && git push";
  256. gull = "git pull --rebase";
  257. gpp = "git pull --rebase git push";
  258. gush = "git push";
  259. gu = "git ls-files --other --exclude-standard";
  260. gt = "git log --graph --oneline --decorate --all";
  261.  
  262. nixos-fix = "nix-store --verify --check-contents --repair";
  263. nixos-repkg = "nix-build --check -A";
  264. nixos-clean = "nix-collect-garbage -d";
  265. nixos-search = "nix-env -qaP --description \\* | sed -re \"s/^nixos\\.//g\" | fgrep -i";
  266. nixos-update = "nixos-rebuild switch";
  267. nixos-upgrade = "nixos-rebuild switch --upgrade";
  268. nxf = "nixos-fix";
  269. nxr = "nixos-repkg";
  270. nxc = "nixos-clean";
  271. nxs = "nixos-search";
  272. nxu = "nixos-update";
  273. nxg = "nixos-upgrade"; # TODO: sync git in /etc/nixos/* from imports
  274.  
  275. nxedit = "vim -p /etc/nixos/packages.nix /etc/nixos/configuration.nix";
  276. # nxedit = "vim /etc/nixos/configuration.nix";
  277.  
  278. pff = "poweroff";
  279. stb = "stack --nix build";
  280. stg = "stack --nix ghci";
  281.  
  282. ".." = "cd ..";
  283. e = "$=EDITOR";
  284. d = "$=TILE_CMD";
  285. st = "$=TERM_CMD";
  286. cg = "grep --color=always";
  287. cgr = "cg -r";
  288. less = "less -R";
  289. timestamp = "date +%s -d";
  290. wtf-size = "du -ha -d1 | sort -h";
  291. my-ip = "curl ipecho.net/plain";
  292.  
  293. shakal-1 = "nix-store --optimize";
  294. shakal-2 = "nix-env --delete-generations 2d";
  295. shakal-3 = "nix-collect-garbage --delete-older-than 2d";
  296.  
  297. ies2-1 = "curl http://game.ies2/api/stage/prepare";
  298. ies2-2 = "curl http://game.ies2/api/stage/scripting";
  299. ies2-3 = "curl http://game.ies2/api/stage/start";
  300. ies2-s = "ssh game.ies2 -p 24000";
  301. };
  302.  
  303. };
  304.  
  305. # Some programs need SUID wrappers, can be configured further or are
  306. # started in user sessions.
  307. # programs.bash.enableCompletion = true;
  308. # programs.mtr.enable = true;
  309. # programs.gnupg.agent = { enable = true; enableSSHSupport = true; };
  310.  
  311. # Cron.
  312. services.cron = {
  313. enable = true;
  314. mailto = "user";
  315. systemCronJobs = [
  316. # "30 23 * * * user DISPLAY=:0.0 ${pkgs.libnotify}/bin/notify-send 'Time to go to bed'"
  317. "* * * * * user ${lowBatteryNotifier}"
  318. # "@weekly root nix-collect-garbage"
  319. ];
  320. };
  321.  
  322. services.openssh = {
  323. enable = true;
  324. extraConfig = ''
  325. ClientAliveInterval 15
  326. X11Forwarding yes
  327. X11UseLocalHost no
  328. '';
  329. permitRootLogin = "no";
  330. ports = [ 22 ];
  331. passwordAuthentication = true;
  332. };
  333.  
  334. # Enable CUPS to print documents.
  335. # services.printing.enable = true;
  336.  
  337. # ANDROID DEBUG
  338.  
  339. # Huawei
  340. # services.udev.extraRules = ''
  341. # SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0660", GROUP="plugdev"
  342. # '';
  343.  
  344. # Acer Aspire sound device fix
  345. boot.extraModprobeConfig = ''
  346. options snd_hda_intel id=PCH,HDMI index=1,0
  347. '';
  348.  
  349. # Less sudden poweroffs
  350. services.logind.extraConfig = ''
  351. HandleLidSwitch=suspend
  352. HandlePowerKey=ignore
  353. '';
  354.  
  355. services.xserver = {
  356. enable = true;
  357. defaultDepth = 24;
  358. videoDriver = "intel";
  359. layout = "us, ru";
  360. xkbOptions = "compose:ralt, grp:ctrl_shift_toggle, grp_led:caps";
  361. # grp:caps_toggle, grp_led:caps
  362. # libinput.enable = true;
  363. # libinput.disableWhileTyping = true;
  364. synaptics = { # yes, I would need that
  365. enable = true;
  366. twoFingerScroll = true;
  367. additionalOptions = ''
  368. MatchProduct "ETPS/2 Elantech Touchpad"
  369. '';
  370. };
  371.  
  372. windowManager.i3.enable = true;
  373. # windowManager.xmonad = {
  374. # enable = true;
  375. # enableContribAndExtras = true;
  376. # };
  377. windowManager.default = "i3";
  378.  
  379. # displayManager.lightdm.enable = true;
  380. displayManager = {
  381. slim = {
  382. enable = true;
  383. defaultUser = "user";
  384. theme = pkgs.fetchurl {
  385. url = "https://github.com/edwtjo/nixos-black-theme/archive/v1.0.tar.gz";
  386. sha256 = "13bm7k3p6k7yq47nba08bn48cfv536k4ipnwwp1q1l2ydlp85r9d";
  387. };
  388. # theme = pkgs.slimThemes.subway;
  389. # TODO: download, hack and upload to db.tt
  390. # theme = pkgs.fetchurl {
  391. # url = "https://github.com/Hinidu/nixos-solarized-slim-theme/archive/master.zip";
  392. # sha256 = "f0ef5ed9518f05b9c540a5dd7e21111a26e91d405f1292ad86b1fc8704733ca8";
  393. # };
  394. };
  395. };
  396.  
  397. desktopManager.xterm.enable = false;
  398.  
  399. # displayManager.kdm.enable = true;
  400. # desktopManager.kde4.enable = true;
  401. };
  402.  
  403. fonts = {
  404. enableFontDir = true;
  405. enableGhostscriptFonts = true;
  406. fonts = with pkgs; [
  407. font-awesome-ttf
  408. fira
  409. fira-mono
  410. # nerdfonts
  411. # input-fonts
  412. terminus_font
  413. powerline-fonts
  414. (let input-fonts = let version = "2017-01-23";
  415. in with pkgs; stdenv.mkDerivation rec {
  416. name = "input-fonts-${version}";
  417. src = pkgs.fetchurl {
  418. name = "Input-Font.zip";
  419. url = "http://input.fontbureau.com/build/?fontSelection=whole&a=0&g=ss&i=serif&l=serifs_round&zero=0&asterisk=0&braces=straight&preset=dejavu&line-height=1.2&accept=I+do&email=";
  420. sha256 = "15b1mw4pzck91k5msqfsc20syv5rl84di1ylbjdilnpxhq9ggz29";
  421. };
  422. nativeBuildInputs = [ unzip ];
  423. phases = [ "unpackPhase" "installPhase" ];
  424. sourceRoot = ".";
  425. installPhase = ''
  426. mkdir -p $out/share/fonts/truetype
  427. find Input_Fonts -name "*.ttf" -exec cp -a {} "$out"/share/fonts/truetype/ \;
  428. mkdir -p "$out"/share/doc
  429. cp -a *.txt "$out"/share/doc/
  430. '';
  431.  
  432. meta = with stdenv.lib; {
  433. description = "Fonts for Code, from Font Bureau";
  434. homepage = http://input.fontbureau.com;
  435. license = licenses.unfree;
  436. maintainers = with maintainers; [ romildo ];
  437. platforms = platforms.all;
  438. };
  439. }; in input-fonts)
  440. ];
  441. };
  442.  
  443. users.groups = {
  444. dialout = {
  445. members = [ "user" ];
  446. };
  447. vboxusers = {
  448. members = [ "user" ];
  449. };
  450. };
  451.  
  452. users.users.user = {
  453. isNormalUser = true;
  454. uid = 1000;
  455. extraGroups = [ "wheel" "network" "dialout" "audio" "cdrom" ];
  456. shell = pkgs.bashInteractive; # Hey?
  457. # set password by passwd!
  458. };
  459.  
  460.  
  461. # Nixos Manual on tty8
  462. services.nixosManual.showManual = true;
  463.  
  464. # This value determines the NixOS release with which your system is to be
  465. # compatible, in order to avoid breaking some software such as database
  466. # servers. You should change this only after NixOS release notes say you
  467. # should.
  468. # system.stateVersion = "17.09"; # Did you read the comment?
  469. system.stateVersion = "18.03"; # Did you read the comment?
  470.  
  471. # a little workaround, which didn't work with chmod issue
  472. nix.readOnlyStore = false;
  473. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement