I want to add a function to make initializing a flake easier, I thought about making a bash function but since I manage my bash shell with home-manager I was wondering if there was a way to create commands/functions in nix home-manager that I can then run in bash, something akin to the following snippet would be nice
The full power of bash is available to you here, so turning this snippet into a custom module that works as teased in the post is quite doable, but takes some programming.
The benefit of this over the accepted solution is that both the executed functions are lighter (because they don’t need to call out to subshells) and that you’re just concatenating strings rather than building derivations.
The downside is that it’s bash-specific and the syntax requires understanding bash.