├── .gitignore ├── README.md ├── meta.nix ├── config ├── kcminputrc └── termite ├── hardware-configuration.nix ├── pragmatapro.nix ├── configuration.nix └── minimal-configuration.nix /.gitignore: -------------------------------------------------------------------------------- 1 | result 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Usage 2 | 3 | ``` bash 4 | $ ./build.sh [path to ] 5 | ``` 6 | -------------------------------------------------------------------------------- /meta.nix: -------------------------------------------------------------------------------- 1 | # dummy config so minimal-configuration.nix evaluates. 2 | { 3 | hostname = "cstrahan-nixos"; 4 | productName = "MacBookPro11,3"; 5 | } 6 | -------------------------------------------------------------------------------- /config/kcminputrc: -------------------------------------------------------------------------------- 1 | [Keyboard] 2 | ClickVolume=0 3 | KeyboardRepeating=0 4 | NumLock=2 5 | RepeatDelay=200 6 | RepeatRate=30 7 | 8 | [Mouse] 9 | cursorSize=0 10 | cursorTheme=breeze_cursors 11 | -------------------------------------------------------------------------------- /hardware-configuration.nix: -------------------------------------------------------------------------------- 1 | # dummy hardware-configuration.nix to make minimal-configuration.nix evaluate. 2 | { config, lib, pkgs, ... }: 3 | 4 | { 5 | imports = 6 | [ 7 | ]; 8 | 9 | boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; 10 | boot.kernelModules = [ "kvm-intel" "wl" ]; 11 | boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ]; 12 | 13 | fileSystems."/" = 14 | { device = "/dev/disk/by-label/nixos"; 15 | fsType = "btrfs"; 16 | }; 17 | 18 | fileSystems."/boot" = 19 | { device = "/dev/disk/by-label/EFI"; 20 | fsType = "vfat"; 21 | }; 22 | 23 | swapDevices = [ ]; 24 | } 25 | -------------------------------------------------------------------------------- /pragmatapro.nix: -------------------------------------------------------------------------------- 1 | { runCommand, requireFile, unzip }: 2 | 3 | let 4 | name = "pragmatapro-${version}"; 5 | version = "0.820"; 6 | in 7 | 8 | runCommand name 9 | rec { 10 | outputHashMode = "recursive"; 11 | outputHashAlgo = "sha256"; 12 | outputHash = "07yxp0h63li84qi0hkqr0dlprb4gs5g2b3cbh4s15f0pyfvbgb93"; 13 | 14 | src = requireFile rec { 15 | name = "PragmataPro${version}.zip"; 16 | url = "file://path/to/${name}"; 17 | sha256 = "0dg7h80jaf58nzjbg2kipb3j3w6fz8z5cyi4fd6sx9qlkvq8nckr"; 18 | }; 19 | 20 | buildInputs = [ unzip ]; 21 | } '' 22 | unzip $src 23 | 24 | install_path=$out/share/fonts/truetype/pragmatapro 25 | mkdir -p $install_path 26 | 27 | find -name "PragmataPro*.ttf" -exec mv {} $install_path \; 28 | '' 29 | -------------------------------------------------------------------------------- /config/termite: -------------------------------------------------------------------------------- 1 | [options] 2 | scroll_on_output = false 3 | scroll_on_keystroke = true 4 | audible_bell = false 5 | mouse_autohide = true 6 | allow_bold = true 7 | dynamic_title = true 8 | urgent_on_bell = true 9 | clickable_url = false 10 | font = PragmataPro 12 11 | scrollback_lines = 10000 12 | search_wrap = true 13 | icon_name = terminal 14 | 15 | # "system", "on" or "off" 16 | cursor_blink = off 17 | 18 | # "block", "underline" or "ibeam" 19 | cursor_shape = block 20 | 21 | # Hide links that are no longer valid in url select overlay mode 22 | filter_unmatched_urls = true 23 | 24 | # Tango (with black bg) 25 | # --------------------- 26 | [colors] 27 | cursor = #FFFFFF 28 | cursor_foreground = #000000 29 | foreground = #FFFFFF 30 | foreground_bold = #FFFFFF 31 | background = #000000 32 | 33 | # black 34 | color0 = #000000 35 | color8 = #555753 36 | # red 37 | color1 = #CC0000 38 | color9 = #EF2929 39 | # green 40 | color2 = #4E9A06 41 | color10 = #8AE234 42 | # yellow 43 | color3 = #C4A000 44 | color11 = #FCE94F 45 | # blue 46 | color4 = #3465A4 47 | color12 = #729FCF 48 | # magenta 49 | color5 = #75507B 50 | color13 = #AD7FA8 51 | # cyan 52 | color6 = #06989A 53 | color14 = #34E2E2 54 | # white 55 | color7 = #D3D7CF 56 | color15 = #EEEEEC 57 | 58 | # vim: ft=dosini cms=#%s 59 | -------------------------------------------------------------------------------- /configuration.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, modulesPath, ... }: 2 | { imports = [ 3 | 4 | ]; 5 | 6 | boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ]; 7 | boot.supportedFilesystems = [ "exfat" ]; 8 | 9 | i18n.consoleUseXkbConfig = true; 10 | 11 | environment.extraOutputsToInstall = [ ]; 12 | environment.systemPackages = [ 13 | pkgs.gparted 14 | pkgs.vim 15 | pkgs.neovim 16 | pkgs.bvi 17 | pkgs.glxinfo 18 | pkgs.xsel 19 | pkgs.xclip 20 | pkgs.mkpasswd 21 | pkgs.zsh 22 | pkgs.networkmanagerapplet 23 | pkgs.git 24 | pkgs.curl 25 | pkgs.wget 26 | pkgs.tmux 27 | pkgs.termite 28 | pkgs.tree 29 | ]; 30 | 31 | fonts = { 32 | fontconfig.enable = true; 33 | enableFontDir = true; 34 | enableGhostscriptFonts = true; 35 | fonts = with pkgs; [ 36 | pragmatapro 37 | ]; 38 | }; 39 | 40 | powerManagement.enable = true; 41 | services.dbus.enable = true; 42 | services.upower.enable = true; 43 | services.xserver = { 44 | enable = true; 45 | autorun = lib.mkForce false; 46 | xkbOptions = "ctrl:nocaps"; 47 | 48 | autoRepeatDelay = 200; 49 | autoRepeatInterval = 33; # 30hz 50 | 51 | synaptics.enable = lib.mkForce false; 52 | libinput.enable = true; 53 | libinput.tapping = false; 54 | libinput.tappingDragLock = false; 55 | }; 56 | 57 | nix.useSandbox = true; 58 | nix.maxJobs = 4; 59 | nix.requireSignedBinaryCaches = true; 60 | 61 | networking.enableIPv6 = true; 62 | networking.networkmanager.enable = lib.mkForce true; 63 | networking.networkmanager.insertNameservers = [ "8.8.8.8" "8.8.4.4" ]; 64 | networking.nameservers = [ "8.8.8.8" "8.8.4.4" ]; 65 | networking.wireless.enable = lib.mkForce false; 66 | networking.firewall.enable = false; 67 | 68 | isoImage.contents = [ ]; 69 | 70 | boot.postBootCommands = '' 71 | mkdir -p /root/.config/termite 72 | cp -T ${./config/termite} /root/.config/termite/config 73 | chmod u+w /root/.config/termite/config 74 | 75 | cp -T ${./config/kcminputrc} /root/.config/kcminputrc 76 | chmod u+w /root/.config/kcminputrc 77 | 78 | mkdir -p /root/min-conf 79 | cp -T ${./minimal-configuration.nix} /root/min-conf/configuration.nix 80 | cp -T ${./pragmatapro.nix} /root/min-conf/pragmatapro.nix 81 | cat < /root/min-conf/meta.nix 82 | { 83 | hostname = "cstrahan-nixos"; 84 | productName = "$(cat /sys/class/dmi/id/product_name)"; 85 | } 86 | EOF 87 | ''; 88 | 89 | system.activationScripts.installerCustom = '' 90 | mkdir -p /root/Desktop 91 | ln -sfT ${pkgs.termite}/share/applications/termite.desktop /root/Desktop/termite.desktop 92 | ''; 93 | 94 | nixpkgs.config = { 95 | allowUnfree = true; 96 | packageOverrides = super: let self = super.pkgs; in rec { 97 | pragmatapro = self.callPackage ./pragmatapro.nix { }; 98 | }; 99 | }; 100 | 101 | # Additional packages to include in the store. 102 | system.extraDependencies = [ 103 | # include everything from our minimal configuration, so we don't have to 104 | # download as much. 105 | (import { configuration = import ./minimal-configuration.nix; }).system 106 | ]; 107 | } 108 | -------------------------------------------------------------------------------- /minimal-configuration.nix: -------------------------------------------------------------------------------- 1 | # Installation: 2 | # 3 | # $ mount /dev/disk/by-label/nixos /mnt 4 | # $ mkdir -p /mnt/boot/efi 5 | # $ nixos-generate-config --root /mnt 6 | # $ cp -v min-conf/* /mnt/etc/nixos 7 | # $ mkdir -p /mnt/etc/nixos/passwords -m 700 8 | # $ mkpasswd -m sha-512 > /mnt/etc/nixos/passwords/cstrahan 9 | # $ chmod 700 /mnt/etc/nixos/passwords/cstrahan 10 | # $ mount /dev/disk/by-label/EFI /mnt/boot/efi 11 | # $ nixos-install 12 | { config, lib, pkgs, ... }: 13 | 14 | # Per-machine settings. 15 | let 16 | meta = import ./meta.nix; 17 | isMBP = (builtins.substring 0 10 meta.productName) == "MacBookPro"; 18 | isWork = meta.productName == "MacBookPro11,5"; 19 | isNvidia = meta.productName != "MacBookPro11,5"; 20 | 21 | in 22 | 23 | { 24 | imports = [ 25 | ./hardware-configuration.nix 26 | ]; 27 | 28 | system.stateVersion = "18.03"; 29 | 30 | #boot.loader.efi.canTouchEfiVariables = true; 31 | boot.loader.efi.efiSysMountPoint = "/boot/efi"; 32 | boot.loader.timeout = 8; 33 | boot.loader.systemd-boot.enable = false; 34 | boot.loader.grub = { 35 | enable = true; 36 | efiSupport = true; 37 | efiInstallAsRemovable = true; # don't depend on NVRAM 38 | device = "nodev"; # EFI only 39 | }; 40 | 41 | boot.supportedFilesystems = [ "exfat" "btrfs" ]; 42 | boot.kernelModules = [ "msr" "coretemp" ] ++ lib.optional isMBP "applesmc"; 43 | boot.blacklistedKernelModules = 44 | # make my desktop use the `wl` module for WiFi. 45 | lib.optionals (!isMBP) [ "b43" "bcma" "bcma-pci-bridge" ]; 46 | 47 | # Select internationalisation properties. 48 | time.timeZone = null; 49 | i18n.consoleUseXkbConfig = true; 50 | 51 | networking.hostName = meta.hostname; 52 | 53 | networking.networkmanager.enable = lib.mkForce true; 54 | networking.networkmanager.insertNameservers = [ "8.8.8.8" "8.8.4.4" ]; 55 | networking.nameservers = [ "8.8.8.8" "8.8.4.4" ]; 56 | networking.wireless.enable = lib.mkForce false; 57 | networking.firewall.enable = false; 58 | 59 | hardware = { 60 | enableRedistributableFirmware = true; 61 | opengl.enable = true; 62 | pulseaudio.enable = true; 63 | pulseaudio.support32Bit = true; 64 | pulseaudio.daemon.config = { flat-volumes = "no"; }; 65 | bluetooth.enable = true; 66 | }; 67 | 68 | programs.ssh.startAgent = false; 69 | programs.gnupg = { 70 | agent.enable = true; 71 | agent.enableSSHSupport = true; 72 | agent.enableExtraSocket = false; 73 | agent.enableBrowserSocket = false; 74 | dirmngr.enable = true; 75 | }; 76 | 77 | services.logind.extraConfig = 78 | lib.optionalString isMBP '' 79 | HandlePowerKey=suspend 80 | ''; 81 | 82 | environment.variables = { 83 | BROWSER = "firefox"; 84 | SSL_CERT_FILE = "/etc/ssl/certs/ca-bundle.crt"; 85 | }; 86 | 87 | environment.etc."fuse.conf".text = '' 88 | user_allow_other 89 | ''; 90 | 91 | # Enable the backlight on rMBP 92 | # Disable USB-based wakeup 93 | # see: https://wiki.archlinux.org/index.php/MacBookPro11,x 94 | systemd.services.mbp-fixes = { 95 | description = "Fixes for MacBook Pro"; 96 | wantedBy = [ "multi-user.target" "post-resume.target" ]; 97 | after = [ "multi-user.target" "post-resume.target" ]; 98 | script = '' 99 | if [[ "$(cat /sys/class/dmi/id/product_name)" == "MacBookPro11,3" ]]; then 100 | if [[ "$(${pkgs.pciutils}/bin/setpci -H1 -s 00:01.00 BRIDGE_CONTROL)" != "0000" ]]; then 101 | ${pkgs.pciutils}/bin/setpci -v -H1 -s 00:01.00 BRIDGE_CONTROL=0 102 | fi 103 | echo 5 > /sys/class/leds/smc::kbd_backlight/brightness 104 | 105 | if ${pkgs.gnugrep}/bin/grep -q '\bXHC1\b.*\benabled\b' /proc/acpi/wakeup; then 106 | echo XHC1 > /proc/acpi/wakeup 107 | fi 108 | fi 109 | ''; 110 | serviceConfig.Type = "oneshot"; 111 | }; 112 | 113 | services.xserver = { 114 | enable = true; 115 | autorun = false; 116 | videoDrivers = lib.optional isNvidia "nvidia" ++ 117 | lib.optional (!isNvidia) "radeon"; 118 | xkbOptions = "ctrl:nocaps"; 119 | 120 | autoRepeatDelay = 200; 121 | autoRepeatInterval = 33; # 30hz 122 | 123 | synaptics.enable = lib.mkForce false; 124 | libinput.enable = true; 125 | libinput.tapping = false; 126 | libinput.tappingDragLock = false; 127 | 128 | windowManager.default = "none"; 129 | displayManager.sddm.enable = true; 130 | desktopManager.xterm.enable = true; 131 | desktopManager.default = "plasma5"; 132 | desktopManager.plasma5 = { 133 | enable = true; 134 | enableQt4Support = false; 135 | }; 136 | }; 137 | 138 | environment.systemPackages = [ 139 | pkgs.firefox 140 | 141 | pkgs.gparted 142 | pkgs.vim 143 | pkgs.neovim 144 | pkgs.bvi 145 | pkgs.glxinfo 146 | pkgs.xsel 147 | pkgs.xclip 148 | pkgs.mkpasswd 149 | pkgs.zsh 150 | pkgs.networkmanagerapplet 151 | pkgs.git 152 | pkgs.curl 153 | pkgs.wget 154 | pkgs.tmux 155 | pkgs.termite 156 | pkgs.tree 157 | pkgs.silver-searcher 158 | ]; 159 | 160 | environment.shells = [ "/run/current-system/sw/bin/zsh" ]; 161 | 162 | users = { 163 | mutableUsers = false; 164 | extraGroups.docker.gid = lib.mkForce config.ids.gids.docker; 165 | extraUsers = [ 166 | { 167 | uid = 2000; 168 | name = "cstrahan"; 169 | group = "users"; 170 | extraGroups = [ "wheel" "networkmanager" "docker" "fuse" "vboxusers" ]; 171 | isNormalUser = true; 172 | passwordFile = "/etc/nixos/passwords/cstrahan"; 173 | useDefaultShell = false; 174 | shell = "/run/current-system/sw/bin/zsh"; 175 | } 176 | ]; 177 | }; 178 | 179 | nix = { 180 | package = pkgs.nixUnstable; 181 | useSandbox = true; 182 | binaryCaches = [ "https://cache.nixos.org" ]; 183 | trustedBinaryCaches = [ "https://cache.nixos.org" ]; 184 | requireSignedBinaryCaches = true; 185 | distributedBuilds = true; 186 | }; 187 | 188 | fonts = { 189 | fontconfig.enable = true; 190 | enableFontDir = true; 191 | enableGhostscriptFonts = true; 192 | fonts = with pkgs; [ 193 | pragmatapro 194 | ]; 195 | }; 196 | 197 | nixpkgs.config.allowUnfree = true; 198 | nixpkgs.overlays = [ 199 | (self: super: { 200 | pragmatapro = self.callPackage ./pragmatapro.nix { }; 201 | }) 202 | ]; 203 | } 204 | --------------------------------------------------------------------------------