{ stdenv, requireFile, unrar }: let sFile = { fname, forumlink, sha256 }: requireFile { message = '' Download the Addon from: ${forumlink} Then add it to your nix store, e.g., by using "nix-prefetch-url file://\$PWD/${fname}" from the directory where you saved it. ''; name = fname; inherit sha256; }; in stdenv.mkDerivation { pname = "extended-night-lights"; version = "1.0.0"; srcs = [ (sFile { fname = "Oceania_Lights.rar"; sha256 = "0s2xjym6naqiy3mqqxkjmlgx3gaaxlfa59hcchmvbv6frpfj1172"; forumlink = "https://forums.x-plane.org/index.php?/files/file/50516-extended-night-lighting-oceania-new-zealand-fiji-new-caledonia-papua-new-guinea/"; }) (sFile { fname = "Asia.rar"; sha256 = "0cs7f07pwx82vam73klkmbxfv71nb7a0n9macqln5nxmz6qd9vh5"; forumlink = "https://forums.x-plane.org/index.php?/files/file/50914-extended-night-lighting-asia/"; }) ]; nativeBuildInputs = [ unrar ]; buildCommand = '' mkdir -p $out/"Custom Scenery" for s in $srcs ; do unrar x $s done cp -r */* $out/"Custom Scenery" ''; passthru = { build = '' ln -s $ADDONPATH $out/xplane-extra/extended-night-lights ''; prepare = '' : > "$XPLANEPATH/.addons/enl-files" for f in /xplane-extra/extended-night-lights/"Custom Scenery"/* ; do ln -s "$f" "$XPLANEPATH/''${f#/xplane-extra/extended-night-lights/}" printf "%s\n" "''${f#/xplane-extra/extended-night-lights/}" >> "$XPLANEPATH/.addons/enl-files" done ''; revert = '' if [ -e "$XPLANEPATH/.addons/enl-files" ]; then while read f ; do rm "$XPLANEPATH/$f" done < "$XPLANEPATH/.addons/enl-files" rm "$XPLANEPATH/.addons/enl-files" else false fi ''; }; }