diff --git a/configs/nix-config.nix b/configs/nix-config.nix deleted file mode 100644 index 43c0b3b..0000000 --- a/configs/nix-config.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - system.stateVersion = "24.11"; - - nixpkgs.config.allowUnfree = true; - - nix.settings = { - experimental-features = [ - "nix-command" - "flakes" - "pipe-operators" - ]; - - trusted-users = [ "@wheel" ]; - - # Add binary caches to avoid having to compile them - substituters = [ - "https://cache.nixos.org" - "https://nix-community.cachix.org" - ]; - trusted-public-keys = [ - "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - }; - - programs.nix-ld.enable = true; -} diff --git a/hosts/common.nix b/hosts/common.nix index 3ac2602..b9cfd82 100644 --- a/hosts/common.nix +++ b/hosts/common.nix @@ -4,7 +4,6 @@ [ ../nixosModules ../configs/boot.nix - ../configs/nix-config.nix ../configs/security.nix ../configs/users.nix ../configs/networking.nix @@ -15,4 +14,5 @@ ../configs/graphical.nix ]; nixosModules.enable = true; + nix-config.enable = true; } diff --git a/nixosModules/default.nix b/nixosModules/default.nix index 216eee0..f8c572c 100644 --- a/nixosModules/default.nix +++ b/nixosModules/default.nix @@ -10,7 +10,7 @@ let in { imports = [ - # The rest + ./nix-config.nix ]; options = { diff --git a/nixosModules/nix-config.nix b/nixosModules/nix-config.nix new file mode 100644 index 0000000..0839aef --- /dev/null +++ b/nixosModules/nix-config.nix @@ -0,0 +1,43 @@ +{ + config, + lib, + pkgs, + ... +}: +let + moduleName = "nix-config"; + cfg = config."${moduleName}"; +in +{ + options = { + "${moduleName}".enable = lib.mkEnableOption "Enable ${moduleName}."; + }; + + config = lib.mkIf cfg.enable { + system.stateVersion = "24.11"; + + nixpkgs.config.allowUnfree = true; + + nix.settings = { + experimental-features = [ + "nix-command" + "flakes" + "pipe-operators" + ]; + + trusted-users = [ "@wheel" ]; + + # Add binary caches to avoid having to compile them + substituters = [ + "https://cache.nixos.org" + "https://nix-community.cachix.org" + ]; + trusted-public-keys = [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + }; + + programs.nix-ld.enable = true; + }; +}