Ho posto questa domanda nel canale IRC, ma ho pensato di documentarla qui per riferimento mio e di altri.
Ho un file shell.nix che richiede molto tempo per essere compilato, in particolare sembra che stia costruendo un HUnit
pacchetto.
Il mio file shell.nix è simile a:
{
sources ? import ./nix/sources.nix
, compiler ? "ghc865" } :
let
niv = import sources.nixpkgs {
overlays = [
(_ : _ : { niv = import sources.niv {}; })
] ;
config = {};
};
pkgs = niv.pkgs;
myHaskellPackages = pkgs.haskell.packages.${compiler}.override {
};
in
myHaskellPackages.callCabal2nix "moscoviumorange" (./.) {}
E la fonte è bloccata su (con niv):
{
"niv": {
"branch": "master",
"description": "Easy dependency management for Nix projects",
"homepage": "https://github.com/nmattia/niv",
"owner": "nmattia",
"repo": "niv",
"rev": "88d6f20882b0422470acbcbf2d1b5f07e1d436f0",
"sha256": "0wkvz4drnglmmdrz8q1i1yr2fqizpf96k1wq2rlhd8l8x1522izq",
"type": "tarball",
"url": "https://github.com/nmattia/niv/archive/88d6f20882b0422470acbcbf2d1b5f07e1d436f0.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
"branch": "nixos-19.03",
"description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to",
"homepage": "https://github.com/NixOS/nixpkgs",
"owner": "NixOS",
"repo": "nixpkgs-channels",
"rev": "775fb69ed73e7cf6b7d3dd9853a60f40e8efc340",
"sha256": "1w068b0ydw4c26mcjiwlzdfqcdk3rrwmfx4hxzgfhfwcz2nmh3if",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs-channels/archive/775fb69ed73e7cf6b7d3dd9853a60f40e8efc340.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}
Perché nix sta creando un mucchio di pacchetti, quando presumo che dovrebbero essere nella cache binaria di nixpkg?
Ad esempio, l'output di nix-shell include:
building '/nix/store/7011izw8f2xyvhqadrhnmapddyz61f29-HUnit-1.6.0.0.drv'...
Risposta accettata:
Possiamo cercare il pacchetto HUnit in Hydra (per il 19.03):
https://hydra.nixos.org/eval/1552169?filter=HUnit&compare=1551557&full=#tabs-still-fail
Secondo HUnit
sopra è compilato e sarebbe nella cache binaria.
Determiniamo il percorso del negozio della derivazione che veniva compilata con:
nix-store --query --binding out /nix/store/7011izw8f2xyvhqadrhnmapddyz61f29-HUnit-1.6.0.0.drv
/nix/store/ryr2qdms3n0qbj8d3l9pvs7ajz4dzav4-HUnit-1.6.0.0
Possiamo confrontare quanto segue con hydra:https://hydra.nixos.org/build/103222205#tabs-details
curl https://cache.nixos.org/ryr2qdms3n0qbj8d3l9pvs7ajz4dzav4.narinfo
404
404 significa che il percorso NON è nella cache binaria.
La risposta si è rivelata che stavo facendo riferimento a ghc
essere ghc865
mentre hydra sta probabilmente costruendo con ghc864
per impostazione predefinita (per il 19.03).
Le risposte di cui sopra provenivano originariamente da clever
nel #nixos
Canale IRC, grazie!