-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a186efa
commit 9b190b5
Showing
4 changed files
with
242 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Astal {#astal} | ||
|
||
Astal is a collection of building blocks for creating custom desktop shells. | ||
|
||
## Bundling {#astal-bundling} | ||
|
||
Bundling Astal application is done using `ags` tool, you can use it like this: | ||
|
||
```nix | ||
ags.bundle { | ||
pname = "hyprpanel"; | ||
version = "1.0.0"; | ||
src = fetchFromGitHub { ... }; | ||
# change your entry file (default is `app.ts`) | ||
entry = "app.ts"; | ||
dependencies = [ | ||
# list here astal modules, that your package depends on | ||
# `astal3`, `astal4` and `astal.io` are automatically included | ||
astal.apps | ||
astal.battery | ||
astal.bluetooth | ||
# you can also list here other runtime dependencies | ||
hypridle | ||
hyprpicker | ||
hyprsunset | ||
]; | ||
# GTK 4 support is opt-in | ||
enableGtk4 = true; | ||
meta = { ... }; | ||
} | ||
``` | ||
|
||
You can also pass all other arguments that are supported by `stdenv.mkDerivation`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
{ | ||
lib, | ||
ags, | ||
astal, | ||
dart-sass, | ||
fzf, | ||
gjs, | ||
gnused, | ||
gobject-introspection, | ||
gtk3, | ||
gtk4-layer-shell, | ||
stdenvNoCC, | ||
wrapGAppsHook3, | ||
wrapGAppsHook4, | ||
}: | ||
{ | ||
entry ? "app.ts", | ||
dependencies ? [ ], | ||
enableGtk4 ? false, | ||
... | ||
}@attrs: | ||
stdenvNoCC.mkDerivation ( | ||
finalAttrs: | ||
attrs | ||
// { | ||
nativeBuildInputs = (attrs.nativeBuildInputs or [ ]) ++ [ | ||
ags | ||
gnused | ||
gobject-introspection | ||
(if enableGtk4 then wrapGAppsHook4 else wrapGAppsHook3) | ||
]; | ||
|
||
buildInputs = | ||
(attrs.buildInputs or [ ]) | ||
++ dependencies | ||
++ [ | ||
gjs | ||
astal.astal4 | ||
astal.astal3 | ||
astal.io | ||
]; | ||
|
||
preFixup = | ||
'' | ||
gappsWrapperArgs+=( | ||
--prefix PATH : ${ | ||
lib.makeBinPath ( | ||
dependencies | ||
++ [ | ||
dart-sass | ||
fzf | ||
gtk3 | ||
] | ||
) | ||
} | ||
) | ||
'' | ||
+ lib.optionalString enableGtk4 '' | ||
gappsWrapperArgs+=( | ||
--set LD_PRELOAD "${gtk4-layer-shell}/lib/libgtk4-layer-shell.so" | ||
) | ||
'' | ||
+ (attrs.preFixup or ""); | ||
|
||
installPhase = | ||
let | ||
outBin = "$out/bin/${finalAttrs.pname}"; | ||
in | ||
# bash | ||
'' | ||
runHook preInstall | ||
mkdir -p "$out/bin" "$out/share" | ||
cp -r ./* "$out/share" | ||
ags bundle "${entry}" "${outBin}" -d "SRC='$out/share'" | ||
chmod +x "${outBin}" | ||
if ! head -n 1 "${outBin}" | grep -q "^#!"; then | ||
sed -i '1i #!${gjs}/bin/gjs -m' "${outBin}" | ||
fi | ||
runHook postInstall | ||
''; | ||
|
||
meta = (attrs.meta or { }) // { | ||
mainProgram = finalAttrs.pname; | ||
}; | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
{ | ||
lib, | ||
astal, | ||
blueprint-compiler, | ||
buildGoModule, | ||
callPackage, | ||
dart-sass, | ||
fetchFromGitHub, | ||
gjs, | ||
glib, | ||
gobject-introspection, | ||
gtk4-layer-shell, | ||
installShellFiles, | ||
nix-update-script, | ||
nodejs, | ||
stdenv, | ||
wrapGAppsHook3, | ||
writers, | ||
|
||
extraPackages ? [ ], | ||
}: | ||
let | ||
datadirs = | ||
writers.writeNu "datadirs" | ||
# nu | ||
'' | ||
$env.XDG_DATA_DIRS | ||
| split row ":" | ||
| filter { $"($in)/gir-1.0" | path exists } | ||
| str join ":" | ||
''; | ||
|
||
bins = [ | ||
gjs | ||
nodejs | ||
dart-sass | ||
blueprint-compiler | ||
astal.io | ||
]; | ||
in | ||
buildGoModule rec { | ||
pname = "ags"; | ||
version = "2.2.1"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "Aylur"; | ||
repo = "ags"; | ||
tag = "v${version}"; | ||
hash = "sha256-snHhAgcH8hACWZFaAqHr5uXH412UrAuA603OK02MxN8="; | ||
}; | ||
|
||
vendorHash = "sha256-Pw6UNT5YkDVz4HcH7b5LfOg+K3ohrBGPGB9wYGAQ9F4="; | ||
proxyVendor = true; | ||
|
||
ldflags = [ | ||
"-s" | ||
"-w" | ||
"-X main.astalGjs=${astal.gjs}/share/astal/gjs" | ||
"-X main.gtk4LayerShell=${gtk4-layer-shell}/lib/libgtk4-layer-shell.so" | ||
]; | ||
|
||
nativeBuildInputs = [ | ||
wrapGAppsHook3 | ||
gobject-introspection | ||
installShellFiles | ||
]; | ||
|
||
buildInputs = extraPackages ++ [ | ||
glib | ||
astal.io | ||
astal.astal3 | ||
astal.astal4 | ||
]; | ||
|
||
preFixup = '' | ||
gappsWrapperArgs+=( | ||
--prefix NIX_GI_DIRS : "$(${datadirs})" | ||
--prefix PATH : "${lib.makeBinPath (bins ++ extraPackages)}" | ||
) | ||
''; | ||
|
||
postInstall = | ||
lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) | ||
# bash | ||
'' | ||
installShellCompletion \ | ||
--cmd ags \ | ||
--bash <($out/bin/ags completion bash) \ | ||
--fish <($out/bin/ags completion fish) \ | ||
--zsh <($out/bin/ags completion zsh) | ||
''; | ||
|
||
passthru = { | ||
bundle = callPackage ./bundle.nix { }; | ||
updateScript = nix-update-script { }; | ||
}; | ||
|
||
meta = { | ||
description = "Scaffolding CLI for Astal+TypeScript"; | ||
homepage = "https://github.com/Aylur/ags"; | ||
changelog = "https://github.com/Aylur/ags/releases/tag/v${version}"; | ||
license = lib.licenses.gpl3Plus; | ||
maintainers = with lib.maintainers; [ | ||
foo-dogsquared | ||
johnrtitor | ||
perchun | ||
]; | ||
mainProgram = "ags"; | ||
platforms = lib.platforms.linux; | ||
}; | ||
} |