yep, more dotfiles
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 37 gc = { 38 automatic = true; 39 # absolute disk space saver, if you forget to run GC 40 # once had it over 170gb and brought it back to 50gb 41 options = "--delete-older-than 30d"; 42 } 43 # Same option to say that GC is ran weekly at 3h15 44 // (if isDarwin then { 45 interval = { Weekday = 7; Hour = 3; Minute = 15; }; 46 } else { 47 dates = "Sun *-*-* 03:15:00"; 48 }); 49 50 settings = { 51 experimental-features = [ "nix-command" "flakes" ]; 52 auto-optimise-store = true; 53 54 # Disable flake registry to keep system pure and 55 # avoid network calls at each nix invoation. 56 flake-registry = ""; 57 58 keep-going = true; 59 60 extra-platforms = config.boot.binfmt.emulatedSystems; 61 62 trusted-users = [ config.local.user.username ]; 63 extra-substituters = [ "https://nix-community.cachix.org" ]; 64 extra-trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ]; 65 }; 66 }; 67 }; 68}