Skip to content

Commit

Permalink
Merge pull request #142940 from expipiplus1/haskell-lib-composable
Browse files Browse the repository at this point in the history
Haskell: haskell.lib.composable init and switch
  • Loading branch information
expipiplus1 authored Nov 7, 2021
2 parents 8b7c314 + 15ae25f commit 30a71d9
Show file tree
Hide file tree
Showing 33 changed files with 1,190 additions and 828 deletions.
8 changes: 4 additions & 4 deletions pkgs/applications/misc/gitit/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ let
plugins =
if pluginSupport
then plain
else haskell.lib.disableCabalFlag plain "plugins";
static = haskell.lib.justStaticExecutables plugins;
else haskell.lib.compose.disableCabalFlag "plugins" plain;
static = haskell.lib.compose.justStaticExecutables plugins;

in
(haskell.lib.overrideCabal static (drv: {
(haskell.lib.compose.overrideCabal (drv: {
buildTools = (drv.buildTools or []) ++ [ removeReferencesTo ];
})).overrideAttrs (drv: {
}) static).overrideAttrs (drv: {

# These libraries are still referenced, because they generate
# a `Paths_*` module for figuring out their version.
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/virtualization/arion/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ let
arion =
justStaticExecutables (
overrideCabal
arion-compose
cabalOverrides
arion-compose
);

inherit (haskell.lib) justStaticExecutables overrideCabal;
inherit (haskell.lib.compose) justStaticExecutables overrideCabal;

inherit (haskellPackages) arion-compose;

Expand Down
18 changes: 9 additions & 9 deletions pkgs/development/compilers/elm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ let
fetchElmDeps = import ./fetchElmDeps.nix { inherit stdenv lib fetchurl; };

hsPkgs = haskellPackages.override {
overrides = self: super: with haskell.lib; with lib;
overrides = self: super: with haskell.lib.compose; with lib;
let elmPkgs = rec {
elm = overrideCabal (self.callPackage ./packages/elm.nix { }) (drv: {
elm = overrideCabal (drv: {
# sadly with parallelism most of the time breaks compilation
enableParallelBuilding = false;
preConfigure = self.fetchElmDeps {
Expand All @@ -29,22 +29,22 @@ let
homepage = "https://elm-lang.org/";
license = licenses.bsd3;
maintainers = with maintainers; [ domenkozar turbomack ];
});
}) (self.callPackage ./packages/elm.nix { });

/*
The elm-format expression is updated via a script in the https://github.com/avh4/elm-format repo:
`package/nix/build.sh`
*/
elm-format = justStaticExecutables (overrideCabal (self.callPackage ./packages/elm-format.nix {}) (drv: {
elm-format = justStaticExecutables (overrideCabal (drv: {
jailbreak = true;

description = "Formats Elm source code according to a standard set of rules based on the official Elm Style Guide";
homepage = "https://github.com/avh4/elm-format";
license = licenses.bsd3;
maintainers = with maintainers; [ avh4 turbomack ];
}));
}) (self.callPackage ./packages/elm-format.nix {}));

elmi-to-json = justStaticExecutables (overrideCabal (self.callPackage ./packages/elmi-to-json.nix {}) (drv: {
elmi-to-json = justStaticExecutables (overrideCabal (drv: {
prePatch = ''
substituteInPlace package.yaml --replace "- -Werror" ""
hpack
Expand All @@ -55,9 +55,9 @@ let
homepage = "https://github.com/stoeffel/elmi-to-json";
license = licenses.bsd3;
maintainers = [ maintainers.turbomack ];
}));
}) (self.callPackage ./packages/elmi-to-json.nix {}));

elm-instrument = justStaticExecutables (overrideCabal (self.callPackage ./packages/elm-instrument.nix {}) (drv: {
elm-instrument = justStaticExecutables (overrideCabal (drv: {
prePatch = ''
sed "s/desc <-.*/let desc = \"${drv.version}\"/g" Setup.hs --in-place
'';
Expand All @@ -69,7 +69,7 @@ let
homepage = "https://github.com/zwilias/elm-instrument";
license = licenses.bsd3;
maintainers = [ maintainers.turbomack ];
}));
}) (self.callPackage ./packages/elm-instrument.nix {}));

inherit fetchElmDeps;
elmVersion = elmPkgs.elm.version;
Expand Down
8 changes: 4 additions & 4 deletions pkgs/development/compilers/pakcs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ let

curry-frontend = (haskellPackages.override {
overrides = self: super: {
curry-base = haskell.lib.overrideCabal (super.callPackage ./curry-base.nix {}) (drv: {
curry-base = haskell.lib.compose.overrideCabal (drv: {
inherit src;
postUnpack = "sourceRoot+=/frontend/curry-base";
});
curry-frontend = haskell.lib.overrideCabal (super.callPackage ./curry-frontend.nix {}) (drv: {
}) (super.callPackage ./curry-base.nix {});
curry-frontend = haskell.lib.compose.overrideCabal (drv: {
inherit src;
postUnpack = "sourceRoot+=/frontend/curry-frontend";
});
}) (super.callPackage ./curry-frontend.nix {});
};
}).curry-frontend;
in stdenv.mkDerivation {
Expand Down
Loading

0 comments on commit 30a71d9

Please sign in to comment.