-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
71 lines (60 loc) · 1.89 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
gitignore = {
url = "github:hercules-ci/gitignore.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, rust-overlay, gitignore }:
let
inherit (nixpkgs.lib) genAttrs;
forAllSystems = genAttrs [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
forAllPkgs = function: forAllSystems (system: function pkgs.${system});
mkApp = (program: { type = "app"; inherit program; });
pkgs = forAllSystems (system: (import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
}));
in
{
formatter = forAllPkgs (pkgs: pkgs.nixpkgs-fmt);
packages = forAllPkgs (pkgs: rec {
default = app;
app = pkgs.callPackage ./package.nix { inherit gitignore; };
});
apps = forAllSystems (system: rec {
default = app;
app = mkApp (pkgs.getExe self.packages.${system}.app);
});
devShells = forAllPkgs (pkgs:
with pkgs.lib;
let
file-rust-toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
rust-toolchain = file-rust-toolchain.override { extensions = [ "rust-analyzer" ]; };
in
{
default = pkgs.mkShell rec {
nativeBuildInputs = with pkgs; [
pkg-config
rust-toolchain
act
cargo-expand
cargo-semver-checks
cargo-workspaces
unzip
];
buildInputs = with pkgs; [
openssl
];
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
LD_LIBRARY_PATH = makeLibraryPath buildInputs;
RUST_LOG = "";
};
});
};
}