I am checking out propellor to determine if it can make it easier to maintain a few personal machines. With no prior knowledge of Haskell, that may be a futile attempt.
I am trying to understand the Propellor.Property.Mount documentation and particularly how I would need to write the equivalent of
mount -t nfs 192.168.1.100:/mnt/usb1 /mnt/nfs
I tried putting
& Mount.mounted
"nfs" "192.168.1.100:/mnt/usb1" "/mnt/nfs" ["defaults"]
in config.hs, but that results in
Couldn't match expected type ‘Mount.MountOpts’
with actual type ‘[[Char]]’
In the fourth argument of ‘Mount.mounted’, namely ‘["defaults"]’
In the second argument of ‘(&)’, namely
‘Mount.mounted
"nfs" "192.168.1.100:/mnt/usb1" "/mnt/nfs" ["defaults"]’
The easy way to translate your command to a property is:
This has the benefit of working with any command you might want, and the drawback of not preventing eg, re-mounting an already mounted device.
mounted
takes aMountOpts
which is a specialized data type. You can construct one with eg,(MountOpts ["defaults"])
.But, since
MountOpts
is aMonoid
, and "defaults" is the default of an emptyMountOpts
, you can more simply usemempty
to get the default one:Propellor.Property.Mount was mostly written for use by some other properties, and so doesn't really target the end user as much. And, I notice, its
mounted
property doesn't check if the device is already mounted and so will try to re-mount unnecessarily.I'm not sure if manually driving the mount command makes the most sense; wouldn't it be better to have a property that updates /etc/fstab?
I agreed with you joey, we need to be able to add mount point directly into the fstab file in order to let the world know about all the mount points. Maybe a way also to generate the mount point with the system d syntax.
So maybe the best solution is to have a DSL (like you did in you dism system) and then generators for fstab, systemd, etc... This property should be revertable in order to add or remove lines (files).
the fstab should also contain some invariant code (the lines generated during the system installation). I speak about Debian installation.
Cheers
Fred
I tried adding
This mimicks the bitlbee example on /usr/local/propellor/config-joey.hs
But that results:
That's quite a nice elegant solution, Frederik!
It'll work if you use
This is ncessary because propellor doesn't know if
cmdProperty
makes a change or not. In this case we can just assume it did.I've added a
Propellor.Property.Fstab.mounted
this evening that is essentially Frederik's solution.