-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
106 lines (96 loc) · 3.12 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
{
description = "Buck2 project template supporting both nix-based GHC env and custom GHC HEAD";
inputs = {
nixpkgs.url = "github:MercuryTechnologies/nixpkgs/ghc962";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:matthewbauer/flake-compat/support-fetching-file-type-flakes";
flake = false;
};
rust-overlay.url = "github:oxalica/rust-overlay";
amazonka.url = "git+file:./amazonka";
};
outputs =
inputs @ { self
, nixpkgs
, flake-utils
, rust-overlay
, amazonka
, ...
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlays.default ] ++ import ./toolchains/nix/overlays;
config = {
allowUnfree = true;
allowBroken = true;
};
};
toolchains = import toolchains/nix { inherit system; };
inherit (toolchains.packages.${system}) ghcWithPackages haddock;
buck2BuildInputs = [
pkgs.bash
pkgs.coreutils
pkgs.cacert
pkgs.gnused
pkgs.git
pkgs.nix
pkgs.openssh
] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
pkgs.stdenv.cc.bintools
pkgs.darwin.cctools
];
macOS-security =
# make `/usr/bin/security` available in `PATH`, which is needed for stack
# on darwin which calls this binary to find certificates
pkgs.writeScriptBin "security" ''exec /usr/bin/security "$@"'';
in
rec {
packages = {
inherit ghcWithPackages;
buck2-update = pkgs.writeShellApplication {
name = "buck2-update";
runtimeInputs = with pkgs; [ curl jq nix-prefetch common-updater-scripts nix coreutils ];
text = ''
exec "$BASH" nix/overlays/buck2/update.sh
'';
};
};
devShells = rec {
buck2 = buck2-nix;
buck2-nix = pkgs.mkShellNoCC {
name = "buck2-nix-shell";
packages = buck2BuildInputs ++ [
pkgs.buck2-source
pkgs.nix
pkgs.jq
];
shellHook = ''
export PS1="\n[buck2-nix:\w]$ \0"
'';
};
buck2-ghcHEAD = pkgs.mkShell {
name = "buck2-ghcHEAD-shell";
packages = buck2BuildInputs ++ [
pkgs.buck2-source
pkgs.nix
pkgs.jq
];
# GHC in invokes Nix cc, cc-wrapper invokes mktemp from $PATH. Also GHC invokes otool and
# install_name_tool from $PATH on Darwin.
GHC_PATH = pkgs.lib.makeSearchPath "bin" ([ pkgs.coreutils ] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
pkgs.stdenv.cc.bintools
pkgs.darwin.cctools
]);
shellHook = ''
export PS1="\n[buck2-ghcHEAD:\w]$ \0"
'';
};
amazonka-ghc98 = with amazonka.legacyPackages."${system}"; mkDevShell ghc98;
amazonka-ghcNix = amazonka.legacyPackages."${system}".mkDevShell toolchains.packages."${system}".hsPkgs;
};
});
nixConfig.allow-import-from-derivation = true; # needed for cabal2nix
}