Hey There! I am really enjoying my nixos experience so far! But right now I am stuck trying to repackage a software I regularly use with FHS environments. This is the script I worked out so far:
{ lib
, stdenv
, buildFHSUserEnvBubblewrap
, fetchurl
, dpkg
, pkgs
}:
let
amsel-suite = stdenv.mkDerivation rec {
pname = "amsel-suite";
version = "1.4.2";
src = fetchurl {
url = "https://github.com/OllamTechnologies/launcher-releases/releases/download/v${version}/amsel-suite_${version}_amd64.deb";
hash = "sha256:d723659cdca890ee5ca15325bf3fd8d0feb346367541e1ca154704699daddc26";
};
nativeBuildInputs = [ dpkg ];
unpackCmd = "dpkg -x $curSrc $TMPDIR/src || true";
installPhase = ''
mkdir -p $out
cp -r $TMPDIR/src/* $out
'';
meta = with lib; {
description = "Launcher for the Amsel Suite by Ollam Technologies";
homepage = "https://ollam.ai/";
license = licenses.unfree; # falls unklar, unfree setzen
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ yourGithubHandle ];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
};
};
amsel-suite-fhs = buildFHSUserEnvBubblewrap {
name = "amsel-suite-fhs";
targetPkgs = pkgs: with pkgs; [
glib
nss
nspr
dbus.lib
at-spi2-atk
cups.lib
gtk3
pango
cairo
xorg.libX11
xorg.libXcomposite
xorg.libXdamage
xorg.libXfixes
xorg.libXrandr
libgbm
xorg.libxcb
libxkbcommon
alsa-lib
ffmpeg
libdrm
xorg.libXext
expat
amsel-suite
];
# Wrapper, der persistente Ordner anlegt
runScript = pkgs.writeShellScript "amsel-suite-wrapper" ''
set -euo pipefail
PERSIST_BASE="$HOME/.local/share/amsel-suite"
# Unterordner wie bei Steam anlegen
for dir in home opt usr-local; do
mkdir -p "$PERSIST_BASE/$dir"
done
exec amsel-suite "$@"
'';
extraMounts = [
{
source = "${builtins.getEnv "HOME"}/.local/share/amsel-suite/home";
target = "/home/amsel";
writable = true;
}
{
source = "${builtins.getEnv "HOME"}/.local/share/amsel-suite/opt";
target = "/opt";
writable = true;
}
{
source = "${builtins.getEnv "HOME"}/.local/share/amsel-suite/usr-local";
target = "/usr/local";
writable = true;
}
];
};
in
amsel-suite // {
passthru = { fhsEnv = amsel-suite-fhs; };
}
There are multiple issues with this script, but I cannot figure out how to get it working.
First off, when unpacking the deb, tar complains about being unable to set a sticky bit on chrome-sandbox. Then, when executing the binary in the nix-store it crashes with broken pipes.
The software itself is a launcher which downloads further apps to /opt and executes them. I am wondering what I need to change in order to get a running application in the nix-store. I am relatively new to repackaging binaries, so please feel free to point out if all I have done is crap and point me towards correct ways of implementing this!
Thank you very much in advance!