-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathflake.nix
47 lines (43 loc) · 1.18 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
{
description = "A CLI batch downloader for your Bandcamp collection.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
fenix.url = "github:nix-community/fenix";
naersk.url = "github:nix-community/naersk/master";
};
outputs = {
fenix,
nixpkgs,
naersk,
...
}: let
forSystems = fn:
nixpkgs.lib.genAttrs [
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
"x86_64-linux"
] (system: fn nixpkgs.legacyPackages.${system});
defaultForSystems = fn: forSystems (pkgs: {default = fn pkgs;});
mkBandsnatch = pkgs: let
fenixPkgs = fenix.packages.${pkgs.system};
toolchain = fenixPkgs.stable.defaultToolchain;
naerskLib = pkgs.callPackage naersk {
cargo = toolchain;
rustc = toolchain;
};
in
naerskLib.buildPackage {
src = ./.;
};
in {
packages = defaultForSystems (pkgs: mkBandsnatch pkgs);
devShells = defaultForSystems (
pkgs:
pkgs.mkShell {
inputsFrom = [(mkBandsnatch pkgs)];
RUST_SRC_PATH = "${fenix.packages.${pkgs.system}.stable.rust-src}/lib/rustlib/src/rust/library";
}
);
};
}