-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
42 lines (37 loc) · 1.14 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
{
description = "My Advent of Code puzzle solutions";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
crane.url = "github:ipetkov/crane";
};
outputs = { nixpkgs, crane, ... }:
let
# https://xeiaso.net/blog/nix-flakes-1-2022-02-21/
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs systems;
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; } );
rustOverrides = (builtins.fromTOML (builtins.readFile ./rust-toolchain.toml));
in {
devShells = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
in {
default = pkgs.mkShell {
buildInputs = [
pkgs.clang
pkgs.llvmPackages_latest.bintools
pkgs.rustup
];
RUSTC_VERSION = rustOverrides.toolchain.channel;
};
});
packages = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
in {
default = (crane.mkLib pkgs).buildPackage {
src = ./.;
};
});
};
}