mirror of
https://github.com/pabloaul/lsfg-vk-flake.git
synced 2025-08-27 19:06:28 -03:00
Compare commits
29 commits
unstable-2
...
main
Author | SHA1 | Date | |
---|---|---|---|
|
081cd66b13 | ||
|
cdcec1d2be | ||
|
754f64f7e4 | ||
|
caeeaf5b6d | ||
|
6e5f2362dc | ||
|
0fa0918ada | ||
|
dfdc7159e1 | ||
|
a796344ac2 | ||
|
0b57544e47 | ||
|
fcd672a3b6 | ||
|
d8929d91d2 | ||
|
382a1614c0 | ||
|
12763fb704 | ||
|
9a826097ad | ||
|
c88ac624f0 | ||
|
ec1b66adcb | ||
|
de1d2031dc | ||
|
f6d9f06778 | ||
|
5421d0a4bb | ||
|
9e8162794b | ||
|
51fc478dae | ||
|
955774220f | ||
|
2fcdb54c82 | ||
|
8b08608eca | ||
|
de8696f83f | ||
|
641212e569 | ||
|
291be68043 | ||
|
46745da846 | ||
|
0e4a10cb68 |
7 changed files with 230 additions and 71 deletions
73
README.md
73
README.md
|
@ -1,11 +1,70 @@
|
||||||
# lsfg-vk-flake
|
# lsfg-vk-flake
|
||||||
WIP! Nix flake to build the library for using Lossless Scaling's frame generation on Linux
|
Nix flake for using [Lossless Scaling's frame generation on Linux](https://github.com/PancakeTAS/lsfg-vk)
|
||||||
|
|
||||||
current state: builds and seems to be functional
|
>[!IMPORTANT]
|
||||||
|
> You need to have Lossless Scaling installed on Steam!
|
||||||
|
> In case it is not installed on the default Steam drive, you may want to consider setting the correct path in the lsfg-vk config.
|
||||||
|
|
||||||
## manual install
|
## Installation
|
||||||
1. build the library with ``nix build``
|
### System-wide (NixOS module)
|
||||||
2. copy library and vulkan layer config to your ~/.local: ``cp -r result/* ~/.local/`` (check contents of result first!)
|
This approach will install an implicit layer to ``/etc/vulkan/implicit_layer.d/``
|
||||||
3. have lossless scaling installed on Steam or manually reference the DLL file using LSFG_DLL_PATH
|
|
||||||
|
|
||||||
example usage command: ``LD_PRELOAD=~/.local/lib/liblsfg-vk.so LSFG_DLL_PATH=<POINT_ME_TO>/Lossless.dll ENABLE_LSFG=1 vkcube``
|
Add this to your flake inputs, output function and modules list:
|
||||||
|
```nix
|
||||||
|
inputs = {
|
||||||
|
...
|
||||||
|
lsfg-vk-flake.url = "github:pabloaul/lsfg-vk-flake/main";
|
||||||
|
lsfg-vk-flake.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
}
|
||||||
|
|
||||||
|
outputs = {nixpkgs, lsfg-vk-flake, ...}: {
|
||||||
|
|
||||||
|
nixosConfigurations.hostname = nixpkgs.lib.nixosSystem {
|
||||||
|
...
|
||||||
|
modules = [
|
||||||
|
...
|
||||||
|
lsfg-vk-flake.nixosModules.default
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
And then enable this in your system config:
|
||||||
|
```nix
|
||||||
|
services.lsfg-vk = {
|
||||||
|
enable = true;
|
||||||
|
ui.enable = true; # installs gui for configuring lsfg-vk
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
### User install (manual)
|
||||||
|
1. Build the library:
|
||||||
|
```bash
|
||||||
|
nix build
|
||||||
|
```
|
||||||
|
2. Create the following path in case it does not exist:
|
||||||
|
```bash
|
||||||
|
mkdir -p $HOME/.local/share/vulkan/implicit_layer.d
|
||||||
|
```
|
||||||
|
3. Symlink the build results to your $HOME/.local/
|
||||||
|
```bash
|
||||||
|
cp -ifrsv "$(readlink -f ./result)"/* $HOME/.local/
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
Run a Vulkan application with the environment variable ``ENABLE_LSFG=1`` set.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```bash
|
||||||
|
ENABLE_LSFG=1 vkcube
|
||||||
|
```
|
||||||
|
|
||||||
|
To confirm that it is working, look for output like this in the terminal: lsfg-vk(...): ...
|
||||||
|
|
||||||
|
You can also enable it per game on Steam by adding this to the launch options:
|
||||||
|
```
|
||||||
|
ENABLE_LSFG=1 %COMMAND%
|
||||||
|
```
|
||||||
|
|
||||||
|
>[!NOTE]
|
||||||
|
> If the environment variable is set but the program doesn't show any lsfg-vk output, you may need to add the application to your lsfg-vk configuration file at `~/.config/lsfg-vk/config.toml`. Read more about it in the [Wiki](https://github.com/PancakeTAS/lsfg-vk/wiki/Configuring-lsfg-vk)
|
47
default.nix
47
default.nix
|
@ -1,47 +0,0 @@
|
||||||
{ lib
|
|
||||||
, fetchFromGitHub
|
|
||||||
, cmake
|
|
||||||
, ninja
|
|
||||||
, vulkan-headers
|
|
||||||
, vulkan-loader
|
|
||||||
, llvmPackages
|
|
||||||
, spirv-headers
|
|
||||||
}: let
|
|
||||||
|
|
||||||
in llvmPackages.stdenv.mkDerivation {
|
|
||||||
pname = "lsfg-vk";
|
|
||||||
version = "unstable-2025-07-14-83b869b";
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "PancakeTAS";
|
|
||||||
repo = "lsfg-vk";
|
|
||||||
rev = "83b869b0c4d4cd4da2e760126242c6ed76bafec8";
|
|
||||||
hash = "sha256-LN6DkLN6pMmYRaj+TsAL3PLqINMeYOhQ2Kw16bRF/Q4=";
|
|
||||||
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
|
|
||||||
];
|
|
||||||
|
|
||||||
buildInputs = [
|
|
||||||
vulkan-headers
|
|
||||||
vulkan-loader
|
|
||||||
spirv-headers
|
|
||||||
];
|
|
||||||
|
|
||||||
meta = with lib; {
|
|
||||||
homepage = "https://github.com/PancakeTAS/lsfg-vk/";
|
|
||||||
license = licenses.mit;
|
|
||||||
platforms = platforms.linux;
|
|
||||||
};
|
|
||||||
}
|
|
6
flake.lock
generated
6
flake.lock
generated
|
@ -2,11 +2,11 @@
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1751792365,
|
"lastModified": 1753694789,
|
||||||
"narHash": "sha256-J1kI6oAj25IG4EdVlg2hQz8NZTBNYvIS0l4wpr9KcUo=",
|
"narHash": "sha256-cKgvtz6fKuK1Xr5LQW/zOUiAC0oSQoA9nOISB0pJZqM=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "1fd8bada0b6117e6c7eb54aad5813023eed37ccb",
|
"rev": "dc9637876d0dcc8c9e5e22986b857632effeb727",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
16
flake.nix
16
flake.nix
|
@ -1,11 +1,17 @@
|
||||||
{
|
{
|
||||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
outputs = { nixpkgs, ... }: let
|
outputs = { nixpkgs, ... }:
|
||||||
system = "x86_64-linux";
|
let
|
||||||
pkgs = import nixpkgs { inherit system; };
|
forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ];
|
||||||
in {
|
in
|
||||||
packages.${system}.default = pkgs.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;
|
nixosModules.default = import ./module.nix;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
54
lsfg-vk-ui.nix
Normal file
54
lsfg-vk-ui.nix
Normal file
|
@ -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";
|
||||||
|
};
|
||||||
|
}
|
44
lsfg-vk.nix
Normal file
44
lsfg-vk.nix
Normal file
|
@ -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 ];
|
||||||
|
};
|
||||||
|
}
|
61
module.nix
61
module.nix
|
@ -1,26 +1,69 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
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 {
|
||||||
|
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
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable (
|
||||||
environment.systemPackages = [ cfg.package ];
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
environment.systemPackages = [ cfg.package ];
|
||||||
|
|
||||||
# Installs the Vulkan implicit layer system-wide
|
# Installs the Vulkan implicit layer system-wide
|
||||||
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) {
|
||||||
|
environment.sessionVariables.LSFG_DLL_PATH =
|
||||||
|
lib.warn "losslessDLLFile is deprecated and will only be used by lsfg-vk if LSFG_LEGACY is set."
|
||||||
|
cfg.losslessDLLFile;
|
||||||
|
})
|
||||||
|
(lib.mkIf (cfg.configFile != null) {
|
||||||
|
environment.sessionVariables.LSFG_CONFIG = cfg.configFile;
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue