-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathflake.nix
95 lines (86 loc) · 2.25 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
{
description = "oxidizr";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs =
{
self,
nixpkgs,
...
}:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
pkgsForSystem =
system:
(import nixpkgs {
inherit system;
overlays = [ self.inputs.rust-overlay.overlays.default ];
});
in
{
packages = forAllSystems (
system:
let
inherit (pkgsForSystem system)
lib
rustPlatform
;
cargoToml = lib.trivial.importTOML ./Cargo.toml;
version = cargoToml.package.version;
in
rec {
default = oxidizr;
oxidizr = rustPlatform.buildRustPackage {
pname = "oxidizr";
version = version;
src = lib.cleanSource ./.;
cargoLock.lockFile = ./Cargo.lock;
meta = {
description = "Replace system utilities with Rust alternatives on Ubuntu";
homepage = "https://github.com/jnsgruk/oxidizr";
license = lib.licenses.asl20;
mainProgram = "oxidizr";
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ jnsgruk ];
};
};
}
);
devShells = forAllSystems (
system:
let
pkgs = pkgsForSystem system;
rust = pkgs.rust-bin.stable.latest.default.override {
extensions = [
"rust-src"
"clippy"
"rust-analyzer"
"rustfmt"
];
};
in
{
default = pkgs.mkShell {
name = "oxidizr";
NIX_CONFIG = "experimental-features = nix-command flakes";
RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library";
buildInputs =
(with pkgs; [
cargo-cross
rustup
spread
goreleaser
jq
])
++ [ rust ];
};
}
);
};
}