vifm: 0.13 -> 0.14 (#380559)
[NixPkgs.git] / pkgs / by-name / co / cosmic-comp / package.nix
blob1c0bf7489aefe030eef703ce0fbce35585dc86e7
2   lib,
3   stdenv,
4   rustPlatform,
5   fetchFromGitHub,
6   makeBinaryWrapper,
7   pixman,
8   pkg-config,
9   libinput,
10   libglvnd,
11   libxkbcommon,
12   libgbm,
13   seatd,
14   udev,
15   xwayland,
16   wayland,
17   xorg,
18   useXWayland ? true,
19   systemd,
20   useSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd,
23 rustPlatform.buildRustPackage rec {
24   pname = "cosmic-comp";
25   version = "1.0.0-alpha.2";
27   src = fetchFromGitHub {
28     owner = "pop-os";
29     repo = "cosmic-comp";
30     rev = "epoch-${version}";
31     hash = "sha256-IbGMp+4nRg4v5yRvp3ujGx7+nJ6wJmly6dZBXbQAnr8=";
32   };
34   useFetchCargoVendor = true;
35   cargoHash = "sha256-4ahdQ0lQbG+lifGlsJE0yci4j8pR7tYVsMww9LyYyAA=";
37   separateDebugInfo = true;
39   nativeBuildInputs = [
40     makeBinaryWrapper
41     pkg-config
42   ];
43   buildInputs = [
44     libglvnd
45     libinput
46     libxkbcommon
47     libgbm
48     pixman
49     seatd
50     udev
51     wayland
52   ] ++ lib.optional useSystemd systemd;
54   # Only default feature is systemd
55   buildNoDefaultFeatures = !useSystemd;
57   # Force linking to libEGL, which is always dlopen()ed, and to
58   # libwayland-client, which is always dlopen()ed except by the
59   # obscure winit backend.
60   RUSTFLAGS = map (a: "-C link-arg=${a}") [
61     "-Wl,--push-state,--no-as-needed"
62     "-lEGL"
63     "-lwayland-client"
64     "-Wl,--pop-state"
65   ];
67   makeFlags = [
68     "prefix=$(out)"
69     "CARGO_TARGET_DIR=target/${stdenv.hostPlatform.rust.cargoShortTarget}"
70   ];
72   dontCargoInstall = true;
74   # These libraries are only used by the X11 backend, which will not
75   # be the common case, so just make them available, don't link them.
76   postInstall =
77     ''
78       wrapProgramArgs=(--prefix LD_LIBRARY_PATH : ${
79         lib.makeLibraryPath [
80           xorg.libX11
81           xorg.libXcursor
82           xorg.libXi
83         ]
84       })
85     ''
86     + lib.optionalString useXWayland ''
87       wrapProgramArgs+=(--prefix PATH : ${lib.makeBinPath [ xwayland ]})
88     ''
89     + ''
90       wrapProgram $out/bin/cosmic-comp "''${wrapProgramArgs[@]}"
91     '';
93   meta = with lib; {
94     homepage = "https://github.com/pop-os/cosmic-comp";
95     description = "Compositor for the COSMIC Desktop Environment";
96     mainProgram = "cosmic-comp";
97     license = licenses.gpl3Only;
98     maintainers = with maintainers; [
99       qyliss
100       nyabinary
101     ];
102     platforms = platforms.linux;
103   };