Add externalDrives module to auto-mount known external drives#560
Open
goromal wants to merge 2 commits into
Open
Add externalDrives module to auto-mount known external drives#560goromal wants to merge 2 commits into
goromal wants to merge 2 commits into
Conversation
Mounts known external drives at /mnt/<name> via nofail + x-systemd.automount, so they mount transparently whenever connected (at boot or hot-plugged later) and never block boot when absent. Foreign filesystems (ntfs/vfat/exfat) get uid/gid + dmask/fmask so andrew and the dev group always have read/write access. Default drives: seagate (Seagate Backup Plus, NTFS) and aegis (Apricorn Aegis Padlock SSD, NTFS). Imported into pc-base.nix. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Change DescriptionAdd externalDrives module to auto-mount known external drives
|
goromal
commented
Jun 27, 2026
| in | ||
| { | ||
| options.machines.externalDrives = { | ||
| enable = lib.mkOption { |
Owner
Author
There was a problem hiding this comment.
Make this mkEnableOption instead, so it defaults to false and requires an additional line in pc-base.nix to set to true.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
New
externalDrivesNixOS module (imported intopc-base.nix) that auto-mounts known external hard drives at fixed/mnt/<name>mount points whenever they happen to be connected — at boot or hot-plugged at any later time./dev/disk/by-uuid/…), so/dev/sd?renaming doesn't matter.nofail+x-systemd.automount(+ idle/device timeouts): boot never blocks when a drive is absent, the mount point always exists, and the drive mounts transparently on first access whenever present. Auto-unmounts after idle, so it's safe to unplug.ntfs/ntfs-3g/vfat/exfat, which lack Unix permissions) getuid/gid+dmask=007/fmask=117, so user andrew and the dev group always have read/write. Native filesystems (ext4, …) skip these and keep their on-disk permissions.Default drives
seagateA4E83FF7E83FC5F8/mnt/seagateaegis0259FC5C6268D54B/mnt/aegisAdding more is a one-liner:
machines.externalDrives.drives.<name>.uuid = "…";Options
machines.externalDrives:enable(default true),user(defaultandrew),group(defaultdev), anddrives(attrset of{ uuid, fsType = "ntfs-3g", extraOptions = [] }keyed by mount-point name).Testing
Deployed locally via
anix-upgradeand verified on the Dell machine:mnt-seagate.automount/mnt-aegis.automountactive; both mount on access.findmntshows the ntfs-3g mounts; atouchas andrew succeeds and the created file is ownedandrew:devwith mode-rw-rw----(matchesuid=1000,gid=1000,fmask=117).🤖 Generated with Claude Code