2012-04-11 00:56:38 +04:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
options = {
|
2013-01-16 17:40:41 +04:00
|
|
|
|
2012-04-11 00:56:38 +04:00
|
|
|
system.nixosVersion = mkOption {
|
|
|
|
description = "NixOS version.";
|
|
|
|
};
|
2012-05-18 01:10:42 +04:00
|
|
|
|
2013-01-16 17:40:41 +04:00
|
|
|
system.nixosVersionSuffix = mkOption {
|
|
|
|
description = "NixOS version suffix.";
|
|
|
|
};
|
|
|
|
|
2012-05-18 01:10:42 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
|
2013-01-16 17:40:41 +04:00
|
|
|
system.nixosVersion =
|
|
|
|
builtins.readFile ../../.version + config.system.nixosVersionSuffix;
|
|
|
|
|
|
|
|
system.nixosVersionSuffix =
|
|
|
|
if builtins.pathExists ../../.version-suffix then builtins.readFile ../../.version-suffix else "pre-git";
|
|
|
|
|
2012-05-18 01:10:42 +04:00
|
|
|
# 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";
|
|
|
|
};
|
2013-01-16 17:40:41 +04:00
|
|
|
|
2012-04-11 00:56:38 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|