This commit is contained in:
Xory 2025-11-30 22:06:23 +02:00
parent 8226f5b933
commit 371db9222f
4 changed files with 59 additions and 17 deletions

View file

@ -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));
};
}

View file

@ -122,6 +122,8 @@
variant = "";
};
services.flatpak.enable = true;
# Enable CUPS to print documents.
# services.printing.enable = true;

View file

@ -42,6 +42,10 @@
input-leap
viber
hyprpolkitagent
pulsemixer
feh
opentrack
aitrack
];
home.file = {

33
overlays/opentrack.nix Normal file
View file

@ -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"
'';
});
}