{ lib , stdenv , fetchFromGitHub , rustPlatform , just , pkg-config , makeBinaryWrapper , libxkbcommon , wayland }: rustPlatform.buildRustPackage rec { pname = "cosmic-bg"; version = "1.0.0-alpha.2"; src = fetchFromGitHub { owner = "pop-os"; repo = pname; rev = "epoch-${version}"; hash = "sha256-lAFAZBo5FnXgJV3MrZhaYmBxqtH1E7+Huj53ho/hPik="; }; cargoLock = { lockFile = ./Cargo.lock; outputHashes = { "atomicwrites-0.4.2" = "sha256-QZSuGPrJXh+svMeFWqAXoqZQxLq/WfIiamqvjJNVhxA="; "clipboard_macos-0.1.0" = "sha256-cG5vnkiyDlQnbEfV2sPbmBYKv1hd3pjJrymfZb8ziKk="; "cosmic-config-0.1.0" = "sha256-mdRRfXLyDBYQIPmbuXgXGoOKUlyw6CiSmOUBz1b3vJY="; "smithay-clipboard-0.8.0" = "sha256-4InFXm0ahrqFrtNLeqIuE3yeOpxKZJZx+Bc0yQDtv34="; }; }; postPatch = '' substituteInPlace justfile --replace-fail '#!/usr/bin/env' "#!$(command -v env)" ''; nativeBuildInputs = [ just pkg-config makeBinaryWrapper ]; buildInputs = [ libxkbcommon wayland ]; dontUseJustBuild = true; justFlags = [ "--set" "prefix" (placeholder "out") "--set" "bin-src" "target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/cosmic-bg" ]; postInstall = '' wrapProgram $out/bin/cosmic-bg \ --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [wayland]}" ''; meta = with lib; { homepage = "https://github.com/pop-os/cosmic-bg"; description = "Applies Background for the COSMIC Desktop Environment"; license = licenses.mpl20; maintainers = with maintainers; [ nyabinary ]; platforms = platforms.linux; mainProgram = "cosmic-bg"; }; }