Manual: When building from the channel, link to the exact Git revision

This commit is contained in:
Eelco Dolstra 2013-10-24 02:02:04 +02:00
parent c4149c7b56
commit d49f141a79
6 changed files with 11 additions and 17 deletions

View file

@ -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.

View file

@ -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

View file

@ -1,6 +1,5 @@
{ pkgs, options
# revision can have multiple values: local, HEAD or any revision number.
, revision ? "HEAD"
, revision ? "master"
}:
with pkgs.lib;

View file

@ -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";

View file

@ -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
<literal>"local"</literal>, <literal>"HEAD"</literal> or any
revision number embedded in a string.
'';
};
};

View file

@ -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