Advertisement
Kamiel

configuration.nix

Oct 4th, 2015
714
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 47.45 KB | None | 0 0
  1. # Edit this configuration file to define what should be installed on
  2. # your system.  Help is available in the configuration.nix(5) man page
  3. # and in the NixOS manual (accessible by running ‘nixos-help’).
  4.  
  5. { config, pkgs, ... }:
  6.  
  7. # CFLAGS="-march=core-avx2 -O2 -pipe"
  8.  
  9. {
  10.   imports =
  11.     [ # Include the results of the hardware scan.
  12.       ./hardware-configuration.nix
  13.     ];
  14.  
  15.   # Use the gummiboot efi boot loader.
  16.   boot = {
  17.     extraModprobeConfig = ''
  18.       # thinkpad acpi
  19.       options thinkpad_acpi fan_control=1
  20.       # intel graphics
  21.       options i915 modeset=1 i915_enable_rc6=7 i915_enable_fbc=1 lvds_downclock=1 powersave=0
  22.       # intel audio
  23.       options snd-hda-intel index=0 id=PCH
  24.       options snd-hda-intel index=1 id=HDMI
  25.       # options snd slots=snd-hda-intel
  26.       # fix intel wifi-N
  27.       options iwlwifi 11n_disable=1
  28.     '';
  29.     extraModulePackages = [ config.boot.kernelPackages.tp_smapi ];
  30.     kernelPackages = pkgs.linuxPackages_4_2; # TODO: zen-kernel BFQ/BFS/reiserfs/lowlatency/hibernation/custom font
  31.     kernelParams = [
  32.       # "acpi_osi=\"!Windows 2012\""
  33.       # "acpi_backlight=vendor"
  34.       "acpi_osi="
  35.       # "video.use_native_backlight=1"
  36.       "drm_kms_helper.edid_firmware=edid/1920x1080.bin"
  37.       "video=1920x1080"
  38.       "clocksource=acpi_pm pci=use_crs"
  39.       "consoleblank=0"
  40.     ];
  41.     loader.gummiboot.enable = true;
  42.     loader.efi.canTouchEfiVariables = true;
  43.     initrd.kernelModules = [
  44.       "intel_agp"
  45.       "i915"
  46.       "bbswitch"
  47.       # "tp_smapi"
  48.       # "fbcon" # ???: Built-in now
  49.     ];
  50.     blacklistedKernelModules = [
  51.       # No beeping
  52.       "snd_pcsp"
  53.       "pcspkr"
  54.       # fix bumblebeed
  55.       "nvidia_uvm"
  56.       # because of intel
  57.       "nouveau"
  58.       "nvidiafb"
  59.       # buggy and old
  60.       "thinkpad_acpi"
  61.     ];
  62.   };
  63.  
  64.   fileSystems."/" = pkgs.lib.mkForce {
  65.     label = "root";
  66.     fsType = "ext4";
  67.   };
  68.   fileSystems."/home" = pkgs.lib.mkForce {
  69.     label = "home";
  70.     fsType = "ext4";
  71.   };
  72.   fileSystems."/boot" = pkgs.lib.mkForce {
  73.     device = "/dev/disk/by-label/EFI";
  74.     fsType = "vfat";
  75.   };
  76.   fileSystems."/tmp" = pkgs.lib.mkForce {
  77.     device = "tmpfs";
  78.     fsType = "tmpfs";
  79.     options = "nosuid,nodev,relatime";
  80.   };
  81.  
  82.   swapDevices = pkgs.lib.mkForce [
  83.     { device = "/dev/disk/by-label/Swap"; }
  84.   ];
  85.  
  86.   networking = {
  87.     hostName = "hackbook";
  88.     hostId = "847849e7";
  89.     interfaceMonitor.enable = false;
  90.     wireless.enable = false;
  91.     wireless.interfaces = [ "wlp4s0" ];
  92.     wireless.userControlled.enable = true;
  93.     wireless.userControlled.group = "network";
  94.     useDHCP = false;
  95.     wicd.enable = true;
  96.   };
  97.  
  98.   nix = {
  99.     extraOptions = ''
  100.       auto-optimise-store = true
  101.       env-keep-derivations = true
  102.       gc-keep-outputs = true
  103.       gc-keep-derivations = true
  104.     '';
  105.     maxJobs = pkgs.lib.mkForce 9;
  106.     buildCores = pkgs.lib.mkForce 0;
  107.     useChroot = true;
  108.     binaryCaches = [ "https://cache.nixos.org/" # "https://hydra.nixos.org/" "https://hydra.cryp.to/"
  109.     ];
  110.   };
  111.  
  112.   nixpkgs.config = {
  113.     allowUnfree = true;
  114.  
  115.     firefox = {
  116.       enableGoogleTalkPlugin = true;
  117.       enableAdobeFlash = true;
  118.     };
  119.     chromium = {
  120.       enablePepperFlash = true;
  121.       enablePepperPDF = true;
  122.     };
  123.     mesa = {
  124.       enableTextureFloats = true;
  125.     };
  126.     # virtualbox.enableExtensionPack = true;
  127.  
  128.     haskellPackageOverrides = self : super : (let inherit (pkgs.haskell-ng) lib; in {
  129.       # cabal-install = lib.overrideCabal super.cabal-install (attrs: {
  130.       #         buildDepends = [ self.text ]; # for antigen-hs, see: https://github.com/Tarrasch/antigen-hs/issues/24
  131.       # });
  132.       # ghc-mod = lib.overrideCabal super.ghc-mod (oldAttrs: {
  133.       #   src = pkgs.fetchgit {
  134.       #     url = https://github.com/kazu-yamamoto/ghc-mod;
  135.       #     rev = "247e4e0e7616fe1fecc68fdcf80d6249ac4cee4f";
  136.       #     sha256 = "2a23271d0e6907351a246f095040ba18c3ab6bf1cba08a14338d701defa55474";
  137.       #   };
  138.       #   buildDepends = oldAttrs.buildDepends ++ [ self.cabal-helper self.cereal ];
  139.       # });
  140.  
  141.       # cabal-helper = lib.overrideCabal super.cabal-helper (oldAttrs: {
  142.       #   version = "0.3.2.0";
  143.       #   sha256 = "06igjmr0n8418wid1pr74cgvlsmwni7ar72g9bddivlbxax1pfli";
  144.       # });
  145.       # HaRe = lib.overrideCabal super.HaRe (attrs: {
  146.       #   version = "0.6.1.0";
  147.       #   sha256 = "1azxbfvzdn73bv3vg6xylrjiahaxcx86vhx9b60z106a4ynkxdfr";
  148.       # });
  149.       # ghc-mod = super.ghc-mod.overrideDerivation (attrs: {
  150.       #   src = pkgs.fetchFromGitHub {
  151.       #     owner = "kazu-yamamoto";
  152.       #     repo = "ghc-mod";
  153.       #     rev = "19b3de356928f7c1a7aa3a59430beae08a883e7b";
  154.       #     sha256 = "0airmyw5w912fxlq9r1076q6cca7nvh29smhny1lv694h3bbvgjz";
  155.       #   };
  156.       #   buildInputs = attrs.buildInputs ++ [ pkgs.haskellPackages.cabal-helper ];
  157.       # });
  158.       # cabal-helper = super.cabal-helper.overrideDerivation (attrs: {
  159.       #   src = pkgs.fetchFromGitHub {
  160.       #     owner = "DanielG";
  161.       #     repo = "cabal-helper";
  162.       #     rev = "c2f6a2e5bf40f9e4cb9276bcc9b58ec3627f727a";
  163.       #     sha256 = "075a4i8ck75rc03pmzr65ys20s9g0jwyclfvnziminpp3p8p53vi";
  164.       #   };
  165.       #   version = "0.6.0.0";
  166.       # });
  167.       # cabal-helper = lib.overrideCabal super.cabal-helper (attrs: {
  168.       #   version = "0.6.0.0";
  169.       #   sha256 = "0b12mz370fhlibln6w9c67npp9ivvgkayxn53zv5pq7w76rd1ajv";
  170.       # });
  171.       hobbes = super.hobbes.overrideDerivation (attrs: {
  172.         src = pkgs.fetchFromGitHub {
  173.           owner = "jhickner";
  174.           repo = "hobbes";
  175.           rev = "764b04465b9d46e3521d42cd26f006b571aad912";
  176.           sha256 = "05cqirxfnibnwr1vwziwxp75jh7m871jq5y2rmbkz79b7bw8lbcz";
  177.         };
  178.         buildInputs = with pkgs.haskellPackages; [
  179.           filepath
  180.           filemanip
  181.           fsnotify
  182.           text
  183.         ];
  184.       });
  185.     });
  186.  
  187.     packageOverrides = pkgs: {
  188.       qt48Full = pkgs.qt48Full.override { gtkStyle = true; };
  189.       qt53 = pkgs.qt53.override { gtkStyle = true; };
  190.       emacs = pkgs.emacs.override {
  191.         withGTK2 = false;
  192.         withGTK3 = true;
  193.         # imagemagick = pkgs.imagemagickBig;
  194.       };
  195.       # wicd = pkgs.wicd.override {
  196.       #   python = pkgs.python34;
  197.       # };
  198.       # sxiv_xft = pkgs.stdenv.lib.overrideDerivation (pkgs.sxiv.override
  199.       #   (args: args) // { # here add new args
  200.       #     # withImagemagick = true;
  201.       #     # withLibjpeg = true;
  202.       #     # withGimp = true;
  203.       #   }
  204.       # ) (attrs: {
  205.       #   name = "sxiv_xft-2013.10.27";
  206.       #   # meta.description = "Simple (or small or suckless) X Image Viewer with manga view mode (-m) (baskerville xft fork)";
  207.       #   prePatch = ''
  208.       #     substituteInPlace config.def.h 'static const char * const BAR_FONT = "Monospace:size=9";' 'static const char * const BAR_FONT = "Inconsolata LGC:size=8.6";'
  209.       #     substituteInPlace config.def.h 'static const char * const WIN_BG_COLOR = "#555555";' 'static const char * const WIN_BG_COLOR = "#fdf6e3";'
  210.       #     substituteInPlace config.def.h 'static const char * const WIN_FS_COLOR = "#000000";' 'static const char * const WIN_FS_COLOR = "#657b83";'
  211.       #     substituteInPlace config.def.h 'static const char * const SEL_COLOR    = "#EEEEEE";' 'static const char * const SEL_COLOR    = "#eee8d5";'
  212.       #     substituteInPlace config.def.h 'static const char * const BAR_BG_COLOR = "#222222";' 'static const char * const BAR_BG_COLOR = "#fdf6e3";'
  213.       #     substituteInPlace config.def.h 'static const char * const BAR_FG_COLOR = "#EEEEEE";' 'static const char * const BAR_FG_COLOR = "#657b83";'
  214.       #   '';
  215.       #   src = pkgs.fetchFromGitHub {
  216.       #           owner = "Pitometsu";
  217.       #           repo = "sxiv";
  218.       #     # branch = "xft";
  219.       #     sha256 = "02zj4gmckaca5ryxb52ma1fd26gm2fjpahz7f7iv801qs8i88b1j";
  220.       #     rev = "6af450670d20cfaa779013e85e709eb3fe022c52";
  221.       #   };
  222.       #   # patches = [
  223.       #   #   (let manga_patch = {
  224.       #   #     name = "manga-patch";
  225.       #   #     src = import <nix/fetchurl.nix> {
  226.       #   #       url = "https://github.com/baskerville/sxiv/commit/77eb07637d14c432319605d3e383d37ff1a91850.patch";
  227.       #   #       md5 = "7faf8df927e34a44802ecc17e7b80755";
  228.       #   #     };
  229.       #   #   }; in manga_patch.src)
  230.       #   #   (let xft_patch = {
  231.       #   #     name = "xft-patch";
  232.       #   #     src = import <nix/fetchurl.nix> {
  233.       #   #       url = "https://github.com/baskerville/sxiv/commit/ea4ea27cae735f107c191eb4590db357f9ee5d4f.patch";
  234.       #   #       md5 = "0b8cc129d9d078322fa82179544cc008";
  235.       #   #     };
  236.       #   #   }; in xft_patch.src)
  237.       #   # ];
  238.       #   # buildInputs = attrs.buildInputs ++  [ pkgs.xlibs.libXft ] ++ stdenv.lib.optional attrs.withImagemagick pkgs.imagemagick ++ stdenv.lib.optional attrs.withLibjpeg pkgs.libjpeg ++ stdenv.lib.optional attrs.withGimp pkgs.gimp;
  239.       #         buildInputs = attrs.buildInputs ++  [ pkgs.xlibs.libXft ];
  240.       #         # buildDepends = [ pkgs.xlibs.libXft ];
  241.       # });
  242.     };
  243.   };
  244.  
  245.   # system.copySystemConfiguration = true; # broken because of chroot
  246.  
  247.   services.ntp.enable = true;
  248.   time.timeZone = "Europe/Kiev";
  249.  
  250.   # Select internationalisation properties.
  251.   i18n = {
  252.     consoleFont = "${pkgs.terminus_font}/share/consolefonts/ter-v16n.psf.gz";
  253.     consoleKeyMap = "dvp";
  254.     defaultLocale = "en_US.UTF-8";
  255.   };
  256.  
  257.   programs.zsh = {
  258.     enable = true;
  259.   };
  260.  
  261.   environment = {
  262.     shellAliases = {
  263.       g = "git";
  264.       gl = "git log --pretty=format:\"%an, %ar, %h: %s\"";
  265.       gs = "git status";
  266.       gf = "git fetch";
  267.       ga = "git add";
  268.       gc = "git commit -m";
  269.       gca = "git commit -a -m";
  270.       gp = "git pull --rebase && git push";
  271.       gull = "git pull --rebase";
  272.       gpp = "git pull --rebase git push";
  273.       gush = "git push";
  274.       gm = "git merge";
  275.       gb = "git branch";
  276.       gco = "git checkout";
  277.       gd = "git diff";
  278.       gu = "git ls-files --other --exclude-standard";
  279.       gt = "git log --graph --oneline --decorate --all";
  280.       ecw = "emacsclient";
  281.       ec = "emacsclient -nw";
  282.       gr = "egrep -s --colour=auto";
  283.       tr = "tree -C";
  284.       t = "tr -L 1";
  285.       lls = "ls -F -h --color=auto";
  286.       ll = "ls -l";
  287.       la = "ls -a";
  288.       ls = "ls -h";
  289.       lla = "la -1";
  290.       l = "ls";
  291.       nano = "nano -w";
  292.       cp = "cp -viR";
  293.       mv = "mv -vi";
  294.       rm = "rm -viR";
  295.       md = "mkdir -p -v";
  296.       # jackD = "set_rlimits jackd -Rv -p512 -d alsa -dhw:1 -r96000 -p4096 -n2 -Xseq";
  297.       df = "df -h";
  298.       du = "du -h";
  299.       # burndvd = "growisofs -Z /dev/dvdrw -R -J";
  300.       # burndvdISO = "growisofs -dvd-compat -Z /dev/dvdrw=";
  301.       # burncd = "mkisofs -r -f -jcharset=cp1251 -C $(cdrecord dev=/dev/cdrw -msinfo) -M /dev/cdrw $HOME/forburn/ | cdrecord --speed=4 -v -multi driveropts=burnfree -eject dev=/dev/cdrw -";
  302.       # burncdISO = "cdrecord --speed=4 -v -multi driveropts=burnfree -eject dev=/dev/cdrw";
  303.       # blankcd = "cdrecord --dev=/dev/cdrw --blank=fast";
  304.       # bl = "baudline_jack -waveform -realtime -record -jack -inconnect";
  305.       wget = "wget --no-check-certificate";
  306.       wgetp = "wgetpaste -rXvt";
  307.       killall = "pkill";
  308.       pbcopy = "xsel --clipboard --input --display :0";
  309.       pbpaste = "xsel --clipboard --output --display :0";
  310.       open = "DISPLAY=:0 xdg-open";
  311.       zip = "zip -r";
  312.       ew = "emacs -Q";
  313.       et = "emacs -nw -Q";
  314.       tv = "pv -p --timer --rate --bytes";
  315.       dmesg = "dmesg --color=always";
  316.       less = "less -R";
  317.       s = "ssh";
  318.       c = "curl";
  319.       f = "find";
  320.       h = "heroku";
  321.       haix = "heroku sudo apps:info -xa";
  322.       be = "bundle exec";
  323.       nix-clean = "nix-collect-garbage -d";
  324.       nix-search = "nix-env -qaP --description \* | sed -re 's/^nixos\.//g' | fgrep -i";
  325.       nix-update = "nixos-rebuild switch";
  326.       nix-upgrade = "nixos-rebuild switch --upgrade";
  327.       nxc = "nix-clean";
  328.       nxs = "nix-search";
  329.       nxu = "nix-update";
  330.       nxg = "nix-upgrade";
  331.     };
  332.     shells = [
  333.       "/run/current-system/sw/bin/zsh"
  334.       "/run/current-system/sw/bin/bash"
  335.     ];
  336.     variables = {
  337.       EDITOR = "et";
  338.       # DRI_PRIME = "1";
  339.       VDPAU_DRIVER = "va_gl";
  340.     };
  341.     interactiveShellInit = ''
  342.     '';
  343.     # binsh = "${pkgs.dash}/bin/dash"; # SLIM not work with DASH :'(
  344.  
  345.     # /var/run/current-system/sw/etc/profile
  346.     # shellInit = ''
  347.     #   # ===================================
  348.     #   # SYSTEM WIDE CONFIGURATION GOES HERE
  349.     #   # ===================================
  350.     #   # Set GTK_PATH so that GTK+ can find themes engine.
  351.     #   export GTK_PATH=$GTK_PATH:${pkgs.numix-gtk-theme}/lib/gtk-2.0::${pkgs.numix-gtk-theme}/lib/gtk-3.0:${pkgs.gtk-engine-murrine}/lib/gtk-2.0
  352.  
  353.     #   # Set GTK2 RC
  354.     #   export GTK2_RC_FILES=$GTK2_RC_FILES:${pkgs.numix-gtk-theme}/share/themes/Numix/gtk-2.0/gtkrc
  355.  
  356.     #   # Set GTK_DATA_PREFIX so that GTK+ can find the system themes.
  357.     #   export GTK_DATA_PREFIX=$GTK_DATA_PREFIX:${config.system.path}
  358.     #   # ===================================
  359.     # '';
  360.     # pathsToLink =
  361.     #   [ "/usr/share/themes" "/usr/share/mime" "/usr/share/desktop-directories" ];
  362.  
  363.     # List packages installed in system profile
  364.     systemPackages = with pkgs; ([
  365.       # appearance
  366.       lxappearance gtk-engine-murrine hicolor_icon_theme gtk_engines # numix-icon-theme numix-gtk-theme
  367.       # desktop
  368.       gmrun dmenu compton-git unclutter haskellPackages.yeganesh haskellPackages.xmobar redshift unclutter scrot stalonetray xlaunch xlibs.xev xlibs.xlsfonts xclip xsel primus wmctrl feh xdotool # bgs
  369.       # env
  370.       emacs moc mpv vlc rxvt_unicode zathura conkeror chromium firefox transmission_gtk rtorrent gimp inkscape skype sxiv # sxiv_xft # sxiv_bskv_manga # libreoffice
  371.       # (let sxiv_xft = with pkgs; stdenv.mkDerivation rec {
  372.       #        name = "sxiv_xft";
  373.       #        src = fetchgit {
  374.       #          url = "git://github.com/pitometsu/sxiv.git";
  375.       #          sha256 = "1fapnvaj0cf9gj2gmdls1ch2jh68i51sga9zdmrirmzr9fwqhfhx";
  376.       #          rev = "6af450670d20cfaa779013e85e709eb3fe022c52";
  377.       #        };
  378.       #        postUnpack = ''
  379.       #          substituteInPlace $sourceRoot/Makefile \
  380.       #            --replace /usr/local $out
  381.       #        '';
  382.       #        buildInputs = with pkgs.xlibs; [ libX11 imlib2 libXft libXext fontconfig giflib libexif ]; # TODO: make giflib and libexif optional
  383.       #        meta = with stdenv.lib; {
  384.       #          description = "Simple (or small or suckless) X Image Viewer (xft fork)";
  385.       #          homepage = https://github.com/pitometsu/sxiv;
  386.       #          license = licenses.gpl2Plus;
  387.       #          platforms = platforms.linux;
  388.       #        };
  389.       #      }; in sxiv_xft)
  390.       # cli
  391.       tmux w3m wget zsh tree file lsof
  392.       # dev
  393.       gcc clang gdb gnumake automake autoconf cmake gitAndTools.gitFull subversion bazaar bazaarTools cvs mercurial darcs silver-searcher jre haskellPackages.hobbes # oraclejre oraclejdk
  394.       git-hub heroku haskellPackages.hobbes
  395.       # ruby
  396.       ruby bundler
  397.       # python
  398.       python34Packages.ipython python34Packages.pip python34Packages.virtualenv
  399.       # sci
  400.       R texLive graphviz emacs24Packages.ess gnuplot # octave
  401.       # utils
  402.       keychain aspell imgurbash pastebinit wgetpaste gnupg openvpn qrencode unrar unzip p7zip imagemagickBig pv glxinfo
  403.       python27Packages.googlecl python34Packages.youtube-dl gist haskellPackages.pandoc  haskellPackages.hakyll
  404.       # sys
  405.       dash usbutils pciutils lshw htop ntfs3g fbterm nox hdparm powertop aircrackng acpitool mkpasswd reiser4progs udisks haskellPackages.shake bashmount utillinuxCurses parted gptfdisk # udisks manpages
  406.       # host
  407.       # qemu_kvm # linuxPackages_4_1.virtualbox
  408.     ] ++ (with haskellPackages; [
  409.       # happy hasktags stylish-haskell present hoogle hindent
  410.       cabal-install hlint ghc stack structured-haskell-mode ghc-mod hi hdevtools hoogle
  411.     ]) ++ (with haskell.packages.ghc784; [
  412.       # structured-haskell-mode # ghc stack hlint ghc-mod hi hdevtools cabal-install
  413.     ]) # ++ [ haskell.packages.ghc763.HaRe ]
  414.     );
  415.   };
  416.   # nixpkgs.config.allowBroken = true;
  417.  
  418.   environment.etc."adobe/mms.cfg".text = ''
  419.     EnableLinuxHWVideoDecode = 1
  420.     OverrideGPUValidation = 1
  421.   '';
  422.  
  423.   fonts = {
  424.     enableCoreFonts = true;
  425.     enableFontDir = true;
  426.     enableGhostscriptFonts = false;
  427.  
  428.     fonts = with pkgs; [
  429.       terminus_font
  430.       ubuntu_font_family
  431.       liberation_ttf
  432.       freefont_ttf
  433.       source-code-pro
  434.       (let inconsolata-lgc  = let version = "1.2.0";
  435.            in with pkgs; stdenv.mkDerivation rec {
  436.              name = "inconsolata-lgc-${version}";
  437.              src = fetchurl {
  438.                url = "https://github.com/MihailJP/Inconsolata-LGC/releases/download/LGC-1.2.0/InconsolataLGC-OT-1.2.0.tar.xz";
  439.                sha256 = "0rw8i481sdqi0pspbvyd2f86k0vlrb6mbi94jmsl1kms18c18p66";
  440.              };
  441.              dontBuild = true;
  442.              installPhase = let
  443.                fonts_dir = "$out/share/fonts/opentype";
  444.                doc_dir = "$out/share/doc/${name}";
  445.              in ''
  446.                mkdir -pv "${fonts_dir}"
  447.                mkdir -pv "${doc_dir}"
  448.                cp -v *.otf "${fonts_dir}"
  449.                cp -v {README,LICENSE,ChangeLog} "${doc_dir}"
  450.              '';
  451.              meta = with stdenv.lib; {
  452.                homepage = http://www.levien.com/type/myfonts/inconsolata.html;
  453.                description = "A monospace font for both screen and print, LGC extension";
  454.                license = licenses.ofl;
  455.                platforms = platforms.all;
  456.              };
  457.            }; in inconsolata-lgc)
  458.       inconsolata
  459.       vistafonts
  460.       dejavu_fonts
  461.       freefont_ttf
  462.       unifont
  463.       cm_unicode
  464.       ipafont
  465.       baekmuk-ttf
  466.       source-han-sans-japanese
  467.       source-han-sans-korean
  468.       source-han-sans-simplified-chinese
  469.       source-han-sans-traditional-chinese
  470.       source-sans-pro
  471.       source-serif-pro
  472.       fira
  473.       fira-code
  474.       fira-mono
  475.       hasklig
  476.     ];
  477.     fontconfig = {
  478.       enable = true;
  479.       dpi = 100;
  480.       antialias = true;
  481.       hinting = {
  482.         autohint = false;
  483.         enable = true;
  484.         style = "slight";
  485.       };
  486.       subpixel.lcdfilter = "default";
  487.       ultimate.useEmbeddedBitmaps = true;
  488.  
  489.       defaultFonts = {
  490.         serif = [ "Source Sans Pro" "DejaVu Serif" "IPAMincho" "Beakmuk Batang" ];
  491.         sansSerif = [ "Source Serif Pro" "DejaVu Sans" "IPAGothic" "Beakmuk Dotum" ];
  492.         monospace = [ "Inconsolata LGC" "DejaVu Sans Mono" "IPAGothic" "Beakmuk Dotum" ];
  493.       };
  494.     };
  495.   };
  496.  
  497.   environment.etc."fonts/conf.d/98-matches.conf".text = ''
  498.     <?xml version="1.0"?>
  499.     <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
  500.     <fontconfig>
  501.       <match target="font">
  502.          <!-- Medium hinting for smaller fonts -->
  503.         <match target="font">
  504.           <test compare="more" name="pixelsize" qual="any"><double>5</double></test>
  505.           <test compare="less_eq" name="pixelsize" qual="any"><double>9</double></test>
  506.           <edit mode="assign" name="hintstyle"><const>hintmedium</const></edit>
  507.           <edit mode="assign" name="lcdfilter"><const>lcdlight</const></edit>
  508.         </match>
  509.         <!-- Full hinting for smallest fonts -->
  510.         <match target="font">
  511.           <test compare="less_eq" name="pixelsize" qual="any"><double>5</double></test>
  512.           <edit mode="assign" name="hintstyle"><const>hintfull</const></edit>
  513.           <edit mode="assign" name="lcdfilter"><const>lcdnone</const></edit>
  514.         </match>
  515.         <!-- Medium hinting for bigger fonts -->
  516.         <match target="font">
  517.           <test compare="more_eq" name="pixelsize" qual="any"><double>18</double></test>
  518.           <test compare="less" name="pixelsize" qual="any"><double>24</double></test>
  519.           <edit mode="assign" name="hintstyle"><const>hintmedium</const></edit>
  520.           <edit mode="assign" name="lcdfilter"><const>lcdlight</const></edit>
  521.         </match>
  522.         <!-- Full hinting for biggest fonts -->
  523.         <match target="font">
  524.           <test compare="more_eq" name="pixelsize" qual="any"><double>24</double></test>
  525.           <edit mode="assign" name="hintstyle"><const>hintfull</const></edit>
  526.           <edit mode="assign" name="lcdfilter"><const>lcdnone</const></edit>
  527.         </match>
  528.         <!-- Medium hinting for BOLD bigger fonts -->
  529.         <match target="font">
  530.           <test compare="more_eq" name="pixelsize" qual="any"><double>16</double></test>
  531.           <test compare="less" name="pixelsize" qual="any"><double>18</double></test>
  532.           <test name="weight" compare="more"><const>medium</const></test>
  533.           <edit mode="assign" name="hintstyle"><const>hintmedium</const></edit>
  534.           <edit mode="assign" name="lcdfilter"><const>lcdlight</const></edit>
  535.         </match>
  536.         <!-- Full hinting for BOLD biggest fonts -->
  537.         <match target="font">
  538.           <test compare="more_eq" name="pixelsize" qual="any"><double>18</double></test>
  539.           <test name="weight" compare="more"><const>medium</const></test>
  540.           <edit mode="assign" name="hintstyle"><const>hintfull</const></edit>
  541.           <edit mode="assign" name="lcdfilter"><const>lcdnone</const></edit>
  542.         </match>
  543.         <!-- Medium hinting for _italic_ bigger fonts -->
  544.         <match target="font">
  545.           <test compare="more_eq" name="pixelsize" qual="any"><double>16</double></test>
  546.           <test name="slant" compare="not_eq"><double>0</double></test>
  547.           <edit mode="assign" name="hintstyle"><const>hintmedium</const></edit>
  548.           <edit mode="assign" name="lcdfilter"><const>lcdlight</const></edit>
  549.         </match>
  550.       </match>
  551.     </fontconfig>
  552.   '';
  553.  
  554.   environment.etc."fonts/conf.d/99-aliases.conf".text = ''
  555.     <?xml version="1.0"?>
  556.     <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
  557.     <fontconfig>
  558.       <match target="font">
  559.         <!-- Use Nimbus Sans L instead of Helvetica -->
  560.         <alias binding="same">
  561.           <family>Helvetica</family>
  562.           <prefer>
  563.             <family>Nimbus Sans L</family>
  564.             <family>DejaVu Sans</family>
  565.             <family>Source Han Sans</family>
  566.             <family>Sazanami-Hanazono Mincho</family>
  567.             <family>Hancom</family>
  568.             <family>Code2000</family>
  569.             <family>Code2001</family>
  570.             <family>Code2002</family>
  571.           </prefer>
  572.         </alias>
  573.         <!-- Use Nimbus Sans L instead of Segoe UI -->
  574.         <alias binding="same">
  575.           <family>Segoe UI</family>
  576.           <prefer>
  577.             <family>Nimbus Sans L</family>
  578.             <family>DejaVu Sans</family>
  579.             <family>Source Han Sans</family>
  580.             <family>Sazanami-Hanazono Mincho</family>
  581.             <family>Hancom</family>
  582.             <family>Code2000</family>
  583.             <family>Code2001</family>
  584.             <family>Code2002</family>
  585.           </prefer>
  586.         </alias>
  587.         <!-- Use Liberation Sans instead of Arial -->
  588.         <alias binding="same">
  589.           <family>Arial Unicode MS</family>
  590.           <prefer>
  591.             <family>DejaVu Sans</family>
  592.             <family>Source Han Sans</family>
  593.             <family>Sazanami-Hanazono Mincho</family>
  594.             <family>Hancom</family>
  595.             <family>Code2000</family>
  596.             <family>Code2001</family>
  597.             <family>Code2002</family>
  598.           </prefer>
  599.         </alias>
  600.         <!-- Use Liberation Sans instead of Arial -->
  601.         <alias binding="same">
  602.           <family>Arial</family>
  603.           <prefer>
  604.             <family>Liberation Sans</family>
  605.             <family>DejaVu Sans</family>
  606.             <family>Source Han Sans</family>
  607.             <family>Sazanami-Hanazono Mincho</family>
  608.             <family>Hancom</family>
  609.             <family>Code2000</family>
  610.             <family>Code2001</family>
  611.             <family>Code2002</family>
  612.           </prefer>
  613.         </alias>
  614.         <!-- Use Liberation Sans instead of Corbel -->
  615.         <alias binding="same">
  616.           <family>Corbel</family>
  617.           <prefer>
  618.             <family>Liberation Sans</family>
  619.             <family>DejaVu Sans</family>
  620.             <family>Source Han Sans</family>
  621.             <family>Sazanami-Hanazono Mincho</family>
  622.             <family>Hancom</family>
  623.             <family>Code2000</family>
  624.             <family>Code2001</family>
  625.             <family>Code2002</family>
  626.           </prefer>
  627.         </alias>
  628.         <!-- Use Liberation Sans instead of Candara -->
  629.         <alias binding="same">
  630.           <family>Candara</family>
  631.           <prefer>
  632.             <family>Liberation Sans</family>
  633.             <family>DejaVu Sans</family>
  634.             <family>Source Han Sans</family>
  635.             <family>Sazanami-Hanazono Mincho</family>
  636.             <family>Hancom</family>
  637.             <family>Code2000</family>
  638.             <family>Code2001</family>
  639.             <family>Code2002</family>
  640.           </prefer>
  641.         </alias>
  642.         <!-- Use Liberation Serif instead of Times New Roman -->
  643.         <alias binding="same">
  644.           <family>Times New Roman</family>
  645.           <prefer>
  646.             <family>Liberation Serif</family>
  647.             <family>DejaVu Serif</family>
  648.             <family>Source Han Sans</family>
  649.             <family>Sazanami-Hanazono Mincho</family>
  650.             <family>Hancom</family>
  651.             <family>Code2000</family>
  652.             <family>Code2001</family>
  653.             <family>Code2002</family>
  654.           </prefer>
  655.         </alias>
  656.         <!-- Use Liberation Serif instead of Palatino Linotype -->
  657.         <alias binding="same">
  658.           <family>Palatino Linotype</family>
  659.           <prefer>
  660.             <family>Liberation Serif</family>
  661.             <family>DejaVu Serif</family>
  662.             <family>Source Han Sans</family>
  663.             <family>Sazanami-Hanazono Mincho</family>
  664.             <family>Hancom</family>
  665.             <family>Code2000</family>
  666.             <family>Code2001</family>
  667.             <family>Code2002</family>
  668.           </prefer>
  669.         </alias>
  670.         <!-- Use Liberation Serif instead of Sylfaen -->
  671.         <alias binding="same">
  672.           <family>Sylfaen</family>
  673.           <prefer>
  674.             <family>Liberation Serif</family>
  675.             <family>DejaVu Serif</family>
  676.             <family>Source Han Sans</family>
  677.             <family>Sazanami-Hanazono Mincho</family>
  678.             <family>Hancom</family>
  679.             <family>Code2000</family>
  680.             <family>Code2001</family>
  681.             <family>Code2002</family>
  682.           </prefer>
  683.         </alias>
  684.         <!-- Use Liberation Serif instead of Cambria -->
  685.         <alias binding="same">
  686.           <family>Cambria</family>
  687.           <prefer>
  688.             <family>Liberation Serif</family>
  689.             <family>DejaVu Serif</family>
  690.             <family>Source Han Sans</family>
  691.             <family>Sazanami-Hanazono Mincho</family>
  692.             <family>Hancom</family>
  693.             <family>Code2000</family>
  694.             <family>Code2001</family>
  695.             <family>Code2002</family>
  696.           </prefer>
  697.         </alias>
  698.         <!-- Use Droid Serif instead of Georgia -->
  699.         <alias binding="same">
  700.           <family>Georgia</family>
  701.           <prefer>
  702.             <family>Droid Serif</family>
  703.             <family>DejaVu Serif</family>
  704.             <family>Source Han Sans</family>
  705.             <family>Sazanami-Hanazono Mincho</family>
  706.             <family>Hancom</family>
  707.             <family>Code2000</family>
  708.             <family>Code2001</family>
  709.             <family>Code2002</family>
  710.           </prefer>
  711.         </alias>
  712.         <!-- Use Droid Serif instead of Constantia -->
  713.         <alias binding="same">
  714.           <family>Constantia</family>
  715.           <prefer>
  716.             <family>Droid Serif</family>
  717.             <family>DejaVu Serif</family>
  718.             <family>Source Han Sans</family>
  719.             <family>Sazanami-Hanazono Mincho</family>
  720.             <family>Hancom</family>
  721.             <family>Code2000</family>
  722.             <family>Code2001</family>
  723.             <family>Code2002</family>
  724.           </prefer>
  725.         </alias>
  726.         <!-- Use Ubuntu instead of Calibri -->
  727.         <alias binding="same">
  728.           <family>Calibri</family>
  729.           <prefer>
  730.             <family>Ubuntu</family>
  731.             <family>DejaVu Sans</family>
  732.             <family>Source Han Sans</family>
  733.             <family>Sazanami-Hanazono Mincho</family>
  734.             <family>Hancom</family>
  735.             <family>Code2000</family>
  736.             <family>Code2001</family>
  737.             <family>Code2002</family>
  738.           </prefer>
  739.         </alias>
  740.         <!-- Use Ubuntu instead of Trebuchet MS -->
  741.         <alias binding="same">
  742.           <family>Trebuchet MS</family>
  743.           <prefer>
  744.             <family>Ubuntu</family>
  745.             <family>DejaVu Sans</family>
  746.             <family>Source Han Sans</family>
  747.             <family>Sazanami-Hanazono Mincho</family>
  748.             <family>Hancom</family>
  749.             <family>Code2000</family>
  750.             <family>Code2001</family>
  751.             <family>Code2002</family>
  752.           </prefer>
  753.         </alias>
  754.         <!-- Use Ubuntu instead of Segoe Script -->
  755.         <alias binding="same">
  756.           <family>Segoe Script</family>
  757.           <prefer>
  758.             <family>Ubuntu</family>
  759.             <family>DejaVu Sans</family>
  760.             <family>Source Han Sans</family>
  761.             <family>Sazanami-Hanazono Mincho</family>
  762.             <family>Hancom</family>
  763.             <family>Code2000</family>
  764.             <family>Code2001</family>
  765.             <family>Code2002</family>
  766.           </prefer>
  767.         </alias>
  768.         <!-- Use Ubuntu instead of Lucida Sans Unicode -->
  769.         <alias binding="same">
  770.           <family>Lucida Sans Unicode</family>
  771.           <prefer>
  772.             <family>Ubuntu</family>
  773.             <family>DejaVu Sans</family>
  774.             <family>Source Han Sans</family>
  775.             <family>Sazanami-Hanazono Mincho</family>
  776.             <family>Hancom</family>
  777.             <family>Code2000</family>
  778.             <family>Code2001</family>
  779.             <family>Code2002</family>
  780.           </prefer>
  781.         </alias>
  782.         <!-- Use Ubuntu instead of Comic Sans MS -->
  783.         <alias binding="same">
  784.           <family>Comic Sans MS</family>
  785.           <prefer>
  786.             <family>Ubuntu</family>
  787.             <family>DejaVu Sans</family>
  788.             <family>Source Han Sans</family>
  789.             <family>Sazanami-Hanazono Mincho</family>
  790.             <family>Hancom</family>
  791.             <family>Code2000</family>
  792.             <family>Code2001</family>
  793.             <family>Code2002</family>
  794.           </prefer>
  795.         </alias>
  796.         <!-- Use Droid Sans instead of Verdana -->
  797.         <alias binding="same">
  798.           <family>Verdana</family>
  799.           <prefer>
  800.             <family>Droid Sans</family>
  801.             <family>DejaVu Sans</family>
  802.             <family>Source Han Sans</family>
  803.             <family>Sazanami-Hanazono Mincho</family>
  804.             <family>Hancom</family>
  805.             <family>Code2000</family>
  806.             <family>Code2001</family>
  807.             <family>Code2002</family>
  808.           </prefer>
  809.         </alias>
  810.         <!-- Use Droid Sans instead of Tahoma -->
  811.         <alias binding="same">
  812.           <family>Tahoma</family>
  813.           <prefer>
  814.             <family>Droid Sans</family>
  815.             <family>DejaVu Sans</family>
  816.             <family>Source Han Sans</family>
  817.             <family>Sazanami-Hanazono Mincho</family>
  818.             <family>Hancom</family>
  819.             <family>Code2000</family>
  820.             <family>Code2001</family>
  821.             <family>Code2002</family>
  822.           </prefer>
  823.         </alias>
  824.         <!-- Use Droid Sans instead of Microsoft Sans Serif -->
  825.         <alias binding="same">
  826.           <family>Microsoft Sans Serif</family>
  827.           <prefer>
  828.             <family>Droid Sans</family>
  829.             <family>DejaVu Sans</family>
  830.             <family>Source Han Sans</family>
  831.             <family>Sazanami-Hanazono Mincho</family>
  832.             <family>Hancom</family>
  833.             <family>Code2000</family>
  834.             <family>Code2001</family>
  835.             <family>Code2002</family>
  836.           </prefer>
  837.         </alias>
  838.         <!-- Use Inconsolata LGC instead of Consolas -->
  839.         <alias binding="same">
  840.           <family>Consolas</family>
  841.           <prefer>
  842.             <family>Inconsolata LGC</family>
  843.             <family>MigMix 1M</family>
  844.             <family>DejaVu Sans</family>
  845.             <family>Source Han Sans</family>
  846.             <family>Sazanami-Hanazono Mincho</family>
  847.             <family>Hancom</family>
  848.             <family>Code2000</family>
  849.             <family>Code2001</family>
  850.             <family>Code2002</family>
  851.           </prefer>
  852.         </alias>
  853.         <!-- Use Inconsolata LGC instead of Monaco -->
  854.         <alias binding="same">
  855.           <family>Monaco</family>
  856.           <prefer>
  857.             <family>Inconsolata LGC</family>
  858.             <family>MigMix 1M</family>
  859.             <family>DejaVu Sans</family>
  860.             <family>Source Han Sans</family>
  861.             <family>Sazanami-Hanazono Mincho</family>
  862.             <family>Hancom</family>
  863.             <family>Code2000</family>
  864.             <family>Code2001</family>
  865.             <family>Code2002</family>
  866.           </prefer>
  867.         </alias>
  868.         <!-- Use Inconsolata LGC instead of Monaco -->
  869.         <alias binding="same">
  870.           <family>Menlo</family>
  871.           <prefer>
  872.             <family>Ubuntu Mono</family>
  873.             <family>MigMix 1M</family>
  874.             <family>DejaVu Sans</family>
  875.             <family>Source Han Sans</family>
  876.             <family>Sazanami-Hanazono Mincho</family>
  877.             <family>Hancom</family>
  878.             <family>Code2000</family>
  879.             <family>Code2001</family>
  880.             <family>Code2002</family>
  881.           </prefer>
  882.         </alias>
  883.         <!-- Ubuntu Mono instead of Courier New -->
  884.         <alias binding="same">
  885.           <family>Courier New</family>
  886.           <prefer>
  887.             <family>Ubuntu Mono</family>
  888.             <family>MigMix 1M</family>
  889.             <family>DejaVu Sans</family>
  890.             <family>Source Han Sans</family>
  891.             <family>Sazanami-Hanazono Mincho</family>
  892.             <family>Hancom</family>
  893.             <family>Code2000</family>
  894.             <family>Code2001</family>
  895.             <family>Code2002</family>
  896.           </prefer>
  897.         </alias>
  898.         <!-- Ubuntu Mono instead of Lucida Console -->
  899.         <alias binding="same">
  900.           <family>Lucida Console</family>
  901.           <prefer>
  902.             <family>Ubuntu Mono</family>
  903.             <family>MigMix 1M</family>
  904.             <family>DejaVu Sans Mono</family>
  905.             <family>Source Han Sans</family>
  906.             <family>Sazanami-Hanazono Mincho</family>
  907.             <family>Hancom</family>
  908.             <family>Code2000</family>
  909.             <family>Code2001</family>
  910.             <family>Code2002</family>
  911.           </prefer>
  912.         </alias>
  913.       </match>
  914.     </fontconfig>
  915.  '';
  916.  
  917.   security.sudo.extraConfig = ''
  918.  
  919.     # Disable timeout.
  920.     Defaults env_reset,timestamp_timeout=0
  921.   '';
  922.   security.setuidPrograms = [ "xlaunch"
  923.     # "pmount" "pumount" "udevil"
  924.   ];
  925.  
  926.   # List services that you want to enable:
  927.  
  928.   # Enable the OpenSSH daemon.
  929.   # services.openssh.enable = true;
  930.  
  931.   services.udisks2.enable = true;
  932.   # services.devmon.enable = true;
  933.   services.kmscon.hwRender = true;
  934.  
  935.   # Enable CUPS to print documents.
  936.   # services.printing.enable = true;
  937.  
  938.   # Xorg, WM, DM, DE
  939.   services.xserver = {
  940.     # useGlamor = true;
  941.     vaapiDrivers = with pkgs; [ vaapiIntel vaapiVdpau ];
  942.     enable = true;
  943.     enableTCP = false;
  944.     exportConfiguration = true;
  945.     layout = "us,ru";
  946.     xkbVariant = "dvp,winkeys";
  947.     xkbOptions = "grp:shift_toggle,grp_led:caps,ctrl:nocaps,altwin:meta_alt,altwin:super_win,altwin:hyper_win";
  948.     # autorun = false;
  949.     videoDrivers = [
  950.      # "nouveau"
  951.      # "modesetting"
  952.      "intel"
  953.      "nvidia"
  954.     ];
  955.     synaptics = {
  956.       enable = true;
  957.       vertEdgeScroll = false;
  958.       tapButtons = false;
  959.       twoFingerScroll = true;
  960.     };
  961.  
  962.     config = ''
  963.  
  964.       # /etc/X11/xorg.conf.d/20-thinkpad_clickpad.conf
  965.  
  966.       # Section "InputClass"
  967.       #         Identifier "Clickpad"
  968.       #         MatchDriver "synaptics"
  969.  
  970.       #         Option "Clickpad" "true"
  971.       #         Option "EmulateMidButtonTime" "0"
  972.  
  973.       #         # Left Right Top Bottom
  974.       #         Option "SoftButtonAreas" "60% 0 0 20% 40% 60% 0 20%"
  975.       #         Option "AreaTopEdge" "20%"
  976.       #         Option "AreaBottomEdge" "0"
  977.  
  978.       #         Option "TapButton1" "1"
  979.       #         Option "TapButton3" "2"
  980.       #         Option "TapButton2" "3"
  981.  
  982.       #         # Calm the pad down while clicking
  983.       #         Option "VertHysteresis" "50"
  984.       #         Option "HorizHysteresis" "55"
  985.  
  986.       #         # Drag lock
  987.       #         # Option "LockedDrags" "1"
  988.  
  989.       #         # Tap to click
  990.       #         # Option "FingerLow" "50"
  991.       #         # Option "FingerHigh" "55"
  992.       #         # disable tap to click
  993.       #         Option "MaxTapTime" "0"
  994.  
  995.       #         # Prevent accidental clicks
  996.       #         Option "PalmDetect" "1"
  997.       #         Option "PalmMinWidth" "5"
  998.       #         Option "PalmMinZ" "40"
  999.  
  1000.       #         # Natural scrolling
  1001.       #         Option "VertTwoFingerScroll" "1"
  1002.       #         # Option "VertScrollDelta" "-90"
  1003.       #         Option "HorizTwoFingerScroll" "1"
  1004.       #         # Option "HorizScrollDelta" "-90"
  1005.  
  1006.       #         Option "MinSpeed" "1"
  1007.       #         Option "MaxSpeed" "1"
  1008.  
  1009.       #         Option "AccelerationProfile" "2"
  1010.       #         Option "AccelerationNumerator"   "5"
  1011.       #         Option "AccelerationDenominator" "3"
  1012.       #         Option "AccelerationThreshold"   "4"
  1013.       #         Option "AdaptiveDeceleration" "2"
  1014.       #         # Option "ConstantDeceleration" "2"
  1015.       # EndSection
  1016.  
  1017.       # /etc/X11/xorg.conf.d/50-thinkpad_trackpoint.conf
  1018.  
  1019.       Section "InputClass"
  1020.               Identifier "Clickpad"
  1021.               MatchIsTouchpad "on"
  1022.               MatchDevicePath "/dev/input/event*"
  1023.               Driver "evdev"
  1024.               # Synaptics options come here.
  1025.               Option "TapButton1" "1"
  1026.               Option "TapButton3" "2"
  1027.               Option "TapButton2" "3"
  1028.               Option "SoftButtonAreas" "60% 0 0 40% 20% 60% 0 20%"
  1029.               Option "AreaTopEdge"          "20%"
  1030.               Option "AreaBottomEdge"       "0"
  1031.       EndSection
  1032.  
  1033.       Section "InputClass"
  1034.               Identifier      "TrackPoint"
  1035.               MatchProduct    "TrackPoint"
  1036.               MatchDriver  "evdev"
  1037.               # MatchDevicePath "event"
  1038.               Option          "EmulateWheel"            "true"
  1039.               Option          "EmulateWheelButton"      "2"
  1040.               Option          "EmulateWheelTimeOut"     "200"
  1041.               Option          "XAxisMapping"            "6 7"
  1042.               Option          "YAxisMapping"            "4 5"
  1043.               Option          "ZAxisMapping"            "4 5"
  1044.  
  1045.               Option          "AccelerationProfile"     "2"
  1046.               Option          "AccelerationNumerator"   "5"
  1047.               Option          "AccelerationDenominator" "3"
  1048.               Option          "AccelerationThreshold"   "4"
  1049.               Option          "AdaptiveDeceleration"    "2"
  1050.               # Option          "ConstantDeceleration"    "2"
  1051.       EndSection
  1052.  
  1053.       # /etc/X11/xorg.conf.d/60-mouse-acceleration.conf
  1054.  
  1055.       Section "InputClass"
  1056.               Identifier "My Mouse"
  1057.               MatchIsPointer "yes"
  1058.               # set the following to 1 1 0 respectively to disable acceleration.
  1059.               Option "AccelerationNumerator" "2"
  1060.               Option "AccelerationDenominator" "1"
  1061.               Option "AccelerationThreshold" "4"
  1062.       EndSection
  1063.  
  1064.       #  /etc/X11/xorg.conf.d/10-monitor.conf
  1065.  
  1066.       Section "Monitor"
  1067.           Identifier "Monitor[0]"
  1068.           Option "DPMS" "false"
  1069.           Option "PreferredMode" "1920x1080"
  1070.           DisplaySize 310 174
  1071.       EndSection
  1072.  
  1073.       Section "Device"
  1074.           Identifier "Device-intel[0]"
  1075.           # Driver "intel"
  1076.       Driver "intel"
  1077.           BusID "PCI:0:2:0"
  1078.           Option "DRI" "3"
  1079.           Option "AllowGLXWithComposite" "true"
  1080.       Option "TwinView" "true"
  1081.       Option "XvMC" "true"
  1082.       Option "XAANoOffscreenPixmaps" "true"
  1083.       Option "UseEvents" "true"
  1084.           # Option "AccelMethod" "glamor"
  1085.           Option "AccelMethod" "sna"
  1086.           # Option "AccelMethod" "uxa"
  1087.           Option "AccelMethod" "none"
  1088.           Option "TearFree" "true"
  1089.       Option "Tiling" "true"
  1090.       Option "SwapBuffersWait" "true"
  1091.           Option "Backlight" "intel_backlight"
  1092.       EndSection
  1093.  
  1094.       Section "Device"
  1095.           Identifier "Device-nvidia[0]"
  1096.           Driver "nvidia"
  1097.           BusID "PCI:2:0:0"
  1098.           Option "DRI" "3"
  1099.           Option "AllowGLXWithComposite" "true"
  1100.       Option "TwinView" "true"
  1101.       Option "AddARGBGLXVisuals" "true"
  1102.       Option "DisableGLXRootClipping" "true"
  1103.       Option "DamageEvents" "true"
  1104.           Option "RenderAccel" "true"
  1105.  
  1106.           # caution here
  1107.       Option "UseEvents" "false"
  1108.       Option "TripleBuffer" "true"
  1109.       Option "BackingStore" "true"
  1110.  
  1111.           Option "AccelMethod" "EXA"
  1112.           Option "MigrationHeuristic" "greedy"
  1113.           Option "AccelDFS" "true"
  1114.           Option "EnablePageFlip" "true"
  1115.           Option "EnableDepthMoves" "true"
  1116.       Option "NoLogo" "true"
  1117.       Option "UseDisplayDevice" "none"
  1118.       Option "RegistryDwords" "EnableBrightnessControl=1"
  1119.       EndSection
  1120.  
  1121.       Section "Screen"
  1122.           Identifier "Screen-intel[0]"
  1123.           Device "Device-intel[0]"
  1124.           Monitor "Monitor[0]"
  1125.           DefaultDepth 24
  1126.  
  1127.           SubSection "Display"
  1128.               Depth 24
  1129.               Modes "1920x1080"
  1130.           EndSubSection
  1131.       EndSection
  1132.  
  1133.       Section "Screen"
  1134.           Identifier "Screen-nvidia[0]"
  1135.           Device "Device-nvidia[0]"
  1136.           Monitor "Monitor[0]"
  1137.       Option "AllowEmptyInitialConfiguration" "true"
  1138.       Option "SLI" "AA"
  1139.       Option "RegistryDwords" "PerfLevelSrc=0x2222"
  1140.       Option "metamodes" "nvidia-auto-select +0+0 { ForceFullCompositionPipeline = On }"
  1141.           DefaultDepth 24
  1142.  
  1143.           SubSection "Display"
  1144.               Depth 24
  1145.               Modes "1920x1080"
  1146.           EndSubSection
  1147.       EndSection
  1148.  
  1149.       Section "Module"
  1150.           Load "glx"
  1151.       Load "dbe"
  1152.       Load "extmod"
  1153.       Load "dri"
  1154.       Load "dri2"
  1155.       EndSection
  1156.  
  1157.       Section "Extensions"
  1158.           Option "Composite" "Enable"
  1159.       EndSection
  1160.  
  1161.       Section "ServerLayout"
  1162.           Identifier "Layout[all]"
  1163.       # Inactive "Device-intel[0]"
  1164.           Screen 0 "Screen-nvidia[0]"
  1165.       Screen "Screen-intel[0]"
  1166.       Option "Xinerama" "true"
  1167.       Option "AIGLX" "true"
  1168.       Option "DRI2" "true"
  1169.       Option "GlxVisuals" "all"
  1170.           Option "StandbyTime" "0"
  1171.           Option "SuspendTime" "0"
  1172.           Option "OffTime" "0"
  1173.           Option "BlankTime" "0"
  1174.       EndSection
  1175.  
  1176.       Section "ServerFlags"
  1177.           Option "DefaultServerLayout" "Layout[all]"
  1178.       EndSection
  1179.     '';
  1180.     desktopManager = {
  1181.       kde4.enable = false;
  1182.       xterm.enable = false;
  1183.       default = "none";
  1184.     };
  1185.     displayManager.slim = {
  1186.       enable = true;
  1187.       defaultUser = "netsu";
  1188.       # autoLogin = true;
  1189.       # hideCursor = true;
  1190.     };
  1191.     windowManager.xmonad = {
  1192.       enable = true;
  1193.       enableContribAndExtras = true;
  1194.     };
  1195.   };
  1196.   services.acpid.enable = true;
  1197.   # services.thinkfan.enable = true;
  1198.   # services.thinkfan.sensor = "/sys/class/hwmon/hwmon0/temp1_input";
  1199.   powerManagement.enable = true;
  1200.   powerManagement.cpuFreqGovernor = "ondemand";
  1201.  
  1202.   hardware.bumblebee.enable = true;
  1203.   environment.etc."bumblebee/bumblebee.conf".text = ''
  1204.     # Configuration file for Bumblebee. Values should **not** be put between quotes
  1205.  
  1206.     ## Server options. Any change made in this section will need a server restart
  1207.     # to take effect.
  1208.     [bumblebeed]
  1209.     # The secondary Xorg server DISPLAY number
  1210.     # VirtualDisplay=:8
  1211.     # Should the unused Xorg server be kept running? Set this to true if waiting
  1212.     # for X to be ready is too long and don't need power management at all.
  1213.     KeepUnusedXServer=false
  1214.     # The name of the Bumbleblee server group name (GID name)
  1215.     # ServerGroup=bumblebee
  1216.     # Card power state at exit. Set to false if the card shoud be ON when Bumblebee
  1217.     # server exits.
  1218.     TurnCardOffAtExit=false
  1219.     # The default behavior of '-f' option on optirun. If set to "true", '-f' will
  1220.     # be ignored.
  1221.     NoEcoModeOverride=false
  1222.     # The Driver used by Bumblebee server. If this value is not set (or empty),
  1223.     # auto-detection is performed. The available drivers are nvidia and nouveau
  1224.     # (See also the driver-specific sections below)
  1225.     Driver=nvidia
  1226.  
  1227.     ## Client options. Will take effect on the next optirun executed.
  1228.     [optirun]
  1229.     # Acceleration/ rendering bridge, possible values are auto, virtualgl and
  1230.     # primus.
  1231.     Bridge=auto
  1232.     # The method used for VirtualGL to transport frames between X servers.
  1233.     # Possible values are proxy, jpeg, rgb, xv and yuv.
  1234.     VGLTransport=xv
  1235.     # Should the program run under optirun even if Bumblebee server or nvidia card
  1236.     # is not available?
  1237.     AllowFallbackToIGC=false
  1238.  
  1239.  
  1240.     # Driver-specific settings are grouped under [driver-NAME]. The sections are
  1241.     # parsed if the Driver setting in [bumblebeed] is set to NAME (or if auto-
  1242.     # detection resolves to NAME).
  1243.     # PMMethod: method to use for saving power by disabling the nvidia card, valid
  1244.     # values are: auto - automatically detect which PM method to use
  1245.     #         bbswitch - new in BB 3, recommended if available
  1246.     #       switcheroo - vga_switcheroo method, use at your own risk
  1247.     #             none - disable PM completely
  1248.     # https://github.com/Bumblebee-Project/Bumblebee/wiki/Comparison-of-PM-methods
  1249.  
  1250.     ## Section with nvidia driver specific options, only parsed if Driver=nvidia
  1251.     [driver-nvidia]
  1252.     # Module name to load, defaults to Driver if empty or unset
  1253.     KernelDriver=nvidia
  1254.     PMMethod=bbswitch
  1255.     # colon-separated path to the nvidia libraries
  1256.     # LibraryPath=/usr/lib/nvidia:/usr/lib32/nvidia
  1257.     # comma-separated path of the directory containing nvidia_drv.so and the
  1258.     # default Xorg modules path
  1259.     # XorgModulePath=/usr/lib/nvidia/xorg/,/usr/lib/xorg/modules
  1260.     # XorgConfFile=/etc/bumblebee/xorg.conf.nvidia
  1261.     XorgConfFile=/etc/X11/xorg.conf
  1262.  
  1263.     ## Section with nouveau driver specific options, only parsed if Driver=nouveau
  1264.     [driver-nouveau]
  1265.     KernelDriver=nouveau
  1266.     PMMethod=bbswitch
  1267.     XorgConfFile=/etc/bumblebee/xorg.conf.nouveau
  1268.   '';
  1269.  
  1270.   hardware.opengl.s3tcSupport = true;
  1271.   hardware.trackpoint.sensitivity = 255;
  1272.   # hardware.trackpoint.speed = 255;
  1273.   # hardware.firmware = [ pkgs.linuxPackages_4_1.mt7601 ];
  1274.   hardware.enableAllFirmware = true;
  1275.  
  1276.   # User account
  1277.   users.extraUsers.netsu = {
  1278.     isNormalUser = true;
  1279.     name = "netsu";
  1280.     description = "Yuriy Pitomets";
  1281.     group = "users";
  1282.     extraGroups = [ "wheel" "network" "disk" ];
  1283.     uid = 1000;
  1284.     createHome = true;
  1285.     home = "/home/netsu";
  1286.     hashedPassword = "RXBFfJzQ59q6Q";
  1287.   };
  1288.   users.mutableUsers = false;
  1289.  
  1290.   users.extraUsers.root = {
  1291.     hashedPassword = null;
  1292.     initialHashedPassword = null;
  1293.     initialPassword = null;
  1294.     password = null;
  1295.     passwordFile = null;
  1296.   };
  1297.  
  1298.   services.openssh.permitRootLogin = "no";
  1299.  
  1300.   # Make Zsh the default shell system-wide
  1301.   users.defaultUserShell = "/run/current-system/sw/bin/zsh";
  1302. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement