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
dconf2nix: init at 0.5.0 #94891
dconf2nix: init at 0.5.0 #94891
Conversation
Apparently, I'm not a trusted user: https://gist.github.com/GrahamcOfBorg/755c9a6d20cccee353811b1df5fb430a
If there's anything I should fix, I'd appreciate any help 🙏 |
This is because you're doing a IFD (import from derivation) |
Thanks for the quick review @jonringer ! I'll address your comments soon.
Does this have any implications? Should I do it differently? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main issue is that you're trying to evaluate ANOTHER derivation from the src fixed output derivation.
Please move all the relevant packaging detail from upstream to here.
@cdepillabout please help with haskell packaging :)
27b36a8
to
60e398b
Compare
I think I addressed all your comments, @jonringer , thanks again!
Not sure exactly how I should solve this, any help would be much appreciated 🙏 |
Maybe doing somethink like this? prePatch = ''
rm $src/default.nix
''; |
@@ -10,6 +10,8 @@ self: super: { | |||
multi-ghc-travis = throw ("haskellPackages.multi-ghc-travis has been renamed" | |||
+ " to haskell-ci, which is now on hackage"); | |||
|
|||
dconf2nix = self.callPackage ../tools/haskell/dconf2nix { }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than trying to build this package as a non-hackage-package
, it would be easier for us if you were to just release it to Hackage.
If dconf2nix
was released to Hackage, then the Haskell tooling here in Nixpkgs will pull in the latest version every time you make a new release to Hackage. In most cases, you won't have to do anything to maintain it here in nixpkgs. It will just be available by default.
Also, releasing to Hackage generally helps the wider Hackage community, since non-nixpkg users have an easy way to get your package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know about the trade-offs but if we think about it, this is a tool for Nix users so I'd expect anyone using it to install it via Nix and not by other means.
OTOH I don't want to maintain a Hackage package, that's why I added myself as a maintainer here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't upload to Hackage, it will probably be more work for you to maintain it here in nixpkgs, but as long as you're willing to deal with that extra work, it is fine.
Check out how haskellPackages.spago
is packaged in nixpkgs, and model the packaging for dconf2nix
on that. Spago is another tool written in Haskell that is not on Hackage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might consider it in the long run if this doesn't work out but for now I just want to make it available on Nixpkgs as a top-level package, so the PR must exist regardless of being on Hackage or not.
I looked at the definition of vaultenv to have an idea about how to package it but it's also my first time doing it so I'm not really sure what else I'm missing. I'll have a look at Spago too 👍
I don't really understand how Spago is built 😕 . I see it has a similar derivation but on the Github repository there's no OTOH I think the issue here with my derivation is due to my default.nix calling Any help much appreciated 🙇 |
@gvolpe You can basically copy the Basically, you'll need a
Yeah, there are derivations for building Haskell packages here in nixpkgs, but there are no derivations on most of the upstream Haskell packages. In general you will want to look for how to package stuff here in nixpkgs, not in the upstream repos.
Yes, the problem is that you're using IFD: https://blog.hercules-ci.com/2019/08/30/native-support-for-import-for-derivation/ The approach that you should follow is the exact same approach that Because Hydra doesn't allow IFD, you will need to duplicate the Nix files here in nixpkgs and your upstream repo. This is somewhat unfortunate, but it is the current state of affairs here in nixpkgs. |
Thanks @cdepillabout , I'll have some time tomorrow to look into it.
FWIW I'm not packing it per-se but I'm taking advantages of Cachix and Github Actions. Isn't there something like Also, the current Thanks again for your time! |
I tried to follow how { haskell, haskellPackages, lib, runCommand }:
let
dconf2nix =
haskell.lib.justStaticExecutables
(haskell.lib.overrideCabal haskellPackages.dconf2nix (oldAttrs: {
maintainers = (oldAttrs.maintainers or []) ++ [
lib.maintainers.cdepillabout
];
}));
in
dconf2nix.overrideAttrs (oldAttrs: {
passthru = (oldAttrs.passthru or {}) // {
updateScript = ./update.sh;
# These tests can be run with the following command. The tests access the
# network, so they cannot be run in the nix sandbox. sudo is needed in
# order to change the sandbox option.
#
# $ sudo nix-build -A dconf2nix.passthru.tests --option sandbox relaxed
#
tests =
runCommand
"dconf2nix-tests"
{
__noChroot = true;
nativeBuildInputs = [
dconf2nix
];
}
''
dconf2nix -v
'';
};
}) |
Would you be able to push what you have so far? The code snippet you pasted looks fine for the most part, so I am having trouble seeing what you're having trouble with. |
Sure @cdepillabout , I just pushed what I have, based on the |
The command error: cannot auto-call a function that has an argument without a default value ('haskell') |
@gvolpe Here's what I needed to do to get this to build: iff --git a/pkgs/development/haskell-modules/non-hackage-packages.nix b/pkgs/development/haskell-modules/non-hackage-packages.nix
index dd6a13f23c2..8801f1f1ddd 100644
--- a/pkgs/development/haskell-modules/non-hackage-packages.nix
+++ b/pkgs/development/haskell-modules/non-hackage-packages.nix
@@ -10,7 +10,7 @@ self: super: {
multi-ghc-travis = throw ("haskellPackages.multi-ghc-travis has been renamed"
+ " to haskell-ci, which is now on hackage");
- dconf2nix = self.callPackage ../tools/haskell/dconf2nix { };
+ dconf2nix = self.callPackage ../tools/haskell/dconf2nix/dconf2nix.nix { };
# https://github.com/channable/vaultenv/issues/1
vaultenv = self.callPackage ../tools/haskell/vaultenv { };
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index f3ec07d8534..dcff5fadd66 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -2921,7 +2921,7 @@ in
dclxvi = callPackage ../development/libraries/dclxvi { };
- dconf2nix = haskellPackages.dconf2nix;
+ dconf2nix = callPackage ../development/tools/haskell/dconf2nix { };
dcraw = callPackage ../tools/graphics/dcraw { }; |
Wow, I feel dumb I didn't see that! Thanks @cdepillabout, I'll try it out as soon as I get home 🙇 |
@cdepillabout what command do you run to build |
Oh nevermind, it builds fine. I was running the command not from the top-level directory... Thanks a lot for your help! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few other small fixes that can be made:
diff --git a/pkgs/development/tools/haskell/dconf2nix/default.nix b/pkgs/development/tools/haskell/dconf2nix/default.nix
index 3bcd4e2e1f3..cbaa47b6556 100644
--- a/pkgs/development/tools/haskell/dconf2nix/default.nix
+++ b/pkgs/development/tools/haskell/dconf2nix/default.nix
@@ -5,7 +5,7 @@ let
haskell.lib.justStaticExecutables
(haskell.lib.overrideCabal haskellPackages.dconf2nix (oldAttrs: {
maintainers = (oldAttrs.maintainers or []) ++ [
- lib.maintainers.cdepillabout
+ lib.maintainers.gvolpe
];
}));
in
@@ -14,23 +14,19 @@ dconf2nix.overrideAttrs (oldAttrs: {
passthru = (oldAttrs.passthru or {}) // {
updateScript = ./update.sh;
- # These tests can be run with the following command. The tests access the
- # network, so they cannot be run in the nix sandbox. sudo is needed in
- # order to change the sandbox option.
- #
- # $ sudo nix-build -A dconf2nix.passthru.tests --option sandbox relaxed
+ # These tests can be run with the following command.
#
+ # $ nix-build -A dconf2nix.passthru.tests
tests =
runCommand
"dconf2nix-tests"
{
- __noChroot = true;
nativeBuildInputs = [
dconf2nix
];
}
''
- dconf2nix -v
+ dconf2nix > $out
'';
};
})
You don't need to run the tests with the relaxed sandbox, because it appears that just running dconf2nix
produces output. I'm assuming this is a good enough check to see if dconf2nix
is compiled correctly, but if there is a better one please feel free to use it.
I've made sure that dconf2nix
builds, the update.sh
script works as expected, and the tests pass. Once you make these above changes, this looks good and I will go ahead and merge it in!
edit: Oh, and usually other maintainers appreciate if you squash your commits, and make sure that the commit adding you as a maintainer comes before the commit where you add dconf2nix
.
e904a40
to
7d0ae2b
Compare
7d0ae2b
to
b987a31
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for working through this with us!
Thank you for being patient @cdepillabout ! 🙇 |
Motivation for this change
To make the dconf2nix package available on Nixpkgs.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)