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