about summary refs log tree commit diff
path: root/nixos/modules/misc
diff options
context:
space:
mode:
authorJan Malakhovski <oxij@oxij.org>2017-04-01 00:00:00 +0000
committerJan Malakhovski <oxij@oxij.org>2018-02-18 12:56:30 +0000
commit2e6b796761672e0e3ed685487007bb0d99126d91 (patch)
tree530c7866ba30fa6480e24da2d603bac7b292a0e1 /nixos/modules/misc
parent09512be289819507ca53d7f7be5e4b712b78283d (diff)
downloadnixlib-2e6b796761672e0e3ed685487007bb0d99126d91.tar
nixlib-2e6b796761672e0e3ed685487007bb0d99126d91.tar.gz
nixlib-2e6b796761672e0e3ed685487007bb0d99126d91.tar.bz2
nixlib-2e6b796761672e0e3ed685487007bb0d99126d91.tar.lz
nixlib-2e6b796761672e0e3ed685487007bb0d99126d91.tar.xz
nixlib-2e6b796761672e0e3ed685487007bb0d99126d91.tar.zst
nixlib-2e6b796761672e0e3ed685487007bb0d99126d91.zip
nixos: rename config.system.nixos* -> config.system.nixos.*
Diffstat (limited to 'nixos/modules/misc')
-rw-r--r--nixos/modules/misc/label.nix6
-rw-r--r--nixos/modules/misc/version.nix62
2 files changed, 34 insertions, 34 deletions
diff --git a/nixos/modules/misc/label.nix b/nixos/modules/misc/label.nix
index 30d8fc9952b7..5faac8936f8f 100644
--- a/nixos/modules/misc/label.nix
+++ b/nixos/modules/misc/label.nix
@@ -3,14 +3,14 @@
 with lib;
 
 let
-  cfg = config.system;
+  cfg = config.system.nixos;
 in
 
 {
 
   options.system = {
 
-    nixosLabel = mkOption {
+    nixos.label = mkOption {
       type = types.str;
       description = ''
         NixOS version name to be used in the names of generated
@@ -26,7 +26,7 @@ in
   config = {
     # This is set here rather than up there so that changing it would
     # not rebuild the manual
-    system.nixosLabel = mkDefault cfg.nixosVersion;
+    system.nixos.label = mkDefault cfg.version;
   };
 
 }
diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix
index 83427d26fff9..6af584250a70 100644
--- a/nixos/modules/misc/version.nix
+++ b/nixos/modules/misc/version.nix
@@ -3,7 +3,7 @@
 with lib;
 
 let
-  cfg = config.system;
+  cfg = config.system.nixos;
 
   releaseFile  = "${toString pkgs.path}/.version";
   suffixFile   = "${toString pkgs.path}/.version-suffix";
@@ -16,43 +16,27 @@ in
 
   options.system = {
 
-    stateVersion = mkOption {
-      type = types.str;
-      default = cfg.nixosRelease;
-      description = ''
-        Every once in a while, a new NixOS release may change
-        configuration defaults in a way incompatible with stateful
-        data. For instance, if the default version of PostgreSQL
-        changes, the new version will probably be unable to read your
-        existing databases. To prevent such breakage, you can set the
-        value of this option to the NixOS release with which you want
-        to be compatible. The effect is that NixOS will option
-        defaults corresponding to the specified release (such as using
-        an older version of PostgreSQL).
-      '';
-    };
-
-    nixosVersion = mkOption {
+    nixos.version = mkOption {
       internal = true;
       type = types.str;
       description = "The full NixOS version (e.g. <literal>16.03.1160.f2d4ee1</literal>).";
     };
 
-    nixosRelease = mkOption {
+    nixos.release = mkOption {
       readOnly = true;
       type = types.str;
       default = fileContents releaseFile;
       description = "The NixOS release (e.g. <literal>16.03</literal>).";
     };
 
-    nixosVersionSuffix = mkOption {
+    nixos.versionSuffix = mkOption {
       internal = true;
       type = types.str;
       default = if pathExists suffixFile then fileContents suffixFile else "pre-git";
       description = "The NixOS version suffix (e.g. <literal>1160.f2d4ee1</literal>).";
     };
 
-    nixosRevision = mkOption {
+    nixos.revision = mkOption {
       internal = true;
       type = types.str;
       default = if pathIsDirectory gitRepo then commitIdFromGitRepo gitRepo
@@ -61,12 +45,28 @@ in
       description = "The Git revision from which this NixOS configuration was built.";
     };
 
-    nixosCodeName = mkOption {
+    nixos.codeName = mkOption {
       readOnly = true;
       type = types.str;
       description = "The NixOS release code name (e.g. <literal>Emu</literal>).";
     };
 
+    stateVersion = mkOption {
+      type = types.str;
+      default = cfg.release;
+      description = ''
+        Every once in a while, a new NixOS release may change
+        configuration defaults in a way incompatible with stateful
+        data. For instance, if the default version of PostgreSQL
+        changes, the new version will probably be unable to read your
+        existing databases. To prevent such breakage, you can set the
+        value of this option to the NixOS release with which you want
+        to be compatible. The effect is that NixOS will option
+        defaults corresponding to the specified release (such as using
+        an older version of PostgreSQL).
+      '';
+    };
+
     defaultChannel = mkOption {
       internal = true;
       type = types.str;
@@ -78,15 +78,15 @@ in
 
   config = {
 
-    system = {
+    system.nixos = {
       # These defaults are set here rather than up there so that
       # changing them would not rebuild the manual
-      nixosVersion = mkDefault (cfg.nixosRelease + cfg.nixosVersionSuffix);
-      nixosRevision      = mkIf (pathIsDirectory gitRepo) (mkDefault            gitCommitId);
-      nixosVersionSuffix = mkIf (pathIsDirectory gitRepo) (mkDefault (".git." + gitCommitId));
+      version = mkDefault (cfg.release + cfg.versionSuffix);
+      revision      = mkIf (pathIsDirectory gitRepo) (mkDefault            gitCommitId);
+      versionSuffix = mkIf (pathIsDirectory gitRepo) (mkDefault (".git." + gitCommitId));
 
       # Note: code names must only increase in alphabetical order.
-      nixosCodeName = "Impala";
+      codeName = "Impala";
     };
 
     # Generate /etc/os-release.  See
@@ -96,10 +96,10 @@ in
       ''
         NAME=NixOS
         ID=nixos
-        VERSION="${config.system.nixosVersion} (${config.system.nixosCodeName})"
-        VERSION_CODENAME=${toLower config.system.nixosCodeName}
-        VERSION_ID="${config.system.nixosVersion}"
-        PRETTY_NAME="NixOS ${config.system.nixosVersion} (${config.system.nixosCodeName})"
+        VERSION="${cfg.version} (${cfg.codeName})"
+        VERSION_CODENAME=${toLower cfg.codeName}
+        VERSION_ID="${cfg.version}"
+        PRETTY_NAME="NixOS ${cfg.version} (${cfg.codeName})"
         HOME_URL="https://nixos.org/"
         SUPPORT_URL="https://nixos.org/nixos/support.html"
         BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues"