summaryrefslogtreecommitdiff
path: root/pkgs/astal
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pkgs/astal/builder.nix63
-rw-r--r--pkgs/astal/default.nix35
-rw-r--r--pkgs/astal/theme.nix34
3 files changed, 65 insertions, 67 deletions
diff --git a/pkgs/astal/builder.nix b/pkgs/astal/builder.nix
index db102bd..ffb38ce 100644
--- a/pkgs/astal/builder.nix
+++ b/pkgs/astal/builder.nix
@@ -1,43 +1,44 @@
{
- pkgs,
+ stdenvNoCC,
astal,
+ gobject-introspection,
+ lib,
+ lua,
name,
src,
- extraLuaPackages ? (_: []),
+ wrapGAppsHook3,
extraPackages ? [],
}: let
- lua = pkgs.lua.withPackages (ps:
- (extraLuaPackages ps)
- ++ [
- ps.lgi
- (ps.luaPackages.toLuaModule (pkgs.stdenvNoCC.mkDerivation {
- name = "astal";
- src = "${astal}/lang/lua/astal";
- dontBuild = true;
- installPhase = ''
- mkdir -p $out/share/lua/${ps.lua.luaversion}/astal
- cp -r * $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}
- '';
- }))
- ]);
+ lua_ = lua.withPackages (ps: [
+ ps.lgi
+ (ps.luaPackages.toLuaModule (stdenvNoCC.mkDerivation {
+ name = "astal";
+ src = "${astal}/lang/lua/astal";
+ dontBuild = true;
+ installPhase = ''
+ mkdir -p $out/share/lua/${ps.lua.luaversion}/astal
+ cp -r * $out/share/lua/${ps.lua.luaversion}/astal
+ '';
+ }))
+ (ps.luaPackages.toLuaModule (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
+ #!${lua_}/bin/lua
require "init"
'';
in
- pkgs.stdenvNoCC.mkDerivation {
+ stdenvNoCC.mkDerivation {
inherit src name;
- nativeBuildInputs = with pkgs; [
+ nativeBuildInputs = [
wrapGAppsHook3
gobject-introspection
];
@@ -45,9 +46,9 @@ in
buildInputs =
extraPackages
++ [
- lua
- astal.packages.${pkgs.stdenv.hostPlatform.system}.io
- astal.packages.${pkgs.stdenv.hostPlatform.system}.astal3
+ lua_
+ astal.io
+ astal.astal3
];
installPhase = ''
@@ -63,7 +64,7 @@ in
preFixup = ''
gappsWrapperArgs+=(
- --prefix PATH : "${pkgs.lib.makeBinPath extraPackages}"
+ --prefix PATH : "${lib.makeBinPath extraPackages}"
)
'';
}
diff --git a/pkgs/astal/default.nix b/pkgs/astal/default.nix
index dc8f2a7..d076f07 100644
--- a/pkgs/astal/default.nix
+++ b/pkgs/astal/default.nix
@@ -1,32 +1,29 @@
{
- pkgs,
- stdenv,
- inputs,
- options,
+ astal,
+ callPackage,
+ dart-sass,
+ networkmanager,
+ runCommand,
+ writeShellApplication,
+ # System theme must be passed in
+ theme ? null,
...
}: let
- inherit (pkgs) runCommand dart-sass;
-
- apkgs = inputs.astal.packages.${stdenv.hostPlatform.system};
- scss = "${dart-sass}/bin/sass";
- theme = import ./theme.nix {inherit options;};
-
+ vars = import ./theme.nix {inherit theme;};
mkAstal = file:
- import ./builder.nix {
- inherit pkgs;
- astal = inputs.astal;
+ callPackage ./builder.nix {
src = runCommand "src" {} ''
mkdir -p $out
cp -r ${./src}/{*.lua,widget} $out/
cp $out/${file}.lua $out/init.lua
cp -r ${./src}/style/* .
- echo '${theme}' > theme.scss
+ echo '${vars}' > theme.scss
cat theme.scss style.scss widget/* > main.scss
- ${scss} main.scss $out/main.css
+ ${dart-sass}/bin/sass main.scss $out/main.css
'';
name = "astal-${file}";
extraPackages =
- (with apkgs; [
+ (with astal; [
apps
battery
hyprland
@@ -36,15 +33,15 @@
tray
wireplumber
])
- ++ (with pkgs; [
+ ++ [
networkmanager
- ]);
+ ];
};
mkAstalWrapper = file: let
pkg = mkAstal file;
in
- pkgs.writeShellApplication {
+ writeShellApplication {
name = "astal-${file}";
text = ''
${pkg}/bin/astal-${file}
diff --git a/pkgs/astal/theme.nix b/pkgs/astal/theme.nix
index 9774012..b76864c 100644
--- a/pkgs/astal/theme.nix
+++ b/pkgs/astal/theme.nix
@@ -1,26 +1,26 @@
-{options, ...}: ''
+{theme, ...}: ''
- $text: #${options.theme.colors.text};
- $subtext: #${options.theme.colors.subtext};
+ $text: #${theme.colors.text};
+ $subtext: #${theme.colors.subtext};
- $base: #${options.theme.colors.base};
- $surface: #${options.theme.colors.surface};
- $overlay: #${options.theme.colors.overlay};
+ $base: #${theme.colors.base};
+ $surface: #${theme.colors.surface};
+ $overlay: #${theme.colors.overlay};
- $primary: #${options.theme.colors.primary};
- $success: #${options.theme.colors.success};
- $warning: #${options.theme.colors.warning};
- $error: #${options.theme.colors.error};
+ $primary: #${theme.colors.primary};
+ $success: #${theme.colors.success};
+ $warning: #${theme.colors.warning};
+ $error: #${theme.colors.error};
- $border: ${toString options.theme.borderWidth}px;
+ $border: ${toString theme.borderWidth}px;
- $inner-radius: ${toString options.theme.innerRadius}px;
- $outer-radius: ${toString options.theme.outerRadius}px;
+ $inner-radius: ${toString theme.innerRadius}px;
+ $outer-radius: ${toString theme.outerRadius}px;
- $inner-gap: ${toString options.theme.innerGap}px;
- $outer-gap: ${toString options.theme.outerGap}px;
+ $inner-gap: ${toString theme.innerGap}px;
+ $outer-gap: ${toString theme.outerGap}px;
- $font-name: "${options.theme.font.regular}", "${options.theme.font.monospace}";
- $font-size: ${toString options.theme.font.size}px;
+ $font-name: "${theme.font.regular}", "${theme.font.monospace}";
+ $font-size: ${toString theme.font.size}px;
''