nix: initial tooling

This commit is contained in:
raf 2025-07-22 00:11:07 +03:00
commit 8547710b62
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
5 changed files with 103 additions and 0 deletions

31
nix/package.nix Normal file
View file

@ -0,0 +1,31 @@
{
lib,
rustPlatform,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "eh";
version = (builtins.fromTOML (builtins.readFile ../Cargo.toml)).workspace.package.version;
src = let
fs = lib.fileset;
s = ../.;
in
fs.toSource {
root = s;
fileset = fs.unions (map (dir: (s + /${dir})) [
".cargo"
"eh"
"xtask"
"Cargo.toml"
"Cargo.lock"
]);
};
cargoLock.lockFile = "${finalAttrs.src}/Cargo.lock";
enableParallelBuilding = true;
meta = {
description = "Ergonomic Nix CLI helper";
maintainers = with lib.licenses; [NotAShelf];
};
})

19
nix/shell.nix Normal file
View file

@ -0,0 +1,19 @@
{
mkShell,
rust-analyzer,
rustfmt,
clippy,
cargo,
rustPlatform,
}:
mkShell {
name = "rust";
packages = [
rust-analyzer
rustfmt
clippy
cargo
];
RUST_SRC_PATH = "${rustPlatform.rustLibSrc}";
}