diff --git a/flake.nix b/flake.nix index 2647b13..a8c60e8 100644 --- a/flake.nix +++ b/flake.nix @@ -61,6 +61,17 @@ machineDefinitions; tryFiles = import ./lib/utils/try-files.nix { inherit lib; }; + + xonePatcher = { fetchFromGitHub, xone }: + xone.overrideAttrs ( + final: prev: { + src = fetchFromGitHub { + owner = "manuth"; + repo = "xone"; + rev = "954fc823fbaa429ad6e1c1a06a4a006598ef35ae"; + sha256 = "lsfm7WDXTB6t05AI/pp17yZvkNvnM2WBMUHL1eVO6qw="; + }; + }); in flake-utils.lib.eachDefaultSystem ( system: @@ -73,17 +84,6 @@ sops-nix.overlays.default ]; }; - - xonePatcher = - xone: (xone.overrideAttrs ( - final: prev: { - src = pkgs.fetchFromGitHub { - owner = "manuth"; - repo = "xone"; - rev = "954fc823fbaa429ad6e1c1a06a4a006598ef35ae"; - sha256 = "lsfm7WDXTB6t05AI/pp17yZvkNvnM2WBMUHL1eVO6qw="; - }; - })); in { packages = { rcloneDocs = @@ -103,7 +103,10 @@ pkgs.runCommand "options-doc.md" {} '' cat ${optionsDoc.optionsCommonMark} >> $out ''; - xone = xonePatcher pkgs.linuxPackages_latest.xone; + xone = xonePatcher { + inherit (pkgs) fetchFromGitHub; + inherit (pkgs.linuxPackages_latest) xone; + }; }; devShells.default = pkgs.mkShellNoCC ( @@ -139,6 +142,8 @@ { pkgs, ... }: { config = { _module.args = { + inherit xonePatcher; + machine = machine // { name = hostname; config = (pkgs.callPackage config { }); diff --git a/lib/configuration.nix b/lib/configuration.nix index 25397da..ffd4caf 100644 --- a/lib/configuration.nix +++ b/lib/configuration.nix @@ -5,6 +5,7 @@ ./modules/my-users.nix ./modules/sddm.nix ./modules/unfree.nix + ./modules/xone.nix ]; config = { @@ -102,6 +103,9 @@ package = config.boot.kernelPackages.nvidiaPackages.stable; }; + # Drivers + hardware.xone.enable = (lib.mkIf machine.config.xone true); + # Enable KDE Plasma services.displayManager.sddm = { enable = true; diff --git a/lib/modules/xone.nix b/lib/modules/xone.nix new file mode 100644 index 0000000..46c1823 --- /dev/null +++ b/lib/modules/xone.nix @@ -0,0 +1,22 @@ +{ lib, pkgs, xonePatcher, ... }: { + config = { + nixpkgs = { + config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + "xow_dongle-firmware" + ]; + + overlays = [ + (final: prev: { + linuxPackages = prev.linuxPackages.extend ( + final: prev: { + xone = xonePatcher { + inherit (pkgs) fetchFromGitHub; + inherit (prev) xone; + }; + } + ); + }) + ]; + }; + }; +}