about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2024-05-25 22:16:47 +0300
committerAzat Bahawi <azat@bahawi.net>2024-05-25 22:16:47 +0300
commit364e8a98ad25127f2a51696ec03729e3a783044f (patch)
tree1ac46553d1dca1259da539eddc7db100eaf5c137 /lib
parent2024-05-05 (diff)
2024-05-25
Diffstat (limited to '')
-rw-r--r--lib/default.nix19
-rw-r--r--lib/my.nix11
2 files changed, 17 insertions, 13 deletions
diff --git a/lib/default.nix b/lib/default.nix
index cd4b601..a6a25c9 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -33,20 +33,13 @@ lib: _: with lib; rec {
       builtins.readDir
       (mapAttrsToList (
         name: type:
+        let
+          modulePath = dir + "/${name}";
+        in
         if type == "regular" && hasSuffix ".nix" name && name != "default.nix" then
-          [
-            {
-              name = removeSuffix ".nix" name;
-              value = dir + "/${name}";
-            }
-          ]
-        else if type == "directory" && pathExists (dir + "/${name}/default.nix") then
-          [
-            {
-              inherit name;
-              value = dir + "/${name}";
-            }
-          ]
+          [ (nameValuePair (removeSuffix ".nix" name) modulePath) ]
+        else if type == "directory" && pathExists (modulePath + "/default.nix") then
+          [ (nameValuePair name modulePath) ]
         else
           [ ]
       ))
diff --git a/lib/my.nix b/lib/my.nix
index 7d2d1de..8e9b3fc 100644
--- a/lib/my.nix
+++ b/lib/my.nix
@@ -30,6 +30,12 @@ with lib;
                       readOnly = true;
                     };
 
+                    stateVersion = mkOption {
+                      description = "Machine's Nixpkgs state version.";
+                      type = str;
+                      default = trivial.release;
+                    };
+
                     deviceIcon = mkOption {
                       description = "Device icon to be used with nix-topology.";
                       type = nullOr (either path str);
@@ -152,6 +158,7 @@ with lib;
         configurations = {
           # VPS in Germany.
           manwe = {
+            stateVersion = "24.05";
             deviceIcon = "devices.cloud-server";
             system = "x86_64-linux";
             isHeadless = true;
@@ -195,6 +202,7 @@ with lib;
 
           # VPS in Germany.
           varda = {
+            stateVersion = "24.05";
             deviceIcon = "devices.cloud-server";
             system = "x86_64-linux";
             isHeadless = true;
@@ -217,6 +225,7 @@ with lib;
 
           # VPS in France.
           yavanna = {
+            stateVersion = "24.05";
             deviceIcon = "devices.cloud-server";
             system = "x86_64-linux";
             isHeadless = true;
@@ -245,6 +254,7 @@ with lib;
 
           # A beefy desktop: 7950x/rx6750xt/128GB.
           eonwe = {
+            stateVersion = "24.05";
             deviceIcon = "devices.desktop";
             system = "x86_64-linux";
             isHeadful = true;
@@ -258,6 +268,7 @@ with lib;
 
           # ThinkPad T480.
           melian = {
+            stateVersion = "24.05";
             deviceIcon = "devices.laptop";
             system = "x86_64-linux";
             isHeadful = true;

Consider giving Nix/NixOS a try! <3