Merge pull request #11291 from obsidiansystems/coarse-version

Coarse versions for constituent packages
This commit is contained in:
John Ericson 2024-08-14 12:18:11 -05:00 committed by GitHub
commit 982adb151a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 47 additions and 22 deletions

View file

@ -26,12 +26,6 @@
officialRelease = false;
version = lib.fileContents ./.version + versionSuffix;
versionSuffix =
if officialRelease
then ""
else "pre${builtins.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101")}_${self.shortRev or "dirty"}";
linux32BitSystems = [ "i686-linux" ];
linux64BitSystems = [ "x86_64-linux" "aarch64-linux" ];
linuxSystems = linux32BitSystems ++ linux64BitSystems;
@ -130,12 +124,16 @@
# without "polluting" the top level "`pkgs`" attrset.
# This also has the benefit of providing us with a distinct set of packages
# we can iterate over.
nixComponents = lib.makeScope final.nixDependencies.newScope (import ./packaging/components.nix);
nixComponents = lib.makeScope final.nixDependencies.newScope (import ./packaging/components.nix {
inherit (final) lib;
inherit officialRelease;
src = self;
});
# The dependencies are in their own scope, so that they don't have to be
# in Nixpkgs top level `pkgs` or `nixComponents`.
nixDependencies = lib.makeScope final.newScope (import ./packaging/dependencies.nix {
inherit inputs stdenv versionSuffix;
inherit inputs stdenv;
pkgs = final;
});
@ -170,6 +168,7 @@
linux64BitSystems
nixpkgsFor
self
officialRelease
;
};
@ -253,10 +252,10 @@
dockerImage =
let
pkgs = nixpkgsFor.${system}.native;
image = import ./docker.nix { inherit pkgs; tag = version; };
image = import ./docker.nix { inherit pkgs; tag = pkgs.nix.version; };
in
pkgs.runCommand
"docker-image-tarball-${version}"
"docker-image-tarball-${pkgs.nix.version}"
{ meta.description = "Docker image with Nix for ${system}"; }
''
mkdir -p $out/nix-support

View file

@ -47,7 +47,8 @@
, pname ? "nix"
, versionSuffix ? ""
, version
, versionSuffix
# Whether to build Nix. Useful to skip for tasks like testing existing pre-built versions of Nix
, doBuild ? true
@ -112,8 +113,6 @@
let
inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
# selected attributes with defaults, will be used to define some
# things which should instead be gotten via `finalAttrs` in order to
# work with overriding.

View file

@ -1,11 +1,34 @@
{
lib,
src,
officialRelease,
}:
scope:
let
inherit (scope) callPackage;
baseVersion = lib.fileContents ../.version;
versionSuffix = lib.optionalString (!officialRelease) "pre";
fineVersionSuffix = lib.optionalString
(!officialRelease)
"pre${builtins.substring 0 8 (src.lastModifiedDate or src.lastModified or "19700101")}_${src.shortRev or "dirty"}";
fineVersion = baseVersion + fineVersionSuffix;
in
# This becomes the pkgs.nixComponents attribute set
{
nix = callPackage ../package.nix { };
version = baseVersion + versionSuffix;
inherit versionSuffix;
nix = callPackage ../package.nix {
version = fineVersion;
versionSuffix = fineVersionSuffix;
};
nix-util = callPackage ../src/libutil/package.nix { };
nix-util-c = callPackage ../src/libutil-c/package.nix { };
@ -34,10 +57,10 @@ in
nix-cmd = callPackage ../src/libcmd/package.nix { };
# Will replace `nix` once the old build system is gone.
nix-ng = callPackage ../src/nix/package.nix { };
nix-ng = callPackage ../src/nix/package.nix { version = fineVersion; };
nix-internal-api-docs = callPackage ../src/internal-api-docs/package.nix { };
nix-external-api-docs = callPackage ../src/external-api-docs/package.nix { };
nix-internal-api-docs = callPackage ../src/internal-api-docs/package.nix { version = fineVersion; };
nix-external-api-docs = callPackage ../src/external-api-docs/package.nix { version = fineVersion; };
nix-perl-bindings = callPackage ../src/perl/package.nix { };
}

View file

@ -8,7 +8,6 @@
pkgs,
stdenv,
versionSuffix,
}:
let
@ -73,11 +72,9 @@ let
strictDeps = prevAttrs.strictDeps or true;
enableParallelBuilding = true;
};
in
scope: {
inherit stdenv versionSuffix;
version = lib.fileContents ../.version + versionSuffix;
inherit stdenv;
aws-sdk-cpp = (pkgs.aws-sdk-cpp.override {
apis = [ "s3" "transfer" ];

View file

@ -6,6 +6,7 @@
, linux64BitSystems
, nixpkgsFor
, self
, officialRelease
}:
let
inherit (inputs) nixpkgs nixpkgs-regression;
@ -16,7 +17,7 @@ let
};
testNixVersions = pkgs: client: daemon:
pkgs.callPackage ../package.nix {
pkgs.nixComponents.callPackage ../package.nix {
pname =
"nix-tests"
+ lib.optionalString
@ -28,6 +29,12 @@ let
test-daemon = daemon;
doBuild = false;
# This could be more accurate, but a shorter version will match the
# fine version with rev. This functionality is already covered in
# the normal test, so it's fine.
version = pkgs.nixComponents.version;
versionSuffix = pkgs.nixComponents.versionSuffix;
};
# Technically we could just return `pkgs.nixComponents`, but for Hydra it's