nisspkgs/scripts/niss-misc.nix

38 lines
932 B
Nix

{ pkgs ? import <nixpkgs> {},
charFilters ? true,
find-parent ? true,
galleryHelpers ? true,
nd ? true
}@inputs:
let
inherit (pkgs) lib stdenv;
deps = with pkgs;
(lib.filterAttrs (k: v: inputs.${k} or true) {
galleryHelpers = [ rakudo ];
charFilters = [ rakudo ];
find-parent = [ execline ];
nd = [ execline ];
});
dir = d:
let path = ./niss-misc/${d}; in
lib.fileset.toSource { root = path; fileset = path; };
in
assert lib.assertMsg (nd -> find-parent) "nd depends on find-parent";
stdenv.mkDerivation {
name = "niss-misc";
buildInputs = lib.concatLists (lib.attrValues deps);
dontUnpack = true;
installPhase = lib.concatStringsSep "\n"
([ "mkdir -p $out/bin" ] ++
map (d: "cp ${dir d}/* $out/bin") (lib.attrNames deps) ++
[ "chmod a+x $out/bin/*" ]);
meta.description = "niss's funny little scripts";
}