yep, more dotfiles
at main 2.0 kB view raw
1{ self 2, config 3, lib 4, pkgs 5 6, isDarwin 7, ... 8}: 9 10let 11 clear-nix-env = false; 12 13 cfg = config.local.fragment.nix; 14in 15 16{ 17 options.local.fragment.nix.enable = lib.mkEnableOption '' 18 Nix related 19 ''; 20 21 config = lib.mkIf cfg.enable { 22 nix = { 23 package = pkgs.lixPackageSets.stable.lix; 24 25 # Make system registry consistent with flake inputs 26 # Add `self` registry input that refers to flake 27 registry = lib.mapAttrs (_: value: { flake = value; }) (self.inputs // { inherit self; }); 28 29 nixPath = 30 if clear-nix-env 31 # Actually make it empty to disable nix-* legacy commands 32 then [ ] 33 # Make NixOS system's legacy channels consistent with registry and flake inputs 34 else lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; 35 36 gc = { 37 automatic = true; 38 # absolute disk space saver, if you forget to run GC 39 # once had it over 170gb and brought it back to 50gb 40 options = "--delete-older-than 30d"; 41 } 42 # Same option to say that GC is ran weekly at 3h15 43 // (if isDarwin then { 44 interval = { Weekday = 7; Hour = 3; Minute = 15; }; 45 } else { 46 dates = "Sun *-*-* 03:15:00"; 47 }); 48 49 settings = { 50 experimental-features = [ "nix-command" "flakes" ]; 51 auto-optimise-store = true; 52 53 # Disable flake registry to keep system pure and 54 # avoid network calls at each nix invoation. 55 flake-registry = ""; 56 57 use-xdg-base-directories = true; 58 59 keep-going = true; 60 61 extra-platforms = config.boot.binfmt.emulatedSystems; 62 63 trusted-users = [ config.local.user.username ]; 64 extra-substituters = [ "https://nix-community.cachix.org" ]; 65 extra-trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ]; 66 }; 67 }; 68 69 # other disk space saver 70 services.angrr = { 71 enable = true; 72 period = "2weeks"; 73 enableNixGcIntegration = true; 74 }; 75 }; 76}