build: dendritic flake, devShell and crate skeleton

This commit is contained in:
elwrcl committed 2026-09-29 23:24:36 +03:00
1 parent fbdc8da28f
commit d69049d97c
10 files changed
+1587

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
{ ... }:
{
perSystem =
{ pkgs, self', ... }:
{
devShells.default = pkgs.mkShell {
inputsFrom = [ self'.packages.default ];
packages = with pkgs; [
cargo-nextest
clippy
rust-analyzer
rustfmt
# Manual verification: grim is the pixel oracle, magick compares.
grim
imagemagick
wayland-utils
];
# The repo is a path: flake, so Nix copies the whole tree on every
# evaluation. Keep the multi-gigabyte target dir out of it.
shellHook = ''
export CARGO_TARGET_DIR="''${XDG_CACHE_HOME:-$HOME/.cache}/valw/target"
'';
};
};
}
+22
View File
@@ -0,0 +1,22 @@
{ ... }:
{
perSystem =
{ pkgs, ... }:
{
formatter = pkgs.writeShellApplication {
name = "nixfmt-tree";
runtimeInputs = [
pkgs.nixfmt
pkgs.fd
pkgs.findutils
];
text = ''
if [ "$#" -eq 0 ]; then
set -- .
fi
fd --type f --extension nix --hidden --exclude .jj . "$@" \
| xargs -r nixfmt
'';
};
};
}
+40
View File
@@ -0,0 +1,40 @@
{ ... }:
{
perSystem =
{ pkgs, lib, ... }:
{
packages.default = pkgs.rustPlatform.buildRustPackage {
pname = "valw";
version = "0.1.0";
src = lib.cleanSourceWith {
src = ../.;
filter =
path: _type:
!(builtins.elem (baseNameOf path) [
".direnv"
".jj"
"result"
"target"
]);
};
cargoLock.lockFile = ../Cargo.lock;
nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs = [
pkgs.libxkbcommon
pkgs.wayland
];
# Tests run through `nix flake check` instead.
doCheck = false;
meta = {
description = "macOS-style screenshots for niri";
mainProgram = "valw";
platforms = lib.platforms.linux;
};
};
};
}