2012-04-10 22:56:38 +02:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
options = {
|
2013-01-16 14:40:41 +01:00
|
|
|
|
2012-04-10 22:56:38 +02:00
|
|
|
system.nixosVersion = mkOption {
|
2013-10-23 16:59:33 +02:00
|
|
|
internal = true;
|
2013-01-16 15:03:54 +01:00
|
|
|
type = types.uniq types.string;
|
2012-04-10 22:56:38 +02:00
|
|
|
description = "NixOS version.";
|
|
|
|
};
|
2012-05-17 23:10:42 +02:00
|
|
|
|
2013-01-16 14:40:41 +01:00
|
|
|
system.nixosVersionSuffix = mkOption {
|
2013-10-23 16:59:33 +02:00
|
|
|
internal = true;
|
2013-01-16 15:03:54 +01:00
|
|
|
type = types.uniq types.string;
|
2013-01-16 14:40:41 +01:00
|
|
|
description = "NixOS version suffix.";
|
|
|
|
};
|
|
|
|
|
2013-07-17 13:34:40 +02:00
|
|
|
system.nixosCodeName = mkOption {
|
2013-10-23 16:59:33 +02:00
|
|
|
internal = true;
|
2013-07-17 13:34:40 +02:00
|
|
|
type = types.uniq types.string;
|
|
|
|
description = "NixOS release code name.";
|
|
|
|
};
|
|
|
|
|
2012-05-17 23:10:42 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
|
2013-01-16 14:40:41 +01:00
|
|
|
system.nixosVersion =
|
2013-10-24 02:02:04 +02:00
|
|
|
mkDefault (readFile "${toString pkgs.path}/.version" + config.system.nixosVersionSuffix);
|
2013-01-16 14:40:41 +01:00
|
|
|
|
|
|
|
system.nixosVersionSuffix =
|
2013-10-16 23:05:42 +02:00
|
|
|
let suffixFile = "${toString pkgs.path}/.version-suffix"; in
|
2013-10-24 02:02:04 +02:00
|
|
|
mkDefault (if pathExists suffixFile then readFile suffixFile else "pre-git");
|
2013-01-16 14:40:41 +01:00
|
|
|
|
2013-07-17 13:34:40 +02:00
|
|
|
# Note: code names must only increase in alphabetical order.
|
|
|
|
system.nixosCodeName = "Aardvark";
|
|
|
|
|
2012-05-17 23:10:42 +02: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
|
2013-07-17 13:34:40 +02:00
|
|
|
VERSION="${config.system.nixosVersion} (${config.system.nixosCodeName})"
|
2012-05-17 23:10:42 +02:00
|
|
|
VERSION_ID="${config.system.nixosVersion}"
|
2013-07-17 13:34:40 +02:00
|
|
|
PRETTY_NAME="NixOS ${config.system.nixosVersion} (${config.system.nixosCodeName})"
|
2012-05-17 23:10:42 +02:00
|
|
|
HOME_URL="http://nixos.org/"
|
|
|
|
'';
|
|
|
|
target = "os-release";
|
|
|
|
};
|
2013-01-16 14:40:41 +01:00
|
|
|
|
2012-04-10 22:56:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|