This commit is contained in:
thornAvery 2021-12-01 03:03:04 +00:00
parent 1cb9558160
commit 4148be6ec7
4 changed files with 4 additions and 4 deletions

7
nix/overlay.nix Normal file
View file

@ -0,0 +1,7 @@
inputs: final: prev: {
haskellPackages = prev.haskellPackages.override {
overrides = haskellSelf: haskellSuper:
((import ./utils.nix) { inherit inputs; pkgs = prev; })
// { };
};
}

3
nix/packages.nix Normal file
View file

@ -0,0 +1,3 @@
inputs: [
../code
]

27
nix/utils.nix Normal file
View file

@ -0,0 +1,27 @@
{ inputs, pkgs, ... }:
let
fn = root: map (p: "${root}/" + p) (builtins.attrNames (builtins.readDir root));
gn = root:
let items = builtins.readDir root;
fn = file: type:
if type == "regular"
then
(let m = (builtins.match "(.*)\\.cabal" file);
in if !(isNull m)
then { "${builtins.elemAt m 0}" = root; }
else {})
else {};
in builtins.foldl' (x: y: x // y) {} (builtins.attrValues (builtins.mapAttrs fn items));
hn = s:
builtins.filter
(x: (builtins.hasAttr "flake" x) && !x.flake)
s;
packagePaths = builtins.foldl'
(x: y: x // y)
{}
(map gn ((import ./packages.nix) inputs));
in
builtins.mapAttrs
(name: path: pkgs.haskellPackages.callCabal2nix name path {})
packagePaths