forgejo-lts: 7.0.10 -> 7.0.11
[NixPkgs.git] / pkgs / by-name / co / cosmic-comp / package.nix
blob141f1bcfaa25e7997da0506f7995ebea0dbaffcc
1 { lib
2 , stdenv
3 , rustPlatform
4 , fetchFromGitHub
5 , makeBinaryWrapper
6 , pixman
7 , pkg-config
8 , libinput
9 , libglvnd
10 , libxkbcommon
11 , mesa
12 , seatd
13 , udev
14 , xwayland
15 , wayland
16 , xorg
17 , useXWayland ? true
18 , systemd
19 , useSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
22 rustPlatform.buildRustPackage rec {
23   pname = "cosmic-comp";
24   version = "1.0.0-alpha.2";
26   src = fetchFromGitHub {
27     owner = "pop-os";
28     repo = "cosmic-comp";
29     rev = "epoch-${version}";
30     hash = "sha256-IbGMp+4nRg4v5yRvp3ujGx7+nJ6wJmly6dZBXbQAnr8=";
31   };
33   cargoLock = {
34     lockFile = ./Cargo.lock;
35     outputHashes = {
36       "atomicwrites-0.4.2" = "sha256-QZSuGPrJXh+svMeFWqAXoqZQxLq/WfIiamqvjJNVhxA=";
37       "clipboard_macos-0.1.0" = "sha256-cG5vnkiyDlQnbEfV2sPbmBYKv1hd3pjJrymfZb8ziKk=";
38       "cosmic-config-0.1.0" = "sha256-MZLjSIhPz+cpaSHA1R1S+9FD60ys+tHaJ+2Cz+2B/uE=";
39       "cosmic-protocols-0.1.0" = "sha256-6XM6kcM2CEGAziCkal4uO0EL1nEWOKb3rFs7hFh6r7Y=";
40       "cosmic-settings-config-0.1.0" = "sha256-j4tAclYoenNM+iBwk8iHOj4baIXc4wkclPl5RZsADGI=";
41       "cosmic-text-0.12.1" = "sha256-3opGta6Co8l+hIQRVGkfSy6IqJXq/N8ZzqF+YGQADmI=";
42       "d3d12-0.19.0" = "sha256-usrxQXWLGJDjmIdw1LBXtBvX+CchZDvE8fHC0LjvhD4=";
43       "glyphon-0.5.0" = "sha256-j1HrbEpUBqazWqNfJhpyjWuxYAxkvbXzRKeSouUoPWg=";
44       "iced-0.12.0" = "sha256-1RSl5Zd6pkSdAD0zkjL8mzgBbCuc0AE564uI8zrNCyc=";
45       "id_tree-1.8.0" = "sha256-uKdKHRfPGt3vagOjhnri3aYY5ar7O3rp2/ivTfM2jT0=";
46       "smithay-0.3.0" = "sha256-vep0/Hv1E5YvnHFV91+4Y3CTxOYCAndEnguw/XJ3sNM=";
47       "smithay-clipboard-0.8.0" = "sha256-4InFXm0ahrqFrtNLeqIuE3yeOpxKZJZx+Bc0yQDtv34=";
48       "smithay-egui-0.1.0" = "sha256-i8Rlo221v8G7QUAVVBtBNdOtQv1Drv2oj+EhTBak25g=";
49       "softbuffer-0.4.1" = "sha256-a0bUFz6O8CWRweNt/OxTvflnPYwO5nm6vsyc/WcXyNg=";
50       "taffy-0.3.11" = "sha256-SCx9GEIJjWdoNVyq+RZAGn0N71qraKZxf9ZWhvyzLaI=";
51     };
52   };
54   separateDebugInfo = true;
56   nativeBuildInputs = [ makeBinaryWrapper pkg-config ];
57   buildInputs = [
58       libglvnd
59       libinput
60       libxkbcommon
61       mesa
62       pixman
63       seatd
64       udev
65       wayland
66     ] ++ lib.optional useSystemd systemd;
68   # Only default feature is systemd
69   buildNoDefaultFeatures = !useSystemd;
71   # Force linking to libEGL, which is always dlopen()ed, and to
72   # libwayland-client, which is always dlopen()ed except by the
73   # obscure winit backend.
74   RUSTFLAGS = map (a: "-C link-arg=${a}") [
75     "-Wl,--push-state,--no-as-needed"
76     "-lEGL"
77     "-lwayland-client"
78     "-Wl,--pop-state"
79   ];
81   makeFlags = [
82     "prefix=$(out)"
83     "CARGO_TARGET_DIR=target/${stdenv.hostPlatform.rust.cargoShortTarget}"
84   ];
86   dontCargoInstall = true;
88   # These libraries are only used by the X11 backend, which will not
89   # be the common case, so just make them available, don't link them.
90   postInstall = ''
91     wrapProgramArgs=(--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [
92         xorg.libX11 xorg.libXcursor xorg.libXi
93     ]})
94   '' + lib.optionalString useXWayland ''
95     wrapProgramArgs+=(--prefix PATH : ${lib.makeBinPath [ xwayland ]})
96   '' + ''
97     wrapProgram $out/bin/cosmic-comp "''${wrapProgramArgs[@]}"
98   '';
100   meta = with lib; {
101     homepage = "https://github.com/pop-os/cosmic-comp";
102     description = "Compositor for the COSMIC Desktop Environment";
103     mainProgram = "cosmic-comp";
104     license = licenses.gpl3Only;
105     maintainers = with maintainers; [ qyliss nyabinary ];
106     platforms = platforms.linux;
107   };