From 56aa40a8765fc3d2da61cda3775e894d8dd0c7d9 Mon Sep 17 00:00:00 2001 From: Aylur Date: Thu, 12 Sep 2024 01:18:50 +0200 Subject: fixes and touchups --- core/src/widget/stack.vala | 2 +- docs/getting-started/nix.md | 8 +++++++- examples/lua/simple-bar/app.lua | 19 ------------------- examples/lua/simple-bar/init.lua | 19 +++++++++++++++++++ nix/lua.nix | 24 +++++++++++++++++------- 5 files changed, 44 insertions(+), 28 deletions(-) delete mode 100644 examples/lua/simple-bar/app.lua create mode 100644 examples/lua/simple-bar/init.lua diff --git a/core/src/widget/stack.vala b/core/src/widget/stack.vala index d1d345f..e9a2bd2 100644 --- a/core/src/widget/stack.vala +++ b/core/src/widget/stack.vala @@ -1,4 +1,4 @@ -public class Astal.Switch : Gtk.Stack { +public class Astal.Stack : Gtk.Stack { /** * whether to implicity destroy previous children when setting them */ diff --git a/docs/getting-started/nix.md b/docs/getting-started/nix.md index bfdfdc7..f09a80b 100644 --- a/docs/getting-started/nix.md +++ b/docs/getting-started/nix.md @@ -22,7 +22,13 @@ Using Astal on Nix will require you to package your project. in { packages.${system}.default = astal.lib.mkLuaPacakge { inherit pkgs; - src = ./path/to/project; # should contain app.lua + src = ./path/to/project; # should contain init.lua + + # add extra glib packages or binaries + extraPackages = [ + astal.packages.${system}.battery + pkgs.dart-sass + ]; }; }; } diff --git a/examples/lua/simple-bar/app.lua b/examples/lua/simple-bar/app.lua deleted file mode 100644 index aecf7a6..0000000 --- a/examples/lua/simple-bar/app.lua +++ /dev/null @@ -1,19 +0,0 @@ -local astal = require("astal") -local App = astal.App - -local Bar = require("widget.Bar") -local src = require("lib").src - -local scss = src("style.scss") -local css = "/tmp/style.css" - -astal.exec("sass " .. scss .. " " .. css) - -App:start({ - css = css, - main = function() - for _, mon in pairs(App.monitors) do - Bar(mon) - end - end, -}) diff --git a/examples/lua/simple-bar/init.lua b/examples/lua/simple-bar/init.lua new file mode 100644 index 0000000..aecf7a6 --- /dev/null +++ b/examples/lua/simple-bar/init.lua @@ -0,0 +1,19 @@ +local astal = require("astal") +local App = astal.App + +local Bar = require("widget.Bar") +local src = require("lib").src + +local scss = src("style.scss") +local css = "/tmp/style.css" + +astal.exec("sass " .. scss .. " " .. css) + +App:start({ + css = css, + main = function() + for _, mon in pairs(App.monitors) do + Bar(mon) + end + end, +}) diff --git a/nix/lua.nix b/nix/lua.nix index a790021..0986836 100644 --- a/nix/lua.nix +++ b/nix/lua.nix @@ -10,9 +10,8 @@ defaults: { (extraLuaPackages ps) ++ [ ps.lgi - (ps.luaPackages.toLuaModule (pkgs.stdenv.mkDerivation { + (ps.luaPackages.toLuaModule (pkgs.stdenvNoCC.mkDerivation { name = "astal"; - version = "0.1.0"; src = "${astal}/core/lua"; dontBuild = true; installPhase = '' @@ -20,12 +19,19 @@ defaults: { cp -r astal/* $out/share/lua/${ps.lua.luaversion}/astal ''; })) + (ps.luaPackages.toLuaModule (pkgs.stdenvNoCC.mkDerivation { + inherit src name; + dontBuild = true; + installPhase = '' + mkdir -p $out/share/lua/${ps.lua.luaversion} + cp -r * $out/share/lua/${ps.lua.luaversion} + ''; + })) ]); script = '' #!${lua}/bin/lua - package.path = package.path .. ";${src}/?.lua" - require "app" + require "init" ''; in pkgs.stdenvNoCC.mkDerivation { @@ -45,14 +51,18 @@ in installPhase = '' runHook preInstall + mkdir -p $out/bin cp -r * $out/bin echo '${script}' > astal-lua install -m 755 astal-lua $out/bin/${name} + runHook postInstall ''; - gappsWrapperArgs = [ - "--prefix PATH : ${pkgs.lib.makeBinPath extraPackages}" - ]; + preFixup = '' + gappsWrapperArgs+=( + --prefix PATH : ${pkgs.lib.makeBinPath extraPackages} + ) + ''; } -- cgit v1.2.3