-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
81 lines (70 loc) · 2.17 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
{
description = "nix-config-parser";
inputs = {
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2211.433406.tar.gz";
fenix = {
url = "https://flakehub.com/f/nix-community/fenix/0.1.1618.tar.gz";
inputs.nixpkgs.follows = "nixpkgs";
};
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
nix = {
url = "https://flakehub.com/f/NixOS/nix/2.18.1.tar.gz";
# Omitting `inputs.nixpkgs.follows = "nixpkgs";` on purpose
};
};
outputs =
{ self
, nixpkgs
, fenix
, naersk
, nix
, ...
} @ inputs:
let
supportedSystems = [ "i686-linux" "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: (forSystem system f));
forSystem = system: f: f rec {
inherit system;
pkgs = import nixpkgs { inherit system; };
lib = pkgs.lib;
};
fenixToolchain = system: with fenix.packages.${system};
combine ([
stable.clippy
stable.rustc
stable.cargo
stable.rustfmt
stable.rust-src
] ++ nixpkgs.lib.optionals (system == "x86_64-linux") [
targets.x86_64-unknown-linux-musl.stable.rust-std
] ++ nixpkgs.lib.optionals (system == "i686-linux") [
targets.i686-unknown-linux-musl.stable.rust-std
] ++ nixpkgs.lib.optionals (system == "aarch64-linux") [
targets.aarch64-unknown-linux-musl.stable.rust-std
]);
in
{
devShells = forAllSystems ({ system, pkgs, ... }:
let
toolchain = fenixToolchain system;
in
{
default = pkgs.mkShell {
name = "nix-config-parser-shell";
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
nativeBuildInputs = with pkgs; [ ];
buildInputs = with pkgs; [
toolchain
rust-analyzer
cargo-outdated
cargo-audit
nixpkgs-fmt
]
++ lib.optionals (pkgs.stdenv.isDarwin) (with pkgs; [ libiconv ]);
};
});
};
}