53 lines
1.6 KiB
Nix
53 lines
1.6 KiB
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));
|
||
|
||
meta = {
|
||
description = "niss's funny little scripts";
|
||
longDescription = ''
|
||
- `galleryHelpers`: helper scripts for putting together the input for
|
||
`gallery.niss.website`. exceedingly unlikely to be useful to anyone
|
||
else.
|
||
- `charFilters`: `little` for making text ˡⁱᵏᵉ ᵗʰⁱˢ and `wide` for
|
||
text like this.
|
||
- find-parent:
|
||
`find-parent ‹file›` looks for `‹file›` in the current directory or
|
||
any of its ancestors, and prints the path of the file found, if any.
|
||
`find-parent -d ‹file›` prints the path of only the directory
|
||
containing the file, rather than the file itself.
|
||
- nd: looks for a `flake.nix` and runs `nix develop` if so.
|
||
uses `find-parent`.
|
||
'';
|
||
};
|
||
}
|