diff --git a/flake.nix b/flake.nix index fb6b09d..663cf94 100644 --- a/flake.nix +++ b/flake.nix @@ -6,9 +6,11 @@ forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ]; in { - packages = forAllSystems (system: - { default = nixpkgs.legacyPackages.${system}.callPackage ./default.nix { }; } - ); + 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..fe2f972 --- /dev/null +++ b/lsfg-vk-ui.nix @@ -0,0 +1,47 @@ +{ + lib, + fetchFromGitHub, + rustPlatform, + pkg-config, + glib, + pango, + gdk-pixbuf, + gtk4, + libadwaita +}: + +rustPlatform.buildRustPackage { + pname = "lsfg-vk-ui"; + version = "unstable-2025-07-25-e8f8056"; + + src = fetchFromGitHub { + owner = "PancakeTAS"; + repo = "lsfg-vk"; + rev = "e8f805632307ab526a989b33dcf9653c5679d374"; + hash = "sha256-3EmH8skhpa0ELYE3UoV2SanGUqjC9nu8IPE3JPny+V4="; + }; + + cargoHash = "sha256-EMVDcThepj8Lq42NBxROPUin94TikUdwR/wTVXn2tI0="; + + sourceRoot = "source/ui"; + + nativeBuildInputs = [ + pkg-config + glib + ]; + + buildInputs = [ + pango + gdk-pixbuf + gtk4 + libadwaita + ]; + + meta = with lib; { + description = "Graphical interface for lsfg-vk"; + homepage = "https://github.com/PancakeTAS/lsfg-vk/"; + license = licenses.mit; + platforms = platforms.linux; + mainProgram = "lsfg-vk-ui"; + }; +} \ No newline at end of file diff --git a/default.nix b/lsfg-vk.nix similarity index 85% rename from default.nix rename to lsfg-vk.nix index 7db0ef7..48a632a 100644 --- a/default.nix +++ b/lsfg-vk.nix @@ -18,6 +18,11 @@ llvmPackages.stdenv.mkDerivation { fetchSubmodules = true; }; + postPatch = '' + substituteInPlace VkLayer_LS_frame_generation.json \ + --replace "liblsfg-vk.so" "$out/lib/liblsfg-vk.so" + ''; + cmakeFlags = [ "-DCMAKE_BUILD_TYPE=Release" ]; 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."