summary refs log tree commit diff
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:31 +0000
commit0fd8ce96ac7c708919da422d032dbf0f23c8c03a (patch)
treed178e7c72a8b515384d2b5008a20c3fb075900d3
parent2e6b796761672e0e3ed685487007bb0d99126d91 (diff)
downloadnixlib-0fd8ce96ac7c708919da422d032dbf0f23c8c03a.tar
nixlib-0fd8ce96ac7c708919da422d032dbf0f23c8c03a.tar.gz
nixlib-0fd8ce96ac7c708919da422d032dbf0f23c8c03a.tar.bz2
nixlib-0fd8ce96ac7c708919da422d032dbf0f23c8c03a.tar.lz
nixlib-0fd8ce96ac7c708919da422d032dbf0f23c8c03a.tar.xz
nixlib-0fd8ce96ac7c708919da422d032dbf0f23c8c03a.tar.zst
nixlib-0fd8ce96ac7c708919da422d032dbf0f23c8c03a.zip
nixos: introduce system.nixos.tags
-rw-r--r--nixos/modules/misc/label.nix22
1 files changed, 21 insertions, 1 deletions
diff --git a/nixos/modules/misc/label.nix b/nixos/modules/misc/label.nix
index 5faac8936f8f..b4e88915d829 100644
--- a/nixos/modules/misc/label.nix
+++ b/nixos/modules/misc/label.nix
@@ -21,12 +21,32 @@ in
       '';
     };
 
+    nixos.tags = mkOption {
+      type = types.listOf types.str;
+      default = [];
+      example = [ "with-xen" ];
+      description = ''
+        Strings to prefix to the default
+        <option>system.nixos.label</option>.
+
+        Useful for not loosing track of configurations built with
+        different options, e.g.:
+
+        <screen>
+        {
+          system.nixos.tags = [ "with-xen" ];
+          virtualisation.xen.enable = true;
+        }
+        </screen>
+      '';
+    };
+
   };
 
   config = {
     # This is set here rather than up there so that changing it would
     # not rebuild the manual
-    system.nixos.label = mkDefault cfg.version;
+    system.nixos.label = mkDefault (concatStringsSep "-" (sort (x: y: x < y) cfg.tags) + "-" + cfg.version);
   };
 
 }