Have a proper install script

This commit is contained in:
Surma
2024-08-07 13:05:26 +01:00
parent c308108279
commit 8c76d43a68

View File

@@ -22,7 +22,8 @@
with pkgs; with pkgs;
{ {
packages = rec { packages = rec {
default = stdenv.mkDerivation { default = mozjpeg-squoosh;
mozjpeg-squoosh = stdenv.mkDerivation {
name = "mozjpeg-squoosh"; name = "mozjpeg-squoosh";
src = ./.; src = ./.;
nativeBuildInputs = [ nativeBuildInputs = [
@@ -51,18 +52,18 @@
pkg-config pkg-config
]; ];
configurePhase = '' configurePhase = ''
# $HOME is required for Emscripten to work. # $HOME is required for Emscripten to work.
# See: https://nixos.org/manual/nixpkgs/stable/#emscripten # See: https://nixos.org/manual/nixpkgs/stable/#emscripten
export HOME=$TMPDIR export HOME=$TMPDIR
autoreconf -ifv autoreconf -ifv
emconfigure ./configure \ emconfigure ./configure \
--disable-shared \ --disable-shared \
--without-turbojpeg \ --without-turbojpeg \
--without-simd \ --without-simd \
--without-arith-enc \ --without-arith-enc \
--without-arith-dec \ --without-arith-dec \
--with-build-date=squoosh \ --with-build-date=squoosh \
--prefix=$out --prefix=$out
''; '';
buildPhase = '' buildPhase = ''
export HOME=$TMPDIR export HOME=$TMPDIR
@@ -75,19 +76,17 @@
''; '';
dontFixup = true; dontFixup = true;
}; };
}; installScript = writeShellScriptBin "install.sh" ''
devShells.default = pkgs.mkShell { ${pkgs.coreutils}/bin/mkdir build
packages = [ ${pkgs.coreutils}/bin/cp ${mozjpeg-squoosh}/* build/
autoconf
automake
libtool
emscripten
pkg-config
];
shellHook = ''
echo "Path to MozJPEG: ${mozjpeg-src}"
''; '';
}; };
apps = {
install = {
type = "app";
# program = "
};
};
} }
); );
} }