Describe the bug
nix-build should exit based on how the build failed. For example, from the docs:
Special exit codes:
100
Generic build failure, the builder process returned with a non-zero exit code.
101
Build timeout, the build was aborted because it did not complete within the specified timeout.
102
Hash mismatch, the build output was rejected because it does not match the outputHash attribute of the derivation.
104
Not deterministic, the build succeeded in check mode but the resulting output is not binary reproducable.
However, this is currently broken:
[grahamc@hyperchicken:~/projects/github.com/NixOS/nixpkgs]$ nix-build /nix/store/c70v6crmck8g7hrijma6b9r6x4a81x2v-7c4465cefb27d4e0d07535d368febdf77b579566.patch.drv ; echo $?
this derivation will be built:
/nix/store/c70v6crmck8g7hrijma6b9r6x4a81x2v-7c4465cefb27d4e0d07535d368febdf77b579566.patch.drv
building '/nix/store/c70v6crmck8g7hrijma6b9r6x4a81x2v-7c4465cefb27d4e0d07535d368febdf77b579566.patch.drv'...
trying https://github.com/mpv-player/mpv/commit/7c4465cefb27d4e0d07535d368febdf77b579566.patch
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3553 100 3553 0 0 16919 0 --:--:-- --:--:-- --:--:-- 16919
error: hash mismatch in fixed-output derivation '/nix/store/c70v6crmck8g7hrijma6b9r6x4a81x2v-7c4465cefb27d4e0d07535d368febdf77b579566.patch.drv':
specified: sha256-PX8fPds1v2tAoUcohQFO2RKSlK50/uNmYbNMBYQwzPk=
got: sha256-PX8fPds1v3tAoUcohQFO2RKSlK50/uNmYbNMBYQwzPk=
1
[grahamc@hyperchicken:~/projects/github.com/NixOS/nixpkgs]$ nix-store --realize /nix/store/c70v6crmck8g7hrijma6b9r6x4a81x2v-7c4465cefb27d4e0d07535d368febdf77b579566.patch.drv; echo $?
this derivation will be built:
/nix/store/c70v6crmck8g7hrijma6b9r6x4a81x2v-7c4465cefb27d4e0d07535d368febdf77b579566.patch.drv
building '/nix/store/c70v6crmck8g7hrijma6b9r6x4a81x2v-7c4465cefb27d4e0d07535d368febdf77b579566.patch.drv'...
trying https://github.com/mpv-player/mpv/commit/7c4465cefb27d4e0d07535d368febdf77b579566.patch
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3553 100 3553 0 0 36628 0 --:--:-- --:--:-- --:--:-- 36628
error: hash mismatch in fixed-output derivation '/nix/store/c70v6crmck8g7hrijma6b9r6x4a81x2v-7c4465cefb27d4e0d07535d368febdf77b579566.patch.drv':
specified: sha256-PX8fPds1v2tAoUcohQFO2RKSlK50/uNmYbNMBYQwzPk=
got: sha256-PX8fPds1v3tAoUcohQFO2RKSlK50/uNmYbNMBYQwzPk=
1
Steps To Reproduce
- Create a fixed output derivation which has the wrong hash
- Try to build it
- Note that the exit code is wrong.
Expected behavior
Nix should exit with the documented exit codes.
nix-env --version output
nix-env (Nix) 2.4pre20210514_de9e43c
Additional context
NixOS unstable
Describe the bug
nix-build should exit based on how the build failed. For example, from the docs:
However, this is currently broken:
Steps To Reproduce
Expected behavior
Nix should exit with the documented exit codes.
nix-env --versionoutputnix-env (Nix) 2.4pre20210514_de9e43c
Additional context
NixOS unstable