diff --git a/modules/environment/files.nix b/modules/environment/files.nix deleted file mode 100644 index e1c5cb0..0000000 --- a/modules/environment/files.nix +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (c) 2019-2020, see AUTHORS. Licensed under MIT License, see LICENSE. - -{ config, lib, pkgs, ... }: - -with lib; - -{ - - ###### interface - - options = { - - }; - - - ###### implementation - - config = { - - environment.etc = { - "nix/nix.conf".text = '' - sandbox = false - substituters = https://cache.nixos.org https://nix-on-droid.cachix.org - trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-on-droid.cachix.org-1:56snoMJTXmDRC1Ei24CmKoUqvHJ9XCp+nidK7qkMQrU= - ''; - }; - - }; - -} diff --git a/modules/environment/nix.nix b/modules/environment/nix.nix new file mode 100644 index 0000000..9938b7b --- /dev/null +++ b/modules/environment/nix.nix @@ -0,0 +1,73 @@ +# Copyright (c) 2019-2020, see AUTHORS. Licensed under MIT License, see LICENSE. + +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.nix; +in + +{ + + ###### interface + + options = { + + nix = { + substituters = mkOption { + type = types.listOf types.str; + default = []; + description = '' + A list of URLs of substituters. The official NixOS and nix-on-droid + substituters are added by default. + ''; + }; + + trustedPublicKeys = mkOption { + type = types.listOf types.str; + default = []; + description = '' + A list of public keys. When paths are copied from another Nix store (such as a + binary cache), they must be signed with one of these keys. The official NixOS + and nix-on-droid public keys are added by default. + ''; + }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + description = "Extra config to be appended to /etc/nix/nix.conf."; + }; + }; + + }; + + + ###### implementation + + config = { + + environment.etc = { + "nix/nix.conf".text = '' + sandbox = false + substituters = ${concatStringsSep " " cfg.substituters} + trusted-public-keys = ${concatStringsSep " " cfg.trustedPublicKeys} + ${cfg.extraConfig} + ''; + }; + + nix = { + substituters = [ + "https://cache.nixos.org" + "https://nix-on-droid.cachix.org" + ]; + trustedPublicKeys = [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "nix-on-droid.cachix.org-1:56snoMJTXmDRC1Ei24CmKoUqvHJ9XCp+nidK7qkMQrU=" + ]; + }; + + }; + +} diff --git a/modules/module-list.nix b/modules/module-list.nix index aa2392a..cbac88f 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -6,10 +6,10 @@ ./build/activation.nix ./build/config.nix ./environment/etc - ./environment/files.nix ./environment/links.nix ./environment/login ./environment/networking.nix + ./environment/nix.nix ./environment/path.nix ./environment/session-init.nix ./home-manager.nix