diff --git a/flake.nix b/flake.nix index 639fbf1..4e97ae7 100644 --- a/flake.nix +++ b/flake.nix @@ -14,6 +14,7 @@ pkgs = import nixpkgs { inherit system overlays; }; + optisize = pkgs.callPackage ./nix/optisize.nix { }; in with pkgs; { @@ -28,6 +29,7 @@ shellHook = '' ''; }; + packages.default = optisize; } ); } diff --git a/nix/optisize.nix b/nix/optisize.nix new file mode 100644 index 0000000..d76aca5 --- /dev/null +++ b/nix/optisize.nix @@ -0,0 +1,32 @@ +{ rustPlatform +, version ? "git" +, lib +, makeWrapper +, withHandbrake ? true +, handbrake +}: +rustPlatform.buildRustPackage { + pname = "optisize"; + inherit version; + src = ../.; + cargoLock.lockFile = ../Cargo.lock; + + nativeBuildInputs = [ makeWrapper ]; + postInstall = with lib; + let + runtimePaths = [ ] + ++ optional withHandbrake handbrake; + in + '' + wrapProgram $out/bin/optisize \ + --prefix PATH : "${makeBinPath runtimePaths}" + ''; + + meta = { + description = "CLI utility to optimize file sizes by matching appropriate optimization scripts"; + homepage = "https://github.com/equirosa/optisize"; + license = lib.licenses.agpl3; + maintainers = with lib.maintainers; [ equirosa ]; + }; +} +