-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
flake.nix
111 lines (101 loc) · 2.69 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
{
description = "git-repo-manager";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/24.05";
flake-utils.url = "github:numtide/flake-utils";
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
flake-utils,
crane,
rust-overlay,
}:
{
overlays = {
git-repo-manager = final: prev: {
git-repo-manager = self.packages.${prev.stdenv.system}.default;
};
};
}
// flake-utils.lib.eachDefaultSystem (
system: let
pkgs =
import nixpkgs
{
inherit system;
overlays = [
rust-overlay.overlays.default
];
};
rustToolchain = pkgs.rust-bin.stable.latest.default;
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
environment = with pkgs; {
pname = "grm"; # otherwise `nix run` looks for git-repo-manager
src = craneLib.cleanCargoSource (craneLib.path ./.);
buildInputs =
[
# tools
pkg-config
rustToolchain
# deps
git
openssl
openssl.dev
zlib
zlib.dev
]
++ lib.optional stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
CoreFoundation
CoreServices
Security
SystemConfiguration
]);
};
in {
apps = {
default = self.apps.${system}.git-repo-manager;
git-repo-manager = flake-utils.lib.mkApp {
drv = self.packages.${system}.git-repo-manager;
};
};
checks = {
pkg = self.packages.${system}.default;
shl = self.devShells.${system}.default;
};
devShells = {
default = pkgs.mkShell (environment
// {
buildInputs =
environment.buildInputs
++ (with pkgs; [
alejandra # nix formatting
black
isort
just
mdbook
python3
ruff
shellcheck
shfmt
]);
});
};
packages = {
default = self.packages.${system}.git-repo-manager;
git-repo-manager = craneLib.buildPackage (environment
// {
cargoArtifacts = craneLib.buildDepsOnly environment;
});
};
}
);
}