2014-04-14 14:26:48 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2012-04-10 20:56:38 +00:00
|
|
|
|
2014-04-14 14:26:48 +00:00
|
|
|
with lib;
|
2012-04-10 20:56:38 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
options = {
|
2013-01-16 13:40:41 +00:00
|
|
|
|
2015-07-27 17:46:36 +00:00
|
|
|
system.stateVersion = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = config.system.nixosRelease;
|
|
|
|
description = ''
|
|
|
|
Every once in a while, a new NixOS release may change
|
|
|
|
configuration defaults in a way incompatible with stateful
|
|
|
|
data. For instance, if the default version of PostgreSQL
|
|
|
|
changes, the new version will probably be unable to read your
|
|
|
|
existing databases. To prevent such breakage, you can set the
|
|
|
|
value of this option to the NixOS release with which you want
|
|
|
|
to be compatible. The effect is that NixOS will option
|
|
|
|
defaults corresponding to the specified release (such as using
|
|
|
|
an older version of PostgreSQL).
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2012-04-10 20:56:38 +00:00
|
|
|
system.nixosVersion = mkOption {
|
2013-10-23 14:59:33 +00:00
|
|
|
internal = true;
|
2013-10-30 10:02:04 +00:00
|
|
|
type = types.str;
|
2012-04-10 20:56:38 +00:00
|
|
|
description = "NixOS version.";
|
|
|
|
};
|
2012-05-17 21:10:42 +00:00
|
|
|
|
2015-07-27 17:46:36 +00:00
|
|
|
system.nixosRelease = mkOption {
|
2015-07-30 11:36:57 +00:00
|
|
|
readOnly = true;
|
2015-07-27 17:46:36 +00:00
|
|
|
type = types.str;
|
|
|
|
default = readFile "${toString pkgs.path}/.version";
|
|
|
|
description = "NixOS release.";
|
|
|
|
};
|
|
|
|
|
2013-01-16 13:40:41 +00:00
|
|
|
system.nixosVersionSuffix = mkOption {
|
2013-10-23 14:59:33 +00:00
|
|
|
internal = true;
|
2013-10-30 10:02:04 +00:00
|
|
|
type = types.str;
|
2013-01-16 13:40:41 +00:00
|
|
|
description = "NixOS version suffix.";
|
|
|
|
};
|
|
|
|
|
2013-10-24 17:58:34 +00:00
|
|
|
system.nixosRevision = mkOption {
|
|
|
|
internal = true;
|
2013-10-30 10:02:04 +00:00
|
|
|
type = types.str;
|
2013-10-24 17:58:34 +00:00
|
|
|
description = "NixOS Git revision hash.";
|
|
|
|
};
|
|
|
|
|
2013-07-17 11:34:40 +00:00
|
|
|
system.nixosCodeName = mkOption {
|
2015-07-30 11:36:57 +00:00
|
|
|
readOnly = true;
|
2013-10-30 10:02:04 +00:00
|
|
|
type = types.str;
|
2013-07-17 11:34:40 +00:00
|
|
|
description = "NixOS release code name.";
|
|
|
|
};
|
|
|
|
|
2013-10-24 13:09:00 +00:00
|
|
|
system.defaultChannel = mkOption {
|
|
|
|
internal = true;
|
2013-10-30 10:02:04 +00:00
|
|
|
type = types.str;
|
2013-11-11 10:22:41 +00:00
|
|
|
default = https://nixos.org/channels/nixos-unstable;
|
2013-10-24 13:09:00 +00:00
|
|
|
description = "Default NixOS channel to which the root user is subscribed.";
|
|
|
|
};
|
|
|
|
|
2012-05-17 21:10:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
|
2015-07-27 17:46:36 +00:00
|
|
|
system.nixosVersion = mkDefault (config.system.nixosRelease + config.system.nixosVersionSuffix);
|
2013-01-16 13:40:41 +00:00
|
|
|
|
|
|
|
system.nixosVersionSuffix =
|
2013-10-16 21:05:42 +00:00
|
|
|
let suffixFile = "${toString pkgs.path}/.version-suffix"; in
|
2013-10-24 00:02:04 +00:00
|
|
|
mkDefault (if pathExists suffixFile then readFile suffixFile else "pre-git");
|
2013-01-16 13:40:41 +00:00
|
|
|
|
2013-10-24 17:58:34 +00:00
|
|
|
system.nixosRevision =
|
|
|
|
let fn = "${toString pkgs.path}/.git-revision"; in
|
|
|
|
mkDefault (if pathExists fn then readFile fn else "master");
|
|
|
|
|
2013-07-17 11:34:40 +00:00
|
|
|
# Note: code names must only increase in alphabetical order.
|
2015-09-03 09:39:39 +00:00
|
|
|
system.nixosCodeName = "Emu";
|
2013-07-17 11:34:40 +00:00
|
|
|
|
2012-05-17 21:10:42 +00:00
|
|
|
# Generate /etc/os-release. See
|
|
|
|
# http://0pointer.de/public/systemd-man/os-release.html for the
|
|
|
|
# format.
|
2013-10-31 22:01:07 +00: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 13:40:41 +00:00
|
|
|
|
2012-04-10 20:56:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|