From d4636fa2548a1980b3541dd386b6977c56218964 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 27 Feb 2016 20:42:55 +0100 Subject: Revert "Add a way to pin a NixOS version within the module system." This reverts commit a5992ad61b314104aff7e28a41ce101a1b0e7c35. Motivation: https://github.com/NixOS/nixpkgs/commit/a5992ad61b314104aff7e28a41ce101a1b0e7c35#commitcomment-14986820 --- nixos/modules/misc/nixos.nix | 82 ------------------------------------------ nixos/modules/misc/nixos.xml | 84 -------------------------------------------- 2 files changed, 166 deletions(-) delete mode 100644 nixos/modules/misc/nixos.nix delete mode 100644 nixos/modules/misc/nixos.xml (limited to 'nixos/modules/misc') diff --git a/nixos/modules/misc/nixos.nix b/nixos/modules/misc/nixos.nix deleted file mode 100644 index 84365b640a48..000000000000 --- a/nixos/modules/misc/nixos.nix +++ /dev/null @@ -1,82 +0,0 @@ -{ config, options, lib, ... }: - -# This modules is used to inject a different NixOS version as well as its -# argument such that one can pin a specific version with the versionning -# system of the configuration. -let - nixosReentry = import config.nixos.path { - inherit (config.nixos) configuration extraModules; - inherit (config.nixpkgs) system; - reEnter = true; - }; -in - -with lib; - -{ - options = { - nixos.path = mkOption { - default = null; - example = literalExample "./nixpkgs-15.09/nixos"; - type = types.nullOr types.path; - description = '' - This option give the ability to evaluate the current set of modules - with a different version of NixOS. This option can be used version - the version of NixOS with the configuration without relying on the - NIX_PATH environment variable. - ''; - }; - - nixos.system = mkOption { - example = "i686-linux"; - type = types.uniq types.str; - description = '' - Name of the system used to compile NixOS. - ''; - }; - - nixos.extraModules = mkOption { - default = []; - example = literalExample "[ ./sshd-config.nix ]"; - type = types.listOf (types.either (types.submodule ({...}:{options={};})) types.path); - description = '' - Define additional modules which would be loaded to evaluate the - configuration. - ''; - }; - - nixos.configuration = mkOption { - type = types.unspecified; - internal = true; - description = '' - Option used by nixos/default.nix to re-inject - the same configuration module as the one used for the current - execution. - ''; - }; - - nixos.reflect = mkOption { - default = { inherit config options; }; - type = types.unspecified; - internal = true; - description = '' - Provides config and options - computed by the module system and given as argument to all - modules. These are used for introspection of options and - configuration by tools such as nixos-option. - ''; - }; - }; - - config = mkMerge [ - (mkIf (config.nixos.path != null) (mkForce { - system.build.toplevel = nixosReentry.system; - system.build.vm = nixosReentry.vm; - nixos.reflect = { inherit (nixosReentry) config options; }; - })) - - { meta.maintainers = singleton lib.maintainers.pierron; - meta.doc = ./nixos.xml; - } - ]; -} diff --git a/nixos/modules/misc/nixos.xml b/nixos/modules/misc/nixos.xml deleted file mode 100644 index 064bdd80b3c9..000000000000 --- a/nixos/modules/misc/nixos.xml +++ /dev/null @@ -1,84 +0,0 @@ - - -NixOS Reentry - - - - -Source: modules/misc/nixos.nix - - - -NixOS reentry can be used for both pinning the evaluation to a -specific version of NixOS, and to dynamically add additional modules into -the Module evaluation. - -
NixOS Version Pinning - -To pin a specific version of NixOS, you need a version that you can -either clone localy, or that you can fetch remotely. - -If you already have a cloned version of NixOS in the directory -/etc/nixos/nixpkgs-16-03, then you can specify the - with either the path or the relative path of -your NixOS clone. For example, you can add the following to your -/etc/nixos/configuration.nix file: - - -nixos.path = ./nixpkgs-16-03/nixos; - - - -Another option is to fetch a specific version of NixOS, with either -the fetchTarball builtin, or the -pkgs.fetchFromGitHub function and use the result as an -input. - - -nixos.path = "${builtins.fetchTarball https://github.com/NixOS/nixpkgs/archive/1f27976e03c15183191d1b4aa1a40d1f14666cd2.tar.gz}/nixos"; - - - -
- - -
Adding Module Dynamically - -To add additional module, the recommended way is to use statically -known modules in the list of imported arguments as described in . Unfortunately, this recommended method has -limitation, such that the list of imported files cannot be selected based on -the content of the configuration. - -Fortunately, NixOS reentry system can be used as an alternative to register -new imported modules based on the content of the configuration. To do so, -one should define both and - options. - - -nixos.path = <nixos>; -nixos.extraModules = - if config.networking.hostName == "server" then - [ ./server.nix ] else [ ./client.nix ]; - - -Also note, that the above can be reimplemented in a different way which is -not as expensive, by using mkIf at the top each -configuration if both modules are present on the file system (see ) and by always inmporting both -modules. - -
- -
Options - -FIXME: auto-generated list of module options. - -
- - -
-- cgit 1.4.1