nixpkgs/pkgs/by-name/co/cosmic-edit/package.nix

109 lines
3.0 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
rustPlatform,
cmake,
makeBinaryWrapper,
cosmic-icons,
glib,
gtk3,
just,
pkg-config,
libglvnd,
libxkbcommon,
libinput,
fontconfig,
freetype,
mesa,
wayland,
xorg,
vulkan-loader,
}:
rustPlatform.buildRustPackage rec {
pname = "cosmic-edit";
version = "0-unstable-2024-01-19";
src = fetchFromGitHub {
owner = "pop-os";
repo = pname;
rev = "b97eb0603bf6c7e168fc6e17aa779af1f105b9ee";
hash = "sha256-oprqM3QTewC/L/KOQ4uT81dPLqjP+Kp+wxgkY8l1Nc8=";
};
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"accesskit-0.11.0" = "sha256-xVhe6adUb8VmwIKKjHxwCwOo5Y1p3Or3ylcJJdLDrrE=";
"atomicwrites-0.4.2" = "sha256-QZSuGPrJXh+svMeFWqAXoqZQxLq/WfIiamqvjJNVhxA=";
"cosmic-config-0.1.0" = "sha256-PR6u2DT+HneMSFszfg0sZK7oLwsOX4YtpUP88KWHy68=";
"cosmic-syntax-theme-0.1.0" = "sha256-9Vf2s5Ry2hco80EbXOuVLwvOWygRiuaRD4tTImWooSg=";
"cosmic-text-0.10.0" = "sha256-WxT0LPXu17jb0XpuCu2PjlGTV1a0K1HMhl6WpciKMkM=";
"glyphon-0.4.1" = "sha256-mwJXi63LTBIVFrFcywr/NeOJKfMjQaQkNl3CSdEgrZc=";
"sctk-adwaita-0.5.4" = "sha256-yK0F2w/0nxyKrSiHZbx7+aPNY2vlFs7s8nu/COp2KqQ=";
"softbuffer-0.3.3" = "sha256-eKYFVr6C1+X6ulidHIu9SP591rJxStxwL9uMiqnXx4k=";
"smithay-client-toolkit-0.16.1" = "sha256-z7EZThbh7YmKzAACv181zaEZmWxTrMkFRzP0nfsHK6c=";
"systemicons-0.7.0" = "sha256-zzAI+6mnpQOh+3mX7/sJ+w4a7uX27RduQ99PNxLNF78=";
"taffy-0.3.11" = "sha256-SCx9GEIJjWdoNVyq+RZAGn0N71qraKZxf9ZWhvyzLaI=";
"winit-0.28.6" = "sha256-FhW6d2XnXCGJUMoT9EMQew9/OPXiehy/JraeCiVd76M=";
};
};
postPatch = ''
substituteInPlace justfile --replace '#!/usr/bin/env' "#!$(command -v env)"
'';
nativeBuildInputs = [ just pkg-config makeBinaryWrapper ];
buildInputs = [
libxkbcommon
glib
gtk3
xorg.libX11
libinput
libglvnd
fontconfig
freetype
wayland
vulkan-loader
];
dontUseJustBuild = true;
justFlags = [
"--set"
"prefix"
(placeholder "out")
"--set"
"bin-src"
"target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/cosmic-edit"
];
# Force linking to libEGL, which is always dlopen()ed, and to
# libwayland-client, which is always dlopen()ed except by the
# obscure winit backend.
RUSTFLAGS = map (a: "-C link-arg=${a}") [
"-Wl,--push-state,--no-as-needed"
"-lEGL"
"-lwayland-client"
"-Wl,--pop-state"
];
# LD_LIBRARY_PATH can be removed once tiny-xlib is bumped above 0.2.2
postInstall = ''
wrapProgram "$out/bin/${pname}" \
--suffix XDG_DATA_DIRS : "${cosmic-icons}/share" \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [
xorg.libX11 xorg.libXcursor xorg.libXi xorg.libXrandr vulkan-loader mesa.drivers
]}
'';
meta = with lib; {
homepage = "https://github.com/pop-os/cosmic-edit";
description = "Text Editor for the COSMIC Desktop Environment";
license = licenses.gpl3Only;
maintainers = with maintainers; [ ahoneybun nyanbinary ];
platforms = platforms.linux;
};
}