This commit is contained in:
RingOfStorms (Joshua Bell) 2025-04-28 22:44:25 -05:00
parent b036db60d2
commit 902917426f
9 changed files with 1234 additions and 1 deletions

66
flake.nix Normal file
View file

@ -0,0 +1,66 @@
{
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"
'';
};
}
);
};
}