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

ca-derivations support #21

Draft
wants to merge 3 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
51 changes: 46 additions & 5 deletions flake.lock

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

7 changes: 4 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
inputs.nixpkgs.url = "nixpkgs/nixos-20.09";
inputs.nixpkgs.follows = "nix/nixpkgs";
inputs.nix.url = "github:nixos/nix/ca/queryRealisation-perl";
Copy link
Contributor

Choose a reason for hiding this comment

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

This was merged into master now.


outputs = { self, nixpkgs }:
outputs = { self, nixpkgs, nix }:

let
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
Expand All @@ -13,7 +14,7 @@
nix-serve = with final; stdenv.mkDerivation {
name = "nix-serve-${self.lastModifiedDate}";

buildInputs = [ perl nix.perl-bindings perlPackages.Plack perlPackages.Starman perlPackages.DBDSQLite ];
buildInputs = [ perl nix.defaultPackage.${super.system}.passthru.perl-bindings perlPackages.Plack perlPackages.Starman perlPackages.DBDSQLite ];
Copy link

Choose a reason for hiding this comment

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

it doesn't seem like super.system is correct. I suppose you meant prev.system?


unpackPhase = "true";

Expand Down
9 changes: 8 additions & 1 deletion nix-serve.psgi
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ my $app = sub {
my $path = $env->{PATH_INFO};

if ($path eq "/nix-cache-info") {
return [200, ['Content-Type' => 'text/plain'], ["StoreDir: $Nix::Config::storeDir\nWantMassQuery: 1\nPriority: 30\n"]];
return [200, ['Content-Type' => 'text/plain'], ["StoreDir: /nix/store\nWantMassQuery: 1\nPriority: 30\n"]];
Copy link

Choose a reason for hiding this comment

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

Maybe you could try the following (see also):

Suggested change
return [200, ['Content-Type' => 'text/plain'], ["StoreDir: /nix/store\nWantMassQuery: 1\nPriority: 30\n"]];
return [200, ['Content-Type' => 'text/plain'], ["StoreDir: ${Nix::Config::storeDir}\nWantMassQuery: 1\nPriority: 30\n"]];

}

elsif ($path =~ /^\/realisations\/(.*)\.doi/) {
my $rawDrvOutput = $1;
my $rawRealisation = queryRawRealisation($rawDrvOutput);
return [404, ['Content-Type' => 'text/plain'], ["No such derivation output.\n"]] unless $rawRealisation;
return [200, ['Content-Type' => 'text/plain'], [$rawRealisation]];
}

elsif ($path =~ /^\/([0-9a-z]+)\.narinfo$/) {
Expand Down