summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2024-03-19 14:42:32 +0100
committertv <tv@krebsco.de>2024-03-19 14:42:32 +0100
commitc260c4a1de0a4c2a129b136932f4cb8ecb074c57 (patch)
tree7263d4704fdf26d154dfa03d4445e033bad50b7c
parentf64e3d14d2701eaa77190a626c142c21459edeb2 (diff)
os-release: add stockholm-version-id option
-rw-r--r--krebs/3modules/os-release.nix38
1 files changed, 22 insertions, 16 deletions
diff --git a/krebs/3modules/os-release.nix b/krebs/3modules/os-release.nix
index bfd352825..929ec45d9 100644
--- a/krebs/3modules/os-release.nix
+++ b/krebs/3modules/os-release.nix
@@ -8,28 +8,34 @@ let
nixos-version = "${nixos-version-id} (${nixos-codeName})";
nixos-pretty-name = "NixOS ${nixos-version}";
- stockholm-version-id = let
- eval = builtins.tryEval (removeSuffix "\n" (readFile <stockholm-version>));
- in
- if eval.success then eval.value else "unknown";
-
- stockholm-version = "${stockholm-version-id}";
+ stockholm-version = "${config.krebs.os-release.stockholm-version-id}";
stockholm-pretty-name = "stockholm ${stockholm-version}";
version = "${stockholm-version}/${nixos-version}";
- version-id = "${stockholm-version-id}/${nixos-version-id}";
+ version-id = "${config.krebs.os-release.stockholm-version-id}/${nixos-version-id}";
pretty-name = "${stockholm-pretty-name} / ${nixos-pretty-name}";
home-url = http://cgit.ni.krebsco.de/stockholm;
in
{
- # http://0pointer.de/public/systemd-man/os-release.html
- environment.etc."os-release".text = mkForce ''
- NAME="stockholm/NixOS"
- ID=stockholm
- VERSION="${version}"
- VERSION_ID="${version-id}"
- PRETTY_NAME="${pretty-name}"
- HOME_URL="${home-url}"
- '';
+ options.krebs.os-release = {
+ stockholm-version-id = lib.mkOption {
+ type = lib.types.str;
+ default = let
+ eval = builtins.tryEval (removeSuffix "\n" (readFile <stockholm-version>));
+ in
+ if eval.success then eval.value else "unknown";
+ };
+ };
+ config = {
+ # http://0pointer.de/public/systemd-man/os-release.html
+ environment.etc."os-release".text = mkForce ''
+ NAME="stockholm/NixOS"
+ ID=stockholm
+ VERSION="${version}"
+ VERSION_ID="${version-id}"
+ PRETTY_NAME="${pretty-name}"
+ HOME_URL="${home-url}"
+ '';
+ };
}