Skip to content

Commit 73320ce

Browse files
committed
Use exeName for packages
1 parent be4476e commit 73320ce

File tree

1 file changed

+45
-41
lines changed

1 file changed

+45
-41
lines changed

nix-tools/flake.nix

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -25,53 +25,57 @@
2525
(attrName: lib.genAttrs systems (system: perSystem.${system}.${attrName}))
2626
;
2727
in
28-
forEachSystem (system:
29-
let
30-
pkgs = haskellNix.legacyPackages.${system};
28+
forEachSystem
29+
(system:
30+
let
31+
pkgs = haskellNix.legacyPackages.${system};
3132

32-
project = pkgs.haskell-nix.cabalProject' {
33-
src = ./.;
34-
compiler-nix-name = "ghc928";
35-
};
33+
project = pkgs.haskell-nix.cabalProject' {
34+
src = ./.;
35+
compiler-nix-name = "ghc928";
36+
};
3637

37-
mkTarball = package:
38-
let
39-
name = "${package.identifier.name}-${package.identifier.version}";
40-
paths = builtins.attrValues package.components.exes;
41-
in
42-
pkgs.runCommand name
43-
{ preferLocalBuild = true; }
44-
''
45-
mkdir -p ${name}
46-
cp --verbose --target-directory ${name} \
47-
${pkgs.lib.concatMapStringsSep " \\\n " (p: "${p}/bin/*") paths}
38+
mkTarball = package:
39+
let
40+
name = "${package.identifier.name}-${package.identifier.version}";
41+
paths = builtins.attrValues package.components.exes;
42+
in
43+
pkgs.runCommand name
44+
{ preferLocalBuild = true; }
45+
''
46+
mkdir -p ${name}
47+
cp --verbose --target-directory ${name} \
48+
${pkgs.lib.concatMapStringsSep " \\\n " (p: "${p}/bin/*") paths}
4849
49-
mkdir -p $out
50-
tar cvzf $out/${name}.tar.gz ${name}
50+
mkdir -p $out
51+
tar cvzf $out/${name}.tar.gz ${name}
5152
52-
mkdir -p $out/nix-support
53-
echo "file binary-dist $out/${name}.tar.gz" >> $out/nix-support/hydra-build-products
54-
# Propagate the release name of the source tarball. This is
55-
# to get nice package names in channels.
56-
echo "${name}" >> $out/nix-support/hydra-release-name
57-
'';
58-
in
59-
lib.recursiveUpdate
60-
project.flake'
61-
(
62-
lib.optionalAttrs (system == "x86_64-linux")
53+
mkdir -p $out/nix-support
54+
echo "file binary-dist $out/${name}.tar.gz" >> $out/nix-support/hydra-build-products
55+
# Propagate the release name of the source tarball. This is
56+
# to get nice package names in channels.
57+
echo "${name}" >> $out/nix-support/hydra-release-name
58+
'';
59+
in
60+
builtins.foldl' lib.recursiveUpdate { } [
61+
{
62+
inherit (project.flake') "checks" "ciJobs" "devShells" "hydraJobs";
63+
packages =
64+
lib.mapAttrs'
65+
(n: v: { name = v.exeName; value = v; })
66+
project.flake'.packages;
67+
}
68+
(lib.optionalAttrs (system == "x86_64-linux")
6369
{
64-
hydraJobs.binary-tarball = mkTarball
65-
project.projectCross.musl64.hsPkgs.nix-tools;
66-
}
67-
//
68-
lib.optionalAttrs (system == "aarch64-linux")
70+
hydraJobs.binary-tarball =
71+
mkTarball project.projectCross.musl64.hsPkgs.nix-tools;
72+
})
73+
(lib.optionalAttrs (system == "aarch64-linux")
6974
{
70-
hydraJobs.binary-tarball = mkTarball
71-
project.projectCross.aarch64-multiplatform-musl.hsPkgs.nix-tools;
72-
}
73-
)
74-
);
75+
hydraJobs.binary-tarball =
76+
mkTarball project.projectCross.aarch64-multiplatform-musl.hsPkgs.nix-tools;
77+
})
78+
]);
7579

7680
nixConfig = {
7781
extra-substituters = [

0 commit comments

Comments
 (0)