nix: package with flakes; simplify devshell

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ia37044debea91a1db3d944a0c74f66356a6a6964
This commit is contained in:
raf 2026-04-06 13:12:30 +03:00
commit 0fc6b177cc
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
6 changed files with 115 additions and 15 deletions

30
nix/package.nix Normal file
View file

@ -0,0 +1,30 @@
{
lib,
rustPlatform,
}:
rustPlatform.buildRustPackage {
pname = "lychee";
version = "1.0.0";
src = let
fs = lib.fileset;
s = ../.;
in
fs.toSource {
root = s;
fileset = fs.unions [
(s + /crates)
(s + /Cargo.lock)
(s + /Cargo.toml)
];
};
cargoLock.lockFile = ../Cargo.lock;
enableParallelBuilding = true;
meta = {
description = "Simple, opinionated image viewer for Wayland";
maintainers = with lib.maintainers; [NotAShelf];
license = lib.licenses.mpl20;
};
}

33
nix/shell.nix Normal file
View file

@ -0,0 +1,33 @@
{
lib,
mkShell,
cargo,
rustfmt,
clippy,
taplo,
pkg-config,
wayland,
libxkbcommon,
}: let
runtimeDeps = [
libxkbcommon
wayland
];
in
mkShell {
name = "rust";
strictDeps = true;
nativeBuildInputs = [
pkg-config
cargo
clippy
(rustfmt.override {asNightly = true;})
taplo
];
buildInputs = runtimeDeps;
env.LD_LIBRARY_PATH = "$LD_LIBRARY_PATH:${lib.makeLibraryPath runtimeDeps}";
}