Skip to content

Instantly share code, notes, and snippets.

@batonac
Last active October 31, 2023 13:15
Show Gist options
  • Save batonac/82467d268a1a8669cd3afacc614afbaa to your computer and use it in GitHub Desktop.
Save batonac/82467d268a1a8669cd3afacc614afbaa to your computer and use it in GitHub Desktop.
NAPS2 on NixOS from Debian package
{ autoPatchelfHook
, curl
, dotnet-runtime
, dotnet-sdk
, dpkg
, fetchurl
, gtk3
, icu
, krb5
, lib
, libnotify
, mesa
, nspr
, nss
, sane-backends
, stdenv
, wrapGAppsHook
, patchelf
}:
stdenv.mkDerivation rec {
pname = "naps2";
version = "7.1.1";
src = fetchurl {
url = "https://github.com/cyanfish/naps2/releases/download/v${version}/naps2-${version}-linux-x64.deb";
hash = "sha256-LD5LN0d1X8a3/2FX37qUDwPB0KnVBaV/glcnntzWMq8=";
};
nativeBuildInputs = [ autoPatchelfHook dpkg wrapGAppsHook patchelf ];
buildInputs = [
curl
dotnet-sdk
gtk3
krb5
mesa
nspr
nss
];
runtimeDependencies = [
(lib.getLib dotnet-runtime)
(lib.getLib gtk3)
(lib.getLib icu)
(lib.getLib sane-backends)
(lib.getLib libnotify)
];
installPhase = ''
runHook preInstall
mkdir -p "$out/bin"
cp -R usr $out
ln -s "$out/usr/lib/naps2/naps2" "$out/bin/naps2"
chmod -R g-w "$out"
runHook postInstall
'';
postInstall = ''
patchelf --set-rpath "${dotnet-sdk}/shared/Microsoft.NETCore.App/6.0.22:$out/usr/lib/naps2" "$out/usr/lib/naps2/libsos.so"
'';
meta = with lib; {
description = "Scan documents to PDF and more, as simply as possible.";
homepage = "https://www.usenaps2.com";
license = licenses.gpl2;
maintainers = with maintainers; [ cyanfish ];
platforms = [ "x86_64-linux" ];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment