Skip to content

Commit

Permalink
Merge pull request #222 from matt1432/nix-passthru
Browse files Browse the repository at this point in the history
[Nix] Expose `girName` of each lib with `passthru`
  • Loading branch information
Aylur authored Jan 2, 2025
2 parents d6c3c9c + cbb59aa commit 207557d
Showing 1 changed file with 31 additions and 22 deletions.
53 changes: 31 additions & 22 deletions nix/mkAstalPkg.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
pkgs: let
inherit (builtins) replaceStrings readFile;
inherit (builtins) elem elemAt readFile replaceStrings splitVersion toJSON;
inherit (pkgs.lib) filterAttrs;

readVer = file: replaceStrings ["\n"] [""] (readFile file);

toTOML = (pkgs.formats.toml {}).generate;
Expand Down Expand Up @@ -42,7 +44,7 @@ pkgs: let
};

urlmap = pkgs.writeText "urlmap" ''
baseURLs = ${builtins.toJSON [
baseURLs = ${toJSON [
["GLib" "https://docs.gtk.org/glib/"]
["GObject" "https://docs.gtk.org/gobject/"]
["Gio" "https://docs.gtk.org/gio/"]
Expand Down Expand Up @@ -72,38 +74,41 @@ in
postUnpack ? "",
}: let
version = readVer "${src}/version";

ver = splitVersion version;
api-ver = "${elemAt ver 0}.${elemAt ver 1}";
girName = "Astal${gir-suffix}-${api-ver}";
in
pkgs.stdenv.mkDerivation {
inherit pname src version;
outputs = ["out" "dev" "doc"];

nativeBuildInputs = with pkgs; [
wrapGAppsHook
gobject-introspection
meson
pkg-config
ninja
vala
wayland
wayland-scanner
python3
];

propagatedBuildInputs = [pkgs.glib] ++ packages;
nativeBuildInputs = with pkgs;
[
wrapGAppsHook
gobject-introspection
meson
pkg-config
ninja
vala
wayland
wayland-scanner
python3
]
++ nativeBuildInputs;

propagatedBuildInputs = with pkgs;
[
glib
]
++ packages;

postUnpack = ''
cp --remove-destination ${../lib/gir.py} $sourceRoot/gir.py
${postUnpack}
'';

postInstall = let
inherit (builtins) splitVersion elemAt elem;
inherit (pkgs.lib.attrsets) filterAttrs;

ver = splitVersion version;
api-ver = "${elemAt ver 0}.${elemAt ver 1}";
girName = "Astal${gir-suffix}-${api-ver}";

data = toTOML libname {
library = {
inherit description authors version;
Expand Down Expand Up @@ -133,6 +138,10 @@ in
mv ${girName}/* $out/share/doc/${website-path}
'';

passthru = {
inherit girName;
};

meta = {
inherit description;
homepage = "https://aylur.github.io/astal";
Expand Down

0 comments on commit 207557d

Please sign in to comment.