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

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;
};
postPatch = ''
substituteInPlace VkLayer_LS_frame_generation.json \
--replace "liblsfg-vk.so" "$out/lib/liblsfg-vk.so"
'';
cmakeFlags = [
"-DCMAKE_BUILD_TYPE=Release"
];

View file

@ -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."