-
Notifications
You must be signed in to change notification settings - Fork 30
/
flake.nix
70 lines (58 loc) · 2 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
{
description = "Basic cli devShell flake";
inputs = {
roc.url = "github:roc-lang/roc";
nixpkgs.follows = "roc/nixpkgs";
# rust from nixpkgs has some libc problems, this is patched in the rust-overlay
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
# to easily make configs for multiple architectures
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, roc, rust-overlay, flake-utils }:
let supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
in flake-utils.lib.eachSystem supportedSystems (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
rocPkgs = roc.packages.${system};
llvmPkgs = pkgs.llvmPackages_16;
# get current working directory
cwd = builtins.toString ./.;
rust =
pkgs.rust-bin.fromRustupToolchainFile "${toString ./rust-toolchain.toml}";
linuxInputs = with pkgs;
lib.optionals stdenv.isLinux [
valgrind
];
darwinInputs = with pkgs;
lib.optionals stdenv.isDarwin
(with pkgs.darwin.apple_sdk.frameworks; [
Security
]);
sharedInputs = (with pkgs; [
jq
rust
llvmPkgs.clang
llvmPkgs.lldb # for debugging
expect
nmap
simple-http-server
rocPkgs.cli
]);
in {
devShell = pkgs.mkShell {
buildInputs = sharedInputs ++ darwinInputs ++ linuxInputs;
# nix does not store libs in /usr/lib or /lib
# for libgcc_s.so.1
NIX_LIBGCC_S_PATH =
if pkgs.stdenv.isLinux then "${pkgs.stdenv.cc.cc.lib}/lib" else "";
# for crti.o, crtn.o, and Scrt1.o
NIX_GLIBC_PATH =
if pkgs.stdenv.isLinux then "${pkgs.glibc.out}/lib" else "";
};
formatter = pkgs.nixpkgs-fmt;
});
}