diff options
Diffstat (limited to 'nix')
-rw-r--r-- | nix/appmenu-glib.nix | 35 | ||||
-rw-r--r-- | nix/gi-docgen.patch (renamed from nix/doc/gi-docgen.patch) | 0 | ||||
-rw-r--r-- | nix/libcava.nix | 60 | ||||
-rw-r--r-- | nix/lua.nix | 6 | ||||
-rw-r--r-- | nix/mkAstalPkg.nix | 141 |
5 files changed, 144 insertions, 98 deletions
diff --git a/nix/appmenu-glib.nix b/nix/appmenu-glib.nix deleted file mode 100644 index 873fb93..0000000 --- a/nix/appmenu-glib.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ - stdenv, - fetchFromGitLab, - pkg-config, - meson, - ninja, - gobject-introspection, - vala, - glib, -}: let - vala-panel-appmenu = fetchFromGitLab { - owner = "vala-panel-project"; - repo = "vala-panel-appmenu"; - rev = "24.05"; - hash = "sha256-8GWauw7r3zKhvGF2TNOI8GDVctUFDhtG/Vy1cNUpsVo="; - }; -in - stdenv.mkDerivation { - pname = "appmenu-glib-translator"; - version = "24.05"; - - src = "${vala-panel-appmenu}/subprojects/appmenu-glib-translator"; - - buildInputs = [ - glib - ]; - - nativeBuildInputs = [ - gobject-introspection - meson - pkg-config - ninja - vala - ]; - } diff --git a/nix/doc/gi-docgen.patch b/nix/gi-docgen.patch index 0ecb4bd..0ecb4bd 100644 --- a/nix/doc/gi-docgen.patch +++ b/nix/gi-docgen.patch diff --git a/nix/libcava.nix b/nix/libcava.nix deleted file mode 100644 index 866599d..0000000 --- a/nix/libcava.nix +++ /dev/null @@ -1,60 +0,0 @@ -{ - stdenv, - fetchFromGitHub, - autoreconfHook, - autoconf-archive, - alsa-lib, - fftw, - iniparser, - libpulseaudio, - portaudio, - sndio, - SDL2, - libGL, - pipewire, - jack2, - ncurses, - pkgconf, - meson, - ninja, -}: -stdenv.mkDerivation rec { - pname = "cava"; - version = "0.10.3"; - - src = fetchFromGitHub { - owner = "LukashonakV"; - repo = "cava"; - rev = "0.10.3"; - hash = "sha256-ZDFbI69ECsUTjbhlw2kHRufZbQMu+FQSMmncCJ5pagg="; - }; - - buildInputs = [ - alsa-lib - libpulseaudio - ncurses - iniparser - sndio - SDL2 - libGL - portaudio - jack2 - pipewire - ]; - - propagatedBuildInputs = [ - fftw - ]; - - nativeBuildInputs = [ - autoreconfHook - autoconf-archive - pkgconf - meson - ninja - ]; - - preAutoreconf = '' - echo ${version} > version - ''; -} diff --git a/nix/lua.nix b/nix/lua.nix index d4221f1..fc68fdd 100644 --- a/nix/lua.nix +++ b/nix/lua.nix @@ -1,6 +1,6 @@ -defaults: { - pkgs ? defaults.pkgs, - astal ? defaults.astal, +self: { + pkgs, + astal ? self, name ? "astal-lua", src, extraLuaPackages ? (ps: []), diff --git a/nix/mkAstalPkg.nix b/nix/mkAstalPkg.nix new file mode 100644 index 0000000..36fcf51 --- /dev/null +++ b/nix/mkAstalPkg.nix @@ -0,0 +1,141 @@ +pkgs: let + inherit (builtins) replaceStrings readFile; + readVer = file: replaceStrings ["\n"] [""] (readFile file); + + toTOML = (pkgs.formats.toml {}).generate; + + docgen = pkgs.gi-docgen.overrideAttrs { + patches = [./gi-docgen.patch]; + }; + + dependency = { + "GObject-2.0" = { + name = "GObject"; + description = "The base type system library"; + docs_url = "https://docs.gtk.org/gobject/"; + }; + "Gtk-3.0" = { + name = "Gtk"; + description = "The GTK toolkit"; + docs_url = "https://docs.gtk.org/gtk3/"; + }; + "Gtk-4.0" = { + name = "Gtk"; + description = "The GTK toolkit"; + docs_url = "https://docs.gtk.org/gtk4/"; + }; + "AstalIO-0.1" = { + name = "AstalIO"; + description = "Astal Core library"; + docs_url = "https://aylur.github.io/libastal/io"; + }; + "NM-1.0" = { + name = "NetworkManager"; + description = "The standard Linux network configuration tool suite"; + docs_url = "https://networkmanager.dev/docs/libnm/latest/"; + }; + "WP-0.5" = { + name = "WirePlumber"; + description = "Modular session/policy manager for PipeWire"; + docs_url = "https://pipewire.pages.freedesktop.org/wireplumber/"; + }; + }; + + urlmap = pkgs.writeText "urlmap" '' + baseURLs = ${builtins.toJSON [ + ["GLib" "https://docs.gtk.org/glib/"] + ["GObject" "https://docs.gtk.org/gobject/"] + ["Gio" "https://docs.gtk.org/gio/"] + ["Gdk" "https://docs.gtk.org/gdk3/"] + ["Gtk" "https://docs.gtk.org/gtk3/"] + ["GdkPixbuf" "https://docs.gtk.org/gdk-pixbuf/"] + ["AstalIO" "https://aylur.github.io/libastal/io"] + + # FIXME: these are not gi-docgen generated, therefore links are broken + ["NM" "https://networkmanager.dev/docs/libnm/latest/"] + ["WP" "https://pipewire.pages.freedesktop.org/wireplumber/"] + ]} + ''; +in + { + src, + pname, + libname, + gir-suffix, + authors, + description, + dependencies ? [], + repo-path ? libname, + website-path ? libname, + nativeBuildInputs ? [], + packages ? [], + postUnpack ? "", + }: let + version = readVer "${src}/version"; + 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; + + 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; + license = "LGPL-2.1"; + browse_url = "https://github.com/Aylur/astal/tree/main/lib/${repo-path}"; + repository_url = "https://github.com/aylur/aylur.git"; + website_url = "https://aylur.github.io/astal/guide/libraries/${website-path}"; + dependencies = ["GObject-2.0"] ++ dependencies; + }; + + extra.urlmap_file = "urlmap.js"; + dependencies = + {inherit (dependency) "GObject-2.0";} + // (filterAttrs (n: _: elem n dependencies) dependency); + }; + in '' + gir="${girName}.gir" + + mkdir -p $out/share/doc/${website-path} + cat ${urlmap} > urlmap.js + + if [ -d "src" ]; then + gir="src/$gir" + fi + + ${docgen}/bin/gi-docgen generate --config ${data} $gir + mv ${girName}/* $out/share/doc/${website-path} + ''; + + meta = { + inherit description; + homepage = "https://aylur.github.io/astal"; + license = pkgs.lib.licenses.lgpl21; + }; + } |