Skip to content

Commit

Permalink
zap-chip-gui: actually provide a gui (#355263)
Browse files Browse the repository at this point in the history
  • Loading branch information
symphorien authored Dec 18, 2024
2 parents b3f70d4 + 66c0af5 commit 51c976d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkgs/by-name/za/zap-chip/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
electron_31,
fetchFromGitHub,
writers,
makeWrapper,
withGui ? false,
}:

Expand Down Expand Up @@ -58,6 +59,8 @@ buildNpmPackage rec {
-c.electronVersion=${electron.version}
'';

nativeBuildInputs = [ makeWrapper ];

postInstall =
''
# this file is also used at runtime
Expand All @@ -66,6 +69,19 @@ buildNpmPackage rec {
+ lib.optionalString (!withGui) ''
# home-assistant chip-* python packages need the executable under the name zap-cli
mv $out/bin/zap $out/bin/zap-cli
''
+ lib.optionalString withGui ''
pushd dist/linux-*unpacked
mkdir -p $out/opt/zap-chip
cp -r locales resources{,.pak} $out/opt/zap-chip
popd
rm $out/bin/zap
makeWrapper '${lib.getExe electron}' "$out/bin/zap" \
--add-flags $out/opt/zap-chip/resources/app.asar \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
--set-default ELECTRON_IS_DEV 0 \
--inherit-argv0
'';

meta = {
Expand Down

0 comments on commit 51c976d

Please sign in to comment.