-
Notifications
You must be signed in to change notification settings - Fork 16
/
flake.nix
63 lines (50 loc) · 1.75 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
{
description = "basic-webserver 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" "aarch64-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;
rust =
pkgs.rust-bin.fromRustupToolchainFile "${toString ./rust-toolchain.toml}";
linuxInputs = with pkgs;
lib.optionals stdenv.isLinux [
valgrind # for debugging
];
darwinInputs = with pkgs;
lib.optionals stdenv.isDarwin
(with pkgs.darwin.apple_sdk.frameworks; [
Security
]);
sharedInputs = (with pkgs; [
rust
llvmPkgs.clang
expect
rocPkgs.cli
sqlite
imagemagick # for file-upload-form example
]);
in {
devShell = pkgs.mkShell {
buildInputs = sharedInputs ++ darwinInputs ++ linuxInputs;
# nix does not store libs in /usr/lib or /lib
NIX_GLIBC_PATH =
if pkgs.stdenv.isLinux then "${pkgs.glibc.out}/lib" else "";
};
formatter = pkgs.nixpkgs-fmt;
});
}