I’d like to use something like this function (I hope “function” is the correct name here). I’ve trimmed it down a bit, but sadly I couldn’t manage to import this to my system configuration like:
Function has same arguments with what has given above.
This fails either with:
error: anonymous function at ...location/mountmodule.nix:1:1 called with unexpected argument 'config', at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:224:8
or like this, if I add ... to the arguments list the function accepts:
error: The option `fsLabel' defined in `...location/common.nix' does not exist.
Which exists but I assume fails because of default parameters passed (e.g. modulesPath or similar).
I’m not sure how to provide more sources Original post has the import method, second post has the link to mountmodule.
Although I’ve been trying to make this work, I’ve also ended up something like this to make it a “module”, which of course, didn’t work. https://gist.github.com/seqizz/cba3e066025c945dffd0aa57057753f3
I was trying to mount a luks-formatted file automatically. Since normal filesystems."<file>".encrypted notation only supports block devices, I’ve tried to use this thing, but apparently I still suck at Nix.
Ended up defining a oneshot systemd service inside my configuration, which runs the needed cryptsetup command and enforces itself before mount service…