diff --git a/README.md b/README.md index 547095d..fba34ce 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,10 @@ outputs = {nixpkgs, lsfg-vk-flake, ...}: { And then enable this in your system config: ```nix -services.lsfg-vk.enable = true; +services.lsfg-vk = { + enable = true; + ui.enable = true; # installs gui for configuring lsfg-vk +}; ``` ### User install (manual) diff --git a/default.nix b/default.nix deleted file mode 100644 index 124b747..0000000 --- a/default.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ - lib, - fetchFromGitHub, - cmake, - ninja, - vulkan-headers, - vulkan-loader, - llvmPackages, - libX11, - libXrandr, - libXinerama, - libXcursor, - libXi, - libglvnd, - libxkbcommon, - wayland-scanner, - pkg-config, - wayland, -}: - -llvmPackages.stdenv.mkDerivation { - pname = "lsfg-vk"; - version = "unstable-2025-07-20-e67fcd3"; - - src = fetchFromGitHub { - owner = "PancakeTAS"; - repo = "lsfg-vk"; - rev = "e67fcd3dd832c9d177ad2be780e5dd0e47810bdf"; - hash = "sha256-c0anP3lWJ2GcjJNGIHcY/sS86AS1tFk0t7vXbaEGTQg="; - fetchSubmodules = true; - }; - - cmakeFlags = [ - "-DCMAKE_BUILD_TYPE=Release" - ]; - - nativeBuildInputs = [ - # clang-tools needs to come before clang so it can locate Vulkan headers correctly - llvmPackages.clang-tools - llvmPackages.clang - llvmPackages.libllvm # needed for release builds - cmake - ninja - wayland-scanner - pkg-config - ]; - - buildInputs = [ - vulkan-headers - vulkan-loader - libX11 - libXrandr - libXinerama - libXcursor - libXi - libglvnd - libxkbcommon - wayland - ]; - - meta = with lib; { - description = "Vulkan layer for frame generation (Requires Lossless Scaling install)"; - homepage = "https://github.com/PancakeTAS/lsfg-vk/"; - license = licenses.mit; - platforms = platforms.linux; - }; -} diff --git a/flake.lock b/flake.lock index 3b37958..83fcd4c 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1752687322, - "narHash": "sha256-RKwfXA4OZROjBTQAl9WOZQFm7L8Bo93FQwSJpAiSRvo=", + "lastModified": 1756266583, + "narHash": "sha256-cr748nSmpfvnhqSXPiCfUPxRz2FJnvf/RjJGvFfaCsM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6e987485eb2c77e5dcc5af4e3c70843711ef9251", + "rev": "8a6d5427d99ec71c64f0b93d45778c889005d9c2", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index c9a3db2..99e7737 100644 --- a/flake.nix +++ b/flake.nix @@ -2,12 +2,16 @@ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; outputs = { nixpkgs, ... }: - let - system = "x86_64-linux"; - pkgs = import nixpkgs { inherit system; }; - in - { - packages.${system}.default = pkgs.callPackage ./default.nix { }; - nixosModules.default = import ./module.nix; - }; + let + forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ]; + in + { + packages = forAllSystems (system: { + default = nixpkgs.legacyPackages.${system}.callPackage ./lsfg-vk.nix { }; + lsfg-vk = nixpkgs.legacyPackages.${system}.callPackage ./lsfg-vk.nix { }; + lsfg-vk-ui = nixpkgs.legacyPackages.${system}.callPackage ./lsfg-vk-ui.nix { }; + }); + + nixosModules.default = import ./module.nix; + }; } diff --git a/lsfg-vk-ui.nix b/lsfg-vk-ui.nix new file mode 100644 index 0000000..700eb7a --- /dev/null +++ b/lsfg-vk-ui.nix @@ -0,0 +1,54 @@ +{ + lib, + fetchFromGitHub, + rustPlatform, + pkg-config, + glib, + pango, + gdk-pixbuf, + gtk4, + libadwaita, +}: + +rustPlatform.buildRustPackage rec { + pname = "lsfg-vk-ui"; + version = "1.0.0"; + + src = fetchFromGitHub { + owner = "PancakeTAS"; + repo = "lsfg-vk"; + tag = "v${version}"; + hash = "sha256-nIyVOil/gHC+5a+sH3vMlcqVhixjJaGWqXbyoh2Nqyw="; + }; + + cargoHash = "sha256-hIQRS/egIDU5Vu/1KWHtpt4S26h+9GadVr+lBAG2LDg="; + + sourceRoot = "source/ui"; + + nativeBuildInputs = [ + pkg-config + glib + ]; + + buildInputs = [ + pango + gdk-pixbuf + gtk4 + libadwaita + ]; + + postInstall = '' + install -Dm444 $src/ui/rsc/gay.pancake.lsfg-vk-ui.desktop $out/share/applications/gay.pancake.lsfg-vk-ui.desktop + install -Dm444 $src/ui/rsc/icon.png $out/share/icons/hicolor/256x256/apps/gay.pancake.lsfg-vk-ui.png + ''; + + meta = { + description = "Graphical configuration interface for lsfg-vk"; + homepage = "https://github.com/PancakeTAS/lsfg-vk/"; + changelog = "https://github.com/PancakeTAS/lsfg-vk/releases/tag/${src.tag}"; + license = lib.licenses.mit; + platforms = lib.platforms.linux; + maintainers = with lib.maintainers; [ pabloaul ]; + mainProgram = "lsfg-vk-ui"; + }; +} \ No newline at end of file diff --git a/lsfg-vk.nix b/lsfg-vk.nix new file mode 100644 index 0000000..63e494c --- /dev/null +++ b/lsfg-vk.nix @@ -0,0 +1,44 @@ +{ + lib, + fetchFromGitHub, + cmake, + vulkan-headers, + llvmPackages, +}: + +llvmPackages.stdenv.mkDerivation rec { + pname = "lsfg-vk"; + version = "1.0.0"; + + src = fetchFromGitHub { + owner = "PancakeTAS"; + repo = "lsfg-vk"; + tag = "v${version}"; + hash = "sha256-hWpuPH7mKbeMaLaRUwtlkNLy4lOnJEe+yd54L7y2kV0="; + fetchSubmodules = true; + }; + + postPatch = '' + substituteInPlace VkLayer_LS_frame_generation.json \ + --replace-fail "liblsfg-vk.so" "$out/lib/liblsfg-vk.so" + ''; + + nativeBuildInputs = [ + llvmPackages.clang-tools + llvmPackages.libllvm + cmake + ]; + + buildInputs = [ + vulkan-headers + ]; + + meta = { + description = "Vulkan layer for frame generation (Requires owning Lossless Scaling)"; + homepage = "https://github.com/PancakeTAS/lsfg-vk/"; + changelog = "https://github.com/PancakeTAS/lsfg-vk/releases/tag/${src.tag}"; + license = lib.licenses.mit; + platforms = lib.platforms.linux; + maintainers = with lib.maintainers; [ pabloaul ]; + }; +} \ No newline at end of file diff --git a/module.nix b/module.nix index 19bc424..f2fcaa6 100644 --- a/module.nix +++ b/module.nix @@ -6,40 +6,41 @@ }: let cfg = config.services.lsfg-vk; - lsfg-vk = pkgs.callPackage ./default.nix { }; + lsfg-vk = pkgs.callPackage ./lsfg-vk.nix { }; + lsfg-vk-ui = pkgs.callPackage ./lsfg-vk-ui.nix { }; in { options = { services.lsfg-vk = { enable = lib.mkEnableOption "Lossless Scaling Frame Generation Vulkan layer"; + ui.enable = lib.mkEnableOption "Enables a GUI for configuring lsfg-vk"; + package = lib.mkOption { type = lib.types.package; description = "The lsfg-vk package to use"; default = lsfg-vk; }; - losslessDLLFile = lib.mkOption - { - type = with lib.types; nullOr str; - default = null; - example = "/home/user/games/Lossless Scaling/Lossless.dll"; - description = '' - Sets the LSFG_DLL_PATH environment variable. - Required if Lossless Scaling isn't installed in a standard location - ''; - }; + losslessDLLFile = lib.mkOption { + type = with lib.types; nullOr str; + default = null; + example = "/home/user/games/Lossless Scaling/Lossless.dll"; + description = '' + Sets the LSFG_DLL_PATH environment variable. + Required if Lossless Scaling isn't installed in a standard location + ''; + }; - configFile = lib.mkOption - { - type = with lib.types; nullOr str; - default = null; - example = "/home/user/.config/lsfg-vk/conf.toml"; - description = '' - Sets the LSFG_CONFIG environment variable. - Required if the lsfg-vk configuration file isn't stored at the standard location - ''; - }; + configFile = lib.mkOption { + type = with lib.types; nullOr str; + default = null; + example = "/home/user/.config/lsfg-vk/conf.toml"; + description = '' + Sets the LSFG_CONFIG environment variable. + Required if the lsfg-vk configuration file isn't stored at the standard location + ''; + }; }; }; @@ -52,6 +53,9 @@ in environment.etc."vulkan/implicit_layer.d/VkLayer_LS_frame_generation.json".source = "${cfg.package}/share/vulkan/implicit_layer.d/VkLayer_LS_frame_generation.json"; } + (lib.mkIf cfg.ui.enable { + environment.systemPackages = [ lsfg-vk-ui ]; + }) (lib.mkIf (cfg.losslessDLLFile != null) { environment.sessionVariables.LSFG_DLL_PATH = lib.warn "losslessDLLFile is deprecated and will only be used by lsfg-vk if LSFG_LEGACY is set."