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
29 nixpkgs = {
30 # Configure your nixpkgs instance
31 config = {
32 # Disable if you don't want unfree packages
33 allowUnfree = true;
34 };
35 };
36
37 nix = let
38 flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs;
39 in {
40 settings = {
41 # Enable flakes and new 'nix' command
42 experimental-features = "nix-command flakes";
43 # Opinionated: disable global registry
44 flake-registry = "";
45 # Workaround for https://github.com/NixOS/nix/issues/9574
46 nix-path = config.nix.nixPath;
47 };
48 # Opinionated: disable channels
49 channel.enable = false;
50
51 # Opinionated: make flake registry and nix path match flake inputs
52 registry = lib.mapAttrs (_: flake: {inherit flake;}) flakeInputs;
53 nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
54 };
55
56 time = {
57 timeZone = "America/New_York";
58 hardwareClockInLocalTime = true;
59 };
60
61 services.automatic-timezoned.enable = true;
62
63 environment.systemPackages = map lib.lowPrio [
64 pkgs.curl
65 inputs.agenix.packages.x86_64-linux.default
66 pkgs.wpa_supplicant_gui
67 pkgs.alacritty
68 pkgs.zsh
69 pkgs.starship
70 pkgs.swww
71 pkgs.sunwait
72 pkgs.wluma
73 pkgs.brightnessctl
74 pkgs.playerctl
75 pkgs.firefox
76 pkgs.slack
77 pkgs.gnome.nautilus
78 pkgs.gnome.file-roller
79 pkgs.fprintd
80 pkgs.gitMinimal
81 (pkgs.vscode-with-extensions.override {
82 vscodeExtensions = with pkgs.vscode-extensions; [
83 bbenoist.nix
84 ];
85 })
86 pkgs.github-desktop
87 ];
88
89 services.fprintd.enable = true;
90
91 fonts.packages = with pkgs; [
92 nerdfonts
93 ];
94
95 environment.sessionVariables = {
96 XDG_CACHE_HOME = "$HOME/.cache";
97 XDG_CONFIG_HOME = "$HOME/.config";
98 XDG_DATA_HOME = "$HOME/.local/share";
99 XDG_STATE_HOME = "$HOME/.local/state";
100 NIXOS_OZONE_WL = "1";
101 };
102
103 # import the secret
104 age.identityPaths = [ "/home/kierank/.ssh/id_rsa" "/etc/ssh/id_rsa" "/mnt/etc/ssh/id_rsa" ];
105 age.secrets.wifi = {
106 file = ../secrets/wifi.age;
107 owner = "kierank";
108 };
109
110 # setup the network
111 networking = {
112 hostName = "moonlark";
113 wireless = {
114 environmentFile = config.age.secrets.wifi.path;
115 userControlled.enable = true;
116 enable = true;
117 networks = {
118 "KlukasNet".psk = "@PSK_HOME@";
119 "Everseen".psk = "@PSK_HOTSPOT@";
120 };
121 };
122 };
123
124 programs.zsh.enable = true;
125 # TODO: Configure your system-wide user settings (groups, etc), add more users as needed.
126 users.users = {
127 kierank = {
128 # You can skip setting a root password by passing '--no-root-passwd' to nixos-install.
129 # Be sure to change it (using passwd) after rebooting!
130 initialPassword = "lolzthisaintsecure!";
131 isNormalUser = true;
132 shell = pkgs.zsh;
133 openssh.authorizedKeys.keys = [
134 "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"
135 ];
136 extraGroups = ["wheel" "networkmanager" "audio" "video" "docker" "plugdev"];
137 };
138 root.openssh.authorizedKeys.keys = [
139 "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"
140 ];
141 };
142
143 programs.hyprland.enable = true;
144
145 # enable cups
146 services.printing.enable = true;
147
148 # enable bluetooth
149 hardware.bluetooth.enable = true;
150
151 # enable pipewire
152 # rtkit is optional but recommended
153 security.rtkit.enable = true;
154 services.pipewire = {
155 enable = true;
156 alsa.enable = true;
157 alsa.support32Bit = true;
158 pulse.enable = true;
159 # If you want to use JACK applications, uncomment this
160 jack.enable = true;
161 };
162
163 # This setups a SSH server. Very important if you're setting up a headless system.
164 # Feel free to remove if you don't need it.
165 services.openssh = {
166 enable = true;
167 settings = {
168 # Opinionated: forbid root login through SSH.
169 PermitRootLogin = "no";
170 # Opinionated: use keys only.
171 # Remove if you want to SSH using passwords
172 PasswordAuthentication = false;
173 };
174 };
175
176 # Requires at least 5.16 for working wi-fi and bluetooth.
177 # https://community.frame.work/t/using-the-ax210-with-linux-on-the-framework-laptop/1844/89
178 boot = {
179 kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") (lib.mkDefault pkgs.linuxPackages_latest);
180 loader.grub = {
181 # no need to set devices, disko will add all devices that have a EF02 partition to the list already
182 device = "nodev";
183 efiSupport = true;
184 efiInstallAsRemovable = true;
185 };
186 };
187
188 # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
189 system.stateVersion = "23.05";
190}