nix-gl-host/default.nix
Félix Baylac Jacqué 375148c949 Introduce a cache system
Copying & patching all the DSOs is a time consuming process (~10s on a
slow hard drive computer). We definitely don't want to go through it
for each process start, we need to introduce a cache.

For this cache, we go the concervative way. We're going to "resolve" a
DSO name (ie. find the DSO absolute path) and sha256-hash each DSO.
We're then going to compare the fingerprints to determine whether or
not we need to nuke and rebuild the DSO cache.

The cache state is persisted through a JSON file saved in the cache dir.
2022-12-05 13:33:01 +01:00

34 lines
772 B
Nix

{ pkgs ? import <nixpkgs> { }, lib ? pkgs.lib }:
pkgs.stdenvNoCC.mkDerivation {
pname = "nix-gl-host";
version = "0.1";
# TODO: filter that out
src = lib.cleanSource ./.;
nativeBuildInputs = [
pkgs.nixpkgs-fmt
pkgs.python3
pkgs.python3Packages.black
pkgs.nixpkgs-fmt
];
postFixup = ''
substituteInPlace $out/bin/nixglhost \
--replace "@patchelf-bin@" "${pkgs.patchelf}/bin/patchelf" \
--replace "IN_NIX_STORE = False" "IN_NIX_STORE = True"
patchShebangs $out/bin/nixglhost
'';
doCheck = true;
checkPhase = ''
black --check src/*.py
nixpkgs-fmt --check *.nix
python src/nixglhost_wrapper_test.py
'';
installPhase = ''
install -D -m0755 src/nixglhost_wrapper.py $out/bin/nixglhost
'';
}