nixpkgs/pkgs/by-name/co/cosmic-initial-setup/package.nix
Kajus Naujokaitis fb85b928b3
cosmic: add missing VERGEN_GIT_SHA where possible
Signed-off-by: Kajus Naujokaitis <kajusn@gmail.com>
2026-07-06 10:28:56 +03:00

109 lines
2.4 KiB
Nix

{
lib,
stdenv,
rustPlatform,
fetchFromGitHub,
just,
killall,
libcosmicAppHook,
libinput,
openssl,
udev,
nixosTests,
nix-update-script,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "cosmic-initial-setup";
version = "1.1.0";
# nixpkgs-update: no auto update
src = fetchFromGitHub {
owner = "pop-os";
repo = "cosmic-initial-setup";
tag = "epoch-${finalAttrs.version}";
hash = "sha256-UABqbmbwW2ZBOO7mq16/h0s55VCWRF2yyf/1TaubC88=";
};
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"
'';
cargoHash = "sha256-DESnl5NjakU4++Ep6CHxDZzHn+o0Gi0eREpXk5BN5iY=";
buildFeatures = [ "nixos" ];
# cargo-auditable fails during the build when compiling the `crabtime::function`
# procedural macro. It panics because the `--out-dir` flag is not passed to
# the rustc wrapper.
#
# Reported this issue upstream in:
# https://github.com/rust-secure-code/cargo-auditable/issues/225
auditable = false;
separateDebugInfo = true;
__structuredAttrs = true;
env = {
VERGEN_GIT_SHA = finalAttrs.src.tag;
DISABLE_IF_EXISTS = "/iso/nix-store.squashfs";
};
nativeBuildInputs = [
libcosmicAppHook
just
];
buildInputs = [
killall
libinput
openssl
udev
];
dontUseJustBuild = true;
dontUseJustCheck = true;
justFlags = [
"--set"
"prefix"
(placeholder "out")
"--set"
"cargo-target-dir"
"target/${stdenv.hostPlatform.rust.cargoShortTarget}"
];
preFixup = ''
libcosmicAppWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ killall ]})
'';
passthru = {
tests = {
inherit (nixosTests)
cosmic
cosmic-autologin
cosmic-noxwayland
cosmic-autologin-noxwayland
;
};
updateScript = nix-update-script {
extraArgs = [
"--version-regex"
"epoch-(.*)"
];
};
};
meta = {
description = "COSMIC Initial Setup";
homepage = "https://github.com/pop-os/cosmic-initial-setup";
license = lib.licenses.gpl3Only;
mainProgram = "cosmic-initial-setup";
platforms = lib.platforms.linux;
teams = [ lib.teams.cosmic ];
};
})