Skip to content

Commit

Permalink
handheld-daemon: 3.9.0 -> 3.10.2 (#373678)
Browse files Browse the repository at this point in the history
  • Loading branch information
GaetanLepage authored Jan 19, 2025
2 parents 2e9a29e + 32d076a commit cc95e67
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 4 deletions.
37 changes: 37 additions & 0 deletions pkgs/by-name/ha/handheld-daemon/0001-remove-selinux-fixes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
diff --git a/src/hhd/plugins/power/power.py b/src/hhd/plugins/power/power.py
index 5ece857..be41542 100644
--- a/src/hhd/plugins/power/power.py
+++ b/src/hhd/plugins/power/power.py
@@ -79,12 +79,6 @@ def create_subvol():
)
return

- # Fixup selinux for swap
- subprocess.run(
- ["semanage", "fcontext", "-a", "-t", "var_t", HHD_SWAP_SUBVOL],
- )
- subprocess.run(["restorecon", HHD_SWAP_SUBVOL])
-
logger.info(f"Creating swap subvolume {HHD_SWAP_SUBVOL}")
os.system(f"btrfs subvolume create {HHD_SWAP_SUBVOL}")

@@ -153,19 +147,6 @@ def create_temporary_swap():
subprocess.run(["chmod", "600", HHD_SWAP_FILE], check=True)
subprocess.run(["mkswap", HHD_SWAP_FILE], check=True)

- # Fixup selinux for swap
- subprocess.run(
- [
- "semanage",
- "fcontext",
- "-a",
- "-t",
- "swapfile_t",
- HHD_SWAP_FILE,
- ],
- )
- subprocess.run(["restorecon", HHD_SWAP_FILE])
-
# Enable swap
subprocess.run(["swapon", HHD_SWAP_FILE], check=True)

22 changes: 18 additions & 4 deletions pkgs/by-name/ha/handheld-daemon/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,25 @@
efibootmgr,
dbus,
lsof,
btrfs-progs,
util-linux,
}:
python3Packages.buildPythonApplication rec {
pname = "handheld-daemon";
version = "3.9.0";
version = "3.10.2";
pyproject = true;

src = fetchFromGitHub {
owner = "hhd-dev";
repo = "hhd";
tag = "v${version}";
hash = "sha256-y3CxdWqQEwdNYs4m1NEUeRjTvvhEpS5S739wyFlluWo=";
hash = "sha256-6BjXqqNe2u/rh1cnuJ13L/1KimprcyatIr53b0GOBSM=";
};

# Handheld-daemon runs some selinux-related utils which are not in nixpkgs.
# NixOS doesn't support selinux so we can safely remove them
patches = [ ./0001-remove-selinux-fixes.patch ];

# This package relies on several programs expected to be on the user's PATH.
# We take a more reproducible approach by patching the absolute path to each of these required
# binaries.
Expand All @@ -41,8 +47,16 @@ python3Packages.buildPythonApplication rec {
substituteInPlace src/hhd/controller/physical/imu.py \
--replace-fail '"modprobe' '"${lib.getExe' kmod "modprobe"}'
substituteInPlace src/hhd/plugins/overlay/power.py \
--replace-fail '"efibootmgr"' '"${lib.getExe' efibootmgr "id"}"'
substituteInPlace src/hhd/plugins/power/power.py \
--replace-fail '"efibootmgr"' '"${lib.getExe' efibootmgr "id"}"' \
--replace-fail '"systemctl"' '"${lib.getExe' systemd "systemctl"}"' \
--replace-fail '"stat"' '"${lib.getExe' coreutils "stat"}"' \
--replace-fail '"swapon"' '"${lib.getExe' util-linux "swapon"}"' \
--replace-fail '"swapoff"' '"${lib.getExe' util-linux "swapoff"}"' \
--replace-fail '"fallocate"' '"${lib.getExe' util-linux "fallocate"}"' \
--replace-fail '"chmod"' '"${lib.getExe' coreutils "chmod"}"' \
--replace-fail '"mkswap"' '"${lib.getExe' util-linux "mkswap"}"' \
--replace-fail '"btrfs",' '"${lib.getExe' btrfs-progs "btrfs"}",'
substituteInPlace src/hhd/device/oxp/serial.py \
--replace-fail "udevadm" "${lib.getExe' systemd "udevadm"}"
Expand Down

0 comments on commit cc95e67

Please sign in to comment.