"value":"\n <p>Yesterday, I wrote about <a href=\"\/daily\/2024\/08\/19\/bash-scripting-for-fun-and-profit\">a bash script I've written<\/a> to export a list of videos on my external hard drive.<\/p>\n\n<p>If you <a href=\"https:\/\/github.com\/opdavies\/dotfiles.nix\/blob\/a1ef2d1402c9c607e7a3e4427ce125d0cabeddcd\/lib\/shared\/scripts\/export-video-list.nix#L12-L31\">looked at the script on GitHub<\/a> and you're familiar with bash scripting, you may have thought it looked a bit odd or missing some things.<\/p>\n\n<p>That's because I wrote it <a href=\"\/daily\/2022\/09\/26\/experimenting-with-the-nix-package-manager\">with Nix<\/a> - the tool I've been using for almost two years to manage my dotfiles and operating system configuration.<\/p>\n\n<p>Using Nix for bash scripts has advantages, like automatically adding the shebang line, setting sensible defaults for error handling, and automatically running <code>shellcheck<\/code> when switching.<\/p>\n\n<p>I think the main advantage, though, is it can inject any dependency packages into the script.<\/p>\n\n<p>This script needs <code>tree<\/code> and <code>jq<\/code>, so they are dependencies of the script and the script can't run if they aren't installed.<\/p>\n\n<p>But, I don't need to assume they are available. Nix can do it automatically and make any packages added as build inputs available.<\/p>\n\n<p>Now, if anyone else wanted to use this script, or I wanted to share another script with colleagues or a client, they can use it without needing to install any dependencies separately and the script will continue to work in the future using its explicitly-added dependencies.<\/p>\n\n ",
"processed":"\n <p>Yesterday, I wrote about <a href=\"http:\/\/default\/daily\/2024\/08\/19\/bash-scripting-for-fun-and-profit\">a bash script I've written<\/a> to export a list of videos on my external hard drive.<\/p>\n\n<p>If you <a href=\"https:\/\/github.com\/opdavies\/dotfiles.nix\/blob\/a1ef2d1402c9c607e7a3e4427ce125d0cabeddcd\/lib\/shared\/scripts\/export-video-list.nix#L12-L31\">looked at the script on GitHub<\/a> and you're familiar with bash scripting, you may have thought it looked a bit odd or missing some things.<\/p>\n\n<p>That's because I wrote it <a href=\"http:\/\/default\/daily\/2022\/09\/26\/experimenting-with-the-nix-package-manager\">with Nix<\/a> - the tool I've been using for almost two years to manage my dotfiles and operating system configuration.<\/p>\n\n<p>Using Nix for bash scripts has advantages, like automatically adding the shebang line, setting sensible defaults for error handling, and automatically running <code>shellcheck<\/code> when switching.<\/p>\n\n<p>I think the main advantage, though, is it can inject any dependency packages into the script.<\/p>\n\n<p>This script needs <code>tree<\/code> and <code>jq<\/code>, so they are dependencies of the script and the script can't run if they aren't installed.<\/p>\n\n<p>But, I don't need to assume they are available. Nix can do it automatically and make any packages added as build inputs available.<\/p>\n\n<p>Now, if anyone else wanted to use this script, or I wanted to share another script with colleagues or a client, they can use it without needing to install any dependencies separately and the script will continue to work in the future using its explicitly-added dependencies.<\/p>\n\n ",