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