-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
67 lines (63 loc) · 1.68 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
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
};
outputs = {
nixpkgs,
utils,
naersk,
...
}:
utils.lib.eachDefaultSystem (
system: let
name = "canvas-cli";
pkgs = import nixpkgs {
inherit system;
};
naersk-lib = naersk.lib."${system}";
deps = with pkgs; [
perl
];
in rec {
packages.${name} = naersk-lib.buildPackage {
pname = "${name}";
root = ./.;
doCheck = true;
copyLibs = true;
buildInputs = deps;
overrideMain = old: {
postInstall = ''
installShellCompletion --cmd canvas-cli \
--bash <($out/bin/canvas-cli completions bash) \
--fish <($out/bin/canvas-cli completions fish) \
--zsh <($out/bin/canvas-cli completions zsh)
'';
};
nativeBuildInputs = with pkgs; [ installShellFiles ];
};
packages.default = packages.${name};
apps.${name} = utils.lib.mkApp {
inherit name;
drv = packages.${name};
};
apps.default = apps.${name};
devShells.default = pkgs.mkShell {
name = "${name}-devshell";
packages = with pkgs;
[
rustc
cargo
clippy
rustfmt
rust-analyzer
alejandra
vhs
]
++ deps;
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
};
}
);
}