nix: init tooling

This commit is contained in:
raf 2025-05-24 23:16:00 +03:00
commit b865832523
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
5 changed files with 100 additions and 0 deletions

28
nix/package.nix Normal file
View file

@ -0,0 +1,28 @@
{
lib,
rustPlatform,
}: let
fs = lib.fileset;
in
rustPlatform.buildRustPackage (finalAttrs: {
pname = "nff";
version = "0.1.0";
src = fs.toSource {
root = ../.;
fileset = fs.unions [
(fs.fileFilter (file: builtins.any file.hasExt ["rs"]) ../src)
../Cargo.lock
../Cargo.toml
];
};
cargoLock.lockFile = "${finalAttrs.src}/Cargo.lock";
useFetchCargoVendor = true;
enableParallelBuilding = true;
meta = {
description = "Experimental nftables ruleset formatter and prettier";
mainProgram = "nff";
};
})

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}";
}