lsfg-vk-ui: init

This commit is contained in:
Nojus 2025-07-27 02:14:25 +02:00
parent 0b57544e47
commit a796344ac2
4 changed files with 82 additions and 24 deletions

View file

@ -6,9 +6,11 @@
forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ]; forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ];
in in
{ {
packages = forAllSystems (system: packages = forAllSystems (system: {
{ default = nixpkgs.legacyPackages.${system}.callPackage ./default.nix { }; } 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; nixosModules.default = import ./module.nix;
}; };

47
lsfg-vk-ui.nix Normal file
View file

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

View file

@ -18,6 +18,11 @@ llvmPackages.stdenv.mkDerivation {
fetchSubmodules = true; fetchSubmodules = true;
}; };
postPatch = ''
substituteInPlace VkLayer_LS_frame_generation.json \
--replace "liblsfg-vk.so" "$out/lib/liblsfg-vk.so"
'';
cmakeFlags = [ cmakeFlags = [
"-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_BUILD_TYPE=Release"
]; ];

View file

@ -6,40 +6,41 @@
}: }:
let let
cfg = config.services.lsfg-vk; 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 in
{ {
options = { options = {
services.lsfg-vk = { services.lsfg-vk = {
enable = lib.mkEnableOption "Lossless Scaling Frame Generation Vulkan layer"; enable = lib.mkEnableOption "Lossless Scaling Frame Generation Vulkan layer";
ui.enable = lib.mkEnableOption "Enables a GUI for configuring lsfg-vk";
package = lib.mkOption { package = lib.mkOption {
type = lib.types.package; type = lib.types.package;
description = "The lsfg-vk package to use"; description = "The lsfg-vk package to use";
default = lsfg-vk; default = lsfg-vk;
}; };
losslessDLLFile = lib.mkOption losslessDLLFile = lib.mkOption {
{ type = with lib.types; nullOr str;
type = with lib.types; nullOr str; default = null;
default = null; example = "/home/user/games/Lossless Scaling/Lossless.dll";
example = "/home/user/games/Lossless Scaling/Lossless.dll"; description = ''
description = '' Sets the LSFG_DLL_PATH environment variable.
Sets the LSFG_DLL_PATH environment variable. Required if Lossless Scaling isn't installed in a standard location
Required if Lossless Scaling isn't installed in a standard location '';
''; };
};
configFile = lib.mkOption configFile = lib.mkOption {
{ type = with lib.types; nullOr str;
type = with lib.types; nullOr str; default = null;
default = null; example = "/home/user/.config/lsfg-vk/conf.toml";
example = "/home/user/.config/lsfg-vk/conf.toml"; description = ''
description = '' Sets the LSFG_CONFIG environment variable.
Sets the LSFG_CONFIG environment variable. Required if the lsfg-vk configuration file isn't stored at the standard location
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 = environment.etc."vulkan/implicit_layer.d/VkLayer_LS_frame_generation.json".source =
"${cfg.package}/share/vulkan/implicit_layer.d/VkLayer_LS_frame_generation.json"; "${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) { (lib.mkIf (cfg.losslessDLLFile != null) {
environment.sessionVariables.LSFG_DLL_PATH = environment.sessionVariables.LSFG_DLL_PATH =
lib.warn "losslessDLLFile is deprecated and will only be used by lsfg-vk if LSFG_LEGACY is set." lib.warn "losslessDLLFile is deprecated and will only be used by lsfg-vk if LSFG_LEGACY is set."