2026-06-28 10:14:56 -07:00
|
|
|
{
|
|
|
|
|
inputs = {
|
2026-10-07 18:29:35 -07:00
|
|
|
nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst";
|
2026-06-28 10:14:56 -07:00
|
|
|
|
|
|
|
|
crane.url = "github:ipetkov/crane";
|
|
|
|
|
|
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
outputs =
|
|
|
|
|
inputs:
|
|
|
|
|
inputs.flake-utils.lib.eachDefaultSystem (
|
|
|
|
|
system:
|
|
|
|
|
let
|
|
|
|
|
pkgs = import inputs.nixpkgs { inherit system; };
|
|
|
|
|
lib = pkgs.lib;
|
|
|
|
|
craneLib = inputs.crane.mkLib pkgs;
|
|
|
|
|
|
|
|
|
|
cargoToml = fromTOML (builtins.readFile ./Cargo.toml);
|
|
|
|
|
name = cargoToml.package.name;
|
|
|
|
|
|
2026-07-31 14:19:53 -07:00
|
|
|
dlDeps =
|
|
|
|
|
with pkgs;
|
|
|
|
|
[
|
|
|
|
|
# needed for both x11 and wayland
|
|
|
|
|
libxkbcommon
|
|
|
|
|
libGL
|
2026-07-31 09:55:08 -07:00
|
|
|
|
2026-07-31 14:19:53 -07:00
|
|
|
libx11
|
|
|
|
|
libxcursor
|
|
|
|
|
libxi
|
|
|
|
|
libxcb
|
|
|
|
|
]
|
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isLinux [
|
|
|
|
|
# libdbus, for rfd
|
|
|
|
|
dbus.lib
|
2026-06-28 10:14:56 -07:00
|
|
|
|
2026-07-31 14:19:53 -07:00
|
|
|
vulkan-loader
|
|
|
|
|
wayland
|
|
|
|
|
];
|
2026-06-28 10:14:56 -07:00
|
|
|
|
|
|
|
|
commonArgs = {
|
|
|
|
|
# all that's needed for artifacts and checks
|
|
|
|
|
nativeBuildInputs = with pkgs; [
|
2026-07-02 15:57:29 -07:00
|
|
|
pkg-config
|
2026-06-28 10:14:56 -07:00
|
|
|
];
|
|
|
|
|
buildInputs = with pkgs; [
|
2026-07-27 22:09:25 -07:00
|
|
|
dav1d
|
2026-06-28 10:14:56 -07:00
|
|
|
];
|
|
|
|
|
|
2026-07-01 09:15:32 -07:00
|
|
|
src = ./.;
|
2026-06-28 10:14:56 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# Build *just* the cargo dependencies,
|
|
|
|
|
# to reuse them for build and test derivations.
|
|
|
|
|
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
|
|
|
|
|
|
|
|
|
# Build the actual crate itself,
|
|
|
|
|
# reusing the dependency artifacts from above.
|
|
|
|
|
crate =
|
|
|
|
|
let
|
|
|
|
|
desktopItem = pkgs.makeDesktopItem {
|
|
|
|
|
inherit name;
|
|
|
|
|
desktopName = name;
|
|
|
|
|
icon = name;
|
|
|
|
|
exec = name;
|
2026-07-01 07:22:44 -07:00
|
|
|
mimeTypes = [
|
|
|
|
|
"image/png"
|
|
|
|
|
"image/jpeg"
|
|
|
|
|
"image/gif"
|
|
|
|
|
"image/webp"
|
|
|
|
|
"image/avif"
|
2026-07-02 15:57:29 -07:00
|
|
|
"image/jxl"
|
2026-07-01 07:22:44 -07:00
|
|
|
"image/tiff"
|
|
|
|
|
"image/bmp"
|
|
|
|
|
"image/vnd.microsoft.icon" # .ico
|
2026-07-30 23:54:37 -07:00
|
|
|
"application/x-krita"
|
2026-08-14 11:36:40 -07:00
|
|
|
"image/svg+xml"
|
2026-07-01 07:22:44 -07:00
|
|
|
];
|
2026-06-28 10:14:56 -07:00
|
|
|
};
|
|
|
|
|
in
|
|
|
|
|
craneLib.buildPackage (
|
|
|
|
|
commonArgs
|
|
|
|
|
// {
|
|
|
|
|
inherit cargoArtifacts;
|
|
|
|
|
|
2026-07-31 09:55:08 -07:00
|
|
|
nativeBuildInputs = commonArgs.nativeBuildInputs ++ [
|
|
|
|
|
pkgs.autoPatchelfHook
|
|
|
|
|
];
|
2026-06-28 10:14:56 -07:00
|
|
|
|
2026-07-31 09:55:08 -07:00
|
|
|
buildInputs = commonArgs.buildInputs ++ [
|
|
|
|
|
pkgs.libgcc
|
|
|
|
|
];
|
2026-06-28 10:14:56 -07:00
|
|
|
|
|
|
|
|
runtimeDependencies = dlDeps;
|
|
|
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
|
mkdir -p "$out/share/applications"
|
|
|
|
|
ln -s "${desktopItem}"/share/applications/* "$out/share/applications/"
|
|
|
|
|
'';
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
in
|
|
|
|
|
{
|
|
|
|
|
packages.default = crate;
|
|
|
|
|
|
|
|
|
|
checks = {
|
|
|
|
|
crate-clippy = craneLib.cargoClippy (
|
|
|
|
|
commonArgs
|
|
|
|
|
// {
|
|
|
|
|
inherit cargoArtifacts;
|
|
|
|
|
|
|
|
|
|
cargoClippyExtraArgs = "-- --deny warnings";
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
devShells.default = craneLib.devShell {
|
2026-07-31 00:05:48 -07:00
|
|
|
LD_LIBRARY_PATH = lib.makeLibraryPath dlDeps;
|
2026-06-28 10:14:56 -07:00
|
|
|
|
|
|
|
|
inputsFrom = [ crate ];
|
|
|
|
|
packages = [ pkgs.rust-analyzer ];
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|