This repository has been archived by the owner on Nov 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
shell.nix
98 lines (87 loc) · 2.56 KB
/
shell.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
{ ci-treefmt ? false
}:
let
pkgs = import ./nixpkgs.nix { };
inherit (pkgs) stdenv lib;
fenixRev = "9e3384c61656487b10226a3366a12c37393b21d9";
fenixPackages = import
(builtins.fetchTarball {
name = "fenix-${fenixRev}";
url = "https://github.com/nix-community/fenix/archive/${fenixRev}.tar.gz";
sha256 = "10kjfa00fs98cvs137x5kr5dmfblmkz8ya5ribb5l0dnfnpgvf5s";
})
{ inherit pkgs; };
rustToolchain = fenixPackages.fromToolchainFile {
file = ./rust-toolchain.toml;
sha256 = "sha256-lFKtXaRZQFPdQHIymMDEpQpWhbfUJpRj1+VHSzzVjn4=";
};
inherit (fenixPackages) rust-analyzer;
cargo-benchcmp = pkgs.rustPlatform.buildRustPackage rec {
pname = "cargo-benchcmp";
version = "0.4.3";
src = pkgs.fetchFromGitHub {
owner = "BurntSushi";
repo = pname;
rev = version;
sha256 = "sha256-nD/qFqq1DOmNZGW4g9Xjpwob/T7d6egFdFMNFG+N+f0=";
};
cargoSha256 = "sha256-frNoGzeOPo/gUksaquiFdRhUd486BABcoznW29FzIK8=";
doCheck = false;
};
# Don't forget to update .github/actions/setup-haskell
stack = pkgs.symlinkJoin {
name = "stack-with-system-ghc";
paths = [ pkgs.stack ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/stack --add-flags "--system-ghc"
'';
};
# Should match .nvmrc
# Also see: https://nixos.wiki/wiki/Node.js#Example_nix_shell_for_Node.js_development
# (but note building Node from source takes aaages)
nodejs = pkgs.nodejs-18_x;
in
pkgs.mkShell {
buildInputs = [
# if `--arg ci-treefmt true` then we only want to include these tools
# (used for running formatting checks in CI)
pkgs.treefmt
#pkgs.deadnix <-- might be nice to use in the future?
pkgs.nixpkgs-fmt
pkgs.ormolu
pkgs.shellcheck
pkgs.shfmt
] ++ lib.optionals (!ci-treefmt) ([
# The rest of the development shell stuff
rustToolchain
rust-analyzer
pkgs.cargo-nextest
pkgs.cargo-watch
pkgs.cargo-udeps
pkgs.cargo-audit
pkgs.cargo-outdated
cargo-benchcmp
pkgs.inferno
# Haskell stuff
stack
pkgs.ghc
pkgs.ghcid
nodejs
pkgs.ninja
pkgs.openssl
pkgs.pkg-config
]
# Linux specific stuff
++ (lib.optionals (stdenv.isx86_64 && stdenv.isLinux) [ ])
# MacOS specific stuff
++ (lib.optionals pkgs.stdenv.isDarwin [
# Fixes for MacOS Catalina
# https://github.com/NixOS/nixpkgs/issues/120688
pkgs.libiconv
pkgs.darwin.apple_sdk.frameworks.CoreServices
]));
DITTO_NINJA = "${pkgs.ninja}/bin/ninja";
# less output from `cargo nextest`
NEXTEST_STATUS_LEVEL = "retry";
}