|
1 | 1 | { |
2 | 2 | lib, |
3 | 3 | stdenv, |
| 4 | + stdenvAdapters, |
4 | 5 | fetchFromGitHub, |
5 | 6 | rustPlatform, |
6 | 7 | cmake, |
7 | | - makeBinaryWrapper, |
8 | | - cosmic-icons, |
9 | | - cosmic-randr, |
10 | 8 | just, |
| 9 | + libcosmicAppHook, |
11 | 10 | pkg-config, |
12 | | - libxkbcommon, |
| 11 | + expat, |
13 | 12 | libinput, |
14 | 13 | fontconfig, |
15 | 14 | freetype, |
16 | | - wayland, |
17 | | - expat, |
| 15 | + pipewire, |
| 16 | + pulseaudio, |
18 | 17 | udev, |
19 | 18 | util-linux, |
| 19 | + cosmic-randr, |
| 20 | + xkeyboard_config, |
| 21 | + nix-update-script, |
| 22 | + |
| 23 | + withMoldLinker ? stdenv.targetPlatform.isLinux, |
20 | 24 | }: |
| 25 | +let |
| 26 | + libcosmicAppHook' = (libcosmicAppHook.__spliced.buildHost or libcosmicAppHook).override { |
| 27 | + includeSettings = false; |
| 28 | + }; |
| 29 | +in |
| 30 | +rustPlatform.buildRustPackage.override |
| 31 | + { stdenv = if withMoldLinker then stdenvAdapters.useMoldLinker stdenv else stdenv; } |
| 32 | + (finalAttrs: { |
| 33 | + pname = "cosmic-settings"; |
| 34 | + version = "1.0.0-alpha.6"; |
21 | 35 |
|
22 | | -rustPlatform.buildRustPackage rec { |
23 | | - pname = "cosmic-settings"; |
24 | | - version = "1.0.0-alpha.1"; |
| 36 | + src = fetchFromGitHub { |
| 37 | + owner = "pop-os"; |
| 38 | + repo = "cosmic-settings"; |
| 39 | + tag = "epoch-${finalAttrs.version}"; |
| 40 | + hash = "sha256-UKg3TIpyaqtynk6wLFFPpv69F74hmqfMVPra2+iFbvE="; |
| 41 | + }; |
25 | 42 |
|
26 | | - src = fetchFromGitHub { |
27 | | - owner = "pop-os"; |
28 | | - repo = "cosmic-settings"; |
29 | | - rev = "epoch-${version}"; |
30 | | - hash = "sha256-gTzZvhj7oBuL23dtedqfxUCT413eMoDc0rlNeqCeZ6E="; |
31 | | - }; |
| 43 | + useFetchCargoVendor = true; |
| 44 | + cargoHash = "sha256-mf/Cw3/RLrCYgsk7JKCU2+oPn1VPbD+4JzkUmbd47m8="; |
32 | 45 |
|
33 | | - useFetchCargoVendor = true; |
34 | | - cargoHash = "sha256-zMHJc6ytbOoi9E47Zsg6zhbQKObsaOtVHuPnLAu36I4="; |
| 46 | + nativeBuildInputs = [ |
| 47 | + cmake |
| 48 | + just |
| 49 | + libcosmicAppHook' |
| 50 | + pkg-config |
| 51 | + rustPlatform.bindgenHook |
| 52 | + util-linux |
| 53 | + ]; |
35 | 54 |
|
36 | | - postPatch = '' |
37 | | - substituteInPlace justfile --replace '#!/usr/bin/env' "#!$(command -v env)" |
38 | | - ''; |
| 55 | + buildInputs = [ |
| 56 | + expat |
| 57 | + fontconfig |
| 58 | + freetype |
| 59 | + libinput |
| 60 | + pipewire |
| 61 | + pulseaudio |
| 62 | + udev |
| 63 | + ]; |
39 | 64 |
|
40 | | - nativeBuildInputs = [ |
41 | | - cmake |
42 | | - just |
43 | | - pkg-config |
44 | | - makeBinaryWrapper |
45 | | - ]; |
46 | | - buildInputs = [ |
47 | | - libxkbcommon |
48 | | - libinput |
49 | | - fontconfig |
50 | | - freetype |
51 | | - wayland |
52 | | - expat |
53 | | - udev |
54 | | - util-linux |
55 | | - ]; |
| 65 | + dontUseJustBuild = true; |
| 66 | + dontUseJustCheck = true; |
56 | 67 |
|
57 | | - dontUseJustBuild = true; |
| 68 | + justFlags = [ |
| 69 | + "--set" |
| 70 | + "prefix" |
| 71 | + (placeholder "out") |
| 72 | + "--set" |
| 73 | + "bin-src" |
| 74 | + "target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/cosmic-settings" |
| 75 | + ]; |
58 | 76 |
|
59 | | - justFlags = [ |
60 | | - "--set" |
61 | | - "prefix" |
62 | | - (placeholder "out") |
63 | | - "--set" |
64 | | - "bin-src" |
65 | | - "target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/cosmic-settings" |
66 | | - ]; |
| 77 | + env."CARGO_TARGET_${stdenv.hostPlatform.rust.cargoEnvVarTarget}_RUSTFLAGS" = |
| 78 | + lib.optionalString withMoldLinker "-C link-arg=-fuse-ld=mold"; |
67 | 79 |
|
68 | | - postInstall = '' |
69 | | - wrapProgram "$out/bin/cosmic-settings" \ |
70 | | - --prefix PATH : ${lib.makeBinPath [ cosmic-randr ]} \ |
71 | | - --suffix XDG_DATA_DIRS : "$out/share:${cosmic-icons}/share" |
72 | | - ''; |
| 80 | + preFixup = '' |
| 81 | + libcosmicAppWrapperArgs+=( |
| 82 | + --prefix PATH : ${lib.makeBinPath [ cosmic-randr ]} |
| 83 | + --set-default X11_BASE_RULES_XML ${xkeyboard_config}/share/X11/xkb/rules/base.xml |
| 84 | + --set-default X11_BASE_EXTRA_RULES_XML ${xkeyboard_config}/share/X11/xkb/rules/extra.xml |
| 85 | + ) |
| 86 | + ''; |
73 | 87 |
|
74 | | - meta = with lib; { |
75 | | - homepage = "https://github.com/pop-os/cosmic-settings"; |
76 | | - description = "Settings for the COSMIC Desktop Environment"; |
77 | | - license = licenses.gpl3Only; |
78 | | - maintainers = with maintainers; [ nyabinary ]; |
79 | | - platforms = platforms.linux; |
80 | | - mainProgram = "cosmic-settings"; |
81 | | - }; |
82 | | -} |
| 88 | + passthru.updateScript = nix-update-script { |
| 89 | + extraArgs = [ |
| 90 | + "--version" |
| 91 | + "unstable" |
| 92 | + "--version-regex" |
| 93 | + "epoch-(.*)" |
| 94 | + ]; |
| 95 | + }; |
| 96 | + |
| 97 | + meta = { |
| 98 | + description = "Settings for the COSMIC Desktop Environment"; |
| 99 | + homepage = "https://github.com/pop-os/cosmic-settings"; |
| 100 | + license = lib.licenses.gpl3Only; |
| 101 | + mainProgram = "cosmic-settings"; |
| 102 | + maintainers = with lib.maintainers; [ |
| 103 | + nyabinary |
| 104 | + HeitorAugustoLN |
| 105 | + ]; |
| 106 | + platforms = lib.platforms.linux; |
| 107 | + }; |
| 108 | + }) |
0 commit comments