dot_testing/lib/default.nix
2024-04-06 16:49:59 -05:00

29 lines
600 B
Nix

{ pkgs ? import <nixpkgs> {} }:
let
getPkgName =
pkg:
builtins.elemAt (builtins.split "-" pkg.name) 0;
in {
mkPackageWrapper =
pkg:
environ:
prefix:
postfix:
pkgs.writeScriptBin
(getPkgName pkg)
''
#! ${pkgs.bash}/bin/bash
${environ}
exec ${prefix} ${pkg}/bin/${getPkgName pkg} ${postfix} "$@"
'';
mkQuarantinedPackage =
pkg:
pkgs.writeScriptBin
(getPkgName pkg)
''
#! ${pkgs.bash}/bin/bash
export HOME=$HOME/.local/${getPkgName pkg}
exec ${pkg}/bin/${getPkgName pkg}
'';
}