Compare commits

...

20 commits

Author SHA1 Message Date
Nojus
081cd66b13 lsfg-vk(-ui): sync up with nixpkgs pr 2025-07-31 07:04:52 +02:00
Nojus
cdcec1d2be lsfg-vk-ui: fix fetch hash
submodules make a difference, whoops. stuff worked on my side because the repo got cached with the submodules included
2025-07-31 02:44:21 +02:00
Nojus
754f64f7e4 flake.lock: bump 2025-07-30 22:14:59 +02:00
Nojus
caeeaf5b6d lsfg-vk(-ui): 1.0.0 release bump 2025-07-30 22:11:03 +02:00
Nojus
6e5f2362dc lsfg-vk(-ui): bump to b4f2833 2025-07-30 19:14:06 +02:00
Nojus
0fa0918ada lsfg-vk(-ui): bump to 3c77bad 2025-07-27 02:35:48 +02:00
Nojus
dfdc7159e1 readme: mention ui package
at this point it might be better to overlay the packages onto pkgs but this remains a task for future me
2025-07-27 02:23:37 +02:00
Nojus
a796344ac2 lsfg-vk-ui: init 2025-07-27 02:14:25 +02:00
Nojus
0b57544e47 default.nix: update lsfg-vk to e8f8056 2025-07-26 14:42:39 +02:00
Nojus
fcd672a3b6 default.nix: reduce 2025-07-25 18:56:38 +02:00
Nojus
d8929d91d2 default.nix: update lsfg-vk to c959c8f 2025-07-25 18:43:53 +02:00
Nojus
382a1614c0 flake.nix: add arm64 as system
Closes: #5
2025-07-21 23:52:21 +02:00
Nojus
12763fb704 default.nix: update lsfg-vk to e67fcd3
spirv-headers got vendored? huh
2025-07-21 14:15:42 +02:00
pabloaul
9a826097ad
Merge pull request #10 from adisbladis/module-no-warn
module.nix: Don't warn when declaring option
2025-07-21 14:08:36 +02:00
adisbladis
c88ac624f0 module.nix: Don't warn when declaring option
The option is _always_ evaluated and therefore the warning is always output, even if your configuration is unaffected.

This refactors the module to:
- Only create env vars if their config is actually declared
- Stick the warning in the config declaration instead of the option
2025-07-21 16:00:26 +12:00
pabloaul
ec1b66adcb
Merge pull request #4 from exalexi/main
module.nix: add configFile option
2025-07-19 22:23:37 +02:00
exalexi
de1d2031dc module.nix: add configFile option 2025-07-19 22:17:09 +02:00
Nojus
f6d9f06778 readme: touchups 2025-07-19 21:33:46 +02:00
Nojus
5421d0a4bb flake.lock: bump 2025-07-19 19:46:48 +02:00
Nojus
9e8162794b default.nix: update lsfg-vk to dd5190a
now with a wayland backend compiled in
2025-07-19 18:41:19 +02:00
7 changed files with 186 additions and 105 deletions

View file

@ -9,7 +9,7 @@ Nix flake for using [Lossless Scaling's frame generation on Linux](https://githu
### System-wide (NixOS module)
This approach will install an implicit layer to ``/etc/vulkan/implicit_layer.d/``
Add this repository to your flake inputs, output function and module list:
Add this to your flake inputs, output function and modules list:
```nix
inputs = {
...
@ -29,25 +29,42 @@ outputs = {nixpkgs, lsfg-vk-flake, ...}: {
}
```
And then you should be able to enable this in your system config using:
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)
1. Build the library:
``nix build``
3. Create the following path in case it does not exist:
``mkdir -p $HOME/.local/share/vulkan/implicit_layer.d``
```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/
``cp -ifrsv "$(readlink -f ./result)"/* $HOME/.local/``
```bash
cp -ifrsv "$(readlink -f ./result)"/* $HOME/.local/
```
## Usage
Run a Vulkan application with the environment variable ``ENABLE_LSFG=1`` set.
Example: ``ENABLE_LSFG=1 vkcube`` and look for output like this in the terminal: lsfg-vk(...): ...
Example:
```bash
ENABLE_LSFG=1 vkcube
```
You can also enable it per game on Steam by adding this to the launch options of a game like this:
``ENABLE_LSFG=1 %COMMAND%``
To confirm that it is working, look for output like this in the terminal: lsfg-vk(...): ...
There are many more options that can be set. Consult the original repository for further documentation.
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)

View file

@ -1,61 +0,0 @@
{
lib,
fetchFromGitHub,
cmake,
ninja,
vulkan-headers,
vulkan-loader,
llvmPackages,
spirv-headers,
libX11,
libXrandr,
libXinerama,
libXcursor,
libXi,
libglvnd,
}:
llvmPackages.stdenv.mkDerivation {
pname = "lsfg-vk";
version = "unstable-2025-07-18-53b4438";
src = fetchFromGitHub {
owner = "PancakeTAS";
repo = "lsfg-vk";
rev = "53b4438a2a567c26d739c856329c1a4d13aa1968";
hash = "sha256-Ze4PBu3W7wKbYAMwQIdV2LBI8xWpYWvNJ3qIId2ByPU=";
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
libX11
libXrandr
libXinerama
libXcursor
libXi
libglvnd
];
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;
};
}

6
flake.lock generated
View file

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1751792365,
"narHash": "sha256-J1kI6oAj25IG4EdVlg2hQz8NZTBNYvIS0l4wpr9KcUo=",
"lastModified": 1753694789,
"narHash": "sha256-cKgvtz6fKuK1Xr5LQW/zOUiAC0oSQoA9nOISB0pJZqM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1fd8bada0b6117e6c7eb54aad5813023eed37ccb",
"rev": "dc9637876d0dcc8c9e5e22986b857632effeb727",
"type": "github"
},
"original": {

View file

@ -1,13 +1,17 @@
{
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;
};
outputs = { nixpkgs, ... }:
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;
};
}

54
lsfg-vk-ui.nix Normal file
View 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
View 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 ];
};
}

View file

@ -6,41 +6,64 @@
}:
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.warn "losslessDLLFile is deprecated and will only be used by lsfg-vk if LSFG_LEGACY is set."
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
'';
};
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
config = lib.mkIf cfg.enable (
lib.mkMerge [
{
environment.systemPackages = [ cfg.package ];
# Installs the Vulkan implicit layer system-wide
environment.etc."vulkan/implicit_layer.d/VkLayer_LS_frame_generation.json".source =
"${cfg.package}/share/vulkan/implicit_layer.d/VkLayer_LS_frame_generation.json";
environment.sessionVariables.LSFG_DLL_PATH = lib.mkIf (cfg.losslessDLLFile != null) cfg.losslessDLLFile;
};
# Installs the Vulkan implicit layer system-wide
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."
cfg.losslessDLLFile;
})
(lib.mkIf (cfg.configFile != null) {
environment.sessionVariables.LSFG_CONFIG = cfg.configFile;
})
]
);
}