From 00f81357aac4fbe778861a86bbf9ea945f6db0bb Mon Sep 17 00:00:00 2001 From: PerchunPak Date: Mon, 27 Jan 2025 09:09:31 +0100 Subject: [PATCH] astal: move source to a separate package It provides general description for all astal packages and r-ryantm will create properly named PRs. --- .../libraries/astal/buildAstalModule.nix | 11 ++----- pkgs/development/libraries/astal/default.nix | 1 + .../libraries/astal/modules/io.nix | 19 +++-------- pkgs/development/libraries/astal/source.nix | 33 +++++++++++++++++++ 4 files changed, 41 insertions(+), 23 deletions(-) create mode 100644 pkgs/development/libraries/astal/source.nix diff --git a/pkgs/development/libraries/astal/buildAstalModule.nix b/pkgs/development/libraries/astal/buildAstalModule.nix index 5ef28e83396b..973334d8f8e1 100644 --- a/pkgs/development/libraries/astal/buildAstalModule.nix +++ b/pkgs/development/libraries/astal/buildAstalModule.nix @@ -1,7 +1,7 @@ { lib, stdenv, - fetchFromGitHub, + source, # this is ./source.nix glib, wrapGAppsHook3, @@ -39,17 +39,12 @@ let cleanArgs args // { pname = "astal-${name}"; - version = "0-unstable-2025-03-21"; + inherit (source) version; __structuredAttrs = true; strictDeps = true; - src = fetchFromGitHub { - owner = "Aylur"; - repo = "astal"; - rev = "dc0e5d37abe9424c53dcbd2506a4886ffee6296e"; - hash = "sha256-5WgfJAeBpxiKbTR/gJvxrGYfqQRge5aUDcGKmU1YZ1Q="; - }; + src = source; sourceRoot = "${finalAttrs.src.name}/${sourceRoot}"; diff --git a/pkgs/development/libraries/astal/default.nix b/pkgs/development/libraries/astal/default.nix index 9edaebb2a92e..227ceb161438 100644 --- a/pkgs/development/libraries/astal/default.nix +++ b/pkgs/development/libraries/astal/default.nix @@ -1,5 +1,6 @@ { wireplumber }: self: { + source = self.callPackage ./source.nix { }; buildAstalModule = self.callPackage ./buildAstalModule.nix { }; apps = self.callPackage ./modules/apps.nix { }; diff --git a/pkgs/development/libraries/astal/modules/io.nix b/pkgs/development/libraries/astal/modules/io.nix index be3bdf2e164a..f60188d29454 100644 --- a/pkgs/development/libraries/astal/modules/io.nix +++ b/pkgs/development/libraries/astal/modules/io.nix @@ -1,17 +1,6 @@ -{ buildAstalModule, nix-update-script }: -(buildAstalModule { +{ buildAstalModule }: +buildAstalModule { name = "io"; sourceRoot = "lib/astal/io"; - meta = { - description = "Astal core library"; - longDescription = '' - Astal is a collection of building blocks for creating custom desktop shells - ''; - mainProgram = "astal"; - }; -}).overrideAttrs - { - # add an update script only in one place, - # so r-ryantm won't run it multiple times - passthru.updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; }; - } + meta.description = "Astal core library"; +} diff --git a/pkgs/development/libraries/astal/source.nix b/pkgs/development/libraries/astal/source.nix new file mode 100644 index 000000000000..29fd220716d1 --- /dev/null +++ b/pkgs/development/libraries/astal/source.nix @@ -0,0 +1,33 @@ +{ + lib, + nix-update-script, + fetchFromGitHub, +}: +(fetchFromGitHub { + owner = "Aylur"; + repo = "astal"; + rev = "dc0e5d37abe9424c53dcbd2506a4886ffee6296e"; + hash = "sha256-5WgfJAeBpxiKbTR/gJvxrGYfqQRge5aUDcGKmU1YZ1Q="; +}).overrideAttrs + ( + final: prev: { + name = "${final.pname}-${final.version}"; # fetchFromGitHub already defines name + pname = "astal-source"; + version = "0-unstable-2025-03-21"; + + meta = prev.meta // { + description = "Building blocks for creating custom desktop shells (source)"; + longDescription = '' + Please don't use this package directly, use one of subpackages in + `astal` namespace. This package is just a `fetchFromGitHub`, which is + reused between all subpackages. + ''; + maintainers = with lib.maintainers; [ perchun ]; + platforms = lib.platforms.linux; + }; + + passthru = prev.passthru // { + updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; }; + }; + } + )