-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
55 lines (51 loc) · 1.76 KB
/
flake.nix
File metadata and controls
55 lines (51 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{
# inspired by: https://serokell.io/blog/practical-nix-flakes#packaging-existing-applications
# description = "A Hello World in Haskell with a dependency and a devShell";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
inputs.htaglib-src =
{
url = "github:jecaro/htaglib/add-property-api";
flake = false;
};
outputs = { self, nixpkgs, htaglib-src }:
let
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" ];
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
nixpkgsFor = forAllSystems (system: import nixpkgs {
inherit system;
overlays = [ self.overlay ];
});
in
{
overlay = (final: prev: {
htagcli = import ./htagcli.nix final;
haskellPackages = prev.haskellPackages.override {
overrides = hfinal: hprev: {
# Use our fork of htaglib
htaglib = prev.haskell.lib.addExtraLibrary
(hprev.callCabal2nix "htaglib" htaglib-src { })
final.taglib;
};
};
});
packages = forAllSystems (system: {
htagcli = nixpkgsFor.${system}.htagcli;
htagcli-static = nixpkgsFor.${system}.pkgsMusl.htagcli;
});
defaultPackage = forAllSystems (system: self.packages.${system}.htagcli);
checks = self.packages;
devShell = forAllSystems (system:
let haskellPackages = nixpkgsFor.${system}.haskellPackages;
in
haskellPackages.shellFor {
packages = p: [ self.packages.${system}.htagcli ];
withHoogle = true;
buildInputs = with haskellPackages; [
cabal-gild
cabal-install
ghcid
haskell-language-server
];
});
};
}