-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
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
arion: init at 0.1.0.0 #71092
arion: init at 0.1.0.0 #71092
Conversation
@roberth Thanks for sending this PR. I don't quite understand why |
I do agree in general, but I try to keep the number of variations of the expressions low. This way I can backport the expression without having to maintain another variation of this file. So it does serve a purpose. |
optionalCabal2nixFile = ./cabal2nix-arion-compose.nix; | ||
|
||
arion-compose = | ||
# Test suite needs nixpkgs as dependency which would make it quite heavy. | ||
pkgs.haskell.lib.dontCheck ( | ||
if ! builtins.pathExists optionalCabal2nixFile | ||
then haskellPackages.arion-compose | ||
else haskellPackages.callPackage optionalCabal2nixFile {}); |
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.
Instead of hard-coding the path ./cabal2nix-arion-compose.nix
, why not take optionalCabal2nixFile
as an argument to this file, so you'd have something like:
{ pkgs
, haskellPackages ? pkgs.haskellPackages
, optionalCabal2nixFile ? null
}:
Then, the arion-compose
expression would become:
arion-compose =
# Test suite needs nixpkgs as dependency which would make it quite heavy.
if isNull optionalCabal2nixFile then haskellPackages.arion-compose else pkgs.haskell.lib.dontCheck (haskellPackages.callPackage optionalCabal2nixFile {});
This should make it more natural to use for most users who are used to the callPackage
style of packages.
{ pkgs | ||
, haskellPackages ? pkgs.haskellPackages | ||
}: |
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.
Instead of taking pkgs
as an argument here, could you only declare the things you need from pkgs
? That would make it more natural to use as a callPackage
-style package.
I'm specifically thinking of things like haskellPackages
(which you do declare), haskell
(for haskell.lib
, or even just the specific things you use from haskell.lib
).
{ pkgs ? import ./. {} | ||
, arion-compose | ||
, arion-compose-eval-src | ||
}: |
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 same thing here about turning this into a callPackage
-style package.
The current way it is written, it is not obvious that arion
depends on things like justStaticExecutables
, overrideCabal
, docker-compose
, makeWrapper
, etc. It would also be more difficult for someone to override those arguments, since they are taken directly from pkgs
.
, arion-compose | ||
, arion-compose-eval-src |
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.
Could you add comments explaining what these are supposed to be?
eval = args@{...}: | ||
import | ||
(arion-compose-eval-src + "/nix/eval-composition.nix") | ||
({ inherit pkgs; } // args); | ||
|
||
build = args@{...}: | ||
let composition = eval args; | ||
in composition.config.out.dockerComposeYaml; |
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.
Could you add comments on what eval
and build
are supposed to be? Also, an example of how they are intended to be used would be helpful.
# Usage ./update ~/src/arion | ||
# | ||
# Make sure that ~/src/arion matches the latest version 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 don't think this necessarily needs to be changed, but it might be easier for other people to run if this update script just pulled arion
from the latest version on Hackage and used that. Then you wouldn't need arion
checked out locally (and have to match versions by hand).
@@ -30842,7 +30842,6 @@ self: { | |||
description = "Run docker-compose with help from Nix/NixOS"; | |||
license = stdenv.lib.licenses.asl20; | |||
hydraPlatforms = stdenv.lib.platforms.none; | |||
broken = true; |
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.
This file is generated automatically, so if you edit it, there is a chance it will cause a build conflict.
Can you remove this change? It will be marked as unbroken next time the file is automatically generated (which happens quite frequently).
You might be interested in this video which explains the process:
https://discourse.nixos.org/t/video-tutorial-how-to-fix-broken-haskell-packages-in-nix/3968
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.
How can you tell I didn't run it?
Tbh I got a linker error in cabal2nix. I wrote an issue here to make that process reproducible if you're interested: NixOS/cabal2nix#431
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.
How can you tell I didn't run it?
As far as I know, in general hackage2nix
is run automatically by some sort of CI setup by peti. So when people send PRs to nixpkgs, they are often asked to not change pkgs/development/haskell-modules/hackage-packages.nix
by hand, because it will sometimes cause merge conflicts.
Also, hackage2nix
will always(?) remove both the broken = true;
and hydraPlatforms = stdenv.lib.platforms.none;
lines.
@roberth Thanks for the additional explanation. I think one of the things I'm having a hard time following is why this is split into a If not, could you add some documentation explaining the reason for the split? I think I'm having a tough time following what is going on in this derivation. |
@cdepillabout, thanks for the extensive review! The reason for the split is that I can use the same |
One more thing I forgot: since you've changed the |
This adds me as a maintainer of arion-compose, which provides the executable for the arion package (NixOS#71092). Note that it has a different name because it was already taken on Hackage before arion switched to Haskell.
This adds me as a maintainer of arion-compose, which provides the executable for the arion package (NixOS#71092). Note that it has a different name because it was already taken on Hackage before arion switched to Haskell.
This adds me as a maintainer of arion-compose, which provides the executable for the arion package (#71092). Note that it has a different name because it was already taken on Hackage before arion switched to Haskell.
@cdepillabout I've dropped the ability to move files between here and the arion project. It probably wasn't worth optimizing for that. |
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.
@roberth Thanks for updating this. This looks good.
I think this should be able to be merged as-is. However, I'm still not 100% sure how the eval
and build
functions are supposed to be used. Maybe you're using them on the upstream arion
repo? Are they meant to be used by normal nix users (people other than you and Domen)?
@cdepillabout yes, they are intended for arion users. We will publish documentation very soon and add a link in the inline docs here. I'll merge it so it's there just in time for NixCon. |
Experimenting building on Mac OS X with a simple derivation - nixpkgs master as of this morning. Roughly: {
arionSrc = pkgs.fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
rev = "ce14f092eab6efcb2915c1db189558c1d5a469e8"; # master as of 20191025 ~Friday morning
sha256 = "1w901v41gfnxd9xaanxns5qxrjnhlpfgsn6g7bhf76jg11lggxf8";
};
arion = (pkgs.callPackage arionSrc {}).arion;
} Install tests are failing with an
OSError: AF_UNIX path too long
It appears that the path length limit for a Unix domain socket is around 104 on Mac OS. This could be related. Please let me know if you would rather want me to open a distinct issue so this merged PR doesn't get hijacked. |
This adds me as a maintainer of arion-compose, which provides the executable for the arion package (NixOS#71092). Note that it has a different name because it was already taken on Hackage before arion switched to Haskell. (cherry picked from commit 3ca15e5)
Motivation for this change
Package Arion, a tool for working with Docker through Nix!
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)