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

Repository syntax change #45

Closed
9 tasks done
infinisil opened this issue Jul 20, 2018 · 12 comments
Closed
9 tasks done

Repository syntax change #45

infinisil opened this issue Jul 20, 2018 · 12 comments

Comments

@infinisil
Copy link
Contributor

infinisil commented Jul 20, 2018

With the merging of #27, a new syntax for repositories is desired. While the old syntax will still work just fine as of now, it has problems with NixOS modules, so it would be good to get away from it. Users will get a warning about that when they use repos with the old syntax:

    NUR repository ${prettyName} is using the deprecated callPackage syntax which
    might result in infinite recursion when used with NixOS modules.

Note that the installation instructions changed as well. The old way works just fine if you don't intend to use it on NixOS, but for the future the new way should be preferred.

The following repositories should be updated:

Migration and new features

Now your main default.nix file should only take one argument, namely pkgs. So if you had something like this before:

{ callPackage, stdenv }: {
  foo = callPackage ./foo;
  bar = stdenv.mkDerivation { /* ... */ };
}

The new syntax looks like this:

{ pkgs }: {
  foo = pkgs.callPackage ./foo;
  bar = pkgs.stdenv.mkDerivation { /* ... */ };
}

This now allows you to provide usable NixOS modules and overlays (by convention in the modules/overlays attributes):

{ pkgs }: {
  foo = pkgs.callPackage ./foo;
  modules.xserver = { pkgs, config, lib, ... }: {
    services.xserver.enable = true;
  };
  overlays.hello = self: super: {
    hello = super.hello.override { ... };
  };
}

You need to make sure to not evaluate the pkgs argument for modules. This will give an error when somebody tries to use the module from NUR:

{ pkgs }: with pkgs; {
  foo = callPackages ./foo;
  modules.bar = { ... };
}
@Ma27
Copy link
Member

Ma27 commented Jul 20, 2018

thanks a lot for the notification! will have a look at it ASAP %)

@kampka
Copy link
Contributor

kampka commented Jul 20, 2018

@infinisil Done 👍

@dtzWill
Copy link
Contributor

dtzWill commented Jul 20, 2018

Done!

@Ma27
Copy link
Member

Ma27 commented Jul 20, 2018

fixed as well, thanks a lot for your effort!

@dywedir
Copy link
Contributor

dywedir commented Jul 20, 2018

@infinisil thanks!
done

@manveru
Copy link
Contributor

manveru commented Jul 20, 2018

Done :)

@jpotier
Copy link

jpotier commented Jul 21, 2018

updated

tilpner added a commit to tilpner/nur-packages that referenced this issue Jul 21, 2018
But only strictly. Haven't tested if my usage of callDirectory
disallows module usage yet.
fgaz added a commit to fgaz/nur-packages that referenced this issue Jul 21, 2018
@fgaz
Copy link
Contributor

fgaz commented Jul 21, 2018

Updated both my repo and my template!

Thanks for the heads-up!

@mpickering
Copy link
Contributor

Updated now in a9fca19

@infinisil
Copy link
Contributor Author

Thanks everybody!

@Ma27
Copy link
Member

Ma27 commented Aug 9, 2018

...and thanks for your work to make this possible!

@Mic92
Copy link
Member

Mic92 commented Aug 9, 2018

@infinisil Now this could become a failure instead of a warning.

milahu pushed a commit to milahu/NUR that referenced this issue Aug 6, 2023
actions: nixos-20.09 -> nixos-21.05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants