spot/flake.nix
2024-11-14 09:44:40 +01:00

91 lines
2.2 KiB
Nix

{
description = "A GUI for yt-dlp written in Rust";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs?ref=nixpkgs-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
flake-utils,
crane,
rust-overlay,
...
}:
flake-utils.lib.eachDefaultSystem (system:
let
craneLib = (crane.mkLib nixpkgs.legacyPackages.${system});
pkgs = import nixpkgs { inherit system; overlays = [ rust-overlay.overlays.default ]; };
nativeBuildInputs = with pkgs; [
gettext
meson
ninja
pkg-config
gtk4 # for gtk-update-icon-cache
glib # for glib-compile-schemas
desktop-file-utils
cargo
rustPlatform.cargoSetupHook
rustc
wrapGAppsHook4
blueprint-compiler
];
buildInputs = with pkgs; [
glib
gtk4
libadwaita
libhandy
openssl
alsa-lib
libpulseaudio
gst_all_1.gst-plugins-base
gst_all_1.gstreamer
];
cargoArtifacts = craneLib.buildDepsOnly ({
src = craneLib.cleanCargoSource (craneLib.path ./.);
inherit buildInputs nativeBuildInputs;
pname = "spot";
});
in with pkgs; {
packages = rec {
spot = craneLib.buildPackage {
src = craneLib.path ./.;
cargoHash = "";
inherit buildInputs nativeBuildInputs cargoArtifacts;
};
default = spot;
};
devShells.default = mkShell {
inherit buildInputs nativeBuildInputs;
packages = with pkgs; [
(rust-bin.stable.latest.default.override {
extensions = [ "rust-src" "rust-analyzer" ];
})
meson
ninja
cargo
];
};
}) // {
overlays.default = final: prev: {
inherit (self.packages.${final.system}) spot;
};
};
}