Add janky development shell
This commit is contained in:
parent
c438d7d665
commit
f613854a56
48
flake.lock
Normal file
48
flake.lock
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1733024928,
|
||||||
|
"narHash": "sha256-n/DOfpKH1vkukuBnach91QBQId2dr5tkE7/7UrkV2zw=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "2c27ab2e60502d1ebb7cf38909de38663f762a79",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"rust-overlay": "rust-overlay"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rust-overlay": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1733020719,
|
||||||
|
"narHash": "sha256-Chv9+3zrf1DhdB9JyskjoV0vJbCQEgkVqrU3p4RPLv8=",
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"rev": "8e18f10703112e6c33e1c0d8b93e8305f6f0a75c",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
43
flake.nix
Normal file
43
flake.nix
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
description = "Advent of Code";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
|
rust-overlay = {
|
||||||
|
url = "github:oxalica/rust-overlay";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { nixpkgs, rust-overlay, ... }:
|
||||||
|
let
|
||||||
|
lib = nixpkgs.lib;
|
||||||
|
systems = ["x86_64-linux"];
|
||||||
|
|
||||||
|
forEachSystem = fn: lib.genAttrs systems (system:
|
||||||
|
let
|
||||||
|
overlays = [ (import rust-overlay) ];
|
||||||
|
pkgs = import nixpkgs { inherit system overlays; };
|
||||||
|
in fn { inherit pkgs; } );
|
||||||
|
|
||||||
|
mkRustToolchain = pkgs: pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||||
|
in {
|
||||||
|
devShells = forEachSystem ({ pkgs }: let
|
||||||
|
rustToolchain = mkRustToolchain pkgs;
|
||||||
|
rustNightlyToolchain = pkgs.rust-bin.selectLatestNightlyWith (t: t.minimal.override {
|
||||||
|
extensions = [ "rustfmt" ];
|
||||||
|
});
|
||||||
|
|
||||||
|
rustShell = pkgs.mkShell {
|
||||||
|
name = "AoC";
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
rustToolchain
|
||||||
|
rustNightlyToolchain
|
||||||
|
];
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
default = rustShell;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
5
rust-toolchain.toml
Normal file
5
rust-toolchain.toml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[toolchain]
|
||||||
|
channel = "stable"
|
||||||
|
components = ["clippy", "rust-analyzer", "rust-src"]
|
||||||
|
targets = ["x86_64-unknown-linux-gnu"]
|
||||||
|
profile = "minimal" # includes rustc, cargo, and rust-std
|
18
rustfmt.toml
Normal file
18
rustfmt.toml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# Just enforce it here as well instead of relying on editorconfig alone
|
||||||
|
hard_tabs = false
|
||||||
|
tab_spaces = 4
|
||||||
|
newline_style = "Unix"
|
||||||
|
|
||||||
|
imports_granularity = "Module"
|
||||||
|
group_imports = "StdExternalCrate"
|
||||||
|
|
||||||
|
force_multiline_blocks = false
|
||||||
|
fn_single_line = false
|
||||||
|
comment_width = 100
|
||||||
|
wrap_comments = true
|
||||||
|
hex_literal_case = "Upper"
|
||||||
|
blank_lines_upper_bound = 2
|
||||||
|
overflow_delimited_expr = true
|
||||||
|
reorder_impl_items = true
|
Loading…
Reference in New Issue
Block a user