-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
56 lines (48 loc) · 1.53 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
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});
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; };
});
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
];
buildInputs = with pkgs; [ ];
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
LD_LIBRARY_PATH = makeLibraryPath buildInputs;
};
});
};
}