diff options
| author | Fuwn <[email protected]> | 2024-09-19 15:52:36 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-09-19 15:52:36 -0700 |
| commit | 875af84f8185650cc26baef1939741527bbbaefc (patch) | |
| tree | 05cbd9581f3aefecde2b34817db2e7207d43a256 /modules | |
| parent | himeji: add docker volume (diff) | |
| download | nixos-config-875af84f8185650cc26baef1939741527bbbaefc.tar.xz nixos-config-875af84f8185650cc26baef1939741527bbbaefc.zip | |
modules: nix options
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/default.nix | 1 | ||||
| -rw-r--r-- | modules/nix/default.nix | 42 | ||||
| -rw-r--r-- | modules/nix/extended.nix | 48 | ||||
| -rw-r--r-- | modules/nix/nh.nix | 9 | ||||
| -rw-r--r-- | modules/options.nix | 7 |
5 files changed, 66 insertions, 41 deletions
diff --git a/modules/default.nix b/modules/default.nix index 44da8e2..b15985c 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -7,5 +7,6 @@ ./software ./variables ./virtualisation + ./options.nix ]; } diff --git a/modules/nix/default.nix b/modules/nix/default.nix index a55548c..6b605ee 100644 --- a/modules/nix/default.nix +++ b/modules/nix/default.nix @@ -1,19 +1,13 @@ { - config, - lib, inputs, pkgs, + lib, + config, ... }: { - imports = [ ./nh.nix ]; - - nixpkgs.config = { - cudaSupport = true; - allowUnfree = true; - }; - - programs.nix-index-database.comma.enable = true; + imports = [ ./extended.nix ]; + nixpkgs.config.allowUnfree = true; nix = { gc.automatic = true; @@ -22,27 +16,6 @@ package = pkgs.nixVersions.git; nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; channel.enable = false; - # distributedBuilds = true; - - buildMachines = - map - (system: { - inherit system; - - hostName = "eu.nixbuild.net"; - maxJobs = 100; - - supportedFeatures = [ - "benchmark" - "big-parallel" - ]; - }) - [ - "x86_64-linux" - "i686-linux" - "aarch64-linux" - "armv7l-linux" - ]; settings = { auto-optimise-store = true; @@ -60,15 +33,8 @@ flake-registry = "${inputs.flake-registry}/flake-registry.json"; trusted-users = [ "@wheel" ]; max-jobs = "auto"; - extra-platforms = config.boot.binfmt.emulatedSystems; keep-outputs = true; - extra-sandbox-paths = [ - config.programs.ccache.cacheDir - "/run/binfmt" - "${pkgs.qemu}" - ]; - system-features = [ "nixos-test" "kvm" diff --git a/modules/nix/extended.nix b/modules/nix/extended.nix new file mode 100644 index 0000000..4e924cd --- /dev/null +++ b/modules/nix/extended.nix @@ -0,0 +1,48 @@ +{ + config, + lib, + pkgs, + ... +}: +{ + imports = [ ./nh.nix ]; + + config = lib.mkIf config.modules.nix.extend { + nixpkgs.config.cudaSupport = true; + programs.nix-index-database.comma.enable = true; + + nix = { + # distributedBuilds = true; + + buildMachines = + map + (system: { + inherit system; + + hostName = "eu.nixbuild.net"; + maxJobs = 100; + + supportedFeatures = [ + "benchmark" + "big-parallel" + ]; + }) + [ + "x86_64-linux" + "i686-linux" + "aarch64-linux" + "armv7l-linux" + ]; + + settings = { + extra-platforms = config.boot.binfmt.emulatedSystems; + + extra-sandbox-paths = [ + config.programs.ccache.cacheDir + "/run/binfmt" + "${pkgs.qemu}" + ]; + }; + }; + }; +} diff --git a/modules/nix/nh.nix b/modules/nix/nh.nix index 70951c0..5b54192 100644 --- a/modules/nix/nh.nix +++ b/modules/nix/nh.nix @@ -1,6 +1,9 @@ +{ lib, config, ... }: { - programs.nh = { - enable = true; - clean.enable = false; + config = lib.mkIf config.modules.nix.extend { + programs.nh = { + enable = true; + clean.enable = false; + }; }; } diff --git a/modules/options.nix b/modules/options.nix new file mode 100644 index 0000000..bd831dc --- /dev/null +++ b/modules/options.nix @@ -0,0 +1,7 @@ +{ lib, ... }: +{ + options.modules.nix.extend = lib.options.mkOption { + default = true; + type = lib.types.bool; + }; +} |