From ccebd915be9e267b9f445d31c31e5b34a4b2adbf Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 30 Apr 2023 14:44:45 -0700 Subject: home/packages: rewrite scripts to use writeShellApplication This function produces a shell script with dependencies, set the PATH, set some SHELLOPTS, and check the script with shellcheck. --- home/beets/default.nix | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'home/beets') diff --git a/home/beets/default.nix b/home/beets/default.nix index 0d7a3b9..ab8cc43 100644 --- a/home/beets/default.nix +++ b/home/beets/default.nix @@ -1,17 +1,21 @@ { config, lib, pkgs, ... }: let cfg = config.my.home.beets; - bc-to-beet = pkgs.writeShellScriptBin "bc-to-beet" '' - ALBUM_PATH="''${1}" - ALBUM_NAME=$(basename "''${ALBUM_PATH}") + bc-to-beet = pkgs.writeShellApplication { + name = "bc-to-beet"; + runtimeInputs = [ pkgs.beets ]; + text = '' + ALBUM_PATH="''${1}" + ALBUM_NAME=$(basename "''${ALBUM_PATH}") - mkdir -p ~/import - rm -rf ~/import/tmp-bc - unzip -d ~/import/tmp-bc ~/import/album.zip - beet import ~/import/tmp-bc - rm -rf ~/import/tmp-bc - rm -rf ~/import/album.zip - ''; + mkdir -p ~/import + rm -rf ~/import/tmp-bc + unzip -d ~/import/tmp-bc ~/import/album.zip + beet import ~/import/tmp-bc + rm -rf ~/import/tmp-bc + rm -rf ~/import/album.zip + ''; + }; in { options.my.home.beets = with lib; { -- cgit 1.4.1