nisspkgs/scripts/niss-misc.nix

53 lines
1.6 KiB
Nix
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ 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`.
'';
};
}