diff --git a/home/fish/default.nix b/home/fish/default.nix index a85c421..3f77e35 100644 --- a/home/fish/default.nix +++ b/home/fish/default.nix @@ -13,20 +13,17 @@ mkdir = "mkdir --parent"; cp = "cp -i"; }; - functions = { - gitignore = "curl -sL https://www.gitignore.io/api/$argv"; - nrun = "nix run nixpkgs#$argv[1] -- $argv[2..]"; - mv-bad-creation-date = ''exiftool -if 'not $CreateDate' -p '$FileName' "$PWD/$argv[1]" | xargs -I {} mv -i "$PWD/$argv[1]/{}" "$argv[2]"''; - rename-images = '' - set -f input "$PWD/$argv[1]" - - if not test -d $input - echo "input is not a directory" - else - exiftool -if '$CreateDate' -p '$FileName' "$input" | xargs -I {} jhead -n%Y-%m-%d-%H%M%S "$input/{}" - end - ''; - fish_prompt = builtins.readFile ./fish_prompt.fish; - }; + functions = + let + rf = builtins.readFile; + in + { + gitignore = "curl -sL https://www.gitignore.io/api/$argv"; + nrun = "nix run nixpkgs#$argv[1] -- $argv[2..]"; + mv-bad-creation-date = ''exiftool -if 'not $CreateDate' -p '$FileName' "$PWD/$argv[1]" | xargs -I {} mv -i "$PWD/$argv[1]/{}" "$argv[2]"''; + rename-images = rf ./rename_images.fish; + fish_prompt = rf ./fish_prompt.fish; + rebuild = "env --chdir $HOME/.nixconf sudo nixos-rebuild switch --flake .#$(hostname)"; + }; }; } diff --git a/home/fish/rename_images.fish b/home/fish/rename_images.fish new file mode 100644 index 0000000..28eb361 --- /dev/null +++ b/home/fish/rename_images.fish @@ -0,0 +1,7 @@ +set -f input "$PWD/$argv[1]" + +if not test -d $input + echo "input is not a directory" +else + exiftool -if '$CreateDate' -p '$FileName' "$input" | xargs -I {} jhead -n%Y-%m-%d-%H%M%S "$input/{}" +end