[Nix-dev] Custom directories

Daniel Hlynskyi abcz2.uprola at gmail.com
Fri May 27 12:28:18 CEST 2016


> Here is how one of my containers has its data dir in a special partition
with special permissions:

Nice. But I don't want to mount /media/logs to my container, because it
will have access to other logs created by other containers.

> But maybe the bindMounts of containers need to be extended so they also create
the target directory with the permissions you want

This (permissions) would be nice feature for fileSystems too, IMO.

2016-05-25 23:14 GMT+03:00 Arnold Krille <arnold at arnoldarts.de>:

> On Wed, 25 May 2016 17:26:24 +0300 Daniel Hlynskyi
> <abcz2.uprola at gmail.com> wrote:
> > Hi. What's canonical Nixos way to specify custom directories?
> >
> > I'm playing with containers. Here is excerpt of my config:
> >
> >   fileSystems."/media/logs" = { fsType = "ext4";  label = "logs"; };
> >   boot.initrd.postMountCommands = ''
> >     chmod 777 /media/logs
> >   '';
> >
> >   containers.dwarfs =
> >     { bindMounts."/media/logs/dwarfs".hostPath = "/media/logs/dwarfs";
> >       bindMounts."/media/logs/dwarfs".isReadOnly = false;
> >       config =
> >    { config, pkgs, ... }:
> >    {
> >          boot.postBootCommands = ''
> >                 chmod 777 /media/logs/dwarfs
> >              '';
> >
> > I'd like for directory /media/logs/dwarfs to exist, but I don't know
> > where to put _the_ mkdir.
> >
> > boot.initrd.postMountCommands is not exactly what I want, because I
> > need to remount drive or reboot host for changes to apply, but plain
> > nixos-rebuild switch doesn't execute postMountCommands.
> >
> > Also I'd like to change directory mask in containers without container
> > restart (instead of boot.postBootCommands)
>
> Here is how one of my containers has its data dir in a special
> partition with special permissions:
>
> https://github.com/kampfschlaefer/nixconfig/blob/master/portal/containers/mpd.nix
> Note that the directory is created by systemd before mounting partition.
>
> But maybe the bindMounts of containers need to be extended so they also
> create the target directory with the permissions you want. But what
> happens when you want a userid for permissions that exists only inside
> the container? Current bindmount stuff is outside the container…
>
> - Arnold
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160527/be29eb6b/attachment.html 


More information about the nix-dev mailing list