dotfiles/overlays/slovensko-eid.nix
Magic_RB 7051dc2587
Attempt to fix bwrap for slovensko-eid, fail
Signed-off-by: Magic_RB <magic_rb@redalder.org>
2023-02-02 10:19:15 +01:00

127 lines
3.9 KiB
Nix

# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
{
name = "slovensko-eid";
overlays = [ "bwrap-x" ];
overlay = {}: final: prev: {
slovensko-eid = let
dlauncher = prev.stdenv.mkDerivation {
pname = "slovensko-dlauncher";
version = "unknown";
src = prev.fetchurl {
url = "https://download.disigcdn.sk/cdn/products/websigner2/disig-web-signer.debian_amd64.deb";
sha256 = "sha256-ryn6Z/4h/ZKpWFq2tYiH3YYmXoAD8t7M8PhIJXCeuv0=";
};
nativeBuildInputs = with prev; [
unar
];
phases = [ "unpackPhase" ];
unpackPhase = ''
mkdir -p $out
ar p $src data.tar.xz | tar -xJ -C $out
'';
};
unwrapped = prev.stdenv.mkDerivation {
pname = "slovensko-eid";
version = "unknown";
builtInputs = with prev; [ gnutar gzip binutils xz ];
src = prev.fetchurl {
url = "https://eidas.minv.sk/downloadservice/eidklient/linux/eID_klient_x86_64.tar.gz";
sha256 = "sha256-v62vIZt7pvzbJtvRe8d3Yaf78P/qMgM4lsC3uRDh3PY=";
};
phases = ["unpackPhase" "installPhase"];
unpackPhase = ''
tar xpf $src
'';
installPhase = ''
ls -lah .
cp -r eID_klient-x86_64.AppImage $out
'';
};
wrapped = prev.appimageTools.wrapType2 { # or wrapType1
name = "patchwork";
src = unwrapped;
extraPkgs = pkgs: with prev; [
pcsclite.out
libglvnd
gcc-unwrapped.lib
zlib
pcsclite.out
xorg.libxcb
xorg.libX11
xorg.libXcursor
dbus.lib
lzlib
zlib
# openssl_1_1.out
libgcrypt
libsForQt5.qt5.qtsvg
libsForQt5.qt5.qtbase.out
];
};
in
# dlauncher;
final.bwrap-x {
pkgs = with prev; [
libglvnd
gcc-unwrapped.lib
zlib
pcsclite.out
xorg.libxcb
xorg.libX11
xorg.libXcursor
dbus.lib
lzlib
zlib
# openssl_1_1.out
libgcrypt
libsForQt5.qt5.qtsvg
libsForQt5.qt5.qtbase.out
];
# --ro-bind ${unwrapped}/lib/eac_mw_klient/ /usr/lib/eac_mw_klient/ \
# --ro-bind ${unwrapped}/bin/EAC_MW_klient /usr/bin/EAC_MW_klient \
bwrapArgsPost = ''
--ro-bind /etc/resolv.conf /etc/resolv.conf \
--ro-bind /run/pcscd/ /run/pcscd \
'';
script = ''
export ENABLE_XORG=1 ENABLE_NETWORK=1 QT_DEBUG_PLUGINS=1 QT_QPA_PLATFORM_PLUGIN_PATH=${unwrapped}/lib/eac_mw_klient/platforms/
export BIND_PATHS="$BIND_PATHS /etc/localtime"
preload_libraries+=("${unwrapped}/lib/eac_mw_klient")
preload_libraries+=("${dlauncher}/opt/disig/websigner/lib")
'';
# exec = "${prev.strace}/bin/strace";
exec = (prev.writeShellScript "eid-bwrap" ''
set -xe
function killstuff {
jobs -p | ${prev.findutils}/bin/xargs kill
}
trap killstuff SIGINT
echo $LD_LIBRARY_PATH
# ${prev.librewolf}/bin/librewolf &
# mkdir -p $HOME/.local/share/Disig/WebSigner/Logs
# touch $HOME/.local/share/Disig/WebSigner/Logs/WebSignerLog.txt
# ${prev.strace}/bin/strace -f ${prev.glibc}/lib64/ld-linux-x86-64.so.2 ${dlauncher}/opt/disig/websigner/bin/WebSigner
# cat $HOME/.local/share/Disig/WebSigner/Logs/WebSignerLog.txt
# exit 1
# ${prev.appimage-run.override { extraPkgs = p: with p; [ pcsclite.out ]; }}/bin/appimage-run ${unwrapped}/eID_klient-x86_64.AppImage
${prev.strace}/bin/strace -f ${wrapped}/bin/patchwork
killstuff
'');
name = "eslovensko-eid";
};
};
}