forked from jeff-hughes/shellcaster
-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
87 lines (77 loc) · 2.33 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
{
description = "hullcaster";
inputs = {
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.flake-utils.follows = "flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
crate2nix = {
url = "github:nix-community/crate2nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-parts.follows = "flake-parts";
inputs.crate2nix_stable.follows = "crate2nix";
inputs.devshell.follows = "devshell";
inputs.flake-utils.follows = "flake-utils";
};
# Development
devshell = {
url = "github:numtide/devshell";
inputs.nixpkgs.follows = "nixpkgs";
};
};
nixConfig = {
extra-trusted-public-keys = "eigenvalue.cachix.org-1:ykerQDDa55PGxU25CETy9wF6uVDpadGGXYrFNJA3TUs=";
extra-substituters = "https://eigenvalue.cachix.org";
allow-import-from-derivation = true;
};
outputs =
inputs @ { self
, nixpkgs
, flake-parts
, rust-overlay
, crate2nix
, ...
}: flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
imports = [
./nix/rust-overlay/flake-module.nix
./nix/devshell/flake-module.nix
];
perSystem = { system, pkgs, lib, inputs', ... }:
let
# If you dislike IFD, you can also generate it with `crate2nix generate`
# on each dependency change and import it here with `import ./Cargo.nix`.
cargoNix = inputs.crate2nix.tools.${system}.appliedCargoNix {
name = "rustnix";
src = ./.;
};
in
rec {
checks = {
rustnix = cargoNix.rootCrate.build.override {
runTests = true;
};
};
packages = {
rustnix = cargoNix.rootCrate.build;
default = packages.rustnix;
inherit (pkgs) rust-toolchain;
rust-toolchain-versions = pkgs.writeScriptBin "rust-toolchain-versions" ''
${pkgs.rust-toolchain}/bin/cargo --version
${pkgs.rust-toolchain}/bin/rustc --version
'';
};
};
};
}