diff options
Diffstat (limited to 'nix')
-rw-r--r-- | nix/devshell.nix | 16 | ||||
-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 | 150 |
5 files changed, 167 insertions, 65 deletions
diff --git a/nix/devshell.nix b/nix/devshell.nix index 66c46e5..2e409c4 100644 --- a/nix/devshell.nix +++ b/nix/devshell.nix @@ -40,19 +40,31 @@ libdbusmenu-gtk3 wayland blueprint-compiler + libadwaita + wayland-scanner dart-sass lua python gjs ]; + + lsp = with pkgs; [ + nodejs + mesonlsp + vala-language-server + vtsls + vscode-langservers-extracted + markdownlint-cli2 + ]; in { default = pkgs.mkShell { - inherit buildInputs; + packages = buildInputs ++ lsp; }; astal = pkgs.mkShell { - buildInputs = + packages = buildInputs + ++ lsp ++ builtins.attrValues ( builtins.removeAttrs self.packages.${pkgs.system} ["docs"] ); 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..b0a00af --- /dev/null +++ b/nix/mkAstalPkg.nix @@ -0,0 +1,150 @@ +pkgs: let + inherit (builtins) elem elemAt readFile replaceStrings splitVersion toJSON; + inherit (pkgs.lib) filterAttrs; + + 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 = ${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"; + + 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 + ] + ++ nativeBuildInputs; + + propagatedBuildInputs = with pkgs; + [ + glib + ] + ++ packages; + + postUnpack = '' + cp --remove-destination ${../lib/gir.py} $sourceRoot/gir.py + ${postUnpack} + ''; + + postInstall = let + 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} + ''; + + passthru = { + inherit girName; + }; + + meta = { + inherit description; + homepage = "https://aylur.github.io/astal"; + license = pkgs.lib.licenses.lgpl21; + }; + } |