Skip to content

Commit

Permalink
Explicitly expose version to avoid release script failure
Browse files Browse the repository at this point in the history
lazyDerivation limits which attributes are exposed, and version is not currently one of them,
so we need to explicitly expose it.

This fixes this CD failure:

https://github.com/NixOS/nixpkgs-check-by-name/actions/runs/8637321506/job/23679230914
  • Loading branch information
infinisil committed Apr 10, 2024
1 parent 6d09601 commit 910e1c9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
15 changes: 10 additions & 5 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,18 @@ let
nix-store --init
'';

# Determine version from Cargo.toml
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version;

# The build with all internal derivation attributes exposed
buildUnredacted = pkgs.callPackage ./package.nix {
inherit nixpkgsLibPath initNix runtimeExprPath testNixpkgsPath version;
};

results = {
# We're using this value as the root result. By default, derivations expose all of their
# internal attributes, which is very messy. We prevent this using lib.lazyDerivation
build = lib.lazyDerivation {
derivation = pkgs.callPackage ./package.nix {
inherit nixpkgsLibPath initNix runtimeExprPath testNixpkgsPath;
};
};
build = lib.lazyDerivation { derivation = buildUnredacted; };

shell = pkgs.mkShell {
env.NIX_CHECK_BY_NAME_EXPR_PATH = toString runtimeExprPath;
Expand Down Expand Up @@ -132,4 +135,6 @@ results.build // results // {
# Built by CI
ci = pkgs.linkFarm "ci" results;

# Used by CI to determine whether a new version should be released
inherit version;
}
2 changes: 1 addition & 1 deletion package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
initNix,
runtimeExprPath,
testNixpkgsPath,
version,
}:
let
fs = lib.fileset;
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version;
in
rustPlatform.buildRustPackage {
pname = "nixpkgs-check-by-name";
Expand Down
2 changes: 1 addition & 1 deletion scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ root=$(git rev-parse --show-toplevel)
repository=${GITHUB_REPOSITORY:-NixOS/nixpkgs-check-by-name}

# Get the version from the Cargo.toml file
version=$(nixeval "$root" -A build.version)
version=$(nixeval "$root" -A version)
echo "Current version is $version"

if existingRelease=$(gh api \
Expand Down

0 comments on commit 910e1c9

Please sign in to comment.