diff options
Diffstat (limited to 'modules/nixos/base/nix.nix')
| -rw-r--r-- | modules/nixos/base/nix.nix | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/modules/nixos/base/nix.nix b/modules/nixos/base/nix.nix new file mode 100644 index 0000000..38fcef0 --- /dev/null +++ b/modules/nixos/base/nix.nix @@ -0,0 +1,44 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.getchoo.base.nix-settings; + inherit (lib) mkDefault mkEnableOption mkIf; +in { + options.getchoo.base.nix-settings.enable = mkEnableOption "base nix settings"; + + imports = [ + ./documentation.nix + ./packages.nix + ]; + + config = let + channelPath = "/etc/nix/channels/nixpkgs"; + in + mkIf cfg.enable { + nix = { + package = mkDefault pkgs.nixFlakes; + + gc = { + automatic = mkDefault true; + dates = mkDefault "weekly"; + options = mkDefault "--delete-older-than 7d"; + }; + + settings = { + auto-optimise-store = true; + experimental-features = ["nix-command" "flakes"]; + }; + + nixPath = [ + "nixpkgs=${channelPath}" + ]; + }; + + systemd.tmpfiles.rules = [ + "L+ ${channelPath} - - - - ${pkgs.path}" + ]; + }; +} |
