3 flake-utils.url = "github:numtide/flake-utils";
4 flake-compat.url = "github:edolstra/flake-compat";
5 flake-compat.flake = false;
6 nixpkgs-mozilla.url = "github:mozilla/nixpkgs-mozilla";
9 { self, nixpkgs, flake-utils, flake-compat, nixpkgs-mozilla }:
10 flake-utils.lib.eachSystem [
17 pkgs = import nixpkgs {
20 nixpkgs-mozilla.overlays.rust
22 config.permittedInsecurePackages = [
23 # It's OK to depend on libdwarf 20210528, because we did not call
24 # the particular vulnerable function in libdwarf
30 packages.hhvm = pkgs.callPackage ./hhvm.nix {
31 lastModifiedDate = self.lastModifiedDate;
33 packages.default = packages.hhvm;
35 checks.quick = pkgs.runCommand
38 buildInputs = pkgs.lib.optionals pkgs.hostPlatform.isMacOS [
39 # `system_cmds` provides `sysctl`, which is used in hphp/test/run.php on macOS
40 pkgs.darwin.system_cmds
46 HHVM_BIN="${packages.hhvm}/bin/hhvm" "${packages.hhvm}/bin/hhvm" hphp/test/run.php quick
61 inherit (packages.hhvm)
66 ${if pkgs.hostPlatform.isLinux then "bundlers" else null} =
71 # Copy to a temporary directory as a workaround to https://github.com/jordansissel/fpm/issues/807
74 mkdir -p "$(dirname "./$LINE")"
75 cp -r "/$LINE" "./$LINE"
76 chmod --recursive u+w "./$LINE"
77 FPM_INPUTS+=("./$LINE")
78 done < ${pkgs.lib.strings.escapeShellArg (pkgs.referencesByPopularity pkg)}
81 rm ./nix/store/*-libgccjit-*/lib/lib
83 ${pkgs.lib.strings.escapeShellArg pkgs.fpm}/bin/fpm \
87 --output-type ${outputType} \
88 --name ${pkgs.lib.strings.escapeShellArg pkg.pname} \
90 pkgs.lib.strings.escapeShellArg
91 (builtins.replaceStrings ["-"] ["~"] pkg.version)
93 --description ${pkgs.lib.strings.escapeShellArg pkg.meta.description} \
94 --url ${pkgs.lib.strings.escapeShellArg pkg.meta.homepage} \
95 --maintainer ${pkgs.lib.strings.escapeShellArg (pkgs.lib.strings.concatStringsSep ", " (map ({name, email, ...}: "\"${name}\" <${email}>") pkg.meta.maintainers))} \
96 --license ${pkgs.lib.strings.escapeShellArg (pkgs.lib.strings.concatStringsSep " AND " (map ({spdxId, ...}: spdxId) (pkgs.lib.lists.toList pkg.meta.license)))} \
98 pkgs.writeScript "after-install.sh" ''
99 for EXECUTABLE in ${pkgs.lib.strings.escapeShellArg pkg}/bin/*
101 NAME=$(basename "$EXECUTABLE")
102 update-alternatives --install "/usr/bin/$NAME" "$NAME" "$EXECUTABLE" 1
107 pkgs.writeScript "before-remove.sh" ''
108 for EXECUTABLE in ${pkgs.lib.strings.escapeShellArg pkg}/bin/*
110 NAME=$(basename "$EXECUTABLE")
111 update-alternatives --remove "$NAME" "$EXECUTABLE"
120 rpm = pkg: pkgs.runCommand
122 { nativeBuildInputs = [ pkgs.rpm ]; }
123 (fpmScript "rpm" pkg);
124 deb = pkg: pkgs.runCommand
126 { nativeBuildInputs = [ pkg.stdenv.cc ]; }
127 (fpmScript "deb" pkg);