rei_toolbox/flake.nix

48 lines
1.1 KiB
Nix

{
description = "Rei's Toolbox";
inputs = {
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils }:
utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages."${system}";
rei_toolbox = pkgs.poetry2nix.mkPoetryApplication {
projectDir = ./.;
};
# We want to produce a package with all of the scripts together,
# with access to some programs on the PATH.
wrappedToolbox = pkgs.stdenv.mkDerivation {
name = "rei_toolbox-wrapped";
src = "${pkgs.emptyDirectory}";
installPhase = ''
# set -eu
mkdir $out $out/bin
for f in ${rei_toolbox}/bin/*; do
ln -s $f $out/bin/
done
runHook postInstall
'';
buildInputs = [ pkgs.makeWrapper ];
postInstall = ''
# set -eu
for fn in $out/bin/*; do
wrapProgram $fn --suffix-each PATH : ${pkgs.ffmpeg}/bin
done
'';
};
in rec {
# `nix build`
packages.reiToolbox = wrappedToolbox;
defaultPackage = packages.reiToolbox;
});
}