-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathflake.nix
74 lines (64 loc) · 2.09 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
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
crane.url = "github:ipetkov/crane";
fenix.url = "github:nix-community/fenix";
fenix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, flake-utils, nixpkgs, crane, fenix, ... }@inputs:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) lib;
inherit (fenix.packages.${system}.minimal) toolchain;
craneLib = (crane.mkLib pkgs).overrideToolchain fenix.packages.${system}.minimal.toolchain;
rustPlatform = pkgs.makeRustPlatform {
cargo = toolchain;
rustc = toolchain;
};
root = ./.;
src = lib.fileset.toSource {
inherit root;
fileset = lib.fileset.unions [
(craneLib.fileset.commonCargoSources root)
(lib.fileset.fileFilter (file: file.hasExt "md") root)
(./py_maplib/LICENSE)
(./py_maplib/tests)
];
};
cargoVendorDir = craneLib.vendorCargoDeps { inherit src; };
python = let
packageOverrides = self: super: {
maplib = self.callPackage ./nix/py_maplib.nix {
inherit src
craneLib cargoVendorDir
rustPlatform;
};
};
in pkgs.python3.override {inherit packageOverrides; self = python;};
in {
packages = rec {
default = py_maplib;
py_maplib = python.pkgs.maplib;
python-env = python.withPackages (ps: [ ps.maplib ps.polars ]);
};
legacyPackages.python = python;
devShells.default = craneLib.devShell {
inputsFrom = [ self.packages.${system}.py_maplib ];
# https://github.com/tikv/jemallocator/pull/116
env.CFLAGS = "-Wno-error=int-conversion";
packages = [
pkgs.cargo-audit
pkgs.cargo-deny
pkgs.cargo-vet
];
};
apps = rec {
python-env = {
type = "app";
program = "${self.packages.${system}.python-env}/bin/python";
};
};
}
);
}