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

+2
View File
@@ -0,0 +1,2 @@
watch_file nix/*.ulu.nix
use flake
+11
View File
@@ -0,0 +1,11 @@
/*
!/.gitignore
!/.envrc
!/flake.nix
!/flake.lock
!/Cargo.toml
!/Cargo.lock
!/nix/
!/src/
!/docs/
!/README.md
Generated
+1363
View File
File diff suppressed because it is too large. Load diff
+32
View File
@@ -0,0 +1,32 @@
[package]
name = "valw"
version = "0.1.0"
edition = "2024"
description = "macOS-style screenshots for niri"
license = "MIT"
[dependencies]
anyhow = "1.0.104"
chrono = "0.4.45"
clap = { version = "4.6.7", features = ["derive"] }
image = { version = "0.25.10", default-features = false, features = ["png"] }
libc = "0.2.189"
niri-ipc = "=26.4.0"
rustix = { version = "1.1.5", features = ["event", "fs", "pipe", "process", "stdio"] }
serde = { version = "1.0.229", features = ["derive"] }
serde_ignored = "0.1.14"
smithay-client-toolkit = "0.21.1"
toml = "1.1.6"
tracing = "0.1.44"
tracing-subscriber = { version = "0.3.23", features = ["env-filter"] }
wayland-client = "0.31.15"
wayland-protocols = { version = "0.32.13", features = ["client", "staging"] }
wayland-protocols-wlr = { version = "0.3.12", features = ["client"] }
wl-clipboard-rs = "0.9.4"
[dev-dependencies]
tempfile = "3.27.0"
# Image encoding is painfully slow unoptimised; keep dev builds usable.
[profile.dev.package."*"]
opt-level = 3
Generated
+48
View File
@@ -0,0 +1,48 @@
{
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1788450739,
"narHash": "sha256-glZLQlzIn1fXH6PazR2iUmTo7kzzyYSshrWhLS9TqCU=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "31729ca8cbdb4fa927b34e5f4353e6a83f39e993",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1790578696,
"narHash": "sha256-ZoxIApko70jCdbH3l20HWXOBaT2HZd87orzd2yJ9dVE=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "7a0f122f5090cf4c2ade2a13a0e229d4e19ba71f",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
+30
View File
@@ -0,0 +1,30 @@
{
description = "valw, macOS-style screenshots for niri";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
};
outputs =
inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } (
{ lib, ... }:
let
inherit (lib.filesystem) listFilesRecursive;
inherit (lib.lists) filter;
inherit (lib.strings) hasSuffix;
in
{
systems = [
"x86_64-linux"
"aarch64-linux"
];
imports = filter (hasSuffix ".ulu.nix") (listFilesRecursive ./nix);
}
);
}
+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;
};
};
};
}
+12
View File
@@ -0,0 +1,12 @@
// Modules land before the CLI uses them; Task 11 removes this.
#![allow(dead_code)]
use clap::Parser;
#[derive(Parser)]
#[command(version, about = "macOS-style screenshots for niri")]
struct Cli {}
fn main() {
Cli::parse();
}