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

flake-utils.lib.mkApp is broken with nix 2.8 #61

Closed
Lunarequest opened this issue Apr 25, 2022 · 4 comments
Closed

flake-utils.lib.mkApp is broken with nix 2.8 #61

Lunarequest opened this issue Apr 25, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@Lunarequest
Copy link

Describe the bug

To Reproduce

Steps to reproduce the behavior:

  1. use nix run on a repo with the an app made with flake-utils.lib.mkApp
  2. errors with error: attribute 'defaultApp.x86_64-linux' should have type 'derivation'

Expected behavior
the app executes normally

System information
nix 2.8.0 linux

Additional context
nix 2.8.0 has more strictness the nix 2.7 which has broken flake-utils

@Lunarequest Lunarequest added the bug Something isn't working label Apr 25, 2022
@zimbatm
Copy link
Member

zimbatm commented Apr 25, 2022

is that fixed?

@TristanCacqueray
Copy link

TristanCacqueray commented May 12, 2022

This issue is still happening when using defaultApp = flake-utils.lib.mkApp { drv = package; }; with nix-2.8 .
This seems to work though: apps.default = flake-utils.lib.mkApp { drv = package; }.

@tv42
Copy link

tv42 commented Jul 18, 2022

It does not seem like this issue should have been closed.

tv42 added a commit to tv42/choosy that referenced this issue Jul 18, 2022
It seems unnecessary (when there's only one app defined?).
`nix run .# -- --help` works just fine without it.

This is a workaround for
numtide/flake-utils#61 (closed but not
fixed!).
@johnrichardrinehart
Copy link

johnrichardrinehart commented Aug 21, 2022

EDIT: Discovered that the problem I was describing underneath the divider, below, was because I wasn't conforming to c0e246b . After respecting that commit and moving my defaultApp value to apps.default nix run . works fine.

        apps = rec {
          go_1_18-fips = flake-utils.lib.mkApp { drv = packages.go_1_18-fips;  exePath = "/bin/go";};
          default = go_1_18-fips;
        };

I have a bunch of files in $out/bin and trying to select only one for defaultApp with exePath or name fails with the above error. It doesn't matter if I try apps.defaultApp or defaultApp.

        apps.defaultApp =  flake-utils.lib.mkApp { drv = packages.go_1_18-fips;  name = "go";};

However, the below works just fine as nix run .#go_1_18-fips

        apps.go_1_18-fips = flake-utils.lib.mkApp { drv = packages.go_1_18-fips;  name = "go";};

It's possible this has been the case for as long as nix 2.8. But, in my case

$ nix --version
nix (Nix) 2.10.3
$ cat flake.lock | grep numtide -C 10
{
  "nodes": {
    "flake-utils": {
      "locked": {
        "lastModified": 1659877975,
        "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
        "owner": "numtide",
        "repo": "flake-utils",
        "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
        "type": "github"
      },
      "original": {
        "owner": "numtide",
        "repo": "flake-utils",
        "type": "github"
      }
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants