nixpkgs/pkgs/by-name/co/cosmic-session/package.nix
2024-09-25 19:28:43 +02:00

67 lines
1.8 KiB
Nix

{
lib,
fetchFromGitHub,
bash,
rustPlatform,
just,
dbus,
stdenv,
xdg-desktop-portal-cosmic,
}:
rustPlatform.buildRustPackage rec {
pname = "cosmic-session";
version = "1.0.0-alpha.2";
src = fetchFromGitHub {
owner = "pop-os";
repo = "cosmic-session";
rev = "epoch-${version}";
hash = "sha256-rkzcu5lXKVQ5RfilcKQjTzeKZv+FpqrtARZgGGlYKK4=";
};
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"cosmic-notifications-util-0.1.0" = "sha256-GmTT7SFBqReBMe4GcNSym1YhsKtFQ/0hrDcwUqXkaBw=";
"launch-pad-0.1.0" = "sha256-c+uawTQlg5SW8x7DOBG2Idv/AfIaCFNtLQLUz8ifT2I=";
};
};
postPatch = ''
substituteInPlace Justfile \
--replace-fail '{{cargo-target-dir}}/release/cosmic-session' 'target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/cosmic-session'
substituteInPlace data/start-cosmic \
--replace-fail '/usr/bin/cosmic-session' "${placeholder "out"}/bin/cosmic-session" \
--replace-fail '/usr/bin/dbus-run-session' "${lib.getBin dbus}/bin/dbus-run-session"
substituteInPlace data/cosmic.desktop \
--replace-fail '/usr/bin/start-cosmic' "${placeholder "out"}/bin/start-cosmic"
'';
buildInputs = [ bash ];
nativeBuildInputs = [ just ];
dontUseJustBuild = true;
justFlags = [
"--set"
"prefix"
(placeholder "out")
];
env.XDP_COSMIC = lib.getExe xdg-desktop-portal-cosmic;
passthru.providedSessions = [ "cosmic" ];
meta = with lib; {
homepage = "https://github.com/pop-os/cosmic-session";
description = "Session manager for the COSMIC desktop environment";
license = licenses.gpl3Only;
mainProgram = "cosmic-session";
maintainers = with maintainers; [
a-kenji
nyabinary
];
platforms = platforms.linux;
};
}