66 lines
1.7 KiB
Nix
66 lines
1.7 KiB
Nix
{
|
|
description = "AOC.";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
nix-filter.url = "github:numtide/nix-filter";
|
|
rust-overlay = {
|
|
url = "github:oxalica/rust-overlay";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
nixpkgs,
|
|
rust-overlay,
|
|
nix-filter,
|
|
...
|
|
}:
|
|
let
|
|
# Utilities
|
|
inherit (nixpkgs) lib;
|
|
# Define the systems to support (all Linux systems exposed by nixpkgs)
|
|
systems = lib.intersectLists lib.systems.flakeExposed lib.platforms.linux;
|
|
forAllSystems = lib.genAttrs systems;
|
|
# Create a mapping from system to corresponding nixpkgs : https://nixos.wiki/wiki/Overlays#In_a_Nix_flake
|
|
nixpkgsFor = forAllSystems (system: (nixpkgs.legacyPackages.${system}.extend rustOverlay));
|
|
# =========
|
|
rustOverlay = import rust-overlay;
|
|
rustVersion = "stable";
|
|
rustChannel = "latest";
|
|
in
|
|
{
|
|
devShells = forAllSystems (
|
|
system:
|
|
let
|
|
pkgs = nixpkgsFor.${system};
|
|
rust = pkgs.rust-bin.${rustVersion}.${rustChannel}.default.override {
|
|
extensions = [
|
|
"rust-src"
|
|
"rust-analyzer"
|
|
];
|
|
};
|
|
in
|
|
{
|
|
default = pkgs.mkShell {
|
|
nativeBuildInputs = (
|
|
with pkgs;
|
|
[
|
|
rust
|
|
sccache
|
|
]
|
|
);
|
|
|
|
buildInputs = [ ];
|
|
|
|
shellHook = ''
|
|
echo "RUST C: "$(rustc --version)" - "$(which rustc)
|
|
export RUSTC_WRAPPER="sccache"
|
|
'';
|
|
};
|
|
}
|
|
);
|
|
};
|
|
}
|