Kieran's opinionated (and probably slightly dumb) nix config
1 2# This is your system's configuration file. 3# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) 4{ 5 inputs, 6 lib, 7 config, 8 pkgs, 9 pkgs-unstable, 10 ... 11}: { 12 # You can import other NixOS modules here 13 imports = [ 14 # If you want to use modules from other flakes (such as nixos-hardware): 15 inputs.hardware.nixosModules.framework-11th-gen-intel 16 17 # Import your generated (nixos-generate-config) hardware configuration 18 ./hardware-configuration.nix 19 20 # Import home-manager's configuration 21 ./home-manager.nix 22 23 # Import disko's configuration 24 ./disk-config.nix 25 26 # hpyrland config 27 # ./hyprland 28 29 ./pam.nix 30 31 # tuigreet 32 ./greetd.nix 33 ]; 34 35 nixpkgs = { 36 # Configure your nixpkgs instance 37 config = { 38 # Disable if you don't want unfree packages 39 allowUnfree = true; 40 }; 41 }; 42 43 nix = let 44 flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs; 45 in { 46 settings = { 47 # Enable flakes and new 'nix' command 48 experimental-features = "nix-command flakes"; 49 # Opinionated: disable global registry 50 flake-registry = ""; 51 # Workaround for https://github.com/NixOS/nix/issues/9574 52 nix-path = config.nix.nixPath; 53 }; 54 # Opinionated: disable channels 55 channel.enable = false; 56 57 # Opinionated: make flake registry and nix path match flake inputs 58 registry = lib.mapAttrs (_: flake: {inherit flake;}) flakeInputs; 59 nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs; 60 }; 61 62 time = { 63 timeZone = "America/New_York"; 64 hardwareClockInLocalTime = true; 65 }; 66 67 services.automatic-timezoned.enable = true; 68 69 environment.systemPackages = map lib.lowPrio [ 70 pkgs.curl 71 pkgs.wget 72 pkgs.dogdns 73 inputs.agenix.packages.x86_64-linux.default 74 pkgs.wpa_supplicant_gui 75 pkgs.overskride 76 pkgs.alacritty 77 pkgs.zsh 78 pkgs.starship 79 pkgs.gh 80 pkgs.swww 81 pkgs.sunwait 82 pkgs.sunpaper 83 pkgs.wluma 84 pkgs.brightnessctl 85 inputs.hyprland-contrib.packages.${pkgs.system}.grimblast 86 pkgs.mako 87 pkgs.hyprpicker 88 pkgs.notify-desktop 89 pkgs.bc 90 pkgs.wl-clipboard 91 pkgs.psmisc 92 pkgs.jq 93 pkgs.playerctl 94 pkgs.firefox 95 pkgs.slack 96 pkgs.gnome.nautilus 97 pkgs.gnome.totem 98 pkgs.loupe 99 pkgs.gnome.file-roller 100 pkgs.polkit_gnome 101 pkgs.fprintd 102 pkgs.gitMinimal 103 pkgs.github-desktop 104 pkgs.udiskie 105 pkgs.neofetch 106 pkgs.cava 107 pkgs.go 108 pkgs.bun 109 pkgs.pitivi 110 pkgs.unstable.arduino-ide 111 pkgs.unstable.arduino-cli 112 pkgs.lazygit 113 pkgs.vhs 114 pkgs.lightworks 115 pkgs.ffmpeg 116 pkgs.ngrok 117 ]; 118 119 services.gnome.gnome-keyring.enable = true; 120 programs.dconf.enable = true; 121 122 systemd = { 123 user.services.polkit-gnome-authentication-agent-1 = { 124 description = "polkit-gnome-authentication-agent-1"; 125 wantedBy = [ "graphical-session.target" ]; 126 wants = [ "graphical-session.target" ]; 127 after = [ "graphical-session.target" ]; 128 serviceConfig = { 129 Type = "simple"; 130 ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; 131 Restart = "on-failure"; 132 RestartSec = 1; 133 TimeoutStopSec = 10; 134 }; 135 }; 136 }; 137 138 fonts.packages = with pkgs; [ 139 nerdfonts 140 fira 141 ]; 142 143 environment.sessionVariables = { 144 XDG_CACHE_HOME = "$HOME/.cache"; 145 XDG_CONFIG_HOME = "$HOME/.config"; 146 XDG_DATA_HOME = "$HOME/.local/share"; 147 SUNPAPERDIR = "${lib.getExe pkgs.sunpaper}"; 148 XDG_STATE_HOME = "$HOME/.local/state"; 149 NIXOS_OZONE_WL = "1"; 150 }; 151 152 # import the secret 153 age.identityPaths = [ "/home/kierank/.ssh/id_rsa" "/etc/ssh/id_rsa" "/mnt/etc/ssh/id_rsa" ]; 154 age.secrets.wifi = { 155 file = ../secrets/wifi.age; 156 owner = "kierank"; 157 }; 158 159 # setup the network 160 networking = { 161 hostName = "moonlark"; 162 wireless = { 163 environmentFile = config.age.secrets.wifi.path; 164 userControlled.enable = true; 165 enable = true; 166 networks = { 167 "KlukasNet".psk = "@PSK_HOME@"; 168 "Everseen".psk = "@PSK_HOTSPOT@"; 169 }; 170 }; 171 }; 172 173 programs.zsh.enable = true; 174 # TODO: Configure your system-wide user settings (groups, etc), add more users as needed. 175 users.users = { 176 kierank = { 177 # You can skip setting a root password by passing '--no-root-passwd' to nixos-install. 178 # Be sure to change it (using passwd) after rebooting! 179 initialPassword = "lolzthisaintsecure!"; 180 isNormalUser = true; 181 shell = pkgs.zsh; 182 openssh.authorizedKeys.keys = [ 183 "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCzEEjvbL/ttqmYoDjxYQmDIq36BabROJoXgQKeh9liBxApwp+2PmgxROzTg42UrRc9pyrkq5kVfxG5hvkqCinhL1fMiowCSEs2L2/Cwi40g5ZU+QwdcwI8a4969kkI46PyB19RHkxg54OUORiIiso/WHGmqQsP+5wbV0+4riSnxwn/JXN4pmnE//stnyAyoiEZkPvBtwJjKb3Ni9n3eNLNs6gnaXrCtaygEZdebikr9kS2g9mM696HvIFgM6cdR/wZ7DcLbG3IdTXuHN7PC3xxL+Y4ek5iMreQIPmuvs4qslbthPGYoYbYLUQiRa9XO5s/ksIj5Z14f7anHE6cuTQVpvNWdGDOigyIVS5qU+4ZF7j+rifzOXVL48gmcAvw/uV68m5Wl/p0qsC/d8vI3GYwEsWG/EzpAlc07l8BU2LxWgN+d7uwBFaJV9VtmUDs5dcslsh8IbzmtC9gq3OLGjklxTfIl6qPiL8U33oc/UwqzvZUrI2BlbagvIZYy6rP+q0= kierank@mockingjay" 184 ]; 185 extraGroups = ["wheel" "networkmanager" "audio" "video" "docker" "plugdev" "input"]; 186 }; 187 root.openssh.authorizedKeys.keys = [ 188 "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCzEEjvbL/ttqmYoDjxYQmDIq36BabROJoXgQKeh9liBxApwp+2PmgxROzTg42UrRc9pyrkq5kVfxG5hvkqCinhL1fMiowCSEs2L2/Cwi40g5ZU+QwdcwI8a4969kkI46PyB19RHkxg54OUORiIiso/WHGmqQsP+5wbV0+4riSnxwn/JXN4pmnE//stnyAyoiEZkPvBtwJjKb3Ni9n3eNLNs6gnaXrCtaygEZdebikr9kS2g9mM696HvIFgM6cdR/wZ7DcLbG3IdTXuHN7PC3xxL+Y4ek5iMreQIPmuvs4qslbthPGYoYbYLUQiRa9XO5s/ksIj5Z14f7anHE6cuTQVpvNWdGDOigyIVS5qU+4ZF7j+rifzOXVL48gmcAvw/uV68m5Wl/p0qsC/d8vI3GYwEsWG/EzpAlc07l8BU2LxWgN+d7uwBFaJV9VtmUDs5dcslsh8IbzmtC9gq3OLGjklxTfIl6qPiL8U33oc/UwqzvZUrI2BlbagvIZYy6rP+q0= kierank@mockingjay" 189 ]; 190 }; 191 192 programs.hyprland.enable = true; 193 services.hypridle.enable = true; 194 195 # enable cups 196 services.printing.enable = true; 197 services.avahi = { 198 enable = true; 199 nssmdns4 = true; 200 openFirewall = true; 201 }; 202 203 204 # enable bluetooth 205 hardware.bluetooth.enable = true; 206 207 # enable pipewire 208 # rtkit is optional but recommended 209 security.rtkit.enable = true; 210 services.pipewire = { 211 enable = true; 212 alsa.enable = true; 213 alsa.support32Bit = true; 214 pulse.enable = true; 215 # If you want to use JACK applications, uncomment this 216 jack.enable = true; 217 }; 218 219 # This setups a SSH server. Very important if you're setting up a headless system. 220 # Feel free to remove if you don't need it. 221 services.openssh = { 222 enable = true; 223 settings = { 224 # Opinionated: forbid root login through SSH. 225 PermitRootLogin = "no"; 226 # Opinionated: use keys only. 227 # Remove if you want to SSH using passwords 228 PasswordAuthentication = false; 229 }; 230 }; 231 232 networking.firewall = { 233 enable = true; 234 allowedTCPPorts = [ 4455 ]; 235 allowedUDPPorts = [ 4455 ]; 236 }; 237 238 239 services.devmon.enable = true; 240 services.gvfs.enable = true; 241 services.udisks2.enable = true; 242 243 services.logind.extraConfig = '' 244 # don't shutdown when power button is short-pressed 245 HandlePowerKey=ignore 246 HandlePowerKeyLongPress=poweroff 247 ''; 248 249 # Requires at least 5.16 for working wi-fi and bluetooth. 250 # https://community.frame.work/t/using-the-ax210-with-linux-on-the-framework-laptop/1844/89 251 boot = { 252 kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") (lib.mkDefault pkgs.linuxPackages_latest); 253 loader.grub = { 254 # no need to set devices, disko will add all devices that have a EF02 partition to the list already 255 device = "nodev"; 256 efiSupport = true; 257 efiInstallAsRemovable = true; 258 }; 259 supportedFilesystems = [ "ntfs" ]; 260 }; 261 262 # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion 263 system.stateVersion = "23.05"; 264}