-
Notifications
You must be signed in to change notification settings - Fork 44
/
flake.nix
109 lines (94 loc) · 2.51 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
107
108
109
{
description = "A Nix flake for OSRD dev shell";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
nixpkgs,
fenix,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
};
pythonPackages = ps: (import ./nix/python_env.nix { inherit ps; });
fixedNode = pkgs.nodejs_20;
fixedNodePackages = pkgs.nodePackages.override {
nodejs = fixedNode;
};
rustVer = fenix.packages.${system}.stable;
rustChan = rustVer.withComponents [
"cargo"
"clippy"
"rust-src"
"rustc"
"rustfmt"
"rust-analyzer"
];
osrd-dev-scripts = pkgs.callPackage ./nix/scripts.nix { };
in
with pkgs;
{
devShells.default = mkShell {
buildInputs =
[
# Rust
rustChan
# Libs
geos
openssl
pkg-config
postgresql
# Tools & Libs
diesel-cli
cargo-watch
osmium-tool
taplo
# API
(python311.withPackages pythonPackages)
ruff-lsp
# Core
gradle
jdk17
# Front
fixedNodePackages.create-react-app
fixedNodePackages.eslint
fixedNodePackages.yarn
fixedNode
# Nix formatter
nixfmt-rfc-style
nixd
# OSRD dev scripts
osrd-dev-scripts
jq
]
# Section added only on Linux systems
++ lib.optionals (!stdenv.isDarwin) [
# Linker
mold-wrapped
]
# Section added only on Darwin (macOS) systems
++ lib.optionals stdenv.isDarwin (
with pkgs.darwin.apple_sdk.frameworks;
[
CoreFoundation
SystemConfiguration
libiconv
]
);
RUSTFLAGS = if stdenv.isDarwin then "" else "-C link-arg=-fuse-ld=mold";
};
}
);
}