Skip to content

Commit

Permalink
nix: use trexio as flake
Browse files Browse the repository at this point in the history
  • Loading branch information
sheepforce committed Dec 11, 2024
1 parent 0420d2c commit 2326b94
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 42 deletions.
65 changes: 58 additions & 7 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@

nixpkgs.url = "github:NixOS/nixpkgs";

trexio = {
url = "github:TREX-CoE/trexio";
flake = false;
};
trexio.url = "github:TREX-CoE/trexio";
};

outputs =
Expand All @@ -24,16 +21,14 @@
flake-utils,
}:
let
trexioOvl = import ./nix/overlay.nix {
trexioSrc = trexio;
};
trexioOvl = import ./nix/overlay.nix;
in
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ trexioOvl ];
overlays = [ /*trexio.overlays.default*/ trexioOvl ];
};
in
{
Expand Down
37 changes: 10 additions & 27 deletions nix/overlay.nix
Original file line number Diff line number Diff line change
@@ -1,31 +1,14 @@
{ trexioSrc }:
final: prev: {
trexio = prev.trexio.overrideAttrs (oldAttrs: {
src = prev.lib.cleanSourceWith {
src = trexioSrc;
filter =
path: type:
!(
builtins.elem (builtins.baseNameOf path) [
"docker"
"helpers-debian"
"ocaml"
"rust"
]
&& type == "directory"
);
};
});

haskell = prev.haskell //
{
packageOverrides = hfinal: hprev:
let ghcMajor = prev.lib.versions.major hprev.ghc.version;
haskell = prev.haskell // {
packageOverrides =
hfinal: hprev:
let
ghcMajor = prev.lib.versions.major hprev.ghc.version;
ghcMinor = prev.lib.versions.minor hprev.ghc.version;
in prev.haskell.packageOverrides hfinal hprev // {
trexio-hs = hfinal.callCabal2nix "trexio-hs" ../. { inherit (final) trexio; };
# template-haskell = hprev.template-haskell_2_22_0_0;
} // prev.lib.attrsets.optionalAttrs (ghcMajor == "9" && ghcMinor == "4") {
};
in
prev.haskell.packageOverrides hfinal hprev
// {
trexio-hs = hfinal.callCabal2nix "trexio-hs" ../. { inherit (final) trexio; };
};
};
}

0 comments on commit 2326b94

Please sign in to comment.