add silly little scripts

This commit is contained in:
rhiannon morris 2025-04-02 18:44:25 +02:00
parent e616d19a15
commit a02f108b75
8 changed files with 397 additions and 1 deletions

53
scripts/niss-misc.nix Normal file
View file

@ -0,0 +1,53 @@
{ 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  
- 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`.
'';
};
}