2014-04-14 16:26:48 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2012-04-10 22:56:38 +02:00
|
|
|
|
2014-04-14 16:26:48 +02:00
|
|
|
with lib;
|
2012-04-10 22:56:38 +02:00
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
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-10-30 11:02:04 +01:00
|
|
|
type = types.str;
|
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-10-30 11:02:04 +01:00
|
|
|
type = types.str;
|
2013-01-16 14:40:41 +01:00
|
|
|
description = "NixOS version suffix.";
|
|
|
|
};
|
|
|
|
|
2013-10-24 19:58:34 +02:00
|
|
|
system.nixosRevision = mkOption {
|
|
|
|
internal = true;
|
2013-10-30 11:02:04 +01:00
|
|
|
type = types.str;
|
2013-10-24 19:58:34 +02:00
|
|
|
description = "NixOS Git revision hash.";
|
|
|
|
};
|
|
|
|
|
2013-07-17 13:34:40 +02:00
|
|
|
system.nixosCodeName = mkOption {
|
2013-10-23 16:59:33 +02:00
|
|
|
internal = true;
|
2013-10-30 11:02:04 +01:00
|
|
|
type = types.str;
|
2013-07-17 13:34:40 +02:00
|
|
|
description = "NixOS release code name.";
|
|
|
|
};
|
|
|
|
|
2013-10-24 15:09:00 +02:00
|
|
|
system.defaultChannel = mkOption {
|
|
|
|
internal = true;
|
2013-10-30 11:02:04 +01:00
|
|
|
type = types.str;
|
2013-11-11 11:22:41 +01:00
|
|
|
default = https://nixos.org/channels/nixos-unstable;
|
2013-10-24 15:09:00 +02:00
|
|
|
description = "Default NixOS channel to which the root user is subscribed.";
|
|
|
|
};
|
|
|
|
|
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-10-24 19:58:34 +02:00
|
|
|
system.nixosRevision =
|
|
|
|
let fn = "${toString pkgs.path}/.git-revision"; in
|
|
|
|
mkDefault (if pathExists fn then readFile fn else "master");
|
|
|
|
|
2013-07-17 13:34:40 +02:00
|
|
|
# Note: code names must only increase in alphabetical order.
|
2014-12-17 16:42:52 +01:00
|
|
|
system.nixosCodeName = "Dingo";
|
2013-07-17 13:34:40 +02:00
|
|
|
|
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.
|
2013-10-31 23:01:07 +01:00
|
|
|
environment.etc."os-release".text =
|
|
|
|
''
|
|
|
|
NAME=NixOS
|
|
|
|
ID=nixos
|
|
|
|
VERSION="${config.system.nixosVersion} (${config.system.nixosCodeName})"
|
|
|
|
VERSION_ID="${config.system.nixosVersion}"
|
|
|
|
PRETTY_NAME="NixOS ${config.system.nixosVersion} (${config.system.nixosCodeName})"
|
|
|
|
HOME_URL="http://nixos.org/"
|
|
|
|
'';
|
2013-01-16 14:40:41 +01:00
|
|
|
|
2012-04-10 22:56:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|