nix-build silently failing and still returning exit code 0 #48

Open
opened 2022-11-30 23:09:27 +00:00 by martyall · 0 comments
martyall commented 2022-11-30 23:09:27 +00:00 (Migrated from github.com)

Running nix build successfully builds the artifacts and links them in the newly created results/bin. When I ran nix-build --debug, I got the following output:

evaluating file '/nix/store/jb9wd23mwynz6k168gg52hysyh5xag1s-source/default.nix'
warning: Git tree '/home/martin/code/iog/stablecoin-plutus' is dirty
acquiring write lock on '/nix/var/nix/temproots/303423'
evaluating file '/nix/store/4wqylrpk95rxrkmppn0ndgp0g8bq5j01-source/flake.nix'
using substituted/cached input 'github:numtide/flake-utils/5aed5285a952e0b949eb3ba02c12fa4fcfef535f' in '/nix/store/sk4ga2wy0b02k7pnzakwq4r3jdknda4g-source'
evaluating file '/nix/store/sk4ga2wy0b02k7pnzakwq4r3jdknda4g-source/flake.nix'
evaluating file '/nix/store/sk4ga2wy0b02k7pnzakwq4r3jdknda4g-source/default.nix'
evaluating attribute 'checks'
evaluating attribute 'devShells'
evaluating attribute 'inputs'
evaluating attribute 'lastModified'
evaluating attribute 'lastModifiedDate'
evaluating attribute 'legacyPackages'
evaluating attribute 'narHash'
evaluating attribute 'outPath'
evaluating attribute 'outputs'
evaluating attribute 'packages'
evaluating attribute 'revCount'
evaluating attribute 'sourceInfo'
evaluating attribute 'submodules'
querying info about missing paths...
starting pool of 24 threads
querying info about missing paths...
starting pool of 24 threads
entered goal loop

which resulted in an exit code 0 but does not build / link any artifacts (I checked this multiple times). In the end the problem was that the README says to put the following into my default.nix

(import
  (
    let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
    fetchTarball {
      url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
      sha256 = lock.nodes.flake-compat.locked.narHash;
    }
  )
  { src = ./.; }
).defaultNix

which references the rev of the flake-compat object in the lock file. However, because of previous dependencies, the flake-compat object in the lock file refers to a fork of flake-compat from IOHK

    "flake-compat": {
      "flake": false,
      "locked": {
        "lastModified": 1647532380,
        "narHash": "sha256-wswAxyO8AJTH7d5oU8VK82yBCpqwA+p6kLgpb1f1PAY=",
        "owner": "input-output-hk",
        "repo": "flake-compat",
        "rev": "7da118186435255a30b5ffeabba9629c344c0bec",
        "type": "github"
      },

whereas flake-compat_11 (and several other variants) did refer to a commit by @edolstra's repo. When I replaced flake-compat with (for example) flake-compat_11, everything worked as intended.

This actually seems like a nix bug but I figured I would put it here first. The reason being that the result dir was not created, there definitely was an error because I was trying to import some probably non-existent nix file, yet the process finishes with exit code 0.

Running `nix build` successfully builds the artifacts and links them in the newly created `results/bin`. When I ran `nix-build --debug`, I got the following output: ``` evaluating file '/nix/store/jb9wd23mwynz6k168gg52hysyh5xag1s-source/default.nix' warning: Git tree '/home/martin/code/iog/stablecoin-plutus' is dirty acquiring write lock on '/nix/var/nix/temproots/303423' evaluating file '/nix/store/4wqylrpk95rxrkmppn0ndgp0g8bq5j01-source/flake.nix' using substituted/cached input 'github:numtide/flake-utils/5aed5285a952e0b949eb3ba02c12fa4fcfef535f' in '/nix/store/sk4ga2wy0b02k7pnzakwq4r3jdknda4g-source' evaluating file '/nix/store/sk4ga2wy0b02k7pnzakwq4r3jdknda4g-source/flake.nix' evaluating file '/nix/store/sk4ga2wy0b02k7pnzakwq4r3jdknda4g-source/default.nix' evaluating attribute 'checks' evaluating attribute 'devShells' evaluating attribute 'inputs' evaluating attribute 'lastModified' evaluating attribute 'lastModifiedDate' evaluating attribute 'legacyPackages' evaluating attribute 'narHash' evaluating attribute 'outPath' evaluating attribute 'outputs' evaluating attribute 'packages' evaluating attribute 'revCount' evaluating attribute 'sourceInfo' evaluating attribute 'submodules' querying info about missing paths... starting pool of 24 threads querying info about missing paths... starting pool of 24 threads entered goal loop ``` which resulted in an exit code 0 but does not build / link any artifacts (I checked this multiple times). In the end the problem was that the README says to put the following into my `default.nix` ```nix (import ( let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in fetchTarball { url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; sha256 = lock.nodes.flake-compat.locked.narHash; } ) { src = ./.; } ).defaultNix ``` which references the rev of the `flake-compat` object in the lock file. However, because of previous dependencies, the `flake-compat` object in the lock file refers to a fork of `flake-compat` from IOHK ``` "flake-compat": { "flake": false, "locked": { "lastModified": 1647532380, "narHash": "sha256-wswAxyO8AJTH7d5oU8VK82yBCpqwA+p6kLgpb1f1PAY=", "owner": "input-output-hk", "repo": "flake-compat", "rev": "7da118186435255a30b5ffeabba9629c344c0bec", "type": "github" }, ``` whereas `flake-compat_11` (and several other variants) _did_ refer to a commit by @edolstra's repo. When I replaced `flake-compat` with (for example) `flake-compat_11`, everything worked as intended. This actually seems like a nix bug but I figured I would put it here first. The reason being that the `result` dir was not created, there definitely was an error because I was trying to import some probably non-existent nix file, yet the process finishes with exit code 0.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/flake-compat#48
No description provided.