NixOS and Home Manager config

feat: modular nix config

nel.pet ea096021 48d220a6

verified
+58 -5
+7
modules/nixos/default.nix
··· 1 + { 2 + _class = "nixos"; 3 + 4 + imports = [ 5 + ./nix.nix 6 + ]; 7 + }
+50
modules/nixos/nix.nix
··· 1 + { inputs, lib, ... }: { 2 + nix = { 3 + # Add all flake inputs to the system flake registry. There are probably better ways to do this. 4 + # Particularly to consider https://github.com/NixOS/nixpkgs/pull/388090 (thank isabels config for pointing that out) 5 + # but thats an issue for future me. 6 + registry = let 7 + # rename self to cyclamen 8 + inputs' = lib.filterAttrs ( 9 + name: value: 10 + if name == "self" 11 + then false 12 + else true 13 + ) (inputs // {cyclamen = inputs.self;}); 14 + in ( 15 + lib.mapAttrs (name: value: { 16 + to = { 17 + type = "path"; 18 + path = value; 19 + }; 20 + }) inputs' 21 + ); 22 + 23 + # Dont need or want that. 24 + channel.enable = false; 25 + 26 + gc = { 27 + automatic = true; 28 + options = "--delete-older-than 14d"; 29 + }; 30 + 31 + settings = { 32 + allowed-users = [ "@wheel" ]; 33 + trusted-users = [ "@wheel" ]; 34 + 35 + experimental-features = [ 36 + # Enable flakes 37 + "nix-command" "flakes" 38 + ]; 39 + 40 + # Disable the global flake registry 41 + flake-registry = ""; 42 + 43 + # Use as many jobs are there are CPU cores available (speed up builds) 44 + max-jobs = "auto"; 45 + 46 + # Use $XDG_STATE_HOME/nix instead of ~/.nix-profile and co 47 + use-xdg-base-directories = true; 48 + }; 49 + }; 50 + }
+1 -5
systems/nel-desktop/configuration.nix
··· 1 1 { ... }: { 2 2 imports = [ 3 + ../../modules/nixos 3 4 ./hardware-configuration.nix 4 5 ]; 5 6 ··· 9 10 10 11 networking.hostName = "nel-desktop"; 11 12 networking.networkmanager.enable = true; 12 - 13 - nix.settings = { 14 - experimental-features = [ "nix-command" "flakes" ]; 15 - use-xdg-base-directories = true; 16 - }; 17 13 18 14 programs.partition-manager.enable = true; 19 15 services.flatpak.enable = true;