diff --git a/lib/default.nix b/lib/default.nix
index dea82ee077e..033269e6b60 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -22,6 +22,8 @@ let
in
{ inherit trivial lists strings stringsWithDeps attrsets sources options
properties modules types meta debug maintainers licenses platforms systems;
+ # Pull in some builtins not included elsewhere.
+ inherit (builtins) pathExists readFile;
}
# !!! don't include everything at top-level; perhaps only the most
# commonly used functions.
diff --git a/lib/lists.nix b/lib/lists.nix
index 578686ae366..262a529b2b6 100644
--- a/lib/lists.nix
+++ b/lib/lists.nix
@@ -1,14 +1,14 @@
# General list operations.
let
+
inherit (import ./trivial.nix) deepSeq;
inc = builtins.add 1;
dec = n: builtins.sub n 1;
- inherit (builtins) elemAt;
in rec {
- inherit (builtins) head tail length isList add sub lessThan;
+ inherit (builtins) head tail length isList add sub lessThan elemAt;
# Create a list consisting of a single element. `singleton x' is
diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix
index a46ec06dac0..3e075529be8 100644
--- a/nixos/doc/manual/default.nix
+++ b/nixos/doc/manual/default.nix
@@ -1,6 +1,5 @@
{ pkgs, options
-# revision can have multiple values: local, HEAD or any revision number.
-, revision ? "HEAD"
+, revision ? "master"
}:
with pkgs.lib;
diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix
index 14437228c74..489fcaeb989 100644
--- a/nixos/modules/misc/version.nix
+++ b/nixos/modules/misc/version.nix
@@ -29,11 +29,11 @@ with pkgs.lib;
config = {
system.nixosVersion =
- mkDefault (builtins.readFile "${toString pkgs.path}/.version" + config.system.nixosVersionSuffix);
+ mkDefault (readFile "${toString pkgs.path}/.version" + config.system.nixosVersionSuffix);
system.nixosVersionSuffix =
let suffixFile = "${toString pkgs.path}/.version-suffix"; in
- mkDefault (if builtins.pathExists suffixFile then builtins.readFile suffixFile else "pre-git");
+ mkDefault (if pathExists suffixFile then readFile suffixFile else "pre-git");
# Note: code names must only increase in alphabetical order.
system.nixosCodeName = "Aardvark";
diff --git a/nixos/modules/services/misc/nixos-manual.nix b/nixos/modules/services/misc/nixos-manual.nix
index 1260272b68e..c522868c1d9 100644
--- a/nixos/modules/services/misc/nixos-manual.nix
+++ b/nixos/modules/services/misc/nixos-manual.nix
@@ -12,8 +12,10 @@ let
cfg = config.services.nixosManual;
manual = import ../../../doc/manual {
- inherit (cfg) revision;
inherit pkgs;
+ revision =
+ let fn = "${toString pkgs.path}/.git-revision";
+ in if pathExists fn then readFile fn else "master";
options = (fixMergeModules baseModules
(removeAttrs extraArgs ["config" "options"]) // {
modules = [ ];
@@ -75,16 +77,6 @@ in
'';
};
- services.nixosManual.revision = mkOption {
- default = "local";
- type = types.uniq types.string;
- description = ''
- Revision of the targeted source file. This value can either be
- "local", "HEAD" or any
- revision number embedded in a string.
- '';
- };
-
};
diff --git a/nixos/release.nix b/nixos/release.nix
index e19403eccb6..d6135a6e1e9 100644
--- a/nixos/release.nix
+++ b/nixos/release.nix
@@ -91,6 +91,7 @@ in {
distPhase = ''
rm -rf .git
echo -n $VERSION_SUFFIX > .version-suffix
+ echo -n ${nixpkgs.rev or nixpkgs.shortRev} > .git-revision
releaseName=nixos-$VERSION$VERSION_SUFFIX
mkdir -p $out/tarballs
mkdir ../$releaseName