Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/nix-github-actions.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Nix actions
on:
pull_request:
merge_group:
push:
branches:
- main
Expand Down Expand Up @@ -47,7 +48,6 @@ jobs:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31
- uses: cachix/cachix-action@v16
if: ${{ ! env.NAMESPACE_RUNNER }}
with:
name: nix-community
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
Expand All @@ -68,7 +68,6 @@ jobs:
extra_nix_config: |
accept-flake-config = true
- uses: cachix/cachix-action@v16
if: ${{ ! env.NAMESPACE_RUNNER }}
with:
name: nix-community
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
Expand Down
22 changes: 0 additions & 22 deletions .github/workflows/publish.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .mergify.yml

This file was deleted.

35 changes: 16 additions & 19 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
description = "Hydra's builtin hydra-eval-jobs as a standalone";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.nixpkgs.url = "https://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz";
inputs.flake-parts.url = "github:hercules-ci/flake-parts";
inputs.flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
inputs.treefmt-nix.url = "github:numtide/treefmt-nix";
Expand Down
23 changes: 10 additions & 13 deletions src/nix-eval-jobs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -465,11 +465,7 @@ auto main(int argc, char **argv) -> int {
throw nix::UsageError("no expression specified");
}

if (myArgs.gcRootsDir.empty()) {
const nix::Path tmpDir = nix::createTempDir();
gcRootsDir.emplace(tmpDir, true);
myArgs.gcRootsDir = tmpDir;
} else {
if (!myArgs.gcRootsDir.empty()) {
myArgs.gcRootsDir = std::filesystem::absolute(myArgs.gcRootsDir);
}

Expand Down Expand Up @@ -570,15 +566,16 @@ auto main(int argc, char **argv) -> int {
nix::writeDerivation(*store, drvAggregate);
auto newDrvPathS = store->printStorePath(newDrvPath);

assert(!myArgs.gcRootsDir.empty());
const nix::Path root =
myArgs.gcRootsDir + "/" +
std::string(nix::baseNameOf(newDrvPathS));
if (!myArgs.gcRootsDir.empty()) {
const nix::Path root =
myArgs.gcRootsDir + "/" +
std::string(nix::baseNameOf(newDrvPathS));

if (!nix::pathExists(root)) {
auto localStore =
store.dynamic_pointer_cast<nix::LocalFSStore>();
localStore->addPermRoot(newDrvPath, root);
if (!nix::pathExists(root)) {
auto localStore = store.dynamic_pointer_cast<
nix::LocalFSStore>();
localStore->addPermRoot(newDrvPath, root);
}
}

nix::logger->log(
Expand Down
21 changes: 21 additions & 0 deletions tests/test_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,27 @@ def test_eval_error() -> None:
assert "this is an evaluation error" in attrs["error"]


def test_no_gcroot_dir() -> None:
cmd = [
str(BIN),
"--meta",
"--workers",
"1",
"--flake",
".#legacyPackages.x86_64-linux.brokenPkgs",
]
res = subprocess.run(
cmd,
cwd=TEST_ROOT.joinpath("assets"),
text=True,
stdout=subprocess.PIPE,
)
print(res.stdout)
attrs = json.loads(res.stdout)
assert attrs["attr"] == "brokenPackage"
assert "this is an evaluation error" in attrs["error"]


def test_constituents() -> None:
with TemporaryDirectory() as tempdir:
cmd = [
Expand Down