diff options
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/config/i18n.nix | 1 | ||||
-rw-r--r-- | nixos/modules/config/sysctl.nix | 1 | ||||
-rw-r--r-- | nixos/modules/installer/tools/nixos-option.sh | 4 | ||||
-rw-r--r-- | nixos/modules/installer/tools/nixos-typecheck.sh | 52 | ||||
-rw-r--r-- | nixos/modules/installer/tools/tools.nix | 8 | ||||
-rw-r--r-- | nixos/modules/misc/meta.nix | 1 | ||||
-rw-r--r-- | nixos/modules/misc/nixpkgs.nix | 49 | ||||
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/misc/gitlab.nix | 3 | ||||
-rw-r--r-- | nixos/modules/services/misc/ihaskell.nix | 4 | ||||
-rw-r--r-- | nixos/modules/services/misc/nixos-manual.nix | 5 | ||||
-rw-r--r-- | nixos/modules/services/web-servers/apache-httpd/default.nix | 3 | ||||
-rw-r--r-- | nixos/modules/services/x11/window-managers/xmonad.nix | 3 | ||||
-rw-r--r-- | nixos/modules/system/boot/kernel.nix | 1 | ||||
-rw-r--r-- | nixos/modules/system/boot/systemd-unit-options.nix | 5 |
15 files changed, 31 insertions, 110 deletions
diff --git a/nixos/modules/config/i18n.nix b/nixos/modules/config/i18n.nix index 3d21bda5734fb..b20fac6ad3e27 100644 --- a/nixos/modules/config/i18n.nix +++ b/nixos/modules/config/i18n.nix @@ -64,7 +64,6 @@ in consoleKeyMap = mkOption { type = mkOptionType { name = "string or path"; - typerep = "(stringOrPath)"; check = t: (isString t || types.path.check t); }; diff --git a/nixos/modules/config/sysctl.nix b/nixos/modules/config/sysctl.nix index 174d7014ca8a7..61b02c5ffa6a6 100644 --- a/nixos/modules/config/sysctl.nix +++ b/nixos/modules/config/sysctl.nix @@ -6,7 +6,6 @@ let sysctlOption = mkOptionType { name = "sysctl option value"; - typerep = "(sysctl)"; check = val: let checkType = x: isBool x || isString x || isInt x || isNull x; diff --git a/nixos/modules/installer/tools/nixos-option.sh b/nixos/modules/installer/tools/nixos-option.sh index dd21dc71ee2b5..17c17d05e288e 100644 --- a/nixos/modules/installer/tools/nixos-option.sh +++ b/nixos/modules/installer/tools/nixos-option.sh @@ -115,8 +115,8 @@ let let name = head attrsNames; rest = tail attrsNames; in if isOption result.options then walkOptions rest { - options = result.options.type.getSubOptionsPrefix ""; - opt = ''(\${result.opt}.type.getSubOptionsPrefix "")''; + options = result.options.type.getSubOptions ""; + opt = ''(\${result.opt}.type.getSubOptions "")''; cfg = ''\${result.cfg}."\${name}"''; } else diff --git a/nixos/modules/installer/tools/nixos-typecheck.sh b/nixos/modules/installer/tools/nixos-typecheck.sh deleted file mode 100644 index f9557be0c50e1..0000000000000 --- a/nixos/modules/installer/tools/nixos-typecheck.sh +++ /dev/null @@ -1,52 +0,0 @@ -#! /bin/sh -#! @shell@ - -if [ -x "@shell@" ]; then export SHELL="@shell@"; fi; - -set -e - -showSyntax() { -cat >&1 << EOF -nixos-typecheck -usage: - nixos-typecheck [action] [args] -where: - action = silent | printAll | printUnspecified | getSpecs - with default action: printUnspecified - args = any argument supported by nix-build -EOF -} - - -# Parse the command line. -extraArgs=() -action=printUnspecified - -while [ "$#" -gt 0 ]; do - i="$1"; shift 1 - case "$i" in - --help) - showSyntax - ;; - silent|printAll|printUnspecified|getSpecs) - action="$i" - ;; - *) - extraArgs="$extraArgs $i" - ;; - esac -done - - -if [ "$action" = silent ]; then - nix-build --no-out-link '<nixpkgs/nixos>' -A typechecker.silent $extraArgs -elif [ "$action" = printAll ]; then - nix-build --no-out-link '<nixpkgs/nixos>' -A typechecker.printAll $extraArgs -elif [ "$action" = printUnspecified ]; then - nix-build --no-out-link '<nixpkgs/nixos>' -A typechecker.printUnspecified $extraArgs -elif [ "$action" = getSpecs ]; then - ln -s $(nix-build --no-out-link '<nixpkgs/nixos>' -A typechecker.specifications $extraArgs)/share/doc/nixos/options-specs.json specifications.json -else - showSyntax - exit 1 -fi diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix index 69bd0d26b7733..9ac3b7a5b16f4 100644 --- a/nixos/modules/installer/tools/tools.nix +++ b/nixos/modules/installer/tools/tools.nix @@ -54,11 +54,6 @@ let inherit (config.system) nixosVersion nixosCodeName nixosRevision; }; - nixos-typecheck = makeProg { - name = "nixos-typecheck"; - src = ./nixos-typecheck.sh; - }; - in { @@ -72,11 +67,10 @@ in nixos-generate-config nixos-option nixos-version - nixos-typecheck ]; system.build = { - inherit nixos-install nixos-generate-config nixos-option nixos-rebuild nixos-typecheck; + inherit nixos-install nixos-generate-config nixos-option nixos-rebuild; }; }; diff --git a/nixos/modules/misc/meta.nix b/nixos/modules/misc/meta.nix index 9a453172c63a9..22622706f2c88 100644 --- a/nixos/modules/misc/meta.nix +++ b/nixos/modules/misc/meta.nix @@ -5,7 +5,6 @@ with lib; let maintainer = mkOptionType { name = "maintainer"; - typerep = "(maintainer)"; check = email: elem email (attrValues lib.maintainers); merge = loc: defs: listToAttrs (singleton (nameValuePair (last defs).file (last defs).value)); }; diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix index 511831ae5cd2f..5eb38c510b483 100644 --- a/nixos/modules/misc/nixpkgs.nix +++ b/nixos/modules/misc/nixpkgs.nix @@ -3,35 +3,32 @@ with lib; let - nixpkgsConfig = pkgs: - let - isConfig = x: - builtins.isAttrs x || builtins.isFunction x; + isConfig = x: + builtins.isAttrs x || builtins.isFunction x; - optCall = f: x: - if builtins.isFunction f - then f x - else f; + optCall = f: x: + if builtins.isFunction f + then f x + else f; - mergeConfig = lhs_: rhs_: - let - lhs = optCall lhs_ { inherit pkgs; }; - rhs = optCall rhs_ { inherit pkgs; }; - in - lhs // rhs // - optionalAttrs (lhs ? packageOverrides) { - packageOverrides = pkgs: - optCall lhs.packageOverrides pkgs // - optCall (attrByPath ["packageOverrides"] ({}) rhs) pkgs; - }; + mergeConfig = lhs_: rhs_: + let + lhs = optCall lhs_ { inherit pkgs; }; + rhs = optCall rhs_ { inherit pkgs; }; in - mkOptionType { - name = "nixpkgs config"; - typerep = "(nixpkgsConfig)"; - check = lib.traceValIfNot isConfig; - merge = config: args: fold (def: mergeConfig def.value) {}; - defaultValues = [{}]; + lhs // rhs // + optionalAttrs (lhs ? packageOverrides) { + packageOverrides = pkgs: + optCall lhs.packageOverrides pkgs // + optCall (attrByPath ["packageOverrides"] ({}) rhs) pkgs; }; + + configType = mkOptionType { + name = "nixpkgs config"; + check = traceValIfNot isConfig; + merge = args: fold (def: mergeConfig def.value) {}; + }; + in { @@ -49,7 +46,7 @@ in }; } ''; - type = nixpkgsConfig pkgs; + type = configType; description = '' The configuration of the Nix Packages collection. (For details, see the Nixpkgs documentation.) It allows you to set diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 88e01069b2640..ad1636e002d8f 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -1,5 +1,4 @@ [ - ../lib/typechecker.nix ./config/debug-info.nix ./config/fonts/corefonts.nix ./config/fonts/fontconfig-ultimate.nix diff --git a/nixos/modules/services/misc/gitlab.nix b/nixos/modules/services/misc/gitlab.nix index e6ebcd6dc145b..cc50bfbea5319 100644 --- a/nixos/modules/services/misc/gitlab.nix +++ b/nixos/modules/services/misc/gitlab.nix @@ -155,21 +155,18 @@ in { packages.gitlab = mkOption { type = types.package; default = pkgs.gitlab; - defaultText = "pkgs.gitlab"; description = "Reference to the gitlab package"; }; packages.gitlab-shell = mkOption { type = types.package; default = pkgs.gitlab-shell; - defaultText = "pkgs.gitlab-shell"; description = "Reference to the gitlab-shell package"; }; packages.gitlab-workhorse = mkOption { type = types.package; default = pkgs.gitlab-workhorse; - defaultText = "pkgs.gitlab-workhorse"; description = "Reference to the gitlab-workhorse package"; }; diff --git a/nixos/modules/services/misc/ihaskell.nix b/nixos/modules/services/misc/ihaskell.nix index c177d68c8fe0c..d0e9b839e754a 100644 --- a/nixos/modules/services/misc/ihaskell.nix +++ b/nixos/modules/services/misc/ihaskell.nix @@ -15,14 +15,12 @@ in options = { services.ihaskell = { enable = mkOption { - type = lib.types.bool; default = false; example = true; description = "Autostart an IHaskell notebook service."; }; haskellPackages = mkOption { - type = lib.types.packageSet; default = pkgs.haskellPackages; defaultText = "pkgs.haskellPackages"; example = literalExample "pkgs.haskell.packages.ghc784"; @@ -35,9 +33,7 @@ in }; extraPackages = mkOption { - type = types.functionTo (types.listOf types.package); default = self: []; - defaultText = "self: []"; example = literalExample '' haskellPackages: [ haskellPackages.wreq diff --git a/nixos/modules/services/misc/nixos-manual.nix b/nixos/modules/services/misc/nixos-manual.nix index 7ba1c319add41..37ea339300d44 100644 --- a/nixos/modules/services/misc/nixos-manual.nix +++ b/nixos/modules/services/misc/nixos-manual.nix @@ -17,8 +17,6 @@ let nixpkgs.system = config.nixpkgs.system; }; - internalModule = { _module = config._module; }; - /* For the purpose of generating docs, evaluate options with each derivation in `pkgs` (recursively) replaced by a fake with path "\${pkgs.attribute.path}". It isn't perfect, but it seems to cover a vast majority of use cases. @@ -31,7 +29,7 @@ let options = let scrubbedEval = evalModules { - modules = [ versionModule ] ++ baseModules ++ [ internalModule ]; + modules = [ versionModule ] ++ baseModules; args = (config._module.args) // { modules = [ ]; }; specialArgs = { pkgs = scrubDerivations "pkgs" pkgs; }; }; @@ -45,7 +43,6 @@ let ) pkgSet; in scrubbedEval.options; - internalModule = config._module; }; entry = "${manual.manual}/share/doc/nixos/index.html"; diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix index 8340287df453e..60ec49c9e66ee 100644 --- a/nixos/modules/services/web-servers/apache-httpd/default.nix +++ b/nixos/modules/services/web-servers/apache-httpd/default.nix @@ -48,7 +48,8 @@ let if svc ? function then svc.function else import (toString "${toString ./.}/${if svc ? serviceType then svc.serviceType else svc.serviceName}.nix"); config = (evalModules - { modules = [ { options = res.options; config = svc.config or svc; } ] ++ [ { _module.check = false; } ]; + { modules = [ { options = res.options; config = svc.config or svc; } ]; + check = false; }).config; defaults = { extraConfig = ""; diff --git a/nixos/modules/services/x11/window-managers/xmonad.nix b/nixos/modules/services/x11/window-managers/xmonad.nix index d8acb824f7df8..6af88d4f645b3 100644 --- a/nixos/modules/services/x11/window-managers/xmonad.nix +++ b/nixos/modules/services/x11/window-managers/xmonad.nix @@ -16,7 +16,6 @@ in services.xserver.windowManager.xmonad = { enable = mkEnableOption "xmonad"; haskellPackages = mkOption { - type = lib.types.packageSet; default = pkgs.haskellPackages; defaultText = "pkgs.haskellPackages"; example = literalExample "pkgs.haskell.packages.ghc784"; @@ -29,9 +28,7 @@ in }; extraPackages = mkOption { - type = lib.types.functionTo (lib.types.listOf lib.types.package); default = self: []; - defaultText = "self: []"; example = literalExample '' haskellPackages: [ haskellPackages.xmonad-contrib diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix index 5b11a3fc61c34..a6bbca9b30bb7 100644 --- a/nixos/modules/system/boot/kernel.nix +++ b/nixos/modules/system/boot/kernel.nix @@ -20,7 +20,6 @@ in options = { boot.kernelPackages = mkOption { - type = types.packageSet; default = pkgs.linuxPackages; # We don't want to evaluate all of linuxPackages for the manual # - some of it might not even evaluate correctly. diff --git a/nixos/modules/system/boot/systemd-unit-options.nix b/nixos/modules/system/boot/systemd-unit-options.nix index 16d0e098b8c86..d4cab93b26b83 100644 --- a/nixos/modules/system/boot/systemd-unit-options.nix +++ b/nixos/modules/system/boot/systemd-unit-options.nix @@ -17,15 +17,14 @@ in rec { unitOption = mkOptionType { name = "systemd option"; - typerep = "(systemdOption)"; - merge = _module: loc: defs: + merge = loc: defs: let defs' = filterOverrides defs; defs'' = getValues defs'; in if isList (head defs'') then concatLists defs'' - else mergeOneOption _module loc defs'; + else mergeOneOption loc defs'; }; sharedOptions = { |