{ "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": "\n

Yesterday, I wrote about a bash script I've written<\/a> to export a list of videos on my external hard drive.<\/p>\n\n

If you 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

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

Using Nix for bash scripts has advantages, like automatically adding the shebang line, setting sensible defaults for error handling, and automatically running shellcheck<\/code> when switching.<\/p>\n\n

I think the main advantage, though, is it can inject any dependency packages into the script.<\/p>\n\n

This script needs tree<\/code> and jq<\/code>, so they are dependencies of the script and the script can't run if they aren't installed.<\/p>\n\n

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

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 ", "format": "full_html", "processed": "\n

Yesterday, I wrote about a bash script I've written<\/a> to export a list of videos on my external hard drive.<\/p>\n\n

If you 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

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

Using Nix for bash scripts has advantages, like automatically adding the shebang line, setting sensible defaults for error handling, and automatically running shellcheck<\/code> when switching.<\/p>\n\n

I think the main advantage, though, is it can inject any dependency packages into the script.<\/p>\n\n

This script needs tree<\/code> and jq<\/code>, so they are dependencies of the script and the script can't run if they aren't installed.<\/p>\n\n

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

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 ", "summary": null } ], "feeds_item": [ { "imported": "1970-01-01T00:33:45+00:00", "guid": null, "hash": "b9459e8502e6216a6d8f4cd2842d9bba", "target_type": "feeds_feed", "target_uuid": "90c85284-7ca8-4074-9178-97ff8384fe76" } ] }