-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathflake.nix
134 lines (122 loc) · 3.41 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
{
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";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
alejandra = {
url = "github:kamadorueda/alejandra/3.0.0";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
rust-overlay,
flake-utils,
alejandra,
...
}:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = import nixpkgs {
inherit system;
overlays = [rust-overlay.overlays.default];
};
pythonPackages = ps: [
ps.black
ps.isort
ps.flake8
ps.intervaltree
ps.numpy
ps.mock
ps.pillow
ps.psycopg
ps.psycopg2
ps.pyyaml
ps.requests
ps.websockets
(ps.callPackage (import ./nix/kdtree.nix) {})
(ps.callPackage (import ./nix/geojson-pydantic.nix) {inherit (ps) pydantic;})
# DATA SCIENCE
ps.ipykernel
ps.jupyterlab
ps.shapely
ps.pyproj
ps.ipympl
ps.matplotlib
ps.networkx
ps.pyosmium
ps.progress
ps.tqdm
ps.ipywidgets
];
fixedNode = pkgs.nodejs-18_x;
fixedNodePackages = pkgs.nodePackages.override {
nodejs = fixedNode;
};
rustChan = pkgs.rust-bin.stable."1.73.0".rust.override {
targets = [];
extensions = [
"clippy"
"rust-src"
"rustc-dev"
"rustfmt"
"rust-analyzer"
];
};
scriptFiles = builtins.attrNames (builtins.readDir ./scripts);
scriptBins =
map (
scriptFile:
pkgs.writeShellScriptBin
(pkgs.lib.strings.removeSuffix ".sh" scriptFile)
(pkgs.lib.strings.replaceStrings
["#!/bin/sh"] [""]
(builtins.readFile ./scripts/${scriptFile}))
)
scriptFiles;
in
with pkgs; {
devShells.default = mkShell {
nativeBuildInputs = [rustChan];
buildInputs =
[
# Tools & Libs
diesel-cli
cargo-watch
cargo-tarpaulin
osmium-tool
geos
openssl
pkg-config
postgresql
# API
(python310.withPackages pythonPackages)
poetry
# Core
jdk17
# Front
fixedNodePackages.create-react-app
fixedNodePackages.eslint
fixedNodePackages.yarn
fixedNode
# Nix formatter
alejandra.defaultPackage.${system}
]
++ lib.optionals stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [
CoreFoundation
SystemConfiguration
])
++ scriptBins;
RUST_SRC_PATH = "${rustPlatform.rustLibSrc}";
OSRD_DEV = "True";
OSRD_BACKEND_URL = "http://localhost:8080";
};
}
);
}