Fix: Add explicit GI_TYPELIB_PATH for AstalNotifd typelib resolution
This commit is contained in:
+41
-4
@@ -11,7 +11,9 @@
|
||||
glib,
|
||||
gjs,
|
||||
libadwaita,
|
||||
pywal16,
|
||||
dart-sass,
|
||||
psmisc,
|
||||
socat,
|
||||
}:
|
||||
let
|
||||
@@ -26,6 +28,8 @@ let
|
||||
lib.fileset.unions [
|
||||
../flake.nix
|
||||
../flake.lock
|
||||
../result
|
||||
../build
|
||||
./.
|
||||
]
|
||||
);
|
||||
@@ -68,10 +72,21 @@ let
|
||||
|
||||
inherit src;
|
||||
|
||||
# Replace reference to ags FHS install path
|
||||
postPatch = ''
|
||||
substituteInPlace package.json pnpm-lock.yaml \
|
||||
--replace-fail "/usr/share/ags/js" "${inputs'.ags.packages.ags.jsPackage}"
|
||||
# Copy the ags JS lib from the Nix store into the source tree so pnpm can
|
||||
# treat it as a local file: dependency (no /nix/store path inside pnpm).
|
||||
cp -R ${inputs'.ags.packages.ags.jsPackage} ags-js-lib
|
||||
|
||||
# Point the devDependency at the local copy instead of the FHS path.
|
||||
substituteInPlace package.json \
|
||||
--replace-fail "file:/usr/share/ags/js" "file:./ags-js-lib"
|
||||
|
||||
# Update the lockfile to reference the local copy as well.
|
||||
# We need to keep specifiers in sync with package.json to satisfy
|
||||
# pnpm's frozen-lockfile check.
|
||||
substituteInPlace pnpm-lock.yaml \
|
||||
--replace-fail "file:/usr/share/ags/js" "file:./ags-js-lib" \
|
||||
--replace-fail "../../../../usr/share/ags/js" "./ags-js-lib"
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
@@ -97,6 +112,7 @@ buildNpmPackage (finalAttrs: {
|
||||
;
|
||||
|
||||
fetcherVersion = 2;
|
||||
# Hash updated after local pnpmDeps build
|
||||
hash = "sha256-m/aPNvv26r0DUvRUR4TL2GwwAHKvEIkc8Nvlm/jpnPc=";
|
||||
|
||||
# fetcher version 2 fails if there are no *-exec files in the output
|
||||
@@ -133,7 +149,8 @@ buildNpmPackage (finalAttrs: {
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
mkdir build
|
||||
# Allow incremental or repeated builds: don't fail if ./build already exists
|
||||
mkdir -p build
|
||||
outPath=./build/${packageJSON.name}
|
||||
ags bundle ./src/app.ts $outPath \
|
||||
--gtk 4 \
|
||||
@@ -166,11 +183,29 @@ buildNpmPackage (finalAttrs: {
|
||||
--prefix PATH : ${
|
||||
lib.makeBinPath [
|
||||
# runtime executables
|
||||
pywal16 # provides `wal` for colorshell's wallpaper module
|
||||
dart-sass
|
||||
glib
|
||||
psmisc
|
||||
socat
|
||||
]
|
||||
}
|
||||
--prefix GI_TYPELIB_PATH : "${
|
||||
lib.makeSearchPath "lib/girepository-1.0" (with inputs'.astal.packages; [
|
||||
astal4
|
||||
apps
|
||||
auth
|
||||
battery
|
||||
bluetooth
|
||||
hyprland
|
||||
io
|
||||
mpris
|
||||
network
|
||||
notifd
|
||||
tray
|
||||
wireplumber
|
||||
])
|
||||
}"
|
||||
)
|
||||
'';
|
||||
|
||||
@@ -178,3 +213,5 @@ buildNpmPackage (finalAttrs: {
|
||||
resources = colorshellResources;
|
||||
};
|
||||
})
|
||||
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
{
|
||||
inputs',
|
||||
lib,
|
||||
stdenv,
|
||||
stdenvNoCC,
|
||||
moreutils,
|
||||
pnpm_10,
|
||||
buildNpmPackage,
|
||||
wrapGAppsHook4,
|
||||
gobject-introspection,
|
||||
glib,
|
||||
gjs,
|
||||
libadwaita,
|
||||
dart-sass,
|
||||
socat,
|
||||
}:
|
||||
let
|
||||
packageJSON = lib.importJSON ../package.json;
|
||||
pname = packageJSON.name;
|
||||
version = packageJSON.version;
|
||||
|
||||
# Cleaned sources from this repository
|
||||
src = lib.fileset.toSource {
|
||||
root = ../.;
|
||||
fileset = lib.fileset.difference ../. (
|
||||
lib.fileset.unions [
|
||||
../flake.nix
|
||||
../flake.lock
|
||||
./.
|
||||
]
|
||||
);
|
||||
};
|
||||
|
||||
# Derivation building just the gresources file
|
||||
colorshellResources = stdenv.mkDerivation {
|
||||
pname = "${pname}-resources.gresource";
|
||||
inherit version;
|
||||
|
||||
inherit src;
|
||||
|
||||
buildInputs = [
|
||||
glib
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
glib-compile-resources resources.gresource.xml \
|
||||
--sourcedir ./resources \
|
||||
--target resources.gresource
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
cp resources.gresource $out
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
|
||||
# Cleaned sources, with FHS paths patched out.
|
||||
colorshellSrc = stdenvNoCC.mkDerivation {
|
||||
pname = "${pname}-src";
|
||||
inherit version;
|
||||
|
||||
inherit src;
|
||||
|
||||
# Replace reference to ags FHS install path
|
||||
postPatch = ''
|
||||
substituteInPlace package.json pnpm-lock.yaml \
|
||||
--replace-fail "/usr/share/ags/js" "${inputs'.ags.packages.ags.jsPackage}"
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
cp -rp * $out
|
||||
'';
|
||||
};
|
||||
in
|
||||
buildNpmPackage (finalAttrs: {
|
||||
inherit pname version;
|
||||
|
||||
src = colorshellSrc;
|
||||
sourceRoot = "${finalAttrs.src.name}";
|
||||
|
||||
npmConfigHook = pnpm_10.configHook;
|
||||
npmDeps = finalAttrs.pnpmDeps;
|
||||
pnpmDeps = pnpm_10.fetchDeps {
|
||||
inherit (finalAttrs)
|
||||
pname
|
||||
version
|
||||
src
|
||||
sourceRoot
|
||||
;
|
||||
|
||||
fetcherVersion = 2;
|
||||
hash = "sha256-Z5JP7hPEjLY9wGnWe6kM6T1qk3UUSlJnoxdDqS/ksnw=";
|
||||
|
||||
# fetcher version 2 fails if there are no *-exec files in the output
|
||||
preFixup = ''
|
||||
touch $out/.dummy-exec
|
||||
'';
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
wrapGAppsHook4
|
||||
gobject-introspection
|
||||
inputs'.ags.packages.default
|
||||
moreutils
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
glib
|
||||
gjs
|
||||
libadwaita
|
||||
inputs'.astal.packages.astal4
|
||||
inputs'.astal.packages.apps
|
||||
inputs'.astal.packages.auth
|
||||
inputs'.astal.packages.battery
|
||||
inputs'.astal.packages.bluetooth
|
||||
inputs'.astal.packages.hyprland
|
||||
inputs'.astal.packages.io
|
||||
inputs'.astal.packages.mpris
|
||||
inputs'.astal.packages.network
|
||||
inputs'.astal.packages.notifd
|
||||
inputs'.astal.packages.tray
|
||||
inputs'.astal.packages.wireplumber
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
mkdir build
|
||||
outPath=./build/${packageJSON.name}
|
||||
ags bundle ./src/app.ts $outPath \
|
||||
--gtk 4 \
|
||||
--root ./src \
|
||||
--define "DEVEL=false" \
|
||||
--define "COLORSHELL_VERSION='${finalAttrs.version}'" \
|
||||
--define "GRESOURCES_FILE='${colorshellResources}'"
|
||||
|
||||
# add socket-communication support on executable
|
||||
{
|
||||
head -n1 $outPath
|
||||
sed '1{/^#!.*$/d}' ${../scripts/socket.sh}
|
||||
cat "$outPath" | sed '/^#!.*$/d'
|
||||
} | sponge $outPath
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/bin
|
||||
cp -rp build/${packageJSON.name} $out/bin/
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
preFixup = ''
|
||||
gappsWrapperArgs+=(
|
||||
--prefix PATH : ${
|
||||
lib.makeBinPath [
|
||||
# runtime executables
|
||||
dart-sass
|
||||
glib
|
||||
socat
|
||||
]
|
||||
}
|
||||
)
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
resources = colorshellResources;
|
||||
};
|
||||
})
|
||||
Reference in New Issue
Block a user