-
Notifications
You must be signed in to change notification settings - Fork 4
/
flake.nix
45 lines (45 loc) · 1.45 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
naersk.url = "github:nix-community/naersk";
};
outputs = { nixpkgs, fenix, naersk, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
rust = fenix.packages.${system}.fromToolchainFile {
file = ./rust-toolchain.toml;
sha256 = "sha256-KXx+ID0y4mg2B3LHp7IyaiMrdexF6octADnAtFIOjrY";
};
naersk-lib = naersk.lib.${system}.override {
rustc = rust;
cargo = rust;
};
python = pkgs.python3.withPackages (ps: with ps; [ seaborn black ]);
in rec {
packages.default = let
cargoPackage =
(builtins.fromTOML (builtins.readFile ./Cargo.toml)).package;
in naersk-lib.buildPackage {
pname = cargoPackage.name;
inherit (cargoPackage) version;
root = ./.;
doCheck = true;
};
apps.default = flake-utils.lib.mkApp { drv = packages.default; };
devShells.default = pkgs.mkShell {
buildInputs = packages.default.nativeBuildInputs ++ [
pkgs.nixfmt
pkgs.rust-analyzer
pkgs.libiconv
python
pkgs.nodePackages.pyright
];
};
});
}