diff --git a/modules/core/networking.nix b/modules/core/networking.nix index c5ec9cbe..43e35c34 100644 --- a/modules/core/networking.nix +++ b/modules/core/networking.nix @@ -1,10 +1,12 @@ -{ config, pkgs, lib, ... }: - -with lib; - -let cfg = config.pub-solar.core; -in { + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.pub-solar.core; +in { options.pub-solar.core = { enableCaddy = mkOption { type = types.bool; @@ -17,12 +19,12 @@ in binaryCaches = mkOption { type = types.listOf types.str; - default = [ ]; + default = []; description = "Binary caches to use."; }; publicKeys = mkOption { type = types.listOf types.str; - default = [ ]; + default = []; description = "Public keys of binary caches."; }; }; @@ -39,15 +41,16 @@ in networking.firewall.enable = true; # Customized binary caches list (with fallback to official binary cache) - nix.binaryCaches = cfg.binaryCaches; - nix.binaryCachePublicKeys = cfg.publicKeys; + nix.settings.substituters = cfg.binaryCaches; + nix.settings.trusted-public-keys = cfg.publicKeys; # These entries get added to /etc/hosts networking.hosts = { - "127.0.0.1" = [ ] - ++ lib.optionals cfg.enableCaddy [ "caddy.local" ] - ++ lib.optionals config.pub-solar.printing.enable [ "cups.local" ] - ++ lib.optionals cfg.enableHelp [ "help.local" ]; + "127.0.0.1" = + [] + ++ lib.optionals cfg.enableCaddy ["caddy.local"] + ++ lib.optionals config.pub-solar.printing.enable ["cups.local"] + ++ lib.optionals cfg.enableHelp ["help.local"]; }; # Caddy reverse proxy for local services like cups diff --git a/modules/core/nix.nix b/modules/core/nix.nix index f7ff5fa4..711304ba 100644 --- a/modules/core/nix.nix +++ b/modules/core/nix.nix @@ -1,19 +1,25 @@ -{ config, pkgs, lib, inputs, ... }: - { + config, + pkgs, + lib, + inputs, + ... +}: { nix = { # Use default version alias for nix package package = pkgs.nix; - # Improve nix store disk usage - autoOptimiseStore = true; gc.automatic = true; optimise.automatic = true; - # Prevents impurities in builds - useSandbox = true; - # give root and @wheel special privileges with nix - trustedUsers = [ "root" "@wheel" ]; - # This is just a representation of the nix default - systemFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ]; + settings = { + # Improve nix store disk usage + auto-optimise-store = true; + # Prevents impurities in builds + sandbox = true; + # give root and @wheel special privileges with nix + trusted-users = ["root" "@wheel"]; + # This is just a representation of the nix default + system-features = ["nixos-test" "benchmark" "big-parallel" "kvm"]; + }; # Generally useful nix option defaults extraOptions = '' min-free = 536870912 diff --git a/profiles/cachix/default.nix b/profiles/cachix/default.nix index d88a3f75..9b810da7 100644 --- a/profiles/cachix/default.nix +++ b/profiles/cachix/default.nix @@ -1,11 +1,13 @@ -{ pkgs, lib, ... }: -let +{ + pkgs, + lib, + ... +}: let folder = ./.; toImport = name: value: folder + ("/" + name); filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key && key != "default.nix"; imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder)); -in -{ +in { inherit imports; - nix.binaryCaches = [ "https://cache.nixos.org/" ]; + nix.settings.substituters = ["https://cache.nixos.org/"]; } diff --git a/profiles/cachix/nix-community.nix b/profiles/cachix/nix-community.nix index 7e4be286..3c957fcd 100644 --- a/profiles/cachix/nix-community.nix +++ b/profiles/cachix/nix-community.nix @@ -1,9 +1,9 @@ { - nix = { - binaryCaches = [ + nix.settings = { + substituters = [ "https://nix-community.cachix.org" ]; - binaryCachePublicKeys = [ + trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ]; }; diff --git a/profiles/cachix/nrdxp.nix b/profiles/cachix/nrdxp.nix index bb3b4a59..ddced9c3 100644 --- a/profiles/cachix/nrdxp.nix +++ b/profiles/cachix/nrdxp.nix @@ -1,9 +1,9 @@ { - nix = { - binaryCaches = [ + nix.settings = { + substituters = [ "https://nrdxp.cachix.org" ]; - binaryCachePublicKeys = [ + trusted-public-keys = [ "nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4=" ]; };