Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17671,6 +17671,12 @@
githubId = 7831184;
name = "John Mercier";
};
mobid = {
email = "matija.obid@posteo.net";
github = "mobid";
githubId = 10497126;
name = "Matija Obid";
};
mochienya = {
name = "mochienya";
github = "mochienya";
Expand Down
83 changes: 83 additions & 0 deletions pkgs/by-name/g-/g-golf-gtk-4-examples/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
stdenv,
lib,
makeWrapper,
wrapGAppsHook4,
pkg-config,
guile,
guile-cairo-unstable,
glib,
gobject-introspection,
gtk4,
which,
adwaita-icon-theme,
libadwaita,
g-golf,
texinfo,
g-golf-adw-1-examples,
useLibadwaita ? false,
}:
stdenv.mkDerivation (finalAttrs: {

inherit (g-golf) version src;

pname = "g-golf-${finalAttrs.variant}-examples";

variant = if useLibadwaita then "adw-1" else "gtk-4";

nativeBuildInputs = [
pkg-config
which
texinfo
makeWrapper
wrapGAppsHook4
glib
]
++ lib.optionals useLibadwaita [ libadwaita ];

buildInputs = [
guile
g-golf
guile-cairo-unstable
gobject-introspection
gtk4
adwaita-icon-theme
];

sourceRoot = "g-golf-${finalAttrs.version}/examples/${finalAttrs.variant}/${
if useLibadwaita then "demo" else "demos"
}";

postBuild =
if useLibadwaita then "glib-compile-resources --target g-resources g-resources.xml" else "";

installPhase = ''
runHook preInstall

mkdir -p $out/bin $out/share/doc/g-golf/examples
cp -rf .. $out/share/doc/g-golf/examples/

find $out/share -type f -executable | while read file; do
name=g-golf-${finalAttrs.variant}-$(basename $file)
makeWrapper $file $out/bin/$name \
--chdir $(dirname $file) \
--prefix PATH : "${guile}/bin" \
--prefix GUILE_LOAD_PATH : "$GUILE_LOAD_PATH" \
--prefix GUILE_LOAD_COMPILED_PATH : "$GUILE_LOAD_COMPILED_PATH" \
--prefix LD_LIBRARY_PATH : "${g-golf}/lib:${guile-cairo-unstable}/lib" \
--set GUILE_AUTO_COMPILE 0
done

runHook postInstall
'';

passthru.tests = { inherit g-golf-adw-1-examples; };

meta = {
description = "G-Golf ${finalAttrs.variant} examples";
homepage = "https://www.gnu.org/software/g-golf/";
license = lib.licenses.lgpl3Plus;
maintainers = with lib.maintainers; [ mobid ];
platforms = lib.platforms.unix;
};
})
73 changes: 73 additions & 0 deletions pkgs/by-name/g-/g-golf/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
stdenv,
lib,
fetchurl,
pkg-config,
texinfo,
guile,
guile-lib,
gobject-introspection,
glib,
xvfb-run,
gtk3,
gtk4,
which,
libadwaita,
}:
stdenv.mkDerivation (finalAttrs: {

pname = "g-golf";
version = "0.8.2";

src = fetchurl {
url = "mirror://gnu/g-golf/${finalAttrs.pname}-${finalAttrs.version}.tar.gz";
hash = "sha256-eXO+RcHFckjPouX1rIhrlv712X0hLTx3s+uRnsLNHQM=";
};

doCheck = true;
makeFlags = [ "GUILE_AUTO_COMPILE=0" ];

nativeBuildInputs = [
pkg-config
texinfo
guile
guile-lib
xvfb-run
gtk3
glib
];

buildInputs = [
gobject-introspection
];

postPatch = ''
sed -i 's|libgirepository-1.0|${gobject-introspection}/lib/libgirepository-1.0.so|' g-golf/init.scm
sed -i "s|libglib-2.0|${glib.out}/lib/libglib-2.0.so|" g-golf/init.scm
sed -i "s|libgobject-2.0|${glib.out}/lib/libgobject-2.0.so|" g-golf/init.scm
Comment on lines +45 to +47
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to get the equivalent working with

env.LD_LIBRARY_PATH = lib.makeLibraryPath [
    gobject-introspection
    glib
];

If you also want to support cross-compilation, these libraries probably need to be retrieved from buildPackages.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I do this, the examples stop working.

Copy link
Copy Markdown
Contributor

@Kiskae Kiskae Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the way this is supposed to work is with GUILE_EXTENSIONS_PATH.

But since this needs to be propagated (as you found by the broken examples), this would probably need to be added to the guile package itself, and then have this package use propagatedBuildInputs to make dependencies available downstream.

Not sure who maintains this interpreter though.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, the Guix package does the same thing


# In build environment, There is no /dev/tty
sed -i "s|/dev/tty|/dev/null|g" test-suite/tests/gobject.scm

sed -i "s|SITEDIR=.*$|SITEDIR="$out/${guile.siteDir}"|" configure
sed -i "s|SITECCACHEDIR=.*$|SITECCACHEDIR="$out/${guile.siteCcacheDir}"|" configure
'';

checkPhase = ''
runHook preCheck
xvfb-run make check
runHook postCheck
'';

postFixup = ''
sed -i "s|(dynamic-link \"libg-golf\")|(dynamic-link \"$out/lib/libg-golf\")|" $out/${guile.siteDir}/g-golf/init.scm
'';

meta = {
description = "Guile Object Library for GNOME";
homepage = "https://www.gnu.org/software/g-golf/";
license = lib.licenses.lgpl3Plus;
maintainers = with lib.maintainers; [ mobid ];
platforms = lib.platforms.unix;
};
})
65 changes: 65 additions & 0 deletions pkgs/by-name/gu/guile-cairo-unstable/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
lib,
stdenv,
fetchgit,
cairo,
expat,
guile,
guile-lib,
pkg-config,
autoconf,
automake,
texinfo,
gettext,
}:

stdenv.mkDerivation {
pname = "guile-cairo";
version = "1.11.2-unstable-2026-01-05";

src = fetchgit {
url = "https://git.savannah.gnu.org/git/guile-cairo.git";
hash = "sha256-MdXqMl0seOoL8muKOOrR5h4arpCeTunNnrHCEAD+nI4=";
rev = "399fbb3f9cb80dca2fefd2fceaedde4c8e75deee";
};

nativeBuildInputs = [
autoconf
automake
texinfo
pkg-config
gettext
];
buildInputs = [
cairo
expat
guile
];

preConfigure = ''
cp ${gettext}/share/gettext/m4/lib-{ld,link,prefix}.m4 m4
autoreconf -fvi
'';

enableParallelBuilding = true;

doCheck = false; # Cannot find unit-test module from guile-lib
nativeCheckInputs = [ guile-lib ];

meta = {
homepage = "https://www.nongnu.org/guile-cairo/";
description = "Cairo bindings for GNU Guile";
longDescription = ''
Guile-Cairo wraps the Cairo graphics library for Guile Scheme.

Guile-Cairo is complete, wrapping almost all of the Cairo API. It is API
stable, providing a firm base on which to do graphics work. Finally, and
importantly, it is pleasant to use. You get a powerful and well
maintained graphics library with all of the benefits of Scheme: memory
management, exceptions, macros, and a dynamic programming environment.
'';
license = lib.licenses.lgpl3Plus;
maintainers = with lib.maintainers; [ mobid ];
platforms = guile.meta.platforms;
};
}
4 changes: 4 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2418,6 +2418,10 @@ with pkgs;

uniscribe = callPackage ../tools/text/uniscribe { };

g-golf-adw-1-examples = callPackage ../by-name/g-/g-golf-gtk-4-examples/package.nix {
useLibadwaita = true;
};

inherit (callPackages ../tools/filesystems/garage { })
garage
garage_1
Expand Down
Loading