Merge pull request #39416 from Ma27/fix-.version-config
.version: don't read from `.version` and deduplicate `.version-suffix` references
This commit is contained in:
commit
fd8dcdfa9d
@ -26,7 +26,3 @@ indent_size = 4
|
|||||||
# Match diffs, avoid to trim trailing whitespace
|
# Match diffs, avoid to trim trailing whitespace
|
||||||
[*.{diff,patch}]
|
[*.{diff,patch}]
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
# https://github.com/NixOS/nixpkgs/pull/39336#discussion_r183387754
|
|
||||||
[.version]
|
|
||||||
insert_final_newline = false
|
|
||||||
|
@ -64,7 +64,7 @@ manual-full.xml: ${MD_TARGETS} .version *.xml
|
|||||||
|
|
||||||
.version:
|
.version:
|
||||||
nix-instantiate --eval \
|
nix-instantiate --eval \
|
||||||
-E '(import ../lib).nixpkgsVersion' > .version
|
-E '(import ../lib).version' > .version
|
||||||
|
|
||||||
%.section.xml: %.section.md
|
%.section.xml: %.section.md
|
||||||
pandoc $^ -w docbook+smart \
|
pandoc $^ -w docbook+smart \
|
||||||
|
@ -30,7 +30,7 @@ pkgs.stdenv.mkDerivation {
|
|||||||
];
|
];
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
echo ${lib.nixpkgsVersion} > .version
|
echo ${lib.version} > .version
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
@ -58,7 +58,7 @@ let
|
|||||||
replaceStrings seq stringLength sub substring tail;
|
replaceStrings seq stringLength sub substring tail;
|
||||||
inherit (trivial) id const concat or and boolToString mergeAttrs
|
inherit (trivial) id const concat or and boolToString mergeAttrs
|
||||||
flip mapNullable inNixShell min max importJSON warn info
|
flip mapNullable inNixShell min max importJSON warn info
|
||||||
nixpkgsVersion mod compare splitByAndCompare
|
nixpkgsVersion version mod compare splitByAndCompare
|
||||||
functionArgs setFunctionArgs isFunction;
|
functionArgs setFunctionArgs isFunction;
|
||||||
|
|
||||||
inherit (fixedPoints) fix fix' extends composeExtensions
|
inherit (fixedPoints) fix fix' extends composeExtensions
|
||||||
|
@ -58,11 +58,14 @@ rec {
|
|||||||
|
|
||||||
inherit (lib.strings) fileContents;
|
inherit (lib.strings) fileContents;
|
||||||
|
|
||||||
|
release = fileContents ../.version;
|
||||||
|
versionSuffix = let suffixFile = ../.version-suffix; in
|
||||||
|
if pathExists suffixFile then fileContents suffixFile else "pre-git";
|
||||||
|
|
||||||
# Return the Nixpkgs version number.
|
# Return the Nixpkgs version number.
|
||||||
nixpkgsVersion =
|
version = release + versionSuffix;
|
||||||
let suffixFile = ../.version-suffix; in
|
|
||||||
fileContents ../.version
|
nixpkgsVersion = builtins.trace "`lib.nixpkgsVersion` is deprecated, use `lib.version` instead!" version;
|
||||||
+ (if pathExists suffixFile then fileContents suffixFile else "pre-git");
|
|
||||||
|
|
||||||
# Whether we're being called by nix-shell.
|
# Whether we're being called by nix-shell.
|
||||||
inNixShell = builtins.getEnv "IN_NIX_SHELL" != "";
|
inNixShell = builtins.getEnv "IN_NIX_SHELL" != "";
|
||||||
|
@ -132,6 +132,11 @@ following incompatible changes:</para>
|
|||||||
<literal>lib.traceCallXml</literal> has been deprecated. Please complain
|
<literal>lib.traceCallXml</literal> has been deprecated. Please complain
|
||||||
if you use the function regularly.
|
if you use the function regularly.
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
The attribute <literal>lib.nixpkgsVersion</literal> has been deprecated in favor of
|
||||||
|
<literal>lib.version</literal>. Please refer to the discussion in
|
||||||
|
<link xlink:href="https://github.com/NixOS/nixpkgs/pull/39416#discussion_r183845745">NixOS/nixpkgs#39416</link> for further reference.
|
||||||
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
version=$(nix-instantiate --eval --strict '<nixpkgs>' -A lib.nixpkgsVersion | sed s/'"'//g)
|
version=$(nix-instantiate --eval --strict '<nixpkgs>' -A lib.version | sed s/'"'//g)
|
||||||
major=${version:0:5}
|
major=${version:0:5}
|
||||||
echo "NixOS version is $version ($major)"
|
echo "NixOS version is $version ($major)"
|
||||||
|
|
||||||
|
@ -5,8 +5,6 @@ with lib;
|
|||||||
let
|
let
|
||||||
cfg = config.system.nixos;
|
cfg = config.system.nixos;
|
||||||
|
|
||||||
releaseFile = "${toString pkgs.path}/.version";
|
|
||||||
suffixFile = "${toString pkgs.path}/.version-suffix";
|
|
||||||
revisionFile = "${toString pkgs.path}/.git-revision";
|
revisionFile = "${toString pkgs.path}/.git-revision";
|
||||||
gitRepo = "${toString pkgs.path}/.git";
|
gitRepo = "${toString pkgs.path}/.git";
|
||||||
gitCommitId = lib.substring 0 7 (commitIdFromGitRepo gitRepo);
|
gitCommitId = lib.substring 0 7 (commitIdFromGitRepo gitRepo);
|
||||||
@ -25,14 +23,14 @@ in
|
|||||||
nixos.release = mkOption {
|
nixos.release = mkOption {
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = fileContents releaseFile;
|
default = trivial.release;
|
||||||
description = "The NixOS release (e.g. <literal>16.03</literal>).";
|
description = "The NixOS release (e.g. <literal>16.03</literal>).";
|
||||||
};
|
};
|
||||||
|
|
||||||
nixos.versionSuffix = mkOption {
|
nixos.versionSuffix = mkOption {
|
||||||
internal = true;
|
internal = true;
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = if pathExists suffixFile then fileContents suffixFile else "pre-git";
|
default = trivial.versionSuffix;
|
||||||
description = "The NixOS version suffix (e.g. <literal>1160.f2d4ee1</literal>).";
|
description = "The NixOS version suffix (e.g. <literal>1160.f2d4ee1</literal>).";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
# this is what `osquery --help` will show as the version.
|
# this is what `osquery --help` will show as the version.
|
||||||
OSQUERY_BUILD_VERSION = version;
|
OSQUERY_BUILD_VERSION = version;
|
||||||
OSQUERY_PLATFORM = "nixos;${builtins.readFile "${toString path}/.version"}";
|
OSQUERY_PLATFORM = "nixos;${stdenv.lib.version}";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "facebook";
|
owner = "facebook";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user