From 2577a17468eac7194dccb11a7e0348f5786f25e3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 17 May 2012 21:10:42 +0000 Subject: [PATCH] * Add /etc/os-release to be Lennart Poettering compliant. See http://0pointer.de/blog/projects/os-release.html svn path=/nixos/trunk/; revision=34162 --- modules/misc/version.nix | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/modules/misc/version.nix b/modules/misc/version.nix index 32e2e1b1dc0..95030fbd03d 100644 --- a/modules/misc/version.nix +++ b/modules/misc/version.nix @@ -12,7 +12,27 @@ with pkgs.lib; + (if builtins.pathExists ../../.version-suffix then builtins.readFile ../../.version-suffix else "pre-svn"); description = "NixOS version."; }; - + + }; + + config = { + + # Generate /etc/os-release. See + # http://0pointer.de/public/systemd-man/os-release.html for the + # format. + environment.etc = singleton + { source = pkgs.writeText "os-release" + '' + NAME=NixOS + ID=nixos + VERSION="${config.system.nixosVersion}" + VERSION_ID="${config.system.nixosVersion}" + PRETTY_NAME="NixOS ${config.system.nixosVersion}" + HOME_URL="http://nixos.org/" + ''; + target = "os-release"; + }; + }; }