diff --git a/flake.nix b/flake.nix index 6d54e22..f705a0d 100644 --- a/flake.nix +++ b/flake.nix @@ -101,7 +101,6 @@ patches = [ ./nixpkgs-patches/pr359282.patch ./nixpkgs-patches/pr361364.patch - ./nixpkgs-patches/pr355973.patch ]; }; nixpkgs-patched = nixpkgs-raw.legacyPackages.x86_64-linux.applyPatches { diff --git a/machines/WinMax2/configuration.nix b/machines/WinMax2/configuration.nix index e5a8782..7c4ea9a 100755 --- a/machines/WinMax2/configuration.nix +++ b/machines/WinMax2/configuration.nix @@ -45,6 +45,9 @@ ACTION=="add", SUBSYSTEM=="i2c", ATTR{name}=="GXTP7385:00", ATTR{power/wakeup}="disabled" ACTION=="add", SUBSYSTEM=="i2c", ATTR{name}=="PNP0C50:00", ATTR{power/wakeup}="disabled" SUBSYSTEM=="usb", ATTR{idVendor}=="2541", ATTR{idProduct}=="9711", ATTR{remove}="1" + + # Enable wake from bluetooth + SUBSYSTEM=="usb", ATTRS{idVendor}=="8087", ATTRS{idProduct}=="0032" RUN+="/bin/sh -c 'echo enabled > /sys$env{DEVPATH}/../power/wakeup;" ''; services = { @@ -102,6 +105,18 @@ # services.printing.enable = true; home-manager.sharedModules = [ { + # Steam's hidpi support is bugged so it needds to be hardcoded + xdg.desktopEntries = { + steam-noScaling = { + name = "Steam (2x scale)"; + exec = "env STEAM_FORCE_DESKTOPUI_SCALING=2 steam %U"; + icon = "steam"; + categories = ["Network" "FileTransfer" "Game"]; + comment = "Application for managing and playing games on Steam"; + prefersNonDefaultGPU = true; + settings.X-KDE-RunOnDiscreteGpu = "true"; + }; + }; programs.plasma.input.keyboard.layouts = lib.mkForce [{layout = "us";} {layout = "es";}]; } ]; diff --git a/nixpkgs-patches/pr355973.patch b/nixpkgs-patches/pr355973.patch deleted file mode 100644 index 579b9d2..0000000 --- a/nixpkgs-patches/pr355973.patch +++ /dev/null @@ -1,213 +0,0 @@ -From cb9f9a1e5a51a87d59b373db7016cee1608debd5 Mon Sep 17 00:00:00 2001 -From: Atemu -Date: Thu, 14 Nov 2024 20:07:25 +0100 -Subject: [PATCH 1/2] fetchgit{,hub}: add tag argument - -It's become a common pattern to use `rev = "refs/tags/${version}"` rather than -just `rev = version` to ensure that the tag gets fetched rather than a branch -that has the same name. This has so far been done using boilerplate though, so -let's add a simple abstraction to fetch a tag instead. ---- - doc/build-helpers/fetchers.chapter.md | 5 ++++- - pkgs/build-support/fetchgit/default.nix | 5 ++++- - pkgs/build-support/fetchgithub/default.nix | 11 ++++++++--- - 3 files changed, 16 insertions(+), 5 deletions(-) - -diff --git a/doc/build-helpers/fetchers.chapter.md b/doc/build-helpers/fetchers.chapter.md -index d37a2fecaccda..567d47a1499be 100644 ---- a/doc/build-helpers/fetchers.chapter.md -+++ b/doc/build-helpers/fetchers.chapter.md -@@ -755,6 +755,9 @@ Used with Subversion. Expects `url` to a Subversion directory, `rev`, and `hash` - - Used with Git. Expects `url` to a Git repo, `rev`, and `hash`. `rev` in this case can be full the git commit id (SHA1 hash) or a tag name like `refs/tags/v1.0`. - -+If you want to fetch a tag you should pass the `tag` parameter instead of `rev` which has the same effect as setting `rev = "refs/tags"/${version}"`. -+This is safer than just setting `rev = version` w.r.t. possible branch and tag name conflicts. -+ - Additionally, the following optional arguments can be given: - - *`fetchSubmodules`* (Boolean) -@@ -833,7 +836,7 @@ A number of fetcher functions wrap part of `fetchurl` and `fetchzip`. They are m - - ## `fetchFromGitHub` {#fetchfromgithub} - --`fetchFromGitHub` expects four arguments. `owner` is a string corresponding to the GitHub user or organization that controls this repository. `repo` corresponds to the name of the software repository. These are located at the top of every GitHub HTML page as `owner`/`repo`. `rev` corresponds to the Git commit hash or tag (e.g `v1.0`) that will be downloaded from Git. Finally, `hash` corresponds to the hash of the extracted directory. Again, other hash algorithms are also available, but `hash` is currently preferred. -+`fetchFromGitHub` expects four arguments. `owner` is a string corresponding to the GitHub user or organization that controls this repository. `repo` corresponds to the name of the software repository. These are located at the top of every GitHub HTML page as `owner`/`repo`. `rev` corresponds to the Git commit hash or tag (e.g `v1.0`) that will be downloaded from Git. If you need to fetch a tag however, you should prefer to use the `tag` parameter which achieves this in a safer way with less boilerplate. Finally, `hash` corresponds to the hash of the extracted directory. Again, other hash algorithms are also available, but `hash` is currently preferred. - - To use a different GitHub instance, use `githubBase` (defaults to `"github.com"`). - -diff --git a/pkgs/build-support/fetchgit/default.nix b/pkgs/build-support/fetchgit/default.nix -index 4c40cbcef7e16..6f4cbba982a0e 100644 ---- a/pkgs/build-support/fetchgit/default.nix -+++ b/pkgs/build-support/fetchgit/default.nix -@@ -13,7 +13,10 @@ in - lib.makeOverridable (lib.fetchers.withNormalizedHash { } ( - # NOTE Please document parameter additions or changes in - # doc/build-helpers/fetchers.chapter.md --{ url, rev ? "HEAD", leaveDotGit ? deepClone -+{ url -+, tag ? null -+, rev ? if tag != null then "refs/tags/${tag}" else "HEAD" # FIXME fetching HEAD by default is problematic at best -+, leaveDotGit ? deepClone - , outputHash ? lib.fakeHash, outputHashAlgo ? null - , fetchSubmodules ? true, deepClone ? false - , branchName ? null -diff --git a/pkgs/build-support/fetchgithub/default.nix b/pkgs/build-support/fetchgithub/default.nix -index d27a3df7d3df7..de9912465a937 100644 ---- a/pkgs/build-support/fetchgithub/default.nix -+++ b/pkgs/build-support/fetchgithub/default.nix -@@ -1,7 +1,10 @@ - { lib, fetchgit, fetchzip }: - - lib.makeOverridable ( --{ owner, repo, rev, name ? "source" -+{ owner, repo -+, tag ? null -+, rev ? if tag != null then "refs/tags/${tag}" else null -+, name ? "source" - , fetchSubmodules ? false, leaveDotGit ? null - , deepClone ? false, private ? false, forceFetchGit ? false - , fetchLFS ? false -@@ -11,6 +14,8 @@ lib.makeOverridable ( - , ... # For hash agility - }@args: - -+assert (lib.assertMsg (rev != null) "You must provide `fetchFromGitHub with a `rev` or `tag`."); -+ - let - - position = (if args.meta.description or null != null -@@ -24,7 +29,7 @@ let - # to indicate where derivation originates, similar to make-derivation.nix's mkDerivation - position = "${position.file}:${toString position.line}"; - }; -- passthruAttrs = removeAttrs args [ "owner" "repo" "rev" "fetchSubmodules" "forceFetchGit" "private" "githubBase" "varPrefix" ]; -+ passthruAttrs = removeAttrs args [ "owner" "repo" "tag" "rev" "fetchSubmodules" "forceFetchGit" "private" "githubBase" "varPrefix" ]; - varBase = "NIX${lib.optionalString (varPrefix != null) "_${varPrefix}"}_GITHUB_PRIVATE_"; - useFetchGit = fetchSubmodules || (leaveDotGit == true) || deepClone || forceFetchGit || fetchLFS || (sparseCheckout != []); - # We prefer fetchzip in cases we don't need submodules as the hash -@@ -53,7 +58,7 @@ let - - fetcherArgs = (if useFetchGit - then { -- inherit rev deepClone fetchSubmodules sparseCheckout fetchLFS; url = gitRepoUrl; -+ inherit tag rev deepClone fetchSubmodules sparseCheckout fetchLFS; url = gitRepoUrl; - } // lib.optionalAttrs (leaveDotGit != null) { inherit leaveDotGit; } - else { - url = "${baseUrl}/archive/${rev}.tar.gz"; - -From e9a31f51468e43aaf8df79d10dca5a3d6447877b Mon Sep 17 00:00:00 2001 -From: Atemu -Date: Wed, 4 Dec 2024 01:37:01 +0100 -Subject: [PATCH 2/2] fetchgit{,hub}: assert illegal tag + rev combinations - -It's quite a bit more complex due to this but this was asked for during review ---- - pkgs/build-support/fetchgit/default.nix | 27 ++++++++++++++++++---- - pkgs/build-support/fetchgithub/default.nix | 11 +++++---- - 2 files changed, 30 insertions(+), 8 deletions(-) - -diff --git a/pkgs/build-support/fetchgit/default.nix b/pkgs/build-support/fetchgit/default.nix -index 6f4cbba982a0e..f2b4726fef09d 100644 ---- a/pkgs/build-support/fetchgit/default.nix -+++ b/pkgs/build-support/fetchgit/default.nix -@@ -15,14 +15,14 @@ lib.makeOverridable (lib.fetchers.withNormalizedHash { } ( - # doc/build-helpers/fetchers.chapter.md - { url - , tag ? null --, rev ? if tag != null then "refs/tags/${tag}" else "HEAD" # FIXME fetching HEAD by default is problematic at best -+, rev ? null - , leaveDotGit ? deepClone - , outputHash ? lib.fakeHash, outputHashAlgo ? null - , fetchSubmodules ? true, deepClone ? false - , branchName ? null - , sparseCheckout ? [] - , nonConeMode ? false --, name ? urlToName url rev -+, name ? null - , # Shell code executed after the file has been fetched - # successfully. This can do things like check or transform the file. - postFetch ? "" -@@ -62,12 +62,30 @@ lib.makeOverridable (lib.fetchers.withNormalizedHash { } ( - assert deepClone -> leaveDotGit; - assert nonConeMode -> (sparseCheckout != []); - -+let -+ revWithTag = -+ let -+ warningMsg = "fetchgit requires one of either `rev` or `tag` to be provided (not both)."; -+ otherIsNull = other: lib.assertMsg (other == null) warningMsg; -+ in -+ if tag != null then -+ assert (otherIsNull rev); -+ "refs/tags/${tag}" -+ else if rev != null then -+ assert (otherIsNull tag); -+ rev -+ else -+ # FIXME fetching HEAD if no rev or tag is provided is problematic at best -+ "HEAD"; -+in -+ - if builtins.isString sparseCheckout then - # Changed to throw on 2023-06-04 - throw "Please provide directories/patterns for sparse checkout as a list of strings. Passing a (multi-line) string is not supported any more." - else - stdenvNoCC.mkDerivation { -- inherit name; -+ name = if name != null then name else urlToName url revWithTag; -+ - builder = ./builder.sh; - fetcher = ./nix-prefetch-git; - -@@ -82,7 +100,8 @@ stdenvNoCC.mkDerivation { - # > from standard in as a newline-delimited list instead of from the arguments. - sparseCheckout = builtins.concatStringsSep "\n" sparseCheckout; - -- inherit url rev leaveDotGit fetchLFS fetchSubmodules deepClone branchName nonConeMode postFetch; -+ inherit url leaveDotGit fetchLFS fetchSubmodules deepClone branchName nonConeMode postFetch; -+ rev = revWithTag; - - postHook = if netrcPhase == null then null else '' - ${netrcPhase} -diff --git a/pkgs/build-support/fetchgithub/default.nix b/pkgs/build-support/fetchgithub/default.nix -index de9912465a937..f80e012955336 100644 ---- a/pkgs/build-support/fetchgithub/default.nix -+++ b/pkgs/build-support/fetchgithub/default.nix -@@ -3,7 +3,7 @@ - lib.makeOverridable ( - { owner, repo - , tag ? null --, rev ? if tag != null then "refs/tags/${tag}" else null -+, rev ? null - , name ? "source" - , fetchSubmodules ? false, leaveDotGit ? null - , deepClone ? false, private ? false, forceFetchGit ? false -@@ -14,13 +14,16 @@ lib.makeOverridable ( - , ... # For hash agility - }@args: - --assert (lib.assertMsg (rev != null) "You must provide `fetchFromGitHub with a `rev` or `tag`."); -+assert (lib.assertMsg (lib.xor (tag == null) (rev == null)) "fetchFromGitHub requires one of either `rev` or `tag` to be provided (not both)."); - - let - - position = (if args.meta.description or null != null - then builtins.unsafeGetAttrPos "description" args.meta -- else builtins.unsafeGetAttrPos "rev" args -+ else if tag != null then -+ builtins.unsafeGetAttrPos "tag" args -+ else -+ builtins.unsafeGetAttrPos "rev" args - ); - baseUrl = "https://${githubBase}/${owner}/${repo}"; - newMeta = meta // { -@@ -61,7 +64,7 @@ let - inherit tag rev deepClone fetchSubmodules sparseCheckout fetchLFS; url = gitRepoUrl; - } // lib.optionalAttrs (leaveDotGit != null) { inherit leaveDotGit; } - else { -- url = "${baseUrl}/archive/${rev}.tar.gz"; -+ url = "${baseUrl}/archive/${if tag != null then "refs/tags/${tag}" else rev}.tar.gz"; - - passthru = { - inherit gitRepoUrl; diff --git a/nixpkgs-patches/pr361364.patch b/nixpkgs-patches/pr361364.patch index 74a7942..71a2791 100644 --- a/nixpkgs-patches/pr361364.patch +++ b/nixpkgs-patches/pr361364.patch @@ -1,36 +1,33 @@ -From c94ae7a159eb8cd86f46ca1ea81dbdca651510f4 Mon Sep 17 00:00:00 2001 +From 437bcf5ec44352a643ce4baecb61e2bde2128e8d Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Tue, 3 Dec 2024 08:47:26 +0100 -Subject: [PATCH 1/2] handheld-daemon: 3.6.1 -> 3.6.2 +Subject: [PATCH] handheld-daemon: 3.6.1 -> 3.6.2 Diff: https://github.com/hhd-dev/hhd/compare/refs/tags/v3.6.1...v3.6.2 Changelog: https://github.com/hhd-dev/hhd/releases/tag/v3.6.2 --- - pkgs/by-name/ha/handheld-daemon/package.nix | 87 ++++++++++++++------- - 1 file changed, 57 insertions(+), 30 deletions(-) + pkgs/by-name/ha/handheld-daemon/package.nix | 32 ++++++++++++--------- + 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/pkgs/by-name/ha/handheld-daemon/package.nix b/pkgs/by-name/ha/handheld-daemon/package.nix -index b99cd1c581476..6b5965e06e645 100644 +index b99cd1c581476..77c898381a004 100644 --- a/pkgs/by-name/ha/handheld-daemon/package.nix +++ b/pkgs/by-name/ha/handheld-daemon/package.nix -@@ -1,63 +1,90 @@ +@@ -1,35 +1,37 @@ { + lib, + python3Packages, fetchFromGitHub, + + # dependencies -+ systemd, hidapi, -+ coreutils, kmod, - lib, - python3, -- toybox, -- lsof -+ dbus, + lsof, + toybox, +- lsof }: -python3.pkgs.buildPythonApplication rec { +python3Packages.buildPythonApplication rec { @@ -42,79 +39,29 @@ index b99cd1c581476..6b5965e06e645 100644 src = fetchFromGitHub { owner = "hhd-dev"; repo = "hhd"; -- rev = "refs/tags/v${version}"; + rev = "refs/tags/v${version}"; - hash = "sha256-IdpSRb66G+WzTv/BC29r2OjO1b4VdWbV6OSzOoiFAO0="; -+ tag = "v${version}"; + hash = "sha256-W1Ap6yTryBDozKe3aO413Fu0RBul9kEA9ACUTdYyOKM="; }; - propagatedBuildInputs = with python3.pkgs; [ -+ # 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. -+ postPatch = '' -+ substituteInPlace src/hhd/controller/lib/hid.py \ -+ --replace-fail "libhidapi" "${lib.getLib hidapi}/lib/libhidapi" -+ -+ substituteInPlace src/hhd/controller/lib/hide.py \ -+ --replace-fail "/bin/chmod" "${lib.getExe' coreutils "chmod"}" \ -+ --replace-fail "udevadm" "${lib.getExe' systemd "udevadm"}" -+ -+ substituteInPlace src/hhd/controller/physical/evdev.py \ -+ --replace-fail "udevadm" "${lib.getExe' systemd "udevadm"}" -+ -+ substituteInPlace src/hhd/controller/physical/imu.py \ -+ --replace-fail '"modprobe' '"${lib.getExe' kmod "modprobe"}' -+ -+ substituteInPlace src/hhd/device/oxp/serial.py \ -+ --replace-fail "udevadm" "${lib.getExe' systemd "udevadm"}" -+ -+ substituteInPlace src/hhd/plugins/overlay/systemd.py \ -+ --replace-fail "dbus-monitor" "${lib.getExe' dbus "dbus-monitor"}" \ -+ --replace-fail "systemd-inhibit" "${lib.getExe' systemd "systemd-inhibit"}" -+ -+ substituteInPlace src/hhd/plugins/overlay/x11.py \ -+ --replace-fail "lsof" "${lib.getExe lsof}" -+ -+ substituteInPlace src/hhd/plugins/plugin.py \ -+ --replace-fail '"id"' '"${lib.getExe' coreutils "id"}"' -+ ''; -+ -+ build-system = with python3Packages; [ -+ setuptools -+ ]; -+ + dependencies = with python3Packages; [ evdev -- hidapi -- kmod + hidapi + kmod ++ lsof + pyserial pyyaml rich setuptools -- toybox + toybox xlib - pyserial - lsof ]; # This package doesn't have upstream tests. - doCheck = false; - -- postPatch = '' -- # handheld-daemon contains a fork of the python module `hid`, so this hook -- # is borrowed from the `hid` derivation. -- hidapi=${hidapi}/lib/ -- test -d $hidapi || { echo "ERROR: $hidapi doesn't exist, please update/fix this build expression."; exit 1; } -- sed -i -e "s|libhidapi|$hidapi/libhidapi|" src/hhd/controller/lib/hid.py -- -- # The generated udev rules point to /bin/chmod, which does not exist in NixOS -- chmod=${toybox}/bin/chmod -- sed -i -e "s|/bin/chmod|$chmod|" src/hhd/controller/lib/hide.py -- ''; -- - postInstall = '' - install -Dm644 $src/usr/lib/udev/rules.d/83-hhd.rules -t $out/lib/udev/rules.d/ +@@ -52,12 +54,16 @@ python3.pkgs.buildPythonApplication rec { install -Dm644 $src/usr/lib/udev/hwdb.d/83-hhd.hwdb -t $out/lib/udev/hwdb.d/ ''; @@ -127,7 +74,7 @@ index b99cd1c581476..6b5965e06e645 100644 - maintainers = with maintainers; [ appsforartists toast ]; + platforms = lib.platforms.linux; + changelog = "https://github.com/hhd-dev/hhd/releases/tag/v${version}"; -+ license = lib.licenses.gpl3Only; ++ license = lib.licenses.mit; + maintainers = with lib.maintainers; [ + appsforartists + toast @@ -135,53 +82,3 @@ index b99cd1c581476..6b5965e06e645 100644 mainProgram = "hhd"; }; } - -From 2cf68f2bf37655d730202f2e551b40172181801c Mon Sep 17 00:00:00 2001 -From: Gaetan Lepage -Date: Mon, 9 Dec 2024 10:26:53 +0100 -Subject: [PATCH 2/2] handheld-daemon: 3.6.2 -> 3.7.0 - -Diff: https://github.com/hhd-dev/hhd/compare/None...v3.7.0 - -Changelog: https://github.com/hhd-dev/hhd/releases/tag/v3.7.0 ---- - pkgs/by-name/ha/handheld-daemon/package.nix | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/pkgs/by-name/ha/handheld-daemon/package.nix b/pkgs/by-name/ha/handheld-daemon/package.nix -index 6b5965e06e645..2fe0c45eca77f 100644 ---- a/pkgs/by-name/ha/handheld-daemon/package.nix -+++ b/pkgs/by-name/ha/handheld-daemon/package.nix -@@ -8,19 +8,20 @@ - hidapi, - coreutils, - kmod, -+ efibootmgr, - dbus, - lsof, - }: - python3Packages.buildPythonApplication rec { - pname = "handheld-daemon"; -- version = "3.6.2"; -+ version = "3.7.0"; - pyproject = true; - - src = fetchFromGitHub { - owner = "hhd-dev"; - repo = "hhd"; - tag = "v${version}"; -- hash = "sha256-W1Ap6yTryBDozKe3aO413Fu0RBul9kEA9ACUTdYyOKM="; -+ hash = "sha256-DkVdYnSEeaNZj76lhdU+9Pl0yzam2A2QGa3aHCmSHEA="; - }; - - # This package relies on several programs expected to be on the user's PATH. -@@ -40,6 +41,9 @@ 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/device/oxp/serial.py \ - --replace-fail "udevadm" "${lib.getExe' systemd "udevadm"}" -