init: publish to git

This commit is contained in:
Nojus 2025-07-11 13:48:40 +02:00
parent 6646d73273
commit 302458a933
5 changed files with 152 additions and 0 deletions

View file

@ -1,2 +1,4 @@
# lsfg-vk-flake
WIP! Nix flake to build the library for using Lossless Scaling's frame generation on Linux
initially broken due to various challenges with the LLVM tools in NixOS

85
default.nix Normal file
View file

@ -0,0 +1,85 @@
{ lib
, fetchFromGitHub
, replaceVars
, srcOnly
, cmake
, meson
, ninja
, SDL2
, glslang
#, glfw
, dxvk_2
, vulkan-headers
, vulkan-loader
, pkg-config
, llvmPackages
#, overrideCC # lto
}: let
peparse-git = fetchFromGitHub {
owner = "trailofbits";
repo = "pe-parse";
rev = "v2.1.1";
hash = "sha256-WuG/OmzrXoH5O7+sSIdUVZP0aS63nuJwHgQfn12Q5xk=";
fetchSubmodules = true;
};
dxvk-git = srcOnly (dxvk_2.overrideAttrs (old: {
src = fetchFromGitHub {
owner = "doitsujin";
repo = "dxvk";
rev = "v2.6.2";
hash = "sha256-nZEi9WYhpI0WaeguoZMV4nt+nfaErvgz5RNDyyZYCJA=";
fetchSubmodules = true;
};
}));
# stdenv_lto = overrideCC llvmPackages.stdenv (llvmPackages.stdenv.cc.override {
# inherit (llvmPackages) bintools;
# });
# this causes problems with dxvk-git which does not like llvm's ar...
in llvmPackages.stdenv.mkDerivation {
pname = "lsfg-vk";
version = "0.0.31";
src = ./.;
# we need to unvendor dxvk and pe-parse which would normally be downloaded from git during buildtime in the cmakefiles
patches = [
(replaceVars ./no-download.patch {
dxvk-git = dxvk-git;
peparse-git = peparse-git;
})
];
#cmakeFlags = [
#"-DCMAKE_BUILD_TYPE=Release"
#"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
#"-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON" # LTO
#];
nativeBuildInputs = [
#llvmPackages.clang-tools # https://github.com/NixOS/nixpkgs/issues/273875
#llvmPackages.libcxxClang # LTO: "ar: error: the 'o' modifier is only applicable to the 'x' operation"
#llvmPackages.bintools # LTO: "RANLIB-NOTFOUND, AR-NOTFOUND"
cmake
meson
ninja
pkg-config
];
buildInputs = [
dxvk-git
SDL2
glslang
vulkan-headers
vulkan-loader
];
meta = with lib; {
homepage = "https://github.com/PancakeTAS/lsfg-vk/";
license = licenses.mit;
platforms = platforms.linux;
};
}

27
flake.lock generated Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1751792365,
"narHash": "sha256-J1kI6oAj25IG4EdVlg2hQz8NZTBNYvIS0l4wpr9KcUo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1fd8bada0b6117e6c7eb54aad5813023eed37ccb",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

10
flake.nix Normal file
View file

@ -0,0 +1,10 @@
{
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 {};
};
}

28
no-download.patch Normal file
View file

@ -0,0 +1,28 @@
diff --git a/cmake/FetchDXVK.cmake b/cmake/FetchDXVK.cmake
index f84de82..bbe9f73 100644
--- a/cmake/FetchDXVK.cmake
+++ b/cmake/FetchDXVK.cmake
@@ -9,8 +9,7 @@ else()
endif()
ExternalProject_Add(dxvk_git
- GIT_REPOSITORY "https://github.com/doitsujin/dxvk"
- GIT_TAG "v2.6.2"
+ URL file://@dxvk-git@
UPDATE_DISCONNECTED true
USES_TERMINAL_CONFIGURE true
USES_TERMINAL_BUILD true
diff --git a/cmake/FetchPeParse.cmake b/cmake/FetchPeParse.cmake
index df7879b..31a4b87 100644
--- a/cmake/FetchPeParse.cmake
+++ b/cmake/FetchPeParse.cmake
@@ -1,8 +1,7 @@
include(ExternalProject)
ExternalProject_Add(peparse_git
- GIT_REPOSITORY "https://github.com/trailofbits/pe-parse"
- GIT_TAG "v2.1.1"
+ URL file://@peparse-git@
UPDATE_DISCONNECTED true
USES_TERMINAL_CONFIGURE true
USES_TERMINAL_BUILD true