diff --git a/flake.nix b/flake.nix index c1bc227..a10a5fb 100644 --- a/flake.nix +++ b/flake.nix @@ -15,29 +15,32 @@ system = "x86_64-linux"; username = "xory"; + opentrack-overlay = import ./overlays/opentrack.nix; + mkNixosHost = hostName: nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = { inherit inputs; }; - modules = [ - impermanence.nixosModules.impermanence - ./hosts/${hostName}/configuration.nix - ./hosts/${hostName}/hardware-configuration.nix + inherit system; + specialArgs = { inherit inputs; }; + modules = [ + { nixpkgs.overlays = [ opentrack-overlay ]; } + impermanence.nixosModules.impermanence + ./hosts/${hostName}/configuration.nix + ./hosts/${hostName}/hardware-configuration.nix - home-manager.nixosModules.home-manager { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.${username} = import ./hosts/${hostName}/home.nix; - } - ]; - }; + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.${username} = import ./hosts/${hostName}/home.nix; + } + ]; + }; in { nixosConfigurations = nixpkgs.lib.mapAttrs' (name: value: { - name = name; - value = mkNixosHost name; - }) - (nixpkgs.lib.filterAttrs (name: value: value == "directory") + name = name; + value = mkNixosHost name; + }) + (nixpkgs.lib.filterAttrs (name: value: value == "directory") (builtins.readDir ./hosts)); }; } diff --git a/hosts/nullstar/configuration.nix b/hosts/nullstar/configuration.nix index 1148d43..f911217 100644 --- a/hosts/nullstar/configuration.nix +++ b/hosts/nullstar/configuration.nix @@ -122,6 +122,8 @@ variant = ""; }; + services.flatpak.enable = true; + # Enable CUPS to print documents. # services.printing.enable = true; diff --git a/hosts/nullstar/home.nix b/hosts/nullstar/home.nix index 95d9f49..9607529 100644 --- a/hosts/nullstar/home.nix +++ b/hosts/nullstar/home.nix @@ -42,6 +42,10 @@ input-leap viber hyprpolkitagent + pulsemixer + feh + opentrack + aitrack ]; home.file = { diff --git a/overlays/opentrack.nix b/overlays/opentrack.nix new file mode 100644 index 0000000..ffb94db --- /dev/null +++ b/overlays/opentrack.nix @@ -0,0 +1,33 @@ +# ./overlays/opentrack.nix +self: super: { + opentrack = super.opentrack.overrideAttrs (oldAttrs: { + # 1. Add dependencies for building (onnxruntime) and wrapping (makeWrapper) + nativeBuildInputs = oldAttrs.nativeBuildInputs or [] ++ [ super.makeWrapper ]; + buildInputs = oldAttrs.buildInputs or [] ++ [ self.onnxruntime ]; + + # 2. Enable the neuralnet tracker feature during compile time + cmakeFlags = oldAttrs.cmakeFlags or [] ++ [ "-DSDK_NEURALNET=ON" ]; + + # 3. After installation, create a wrapper around the main binary + postInstall = (oldAttrs.postInstall or "") + '' + # Construct the full library path from all runtime dependencies + lib_path="${super.lib.makeLibraryPath [ + super.qt5.qtbase + super.qt5.qtwayland + super.opencv + self.onnxruntime + super.procps + super.libevdev + ]}" + + # Construct the full Qt plugin path + qt_plugin_path="${super.qt5.qtbase.bin}/lib/qt-${super.qt5.qtbase.version}/plugins:${super.qt5.qtwayland}/lib/qt-${super.qt5.qtwayland.version}/plugins" + + # Use makeWrapper to prepend the environment variables to the executable + # This modifies the binary at $out/bin/opentrack so it ALWAYS runs with this environment + wrapProgram $out/bin/opentrack \ + --prefix LD_LIBRARY_PATH : "$lib_path" \ + --prefix QT_PLUGIN_PATH : "$qt_plugin_path" + ''; + }); +}