-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
70 lines (63 loc) · 1.96 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
{
description = "My solutions for the advent of code.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.rust-analyzer-src.follows = "";
};
};
outputs = inputs:
inputs.flake-parts.lib.mkFlake
{
inherit inputs;
}
{
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
perSystem =
{ config
, pkgs
, system
, self
, ...
}:
let
version = "0.0.9";
craneLib = inputs.crane.mkLib pkgs;
aocli_src = pkgs.fetchFromGitHub {
owner = "sncxyz";
repo = "aocli";
rev = "v${version}";
hash = "sha256-3a58HglzJ9aJ3cKxWSLCT2Msn1nlAofAzfwt/YM/p/g=";
};
aocli_cargoArtifacts = craneLib.buildDepsOnly { src = aocli_src; };
aocli = craneLib.buildPackage { cargoArtifacts = aocli_cargoArtifacts; src = aocli_src; };
in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
cargo
gcc
rustfmt
clippy
aocli
];
# Certain Rust tools won't work without this
# This can also be fixed by using oxalica/rust-overlay and specifying the rust-src extension
# See https://discourse.nixos.org/t/rust-src-not-found-and-other-misadventures-of-developing-rust-on-nixos/11570/3?u=samuela. for more details.
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
};
};
};
}