Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nix 2.24 upgrade wip #1411

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
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
104 changes: 53 additions & 51 deletions flake.lock

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

5 changes: 3 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
description = "A Nix-based continuous build system";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11-small";
inputs.nix.url = "github:NixOS/nix/2.23-maintenance";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05-small";
inputs.nix.url = "github:NixOS/nix/2.24-maintenance";
inputs.nix.inputs.nixpkgs.follows = "nixpkgs";

outputs = { self, nixpkgs, nix }:
Expand All @@ -25,6 +25,7 @@
hydra = final.callPackage ./package.nix {
inherit (nixpkgs.lib) fileset;
rawSrc = self;
nix-perl-bindings = final.nixComponents.nix-perl-bindings;
};
};

Expand Down
3 changes: 2 additions & 1 deletion package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
, perlPackages

, nix
, nix-perl-bindings
, git

, makeWrapper
Expand Down Expand Up @@ -59,7 +60,7 @@ let
name = "hydra-perl-deps";
paths = lib.closePropagation
([
nix.perl-bindings
nix-perl-bindings
git
] ++ (with perlPackages; [
AuthenSASL
Expand Down
2 changes: 1 addition & 1 deletion src/hydra-eval-jobs/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bin_PROGRAMS = hydra-eval-jobs

hydra_eval_jobs_SOURCES = hydra-eval-jobs.cc
hydra_eval_jobs_LDADD = $(NIX_LIBS) -lnixcmd
hydra_eval_jobs_LDADD = $(NIX_LIBS) -lnixcmd -lnixflake
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am now thinking about making hydra-eval-jobs it's own derivation so that we can split the nix update over multiple pull requests.

Copy link
Member

@Ericson2314 Ericson2314 Sep 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be good for deduplicating with nix-eval-jobs too

#1315

Also hope we can convert hydra to Meson and then use subprojects to still support incremental builds of everything.

#1392

hydra_eval_jobs_CXXFLAGS = $(NIX_CFLAGS) -I ../libhydra
14 changes: 11 additions & 3 deletions src/hydra-eval-jobs/hydra-eval-jobs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "shared.hh"
#include "store-api.hh"
#include "eval.hh"
#include "eval-gc.hh"
#include "eval-inline.hh"
#include "eval-settings.hh"
#include "signals.hh"
Expand Down Expand Up @@ -125,11 +126,14 @@ static void worker(
if (myArgs.flake) {
using namespace flake;

auto flakeRef = parseFlakeRef(myArgs.releaseExpr);
auto [flakeRef, fragment, outputSpec] = parseFlakeRefWithFragmentAndExtendedOutputsSpec(fetchSettings, myArgs.releaseExpr, absPath("."));

auto vFlake = state.allocValue();

auto lockedFlake = lockFlake(state, flakeRef,
auto lockedFlake = lockFlake(
flakeSettings,
state,
flakeRef,
LockFlags {
.updateLockFile = false,
.useRegistries = false,
Expand Down Expand Up @@ -368,7 +372,11 @@ int main(int argc, char * * argv)
]()
{
try {
EvalState state(myArgs.lookupPath, openStore());
auto evalStore = myArgs.evalStoreUrl
? openStore(*myArgs.evalStoreUrl)
: openStore();
EvalState state(myArgs.lookupPath,
evalStore, fetchSettings, evalSettings);
Bindings & autoArgs = *myArgs.getAutoArgs(state);
worker(state, autoArgs, *to, *from);
} catch (Error & e) {
Expand Down
1 change: 1 addition & 0 deletions src/hydra-queue-runner/dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <cmath>
#include <thread>
#include <unordered_map>
#include <unordered_set>

#include "state.hh"

Expand Down
14 changes: 7 additions & 7 deletions src/hydra-queue-runner/nar-extractor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,26 +60,26 @@ struct Extractor : FileSystemObjectSink
: members(members), prefix(prefix)
{ }

void createDirectory(const Path & path) override
void createDirectory(const CanonPath & path) override
{
members.insert_or_assign(prefix + path, NarMemberData { .type = SourceAccessor::Type::tDirectory });
members.insert_or_assign(prefix + path.abs(), NarMemberData { .type = SourceAccessor::Type::tDirectory });
}

void createRegularFile(const Path & path, std::function<void(CreateRegularFileSink &)> func) override
void createRegularFile(const CanonPath & path, std::function<void(CreateRegularFileSink &)> func) override
{
NarMemberConstructor nmc {
members.insert_or_assign(prefix + path, NarMemberData {
members.insert_or_assign(prefix + path.abs(), NarMemberData {
.type = SourceAccessor::Type::tRegular,
.fileSize = 0,
.contents = filesToKeep.count(path) ? std::optional("") : std::nullopt,
.contents = filesToKeep.count(path.abs()) ? std::optional("") : std::nullopt,
}).first->second,
};
func(nmc);
}

void createSymlink(const Path & path, const std::string & target) override
void createSymlink(const CanonPath & path, const std::string & target) override
{
members.insert_or_assign(prefix + path, NarMemberData { .type = SourceAccessor::Type::tSymlink });
members.insert_or_assign(prefix + path.abs(), NarMemberData { .type = SourceAccessor::Type::tSymlink });
}
};

Expand Down
Loading