diff options
author | Profpatsch <mail@profpatsch.de> | 2022-01-09T16·08+0100 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2022-02-28T14·32+0000 |
commit | baecea1cbe84918c86de0ca55ab5b1d3aaba49e8 (patch) | |
tree | 5b72095296bb83e1633373820605c84e1c775877 | |
parent | 723c21ddb671aa4648559109c2d7ea3c23d9a9c9 (diff) |
feat(users/Profpatsch/nix-home): add findia* aliases r/3874
Change-Id: I66d3e69ae2cb4cf56a49c970f59f62fa945dd736 Reviewed-on: https://cl.tvl.fyi/c/depot/+/4840 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de> Autosubmit: Profpatsch <mail@profpatsch.de>
-rw-r--r-- | users/Profpatsch/aliases.nix | 75 | ||||
-rw-r--r-- | users/Profpatsch/nix-home/default.nix | 32 |
2 files changed, 101 insertions, 6 deletions
diff --git a/users/Profpatsch/aliases.nix b/users/Profpatsch/aliases.nix new file mode 100644 index 000000000000..6a1c2c1a63c3 --- /dev/null +++ b/users/Profpatsch/aliases.nix @@ -0,0 +1,75 @@ +{ depot, pkgs, lib, ... }: + +let + bins = depot.nix.getBins pkgs.findutils [ "find" ]; + +in +depot.nix.readTree.drvTargets { + + findia = depot.nix.writeExecline "findia" + { + readNArgs = 1; + # TODO: comment out, thanks to sterni blocking the runExecline change + # meta.description = '' + # Find case-insensitive anywhere (globbing) + + # Usage: findia <pattern> <more find(1) arguments> + # ''; + } [ + bins.find + "-iname" + "*\${1}*" + "$@" + ]; + + findial = depot.nix.writeExecline "findial" + { + readNArgs = 1; + # TODO: comment out, thanks to sterni blocking the runExecline change + # meta.description = '' + # Find case-insensitive anywhere (globbing), follow symlinks"; + + # Usage: findial <pattern> <more find(1) arguments> + # ''; + } [ + bins.find + "-L" + "-iname" + "*\${1}*" + "$@" + ]; + + findian = depot.nix.writeExecline "findian" + { + readNArgs = 2; + # TODO: comment out, thanks to sterni blocking the runExecline change + # meta.description = '' + # Find case-insensitive anywhere (globbing) in directory + + # Usage: findian <directory> <pattern> <more find(1) arguments> + # ''; + } [ + bins.find + "$1" + "-iname" + "*\${2}*" + "$@" + ]; + + findiap = depot.nix.writeExecline "findiap" + { + readNArgs = 2; + # TODO: comment out, thanks to sterni blocking the runExecline change + # meta.description = '' + # Find case-insensitive anywhere (globbing) in directory, the pattern allows for paths. + + # Usage: findiap <directory> <pattern> <more find(1) arguments> + # ''; + } [ + bins.find + "$1" + "-ipath" + "*\${2}*" + "$@" + ]; +} diff --git a/users/Profpatsch/nix-home/default.nix b/users/Profpatsch/nix-home/default.nix index 8f52055ade31..fee70f3d6d5e 100644 --- a/users/Profpatsch/nix-home/default.nix +++ b/users/Profpatsch/nix-home/default.nix @@ -129,18 +129,38 @@ let "\${out}/\${stowPackage}" ]); + # this is a dumb way of generating a pure list of packages from a depot namespace. + readTreeNamespaceDrvs = namespace: + lib.pipe namespace [ + (lib.filterAttrs (_: v: lib.isDerivation v)) + (lib.mapAttrsToList (k: v: { + name = k; + drv = v; + })) + ]; + in + # TODO: temp setup lib.pipe { } [ (_: makeStowDir [{ stowPackage = "scripts"; - originalDir = pkgs.linkFarm "scripts-farm" [ - { - name = "scripts/ytextr"; - path = depot.users.Profpatsch.ytextr; - } - ]; + originalDir = pkgs.linkFarm "scripts-farm" + ([ + { + name = "scripts/ytextr"; + path = depot.users.Profpatsch.ytextr; + } + ] + ++ + (lib.pipe depot.users.Profpatsch.aliases [ + readTreeNamespaceDrvs + (map ({ name, drv }: { + name = "scripts/${name}"; + path = drv; + })) + ])); }]) (d: runStow { stowDir = d; |