uuid: - value: 57f28cf3-4474-4668-8222-c430cbe9b88b langcode: - value: en type: - target_id: daily_email target_type: node_type target_uuid: 8bde1f2f-eef9-4f2d-ae9c-96921f8193d7 revision_timestamp: - value: '2025-05-11T09:00:08+00:00' revision_uid: - target_type: user target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849 revision_log: { } status: - value: true uid: - target_type: user target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849 title: - value: 'Writing bash scripts with Nix' created: - value: '2024-08-20T00:00:00+00:00' changed: - value: '2025-05-11T09:00:08+00:00' promote: - value: false sticky: - value: false default_langcode: - value: true revision_translation_affected: - value: true path: - alias: /daily/2024/08/20/writing-bash-scripts-with-nix langcode: en body: - value: |

Yesterday, I wrote about a bash script I've written to export a list of videos on my external hard drive.

If you looked at the script on GitHub and you're familiar with bash scripting, you may have thought it looked a bit odd or missing some things.

That's because I wrote it with Nix - the tool I've been using for almost two years to manage my dotfiles and operating system configuration.

Using Nix for bash scripts has advantages, like automatically adding the shebang line, setting sensible defaults for error handling, and automatically running shellcheck when switching.

I think the main advantage, though, is it can inject any dependency packages into the script.

This script needs tree and jq, so they are dependencies of the script and the script can't run if they aren't installed.

But, I don't need to assume they are available. Nix can do it automatically and make any packages added as build inputs available.

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.

format: full_html processed: |

Yesterday, I wrote about a bash script I've written to export a list of videos on my external hard drive.

If you looked at the script on GitHub and you're familiar with bash scripting, you may have thought it looked a bit odd or missing some things.

That's because I wrote it with Nix - the tool I've been using for almost two years to manage my dotfiles and operating system configuration.

Using Nix for bash scripts has advantages, like automatically adding the shebang line, setting sensible defaults for error handling, and automatically running shellcheck when switching.

I think the main advantage, though, is it can inject any dependency packages into the script.

This script needs tree and jq, so they are dependencies of the script and the script can't run if they aren't installed.

But, I don't need to assume they are available. Nix can do it automatically and make any packages added as build inputs available.

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.

summary: null field_daily_email_cta: { }