Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[callCabal2nix] copyFile: does not exist (No such file or directory) due to symlink file. #42550

Open
Rizary opened this issue Jun 25, 2018 · 8 comments
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md

Comments

@Rizary
Copy link
Contributor

Rizary commented Jun 25, 2018

Issue description

When I build using nix-build default.nix I got the following error:

ignoring (possibly broken) abi-depends field for packages
haddockPhase
installing
LICENSE: copyFile: does not exist (No such file or directory)
builder for '/nix/store/pbcchaj5zwzjp364hgq1g9p97jslrr11-hspec-core-2.5.1.drv' failed with exit code 1
cannot build derivation '/nix/store/wdnl0hxc9pk6455c7r6n6wjw57hx0d2w-hspec-2.5.1.drv': 1 dependencies couldn't be built
building '/nix/store/j4pag42mjj3dyfiyr4yb1ivh3pq18lns-uuid-types-1.0.3.drv'...

Then I look into the sourc repo https://github.com/hspec/hspec and found that inside hspec-* folder, all the LICENSE file were symlinked to the root folder.

Steps to reproduce

clone hspec and then make the following *.nix file in your separate project folder:

let

  # Import tools
  haskellPackages = pkgs.haskell.packages.ghc822;
  lib = pkgs.lib;
  servant         = import ./nixdeps/servant.nix;

  hspec-src       = ../hspec; # <--- where you put hspec git clone;

  fast = p: pkgs.haskell.lib.dontHaddock (pkgs.haskell.lib.dontCheck p);

  config = { allowUnfree = true; };
  overlays = [
    (newPkgs: oldPkgs: {
      myHaskellPackages = oldPkgs.haskell.packages.ghc822.override {
        overrides = newHaskellPkgs: oldHaskellPkgs: {
          servant =
            newHaskellPkgs.callCabal2nix "servant" "${servant}/servant" {};
          hspec =        
            fast (newHaskellPkgs.callCabal2nix "hspec" "${hspec-src}/" {});
          hspec-core =
            fast (newHaskellPkgs.callCabal2nix "hspec-core" "${hspec-src}/hspec-core" {});
       };
      };
    })
  ];

  nixpkgs = import ./nixdeps/nixpkgs.nix;
  pkgs = import nixpkgs { inherit config overlays; };
in
  {
    inherit (pkgs.myHaskellPackages) servant;
  }

Technical details

 - system: `"x86_64-linux"`
 - host os: `Linux 4.14.49, NixOS, 18.03.132684.f3c913d466f (Impala)`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.0.4`
 - channels(root): `"nixos-18.03.132684.f3c913d466f"`
 - channels(rizilab): `"nixosUnstable-18.09pre142796.4b649a99d84, nixosUnstableSmall-18.09pre142840.e701948f5a3"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs`

Please run nix-shell -p nix-info --run "nix-info -m" and paste the
results.

@roberth
Copy link
Member

roberth commented Jun 27, 2018

A workaround exists right now, by manually calling the cabal2nix tool and passing the --subpath option. It basically makes the builder cd into a subdirectory of src, so if pick the parent directory of your current src, the symlinks will work again.

The downside is that the src is bigger than necessary, which may cause unnecessary rebuilds when irrelevant parts of src change. If that's a concern, although I guess not, you could use filterSource to prevent that issue.

To make this approach work better in your example, you need a callCabal2nix that passes the extra arguments to haskellSrc2nix. This should be achievable with some attrset filtering in callCabal2nix ( pkgs/development/haskell-modules/make-package-set.nix).

@roberth
Copy link
Member

roberth commented Jul 2, 2018

@Rizary could you try #42658 to call cabal2nix with --subpath hspec-core and see if it resolves your problem?

@Rizary
Copy link
Contributor Author

Rizary commented Jul 2, 2018

@roberth i will try it and let you know asap.

@stale
Copy link

stale bot commented Jun 4, 2020

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 4, 2020
@viluon
Copy link
Contributor

viluon commented Jan 21, 2021

This is still important to me, as it seems to break stack install within nix-shell for ghc.nix.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 21, 2021
@roberth roberth changed the title copyFile: does not exist (No such file or directory) due to symlink file. [callCabal2nix] copyFile: does not exist (No such file or directory) due to symlink file. Jan 21, 2021
@roberth
Copy link
Member

roberth commented Jan 21, 2021

@viluon Could you provide more details? stack install doesn't use the Nix sandbox to build your project and the ghc.nix repo only provides a shell which is likely to just work because it's all pinned. If that shell does break, you should create an issue on that repo and perhaps cross-reference it here.

@viluon
Copy link
Contributor

viluon commented Jan 21, 2021

@roberth Good point, my issue is probably of a different origin. I got a very similar error message and mistakenly thought it was a nixpkgs problem. Sorry!

@stale
Copy link

stale bot commented Jul 20, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md
Projects
None yet
Development

No branches or pull requests

3 participants