If I instantiate this derivation:
let
pkgs = import <nixpkgs> {};
in
derivation {
name = "a";
builder = "${pkgs.coreutils}/bin/true";
system = builtins.currentSystem;
}
I get this drv file:
{
"/nix/store/8axn61inlpba8vlvqwzjkn7pjdkmvpna-a.drv": {
"outputs": {
"out": {
"path": "/nix/store/jlh3n04j9qglglvag58lz39cmsjx9ikw-a"
}
},
"inputSrcs": [],
"inputDrvs": {
"/nix/store/nsncr60fii4fwki70bb5ishf1hzq89b5-coreutils-8.31.drv": [
"out"
]
},
"platform": "x86_64-linux",
"builder": "/nix/store/3kqc2wmvf1jkqb2jmcm7rvd9lf4345ra-coreutils-8.31/bin/true",
"args": [],
"env": {
"builder": "/nix/store/3kqc2wmvf1jkqb2jmcm7rvd9lf4345ra-coreutils-8.31/bin/true",
"name": "a",
"out": "/nix/store/jlh3n04j9qglglvag58lz39cmsjx9ikw-a",
"system": "x86_64-linux"
}
}
}
The string "${pkgs.coreutils}/bin/true"
evaluates to "/nix/store/3kqc2wmvf1jkqb2jmcm7rvd9lf4345ra-coreutils-8.31/bin/true"
on my system. So I thought that nix-build
searches the derivation and registers paths inside nix store as inputDrvs
. So I manually performed this replacement and got the following expression and drv:
let
pkgs = import <nixpkgs> {};
in
derivation {
name = "a";
builder = "/nix/store/3kqc2wmvf1jkqb2jmcm7rvd9lf4345ra-coreutils-8.31/bin/true";
system = builtins.currentSystem;
}
{
"/nix/store/1psxqsh1w61pf2010xdjvdd8j1r1ddzx-a.drv": {
"outputs": {
"out": {
"path": "/nix/store/slv8x7rv9zf60azzkwbkk4xasdffdr1h-a"
}
},
"inputSrcs": [],
"inputDrvs": {},
"platform": "x86_64-linux",
"builder": "/nix/store/3kqc2wmvf1jkqb2jmcm7rvd9lf4345ra-coreutils-8.31/bin/true",
"args": [],
"env": {
"builder": "/nix/store/3kqc2wmvf1jkqb2jmcm7rvd9lf4345ra-coreutils-8.31/bin/true",
"name": "a",
"out": "/nix/store/slv8x7rv9zf60azzkwbkk4xasdffdr1h-a",
"system": "x86_64-linux"
}
}
}
As you can see, this does not have coreutils
in inputDrvs
. This would not be the case if nix-build
were evaluating the expression in argument first order. What is the reason behind this behaviour?