nixpkgs/pkgs/by-name/sl/slimerjs/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

53 lines
1.3 KiB
Nix

{ lib
, bash
, fetchFromGitHub
, firefox
, strip-nondeterminism
, stdenv
, unzip
, zip
}:
stdenv.mkDerivation rec {
pname = "slimerjs";
version = "1.0.0";
src = fetchFromGitHub {
owner = "laurentj";
repo = "slimerjs";
sha256 = "sha256-RHd9PqcSkO9FYi5x+09TN7c4fKGf5pCPXjoCUXZ2mvA=";
rev = version;
};
buildInputs = [ zip ];
nativeBuildInputs = [
strip-nondeterminism
unzip
];
preConfigure = ''
test -d src && cd src
test -f omni.ja || zip omni.ja -r */
'';
installPhase = ''
strip-nondeterminism --type zip omni.ja
mkdir -p "$out"/{bin,share/doc/slimerjs,lib/slimerjs}
cp LICENSE README* "$out/share/doc/slimerjs"
cp -r * "$out/lib/slimerjs"
echo '#!${bash}/bin/bash' >> "$out/bin/slimerjs"
echo 'export SLIMERJSLAUNCHER=${firefox}/bin/firefox' >> "$out/bin/slimerjs"
echo "'$out/lib/slimerjs/slimerjs' \"\$@\"" >> "$out/bin/slimerjs"
chmod a+x "$out/bin/slimerjs"
sed -e 's@MaxVersion=[3456][0-9][.]@MaxVersion=99.@' -i "$out/lib/slimerjs/application.ini"
'';
meta = with lib; {
description = "Gecko-based programmatically-driven browser";
mainProgram = "slimerjs";
license = licenses.mpl20;
maintainers = with maintainers; [ raskin ];
platforms = platforms.linux;
};
}