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

use newer clj2nix which passes pkgs as an argument to deps.nix #50270

Merged
merged 1 commit into from Nov 13, 2018

Conversation

hlolli
Copy link
Member

@hlolli hlolli commented Nov 12, 2018

Motivation for this change

@cocreature reported

This [lumo init merge] broke the tarball job on hydra https://hydra.nixos.org/build/83951478/nixlog/1 due to the import of <nixpkgs>.
Things done

I changed how clj2nix exports the nix expression and from now on it wont import like this, instead an argument needs to be passed to the import statement.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

ping @infinisil

@@ -118,7 +118,7 @@ let # packageJSON=./package.json;
'';


cljdeps = import ./deps.nix;
cljdeps = import ./deps.nix pkgs;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file automatically generated?

@@ -1,13 +1,15 @@
# generated by clj2nix
let repos = [
{ pkgs, ... }:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's most common to use { pkgs ? import <nixpkgs> {} }: for such autogenerated files, because then they can be used like import ./foo.nix {} but also pass an argument explicitly with import ./foo.nix { pkgs = ...; }. And we usually don't use ... because those extra arguments get ignored.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally said to use just pkgs: and import ./foo.nix pkgs here because we'd know that this fix is just temporary. I'm suggesting above for it making clj2nix the most usable in general :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, l hope this looks about right now?

@hlolli
Copy link
Member Author

hlolli commented Nov 12, 2018

@Mic92 yes here https://github.com/hlolli/clj2nix

@infinisil thanks for the pro tip! I will change it and squash my PR.

@@ -1,13 +1,15 @@
# generated by clj2nix
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion for clj2nix: I would also include a version number in the generated files.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for this catch, it's now implemented!

@infinisil
Copy link
Member

One minor thing: Can you change the commit message to have the lumo: prefix?

@hlolli
Copy link
Member Author

hlolli commented Nov 12, 2018

@infinisil done !

@infinisil infinisil merged commit 287a1de into NixOS:master Nov 13, 2018
hlolli referenced this pull request Nov 13, 2018
Do not refer to <nixpkgs> as it will produce the following message:

"evaluation aborted with the following error message: 'Illegal use of <nixpkgs> in Nixpkgs.'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants