flake-compat icon indicating copy to clipboard operation
flake-compat copied to clipboard

Fix pure evaluation mode

Open shlevy opened this issue 4 years ago • 1 comments

Currently flake-compat fails in pure evaluation mode, due to the rootSrc cleaning. I suspect we could just add another conditional to https://github.com/edolstra/flake-compat/blob/12c64ca55c1014cdc1b16ed5a804aa8576601ff2/default.nix#L104 to not tryFetchGet when not builtins ? currentSystem

shlevy avatar Aug 19 '21 13:08 shlevy

In my flakes I started using the following default.nix to avoid this issue:

(
  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 =
      if builtins ? currentSystem
      then ./.
      else "${./.}";
  }
)
.defaultNix

pnmadelaine avatar Nov 23 '23 12:11 pnmadelaine