Skip to content

Commit

Permalink
add nix build from flake
Browse files Browse the repository at this point in the history
  • Loading branch information
equirosa committed Oct 5, 2023
1 parent 748e80c commit 5d430d7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
pkgs = import nixpkgs {
inherit system overlays;
};
optisize = pkgs.callPackage ./nix/optisize.nix { };
in
with pkgs;
{
Expand All @@ -28,6 +29,7 @@

shellHook = '' '';
};
packages.default = optisize;
}
);
}
Expand Down
32 changes: 32 additions & 0 deletions nix/optisize.nix
Original file line number Diff line number Diff line change
@@ -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 ];
};
}

0 comments on commit 5d430d7

Please sign in to comment.