-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
79 lines (75 loc) · 2.84 KB
/
flake.nix
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{
description = "hpci";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-23.11";
};
outputs = { self, nixpkgs }:
let
pkgsForSystem = system: if system == "x86_64-linux" then
nixpkgs.legacyPackages.${system}.pkgsMusl
else
nixpkgs.legacyPackages.${system};
in
{
packages =
let
packageForSystem = system:
let
pkgs = pkgsForSystem system;
static_ssl = (pkgs.openssl.override { static = true; });
haskellPackages = pkgs.haskell.packages.ghc948;
packageName = "hpci";
jailbreakUnbreak = pkg: pkgs.haskell.lib.doJailbreak (pkg.overrideAttrs (_: { meta = { }; }));
inherit (pkgs.haskell.lib) appendConfigureFlags justStaticExecutables;
mypackage = haskellPackages.callCabal2nix packageName self rec {
};
in
pkgs.haskell.lib.overrideCabal mypackage (old: {
enableSharedExecutables = false;
enableSharedLibraries = false;
configureFlags = [
"--ghc-option=-optl=-static"
"--ghc-option=-optl=-L${pkgs.zlib.static}/lib"
"--ghc-option=-optl=-lz"
"--extra-lib-dirs=${pkgs.gmp6.override { withStatic = true; }}/lib"
"--extra-lib-dirs=${pkgs.libffi.overrideAttrs (old: { dontDisableStatic = true; })}/lib"
"--extra-lib-dirs=${pkgs.libssh2.overrideAttrs (old: { dontDisableStatic = true; })}/lib"
"--extra-lib-dirs=${pkgs.pkg-config}/lib"
"--extra-lib-dirs=${static_ssl}/lib"
"--extra-lib-dirs=${pkgs.zlib.static}/lib"
];
buildDepends = [
pkgs.libffi
pkgs.libssh2
pkgs.pkg-config
static_ssl
pkgs.zlib.static
];
});
in
{
x86_64-linux = { hpci = packageForSystem "x86_64-linux"; };
aarch64-darwin = { hpci = packageForSystem "aarch64-darwin"; };
};
devShells =
let
devShellForSystem = system:
let pkgs = pkgsForSystem system;
haskellPackages = pkgs.haskell.packages.ghc948;
in pkgs.mkShell {
buildInputs = with haskellPackages; [
haskell-language-server
cabal-install
cabal2nix
] ++ [ pkgs.zlib ];
inputsFrom = builtins.attrValues self.packages.${system};
};
in
{
x86_64-linux = devShellForSystem "x86_64-linux";
aarch64-darwin = devShellForSystem "aarch64-darwin";
};
defaultPackage.x86_64-linux = self.packages.x86_64-linux.hpci;
defaultPackage.aarch64-darwin = self.packages.aarch64-darwin.hpci;
};
}