From cffffeb678e9a1078eeba0f19c9607cda9f31bed Mon Sep 17 00:00:00 2001 From: seth Date: Wed, 7 Feb 2024 18:03:24 -0500 Subject: modules/nixos+darwin: move to traits + archetypes model --- modules/shared/base/nix.nix | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 modules/shared/base/nix.nix (limited to 'modules/shared/base/nix.nix') diff --git a/modules/shared/base/nix.nix b/modules/shared/base/nix.nix new file mode 100644 index 0000000..6e1bdf3 --- /dev/null +++ b/modules/shared/base/nix.nix @@ -0,0 +1,43 @@ +{ + config, + lib, + pkgs, + inputs, + ... +}: let + cfg = config.base.nixSettings; + enable = config.base.enable && cfg.enable; +in { + options.base.nixSettings = { + enable = lib.mkEnableOption "nix settings" // {default = true;}; + }; + + config = lib.mkIf enable { + nix = { + registry.n.flake = lib.mkDefault inputs.nixpkgs; + + nixPath = [ + "nixpkgs=/etc/nix/inputs/nixpkgs" + ]; + + settings = { + auto-optimise-store = pkgs.stdenv.isLinux; + experimental-features = lib.mkDefault ["nix-command" "flakes" "auto-allocate-uids" "repl-flake"]; + + trusted-substituters = lib.mkDefault ["https://getchoo.cachix.org"]; + trusted-public-keys = lib.mkDefault ["getchoo.cachix.org-1:ftdbAUJVNaFonM0obRGgR5+nUmdLMM+AOvDOSx0z5tE="]; + nix-path = config.nix.nixPath; + }; + + gc = { + automatic = lib.mkDefault true; + options = lib.mkDefault "--delete-older-than 7d"; + }; + }; + + nixpkgs = { + overlays = [inputs.self.overlays.default]; + config.allowUnfree = lib.mkDefault true; + }; + }; +} -- cgit v1.2.3