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.davinci-resolve 115 pkgs.ffmpeg 116 ]; 117 118 services.gnome.gnome-keyring.enable = true; 119 programs.dconf.enable = true; 120 121 systemd = { 122 user.services.polkit-gnome-authentication-agent-1 = { 123 description = "polkit-gnome-authentication-agent-1"; 124 wantedBy = [ "graphical-session.target" ]; 125 wants = [ "graphical-session.target" ]; 126 after = [ "graphical-session.target" ]; 127 serviceConfig = { 128 Type = "simple"; 129 ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; 130 Restart = "on-failure"; 131 RestartSec = 1; 132 TimeoutStopSec = 10; 133 }; 134 }; 135 }; 136 137 fonts.packages = with pkgs; [ 138 nerdfonts 139 fira 140 ]; 141 142 environment.sessionVariables = { 143 XDG_CACHE_HOME = "$HOME/.cache"; 144 XDG_CONFIG_HOME = "$HOME/.config"; 145 XDG_DATA_HOME = "$HOME/.local/share"; 146 SUNPAPERDIR = "${lib.getExe pkgs.sunpaper}"; 147 XDG_STATE_HOME = "$HOME/.local/state"; 148 NIXOS_OZONE_WL = "1"; 149 }; 150 151 # import the secret 152 age.identityPaths = [ "/home/kierank/.ssh/id_rsa" "/etc/ssh/id_rsa" "/mnt/etc/ssh/id_rsa" ]; 153 age.secrets.wifi = { 154 file = ../secrets/wifi.age; 155 owner = "kierank"; 156 }; 157 158 # setup the network 159 networking = { 160 hostName = "moonlark"; 161 wireless = { 162 environmentFile = config.age.secrets.wifi.path; 163 userControlled.enable = true; 164 enable = true; 165 networks = { 166 "KlukasNet".psk = "@PSK_HOME@"; 167 "Everseen".psk = "@PSK_HOTSPOT@"; 168 }; 169 }; 170 }; 171 172 programs.zsh.enable = true; 173 # TODO: Configure your system-wide user settings (groups, etc), add more users as needed. 174 users.users = { 175 kierank = { 176 # You can skip setting a root password by passing '--no-root-passwd' to nixos-install. 177 # Be sure to change it (using passwd) after rebooting! 178 initialPassword = "lolzthisaintsecure!"; 179 isNormalUser = true; 180 shell = pkgs.zsh; 181 openssh.authorizedKeys.keys = [ 182 "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" 183 ]; 184 extraGroups = ["wheel" "networkmanager" "audio" "video" "docker" "plugdev" "input"]; 185 }; 186 root.openssh.authorizedKeys.keys = [ 187 "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" 188 ]; 189 }; 190 191 programs.hyprland.enable = true; 192 services.hypridle.enable = true; 193 194 # enable cups 195 services.printing.enable = true; 196 services.avahi = { 197 enable = true; 198 nssmdns4 = true; 199 openFirewall = true; 200 }; 201 202 203 # enable bluetooth 204 hardware.bluetooth.enable = true; 205 206 # enable pipewire 207 # rtkit is optional but recommended 208 security.rtkit.enable = true; 209 services.pipewire = { 210 enable = true; 211 alsa.enable = true; 212 alsa.support32Bit = true; 213 pulse.enable = true; 214 # If you want to use JACK applications, uncomment this 215 jack.enable = true; 216 }; 217 218 # This setups a SSH server. Very important if you're setting up a headless system. 219 # Feel free to remove if you don't need it. 220 services.openssh = { 221 enable = true; 222 settings = { 223 # Opinionated: forbid root login through SSH. 224 PermitRootLogin = "no"; 225 # Opinionated: use keys only. 226 # Remove if you want to SSH using passwords 227 PasswordAuthentication = false; 228 }; 229 }; 230 231 networking.firewall = { 232 enable = true; 233 allowedTCPPorts = [ 4455 ]; 234 allowedUDPPorts = [ 4455 ]; 235 }; 236 237 238 services.devmon.enable = true; 239 services.gvfs.enable = true; 240 services.udisks2.enable = true; 241 242 services.logind.extraConfig = '' 243 # don't shutdown when power button is short-pressed 244 HandlePowerKey=ignore 245 HandlePowerKeyLongPress=poweroff 246 ''; 247 248 # Requires at least 5.16 for working wi-fi and bluetooth. 249 # https://community.frame.work/t/using-the-ax210-with-linux-on-the-framework-laptop/1844/89 250 boot = { 251 kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") (lib.mkDefault pkgs.linuxPackages_latest); 252 loader.grub = { 253 # no need to set devices, disko will add all devices that have a EF02 partition to the list already 254 device = "nodev"; 255 efiSupport = true; 256 efiInstallAsRemovable = true; 257 }; 258 supportedFilesystems = [ "ntfs" ]; 259 }; 260 261 # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion 262 system.stateVersion = "23.05"; 263}