Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auto-luks: require new mountPoint option #1156

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions nix/auto-luks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,25 @@ with utils;
luksFormat</command>.
'';
};

mountPoint = mkOption {
type = types.either (types.enum ["none"]) types.str;
description = ''
This option is required so the autoLuks module knows where the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If required, why allow "null"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was meant as an escape hatch for people that know what they are doing. There might be cases where it is being used without using it for a filesystem.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the type signature make it explicit that I want either a str or the string "none". While technically not required I think making the "none" case explicit in the type serves as a good way to document the existence of it.

device will be mounted at. With this option we inject the
required <literal>_netdev</literal> mount option. Without the
mount option the <literal>local-fs.target</literal> would fail.

Set to the path used in the corresponding
<literal>fileSystems.<replaceable>path</replaceable></literal>
option or to <literal>null</literal> if you know what you are doing.

If you do not use the device on a mount point pass <literal>none</literal>.

WARNING: failing to provide the correct value here might render
the system unbootable.
'';
};
};
});
description = ''
Expand All @@ -86,6 +105,12 @@ with utils;

config = {

fileSystems =
let
mkFileSystemEntry = _: attrs: nameValuePair attrs.mountPoint { options = [ "_netdev" ]; };
in mapAttrs' mkFileSystemEntry
(filterAttrs (_: attrs: attrs.mountPoint != "none") config.deployment.autoLuks);

systemd.services =
let

Expand Down