2024?
This commit is contained in:
parent
b036db60d2
commit
902917426f
9 changed files with 1234 additions and 1 deletions
66
flake.nix
Normal file
66
flake.nix
Normal 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"
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue