stockholm/krebs/3modules/os-release.nix

33 lines
1008 B
Nix
Raw Normal View History

2016-03-05 11:40:20 +00:00
{ config, ... }:
2016-10-20 18:54:38 +00:00
with import <stockholm/lib>;
2016-03-05 11:40:20 +00:00
let
nixos-version-id = "${config.system.nixosVersion}";
nixos-version = "${nixos-version-id} (${config.system.nixosCodeName})";
nixos-pretty-name = "NixOS ${nixos-version}";
2018-02-28 13:47:12 +00:00
stockholm-version-id = let
eval = tryEval (removeSuffix "\n" (readFile <stockholm-version>));
in
if eval.success then eval.value else "unknown";
2016-03-05 11:40:20 +00:00
stockholm-version = "${stockholm-version-id}";
stockholm-pretty-name = "stockholm ${stockholm-version}";
version = "${stockholm-version}/${nixos-version}";
version-id = "${stockholm-version-id}/${nixos-version-id}";
pretty-name = "${stockholm-pretty-name} / ${nixos-pretty-name}";
2016-11-10 22:15:33 +00:00
home-url = http://cgit.ni.krebsco.de/stockholm;
2016-03-05 11:40:20 +00:00
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}"
'';
}