Set the NixOS version to something useful when building from Git
This commit is contained in:
parent
ea358b4eae
commit
b35fe01f02
@ -140,6 +140,16 @@ if [ -n "$buildNix" ]; then
|
||||
fi
|
||||
|
||||
|
||||
# Update the version suffix if we're building from Git (so that
|
||||
# nixos-version shows something useful).
|
||||
if nixos=$(nix-instantiate --find-file nixos "${extraBuildFlags[@]}"); then
|
||||
suffix=$($SHELL $nixos/modules/installer/tools/get-version-suffix "${extraBuildFlags[@]}")
|
||||
if [ -n "$suffix" ]; then
|
||||
echo -n "$suffix" > "$nixos/.version-suffix"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Either upgrade the configuration in the system profile (for "switch"
|
||||
# or "boot"), or just build it and create a symlink "result" in the
|
||||
# current directory (for "build" and "test").
|
||||
|
@ -5,18 +5,25 @@ with pkgs.lib;
|
||||
{
|
||||
|
||||
options = {
|
||||
|
||||
|
||||
system.nixosVersion = mkOption {
|
||||
default =
|
||||
builtins.readFile ../../.version
|
||||
+ (if builtins.pathExists ../../.version-suffix then builtins.readFile ../../.version-suffix else "pre-git");
|
||||
description = "NixOS version.";
|
||||
};
|
||||
|
||||
system.nixosVersionSuffix = mkOption {
|
||||
description = "NixOS version suffix.";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = {
|
||||
|
||||
system.nixosVersion =
|
||||
builtins.readFile ../../.version + config.system.nixosVersionSuffix;
|
||||
|
||||
system.nixosVersionSuffix =
|
||||
if builtins.pathExists ../../.version-suffix then builtins.readFile ../../.version-suffix else "pre-git";
|
||||
|
||||
# Generate /etc/os-release. See
|
||||
# http://0pointer.de/public/systemd-man/os-release.html for the
|
||||
# format.
|
||||
@ -32,7 +39,7 @@ with pkgs.lib;
|
||||
'';
|
||||
target = "os-release";
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ let
|
||||
let
|
||||
|
||||
versionModule =
|
||||
{ system.nixosVersion = version + (lib.optionalString (!officialRelease) versionSuffix);
|
||||
{ system.nixosVersionSuffix = lib.optionalString (!officialRelease) versionSuffix;
|
||||
isoImage.isoBaseName = "nixos-${type}";
|
||||
};
|
||||
|
||||
@ -55,7 +55,7 @@ let
|
||||
|
||||
with import <nixpkgs> {inherit system;};
|
||||
let
|
||||
versionModule = { system.nixosVersion = version + (lib.optionalString (!officialRelease) versionSuffix); };
|
||||
versionModule = { system.nixosVersionSuffix = lib.optionalString (!officialRelease) versionSuffix; };
|
||||
|
||||
config = (import lib/eval-config.nix {
|
||||
inherit system;
|
||||
|
Loading…
Reference in New Issue
Block a user