ctucx.git: nixfiles

ctucx' nixfiles

commit 0e5b8f01953ca3da26c1d9c077c89a0d7b0f62ef
parent 085d3983baa70010344c0d016e709e64a1e5c708
Author: Leah (ctucx) <git@ctu.cx>
Date: Tue, 13 Jun 2023 19:56:25 +0200

flake.nix: set nixos.versionSuffix and nixos.revision
1 file changed, 7 insertions(+), 2 deletions(-)
M
flake.nix
|
9
+++++++--
diff --git a/flake.nix b/flake.nix
@@ -2,7 +2,7 @@
 
   description = "A flake for building my infra";
 
-  outputs = inputs: rec {
+  outputs = { self, ... } @ inputs: rec {
 
     darwinConfigurations = {
       blechkasten = inputs.darwin.lib.darwinSystem rec {

@@ -45,7 +45,12 @@
         };
       };
 
-      defaults     = import ./configurations/common;
+      defaults = { lib, ... }: {
+        imports = [ ./configurations/common ];
+
+        system.nixos.versionSuffix = ".${lib.substring 0 8 (inputs.nixpkgs.sourceInfo.lastModifiedDate or inputs.nixpkgs.sourceInfo.lastModified or "19700101")}.${inputs.nixpkgs.sourceInfo.shortRev or "dirty"}";
+        system.nixos.revision       = lib.mkIf (inputs.nixpkgs.sourceInfo ? rev) inputs.nixpkgs.sourceInfo.rev;
+      };
 
       briefkasten      = import ./machines/briefkasten/configuration.nix;