mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-16 10:39:53 +00:00
Introduce mkInstallable
This commit is contained in:
@@ -15,13 +15,14 @@
|
||||
system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
inherit (pkgs) callPackage writeShellScriptBin;
|
||||
inherit (pkgs) callPackage;
|
||||
|
||||
buildSquooshRustCodec= callPackage (import ../../nix/squoosh-rust-builder) {fenix = fenix.packages.${system};};
|
||||
mkInstallable = callPackage (import ../../nix/mk-installable) {};
|
||||
|
||||
src = ./.;
|
||||
in
|
||||
{
|
||||
mkInstallable {
|
||||
packages = rec {
|
||||
default = resize-squoosh;
|
||||
resize-squoosh = buildSquooshRustCodec {
|
||||
@@ -34,17 +35,6 @@
|
||||
sha256 = "sha256-HTElSB76gqCpDu8S0ZJlfd/S4ftMrbwxFgJM9OXBRz8=";
|
||||
};
|
||||
};
|
||||
|
||||
installScript = writeShellScriptBin "install.sh" ''
|
||||
${pkgs.coreutils}/bin/mkdir -p wasm_build
|
||||
${pkgs.rsync}/bin/rsync --chmod=u+w -r ${self.packages.${system}.resize-squoosh}/* wasm_build/
|
||||
'';
|
||||
};
|
||||
apps = {
|
||||
install = {
|
||||
type = "app";
|
||||
program = "${self.packages.${system}.installScript}/bin/install.sh";
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
Binary file not shown.
@@ -19,10 +19,11 @@
|
||||
inherit (pkgs) callPackage writeShellScriptBin;
|
||||
|
||||
buildSquooshRustCodec= callPackage (import ../../nix/squoosh-rust-builder) {fenix = fenix.packages.${system};};
|
||||
mkInstallable = callPackage (import ../../nix/mk-installable) {};
|
||||
|
||||
src = ./.;
|
||||
in
|
||||
{
|
||||
mkInstallable {
|
||||
packages = rec {
|
||||
default = rotate-squoosh;
|
||||
rotate-squoosh = buildSquooshRustCodec {
|
||||
@@ -33,17 +34,6 @@
|
||||
};
|
||||
wasmBindgen = null;
|
||||
};
|
||||
|
||||
installScript = writeShellScriptBin "install.sh" ''
|
||||
${pkgs.coreutils}/bin/mkdir -p wasm_build
|
||||
${pkgs.rsync}/bin/rsync --chmod=u+w -r ${self.packages.${system}.rotate-squoosh}/* wasm_build/
|
||||
'';
|
||||
};
|
||||
apps = {
|
||||
install = {
|
||||
type = "app";
|
||||
program = "${self.packages.${system}.installScript}/bin/install.sh";
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{ lib }:
|
||||
f: opts:
|
||||
let
|
||||
derivations = (lib.attrsets.mapAttrsToList f opts);
|
||||
in
|
||||
lib.lists.fold (a: b: a // b) { } derivations
|
||||
19
nix/mk-installable/default.nix
Normal file
19
nix/mk-installable/default.nix
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
coreutils,
|
||||
rsync,
|
||||
writeShellScriptBin,
|
||||
lib,
|
||||
}:
|
||||
flake:
|
||||
let
|
||||
installScript = writeShellScriptBin "install.sh" ''
|
||||
${coreutils}/bin/mkdir -p wasm_build
|
||||
${rsync}/bin/rsync --chmod=u+w -r ${flake.packages.default}/* wasm_build/
|
||||
'';
|
||||
in
|
||||
lib.recursiveUpdate flake {
|
||||
apps.install = {
|
||||
type = "app";
|
||||
program = "${installScript}/bin/install.sh";
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user