Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handheld-daemon-ui: init at 3.2.1 #305027

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion nixos/modules/services/hardware/handheld-daemon.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ in
enable = mkEnableOption "Enable Handheld Daemon";
package = mkPackageOption pkgs "handheld-daemon" { };

ui = {
enable = mkEnableOption "Handheld Daemon UI";
toast003 marked this conversation as resolved.
Show resolved Hide resolved
package = mkPackageOption pkgs "handheld-daemon-ui" { };
};

user = mkOption {
type = types.str;
description = ''
Expand All @@ -20,7 +25,10 @@ in
};

config = mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
environment.systemPackages = [
cfg.package
(mkIf cfg.ui.enable cfg.ui.package)
];
toast003 marked this conversation as resolved.
Show resolved Hide resolved
services.udev.packages = [ cfg.package ];
systemd.packages = [ cfg.package ];

Expand All @@ -31,6 +39,11 @@ in

restartIfChanged = true;

path = mkIf cfg.ui.enable [
pkgs.handheld-daemon-ui
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be wrapped inside the UI?

pkgs.lsof
];

serviceConfig = {
ExecStart = "${ lib.getExe cfg.package } --user ${ cfg.user }";
Nice = "-12";
Expand Down
39 changes: 39 additions & 0 deletions pkgs/by-name/ha/handheld-daemon-ui/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
lib,
appimageTools,
fetchurl,
}:
let
pname = "handheld-daemon-ui";
version = "3.1.1";

src = fetchurl {
url = "https://github.com/hhd-dev/hhd-ui/releases/download/v${version}/hhd-ui.Appimage";
hash = "sha256-KH01MvcCbvCqjp1UZHnwfh9G3Yh50CO9Ecjl1Y8VY9E=";
};
extractedFiles = appimageTools.extractType2 { inherit pname version src; };
in
appimageTools.wrapType2 {
inherit pname version src;

extraInstallCommands = ''
# Handheld-daemon expects the UI binary to be called hhd-ui
mv $out/bin/${pname} $out/bin/hhd-ui

mkdir -p $out/share/applications
substitute ${extractedFiles}/hhd-ui.desktop \
$out/share/applications/hhd-ui.desktop \
--replace-fail "Exec=AppRun" "Exec=hhd-ui"
cp ${extractedFiles}/usr/share/icons $out/share -r
'';

meta = with lib; {
description = "The main UI for the Handheld Daemon";
homepage = "https://github.com/hhd-dev/hhd-ui";
license = licenses.gpl3Only;
maintainers = with maintainers; [ toast ];
toast003 marked this conversation as resolved.
Show resolved Hide resolved
mainProgram = "hhd-ui";
platforms = [ "x86_64-linux" ];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
};
}