cosmic: sort package attributes into consistent order

Refactored cosmic packages to follow a consistent attribute sorting order

Signed-off-by: Kajus Naujokaitis <kajusn@gmail.com>
This commit is contained in:
Kajus Naujokaitis 2026-06-29 10:53:13 +03:00
commit 8bed1ba09d
No known key found for this signature in database
15 changed files with 64 additions and 66 deletions

View file

@ -32,8 +32,10 @@ rustPlatform.buildRustPackage (finalAttrs: {
cargoHash = "sha256-ki+unf58rXBCpj5PCpBcg/6FWo16+MdPQWae+w1YkJ8=";
separateDebugInfo = true;
# Only default feature is systemd
buildNoDefaultFeatures = !useSystemd;
separateDebugInfo = true;
__structuredAttrs = true;
nativeBuildInputs = [
@ -51,9 +53,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
]
++ lib.optional useSystemd systemd;
# Only default feature is systemd
buildNoDefaultFeatures = !useSystemd;
makeFlags = [
"prefix=${placeholder "out"}"
"CARGO_TARGET_DIR=target/${stdenv.hostPlatform.rust.cargoShortTarget}"

View file

@ -26,14 +26,13 @@ rustPlatform.buildRustPackage (finalAttrs: {
hash = "sha256-5DsnhaiJgmTakn+q9o2Q7IeuakAC/j0Ck3F3pfFx/EA=";
};
cargoHash = "sha256-2E+98uWtahyQufoZTzdUtkwbuISsUHwlqOmMSpyi1O8=";
separateDebugInfo = true;
postPatch = ''
substituteInPlace justfile --replace-fail '#!/usr/bin/env' "#!$(command -v env)"
'';
cargoHash = "sha256-2E+98uWtahyQufoZTzdUtkwbuISsUHwlqOmMSpyi1O8=";
separateDebugInfo = true;
__structuredAttrs = true;
nativeBuildInputs = [

View file

@ -26,6 +26,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
cargoHash = "sha256-mC19GLLHrjqYXl052HoNFscz9zzQWVBBm0OxzXoUd8U=";
separateDebugInfo = true;
__structuredAttrs = true;
nativeBuildInputs = [
libcosmicAppHook

View file

@ -29,16 +29,20 @@ rustPlatform.buildRustPackage (finalAttrs: {
hash = "sha256-oxXCAvBISkZu76VpvQ9AliFRJ8r5Ay7mjWf4sEwV0Xs=";
};
postPatch = ''
substituteInPlace src/greeter.rs --replace-fail '/usr/bin/env' '${lib.getExe' coreutils "env"}'
substituteInPlace src/greeter.rs --replace-fail '/usr/bin/orca' '${lib.getExe orca}'
'';
cargoHash = "sha256-mfY2hsMxBooRjmTB2jgUIKyKHBpGfZ9Qslwv+2aEQyg=";
separateDebugInfo = true;
env.VERGEN_GIT_SHA = finalAttrs.src.tag;
cargoBuildFlags = [ "--all" ];
separateDebugInfo = true;
__structuredAttrs = true;
env.VERGEN_GIT_SHA = finalAttrs.src.tag;
nativeBuildInputs = [
rustPlatform.bindgenHook
cmake
@ -66,11 +70,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
"target/${stdenv.hostPlatform.rust.cargoShortTarget}"
];
postPatch = ''
substituteInPlace src/greeter.rs --replace-fail '/usr/bin/env' '${lib.getExe' coreutils "env"}'
substituteInPlace src/greeter.rs --replace-fail '/usr/bin/orca' '${lib.getExe orca}'
'';
preFixup = ''
libcosmicAppWrapperArgs+=(
--prefix PATH : ${lib.makeBinPath [ cosmic-randr ]}

View file

@ -24,17 +24,17 @@ stdenvNoCC.mkDerivation (finalAttrs: {
nativeBuildInputs = [ just ];
propagatedBuildInputs = [
pop-icon-theme
hicolor-icon-theme
];
justFlags = [
"--set"
"prefix"
(placeholder "out")
];
propagatedBuildInputs = [
pop-icon-theme
hicolor-icon-theme
];
dontDropIconThemeCache = true;
passthru.updateScript = nix-update-script {

View file

@ -26,6 +26,10 @@ rustPlatform.buildRustPackage (finalAttrs: {
hash = "sha256-0tcrOfVT5b57ev3b5F2U78F2QPGFwp94bqFVNyKH0Yk=";
};
postPatch = ''
substituteInPlace src/main.rs --replace-fail '"/bin/sh"' '"${lib.getExe' bash "sh"}"'
'';
cargoHash = "sha256-wAjFC6qAC3nllbnZf0KVaZTEztNYo6GTvwcp5FYmXLw=";
separateDebugInfo = true;
@ -48,10 +52,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
"target/${stdenv.hostPlatform.rust.cargoShortTarget}"
];
postPatch = ''
substituteInPlace src/main.rs --replace-fail '"/bin/sh"' '"${lib.getExe' bash "sh"}"'
'';
passthru = {
tests = {
inherit (nixosTests)

View file

@ -24,9 +24,15 @@ rustPlatform.buildRustPackage (finalAttrs: {
hash = "sha256-UABqbmbwW2ZBOO7mq16/h0s55VCWRF2yyf/1TaubC88=";
};
cargoHash = "sha256-DESnl5NjakU4++Ep6CHxDZzHn+o0Gi0eREpXk5BN5iY=";
postPatch = ''
# Installs in $out/etc/xdg/autostart instead of /etc/xdg/autostart
substituteInPlace justfile \
--replace-fail \
"autostart-dst := rootdir / 'etc' / 'xdg' / 'autostart' / desktop-entry" \
"autostart-dst := prefix / 'etc' / 'xdg' / 'autostart' / desktop-entry"
'';
separateDebugInfo = true;
cargoHash = "sha256-DESnl5NjakU4++Ep6CHxDZzHn+o0Gi0eREpXk5BN5iY=";
buildFeatures = [ "nixos" ];
@ -38,8 +44,11 @@ rustPlatform.buildRustPackage (finalAttrs: {
# https://github.com/rust-secure-code/cargo-auditable/issues/225
auditable = false;
separateDebugInfo = true;
__structuredAttrs = true;
env.DISABLE_IF_EXISTS = "/iso/nix-store.squashfs";
nativeBuildInputs = [
libcosmicAppHook
just
@ -52,18 +61,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
udev
];
postPatch = ''
# Installs in $out/etc/xdg/autostart instead of /etc/xdg/autostart
substituteInPlace justfile \
--replace-fail \
"autostart-dst := rootdir / 'etc' / 'xdg' / 'autostart' / desktop-entry" \
"autostart-dst := prefix / 'etc' / 'xdg' / 'autostart' / desktop-entry"
'';
preFixup = ''
libcosmicAppWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ killall ]})
'';
dontUseJustBuild = true;
dontUseJustCheck = true;
@ -76,7 +73,9 @@ rustPlatform.buildRustPackage (finalAttrs: {
"target/${stdenv.hostPlatform.rust.cargoShortTarget}"
];
env.DISABLE_IF_EXISTS = "/iso/nix-store.squashfs";
preFixup = ''
libcosmicAppWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ killall ]})
'';
passthru = {
tests = {

View file

@ -26,6 +26,8 @@ rustPlatform.buildRustPackage (finalAttrs: {
separateDebugInfo = true;
__structuredAttrs = true;
env."CARGO_TARGET_${stdenv.hostPlatform.rust.cargoEnvVarTarget}_RUSTFLAGS" = "--cfg tokio_unstable";
nativeBuildInputs = [
just
libcosmicAppHook
@ -43,8 +45,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
"target/${stdenv.hostPlatform.rust.cargoShortTarget}"
];
env."CARGO_TARGET_${stdenv.hostPlatform.rust.cargoEnvVarTarget}_RUSTFLAGS" = "--cfg tokio_unstable";
passthru = {
tests = {
inherit (nixosTests)

View file

@ -30,6 +30,8 @@ rustPlatform.buildRustPackage (finalAttrs: {
separateDebugInfo = true;
__structuredAttrs = true;
env.POLKIT_AGENT_HELPER_1 = "/run/wrappers/bin/polkit-agent-helper-1";
nativeBuildInputs = [
just
libcosmicAppHook
@ -55,8 +57,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
"target/${stdenv.hostPlatform.rust.cargoShortTarget}"
];
env.POLKIT_AGENT_HELPER_1 = "/run/wrappers/bin/polkit-agent-helper-1";
passthru = {
tests = {
inherit (nixosTests)

View file

@ -1,3 +1,7 @@
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: Lily Foster <lily@lily.flowers>
# Portions of this code are adapted from nixos-cosmic
# https://github.com/lilyinstarlight/nixos-cosmic
{
lib,
stdenv,
@ -40,9 +44,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
rustPlatform.bindgenHook
];
# Largely based on lilyinstarlight's work linked below
# https://github.com/lilyinstarlight/nixos-cosmic/blob/main/pkgs/cosmic-player/package.nix
buildInputs = [
alsa-lib
ffmpeg
@ -67,7 +68,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
"target/${stdenv.hostPlatform.rust.cargoShortTarget}"
];
postInstall = ''
preFixup = ''
libcosmicAppWrapperArgs+=(--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0")
'';

View file

@ -21,9 +21,10 @@ stdenv.mkDerivation {
__structuredAttrs = true;
strictDeps = true;
makeFlags = [ "PREFIX=${placeholder "out"}" ];
nativeBuildInputs = [ wayland-scanner ];
makeFlags = [ "PREFIX=${placeholder "out"}" ];
passthru = {
tests = {
inherit (nixosTests)

View file

@ -33,6 +33,8 @@ rustPlatform.buildRustPackage (finalAttrs: {
separateDebugInfo = true;
__structuredAttrs = true;
env.VERGEN_GIT_SHA = finalAttrs.src.rev;
nativeBuildInputs = [
just
libcosmicAppHook
@ -64,8 +66,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
"target/${stdenv.hostPlatform.rust.cargoShortTarget}"
];
env.VERGEN_GIT_SHA = finalAttrs.src.rev;
passthru.updateScript = nix-update-script {
extraArgs = [
"--version"

View file

@ -22,23 +22,25 @@ rustPlatform.buildRustPackage (finalAttrs: {
hash = "sha256-FphY53MaOUUR2oQfZak3HbT+kvysUnw2AIc4L9O+TcU=";
};
postPatch = ''
substituteInPlace data/start-cosmic \
--replace-fail '/usr/bin/cosmic-session' "$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' "$out/bin/start-cosmic"
'';
cargoHash = "sha256-5dLG40X+yxJo566guyHqOCLNp+uNSE+HONS8GIDm58A=";
separateDebugInfo = true;
postPatch = ''
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"
'';
__structuredAttrs = true;
buildInputs = [ bash ];
env.ORCA = "orca"; # get orca from $PATH
nativeBuildInputs = [ just ];
buildInputs = [ bash ];
dontUseJustBuild = true;
justFlags = [
@ -53,8 +55,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
"target/${stdenv.hostPlatform.rust.cargoShortTarget}"
];
env.ORCA = "orca"; # get orca from $PATH
passthru = {
providedSessions = [ "cosmic" ];
tests = {

View file

@ -19,11 +19,11 @@ stdenvNoCC.mkDerivation (finalAttrs: {
hash = "sha256-m2cYppfitpBDKK8CC9i/lUrC9rfSYTuqUSZSyIKKGyg=";
};
makeFlags = [ "prefix=${placeholder "out"}" ];
__structuredAttrs = true;
strictDeps = true;
makeFlags = [ "prefix=${placeholder "out"}" ];
passthru.updateScript = nix-update-script {
extraArgs = [
"--version-regex"

View file

@ -27,7 +27,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
cargoHash = "sha256-Z5dC3W8QoDBZWBjHwRj9MC8EScDjQwUiUcOPTRDToDA=";
separateDebugInfo = true;
__structuredAttrs = true;
nativeBuildInputs = [
@ -41,13 +40,13 @@ rustPlatform.buildRustPackage (finalAttrs: {
udev
];
dontCargoInstall = true;
makeFlags = [
"prefix=${placeholder "out"}"
"CARGO_TARGET_DIR=target/${stdenv.hostPlatform.rust.cargoShortTarget}"
];
dontCargoInstall = true;
passthru = {
tests = {
inherit (nixosTests)