From dde75b40ebf8a1b7d672578463979215631823f9 Mon Sep 17 00:00:00 2001 From: mehbark Date: Wed, 22 Jul 2026 03:15:00 -0400 Subject: [PATCH] flake: add rev to `/etc/os-release` `VARIANT` will be the git SHA thing, suffixed by `-dirty` if it's dirty. This lets us (non-securely) identify what a host is actually running and whether it was built from a dirty commit (bad). `VARIANT` is the easiest `os-release` variable to stuff crap into without redoing the whole file. --- flake.nix | 3 +++ hosts/common/build-info.nix | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 hosts/common/build-info.nix diff --git a/flake.nix b/flake.nix index d7b35a1..f8c8c2a 100644 --- a/flake.nix +++ b/flake.nix @@ -28,6 +28,7 @@ modules = [ (import ./hosts/rowhammer/configuration.nix) agenix.nixosModules.default + (import ./hosts/common/build-info.nix { inherit self; }) ]; }; vesuvius = nixpkgs.lib.nixosSystem { @@ -35,6 +36,7 @@ modules = [ (import ./hosts/vesuvius/configuration.nix) agenix.nixosModules.default + (import ./hosts/common/build-info.nix { inherit self; }) ]; }; zerocool = nixpkgs.lib.nixosSystem { @@ -42,6 +44,7 @@ modules = [ (import ./hosts/zerocool/configuration.nix) agenix.nixosModules.default + (import ./hosts/common/build-info.nix { inherit self; }) ]; }; }; diff --git a/hosts/common/build-info.nix b/hosts/common/build-info.nix new file mode 100644 index 0000000..1c959f8 --- /dev/null +++ b/hosts/common/build-info.nix @@ -0,0 +1,5 @@ +{ self }: +{ ... }: +{ + system.nixos.variantName = if (self ? rev) then self.rev else self.dirtyRev; +}