diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2018-04-26 10:31:05 +0200 |
---|---|---|
committer | Maximilian Bosch <maximilian@mbosch.me> | 2018-04-28 14:23:53 +0200 |
commit | 9274ea390348e17f766732e7fbd335e3bc164954 (patch) | |
tree | ea75418843caff7129e5b9b87434e59f9cac0ef1 | |
parent | 39909289f452fcd60127cbd2372f22ac35f25d08 (diff) | |
download | nixpkgs-9274ea390348e17f766732e7fbd335e3bc164954.tar nixpkgs-9274ea390348e17f766732e7fbd335e3bc164954.tar.gz nixpkgs-9274ea390348e17f766732e7fbd335e3bc164954.tar.bz2 nixpkgs-9274ea390348e17f766732e7fbd335e3bc164954.tar.lz nixpkgs-9274ea390348e17f766732e7fbd335e3bc164954.tar.xz nixpkgs-9274ea390348e17f766732e7fbd335e3bc164954.tar.zst nixpkgs-9274ea390348e17f766732e7fbd335e3bc164954.zip |
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`.
-rw-r--r-- | doc/Makefile | 2 | ||||
-rw-r--r-- | doc/default.nix | 2 | ||||
-rw-r--r-- | lib/default.nix | 2 | ||||
-rw-r--r-- | lib/trivial.nix | 8 | ||||
-rw-r--r-- | nixos/doc/manual/release-notes/rl-1809.xml | 5 | ||||
-rwxr-xr-x | nixos/maintainers/scripts/ec2/create-amis.sh | 2 | ||||
-rw-r--r-- | nixos/modules/misc/version.nix | 4 | ||||
-rw-r--r-- | pkgs/tools/system/osquery/default.nix | 2 |
8 files changed, 17 insertions, 10 deletions
diff --git a/doc/Makefile b/doc/Makefile index 0ddae8631f3..952ef4bfcbb 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -64,7 +64,7 @@ manual-full.xml: ${MD_TARGETS} .version *.xml .version: nix-instantiate --eval \ - -E '(import ../lib).nixpkgsVersion' > .version + -E '(import ../lib).version' > .version %.section.xml: %.section.md pandoc $^ -w docbook+smart \ diff --git a/doc/default.nix b/doc/default.nix index 8abde58bb11..e5be364506f 100644 --- a/doc/default.nix +++ b/doc/default.nix @@ -30,7 +30,7 @@ pkgs.stdenv.mkDerivation { ]; postPatch = '' - echo ${lib.nixpkgsVersion} > .version + echo ${lib.version} > .version ''; installPhase = '' diff --git a/lib/default.nix b/lib/default.nix index b3c4fdc0e59..60ce01a93cd 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -58,7 +58,7 @@ let replaceStrings seq stringLength sub substring tail; inherit (trivial) id const concat or and boolToString mergeAttrs flip mapNullable inNixShell min max importJSON warn info - nixpkgsVersion mod compare splitByAndCompare + nixpkgsVersion version mod compare splitByAndCompare functionArgs setFunctionArgs isFunction; inherit (fixedPoints) fix fix' extends composeExtensions diff --git a/lib/trivial.nix b/lib/trivial.nix index a6a4abba118..251cb796db0 100644 --- a/lib/trivial.nix +++ b/lib/trivial.nix @@ -58,12 +58,14 @@ rec { inherit (lib.strings) fileContents; - version = fileContents ../.version; - suffix = let suffixFile = ../.version-suffix; in + release = fileContents ../.version; + versionSuffix = let suffixFile = ../.version-suffix; in if pathExists suffixFile then fileContents suffixFile else "pre-git"; # Return the Nixpkgs version number. - nixpkgsVersion = version + suffix; + version = release + versionSuffix; + + nixpkgsVersion = builtins.trace "`lib.nixpkgsVersion` is deprecated, use `lib.version` instead!" version; # Whether we're being called by nix-shell. inNixShell = builtins.getEnv "IN_NIX_SHELL" != ""; diff --git a/nixos/doc/manual/release-notes/rl-1809.xml b/nixos/doc/manual/release-notes/rl-1809.xml index 2e53f0563ba..949dbf0e0c1 100644 --- a/nixos/doc/manual/release-notes/rl-1809.xml +++ b/nixos/doc/manual/release-notes/rl-1809.xml @@ -123,6 +123,11 @@ following incompatible changes:</para> <literal>lib.traceCallXml</literal> has been deprecated. Please complain if you use the function regularly. </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> </itemizedlist> diff --git a/nixos/maintainers/scripts/ec2/create-amis.sh b/nixos/maintainers/scripts/ec2/create-amis.sh index 347e6b9c6e0..9461144fad5 100755 --- a/nixos/maintainers/scripts/ec2/create-amis.sh +++ b/nixos/maintainers/scripts/ec2/create-amis.sh @@ -6,7 +6,7 @@ set -e 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} echo "NixOS version is $version ($major)" diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix index d9d60b72509..74c86443ab9 100644 --- a/nixos/modules/misc/version.nix +++ b/nixos/modules/misc/version.nix @@ -23,14 +23,14 @@ in nixos.release = mkOption { readOnly = true; type = types.str; - default = trivial.version; + default = trivial.release; description = "The NixOS release (e.g. <literal>16.03</literal>)."; }; nixos.versionSuffix = mkOption { internal = true; type = types.str; - default = trivial.suffix; + default = trivial.versionSuffix; description = "The NixOS version suffix (e.g. <literal>1160.f2d4ee1</literal>)."; }; diff --git a/pkgs/tools/system/osquery/default.nix b/pkgs/tools/system/osquery/default.nix index b88186a610b..a0aaa846bc7 100644 --- a/pkgs/tools/system/osquery/default.nix +++ b/pkgs/tools/system/osquery/default.nix @@ -24,7 +24,7 @@ stdenv.mkDerivation rec { # this is what `osquery --help` will show as the version. OSQUERY_BUILD_VERSION = version; - OSQUERY_PLATFORM = "nixos;${stdenv.lib.nixpkgsVersion}"; + OSQUERY_PLATFORM = "nixos;${stdenv.lib.version}"; src = fetchFromGitHub { owner = "facebook"; |