dotfiles/lib/shared/home-manager-packages.nix
Oliver Davies 6082de62b0 Look for .ignored/run when running commands
Make the `run` command cleverer by also searching for a `.ignored/run`
file, following the convention of always ignoring a `.ignored` directory
from Git.

This allows me to have a local `run` file that doesn't need to be
committed and pushed to the repo (e.g. it's too specific to me), and
being able to keep it outside of the root of the project directory where
it could be committed accidentally.

A similar approach was done by Andreas Möller using Makefiles in this
article:

https://localheinz.com/articles/2020/05/07/using-makefiles-in-projects-where-i-can-not-use-them

With this function, the `.ignored/run` file is executed if it's found
and exits with the status code of the command.

If not, it will fall back to using `./run` as before.

I considered reversing these and checking for `./run` first as there
could be a performance benefit but, if neither file is found, I want the
error to show `./run` and not `.ignored/run` as that's the main use
case.
2024-07-31 16:40:25 +01:00

59 lines
770 B
Nix

{ inputs, pkgs, ... }:
let
php = pkgs.php82;
phpPackages = pkgs.php82Packages;
inherit (pkgs) writeShellApplication;
scripts = {
notetaker = writeShellApplication (import ./scripts/notetaker.nix);
run = writeShellApplication (import ./scripts/run.nix { inherit pkgs; });
t = writeShellApplication (import ./scripts/t.nix { inherit pkgs; });
};
in
with pkgs;
[
scripts.notetaker
scripts.run
scripts.t
awscli2
bitwarden-cli
bottom
cachix
ctop
delta
dog
doppler
entr
fd
file
gcc
gh
git
git-crypt
gnupg
go
htop
inotify-tools
jq
lua
mob
mysql
php
phpPackages.composer
pv
rustywind
simple-http-server
tldr
tree
tree-sitter
unzip
virtualenv
wget
xcp
xdg-utils
xh
yarn
]