-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
92 lines (82 loc) · 2.59 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
{
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";
};
outputs = inputs @ {
self,
nixpkgs,
flake-utils,
rust-overlay,
...
}:
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 {
default = buck2;
buck2 = pkgs.mkShell {
name = "buck2-shell";
packages = buck2BuildInputs ++ [
pkgs.buck2-source
pkgs.nix
pkgs.jq
# REMOVE LATER
pkgs.alex
];
# 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:\w]$ \0"
'';
};
};
});
nixConfig.allow-import-from-derivation = true; # needed for cabal2nix
}