git.iko.soy/typeable/nixpkgs
on master help sign in
treewide: rename version attributes

As suggested in https://github.com/NixOS/nixpkgs/pull/39416#discussion_r183845745 the versioning attributes in `lib` should be consistent to `nixos/version` which implicates the following changes: * `lib.trivial.version` -> `lib.trivial.release` * `lib.trivial.suffix` -> `lib.trivial.versionSuffix` * `lib.nixpkgsVersion` -> `lib.version` As `lib.nixpkgsVersion` is referenced several times in `NixOS/nixpkgs`, `NixOS/nix` and probably several user's setups. As the rename will cause a notable impact it's better to keep `lib.nixpkgsVersion` as alias with a warning yielded by `builtins.trace`.

commit9274ea390348e17f766732e7fbd335e3bc164954 authorMaximilian Bosch <maximilian@mbosch.me> dateThu 26 Apr 2018, 10:31 (9 years ago) parent3990928
8 files changed+17−10
doc/Makefile+1−1 doc/default.nix+1−1 lib/default.nix+1−1 lib/trivial.nix+5−3 nixos/doc/manual/release-notes/rl-1809.xml+5 nixos/maintainers/scripts/ec2/create-amis.sh+1−1 nixos/modules/misc/version.nix+2−2 pkgs/tools/system/osquery/default.nix+1−1
doc/Makefile+1−1
@@ -64,7 +64,7 @@ manual-full.xml: ${MD_TARGETS} .version *.xml
6464
6565.version:
6666 nix-instantiate --eval \
67− -E '(import ../lib).nixpkgsVersion' > .version
67+ -E '(import ../lib).version' > .version
6868
6969%.section.xml: %.section.md
7070 pandoc $^ -w docbook+smart \
doc/default.nix+1−1
@@ -30,7 +30,7 @@ pkgs.stdenv.mkDerivation {
3030 ];
3131
3232 postPatch = ''
33− echo ${lib.nixpkgsVersion} > .version
33+ echo ${lib.version} > .version
3434 '';
3535
3636 installPhase = ''
lib/default.nix+1−1
@@ -58,7 +58,7 @@ let
5858 replaceStrings seq stringLength sub substring tail;
5959 inherit (trivial) id const concat or and boolToString mergeAttrs
6060 flip mapNullable inNixShell min max importJSON warn info
61− nixpkgsVersion mod compare splitByAndCompare
61+ nixpkgsVersion version mod compare splitByAndCompare
6262 functionArgs setFunctionArgs isFunction;
6363
6464 inherit (fixedPoints) fix fix' extends composeExtensions
lib/trivial.nix+5−3
@@ -58,12 +58,14 @@ rec {
5858
5959 inherit (lib.strings) fileContents;
6060
61− version = fileContents ../.version;
62− suffix = let suffixFile = ../.version-suffix; in
61+ release = fileContents ../.version;
62+ versionSuffix = let suffixFile = ../.version-suffix; in
6363 if pathExists suffixFile then fileContents suffixFile else "pre-git";
6464
6565 # Return the Nixpkgs version number.
66− nixpkgsVersion = version + suffix;
66+ version = release + versionSuffix;
67+
68+ nixpkgsVersion = builtins.trace "`lib.nixpkgsVersion` is deprecated, use `lib.version` instead!" version;
6769
6870 # Whether we're being called by nix-shell.
6971 inNixShell = builtins.getEnv "IN_NIX_SHELL" != "";
nixos/doc/manual/release-notes/rl-1809.xml+5
@@ -123,6 +123,11 @@ following incompatible changes:</para>
123123 <literal>lib.traceCallXml</literal> has been deprecated. Please complain
124124 if you use the function regularly.
125125 </para>
126+ <para>
127+ The attribute <literal>lib.nixpkgsVersion</literal> has been deprecated in favor of
128+ <literal>lib.version</literal>. Please refer to the discussion in
129+ <link xlink:href="https://github.com/NixOS/nixpkgs/pull/39416#discussion_r183845745">NixOS/nixpkgs#39416</link> for further reference.
130+ </para>
126131 </listitem>
127132</itemizedlist>
128133
nixos/maintainers/scripts/ec2/create-amis.sh+1−1
@@ -6,7 +6,7 @@
66set -e
77set -o pipefail
88
9−version=$(nix-instantiate --eval --strict '<nixpkgs>' -A lib.nixpkgsVersion | sed s/'"'//g)
9+version=$(nix-instantiate --eval --strict '<nixpkgs>' -A lib.version | sed s/'"'//g)
1010major=${version:0:5}
1111echo "NixOS version is $version ($major)"
1212
nixos/modules/misc/version.nix+2−2
@@ -23,14 +23,14 @@ in
2323 nixos.release = mkOption {
2424 readOnly = true;
2525 type = types.str;
26− default = trivial.version;
26+ default = trivial.release;
2727 description = "The NixOS release (e.g. <literal>16.03</literal>).";
2828 };
2929
3030 nixos.versionSuffix = mkOption {
3131 internal = true;
3232 type = types.str;
33− default = trivial.suffix;
33+ default = trivial.versionSuffix;
3434 description = "The NixOS version suffix (e.g. <literal>1160.f2d4ee1</literal>).";
3535 };
3636
pkgs/tools/system/osquery/default.nix+1−1
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
2424
2525 # this is what `osquery --help` will show as the version.
2626 OSQUERY_BUILD_VERSION = version;
27− OSQUERY_PLATFORM = "nixos;${stdenv.lib.nixpkgsVersion}";
27+ OSQUERY_PLATFORM = "nixos;${stdenv.lib.version}";
2828
2929 src = fetchFromGitHub {
3030 owner = "facebook";