[prev in list] [next in list] [prev in thread] [next in thread] 

List:       nix-dev
Subject:    Re: [Nix-dev] Custom directories
From:       Daniel Hlynskyi <abcz2.uprola () gmail ! com>
Date:       2016-05-27 10:28:18
Message-ID: CANZg+yfzMAo=nok=FSde1WLBRT1sZVURmRAniVLWYDZmVzsXXQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


> 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@arnoldarts.de>:

> On Wed, 25 May 2016 17:26:24 +0300 Daniel Hlynskyi
> <abcz2.uprola@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@lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
>

[Attachment #5 (text/html)]

<div dir="ltr"><span style="font-size:12.8px">&gt; Here is how one of my containers \
has its data dir in a special  </span><span style="font-size:12.8px">partition with \
special permissions:</span><div><span \
style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Nice. \
But I don&#39;t want to mount /media/logs to my container, because it will have \
access to other logs created by other containers.<br><br>&gt;  </span><span \
style="font-size:12.8px">But maybe the bindMounts of containers need to be extended \
so they also  </span><span style="font-size:12.8px">create the target directory with \
the permissions you want<br><br>This (permissions) would be nice feature for \
fileSystems too, IMO.</span></div></div><div class="gmail_extra"><br><div \
class="gmail_quote">2016-05-25 23:14 GMT+03:00 Arnold Krille <span dir="ltr">&lt;<a \
href="mailto:arnold@arnoldarts.de" \
target="_blank">arnold@arnoldarts.de</a>&gt;</span>:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Wed, 25 May 2016 \
17:26:24 +0300 Daniel Hlynskyi<br> &lt;<a \
href="mailto:abcz2.uprola@gmail.com">abcz2.uprola@gmail.com</a>&gt; wrote:<br> &gt; \
Hi. What&#39;s canonical Nixos way to specify custom directories?<br> &gt;<br>
&gt; I&#39;m playing with containers. Here is excerpt of my config:<br>
&gt;<br>
&gt;     fileSystems.&quot;/media/logs&quot; = { fsType = &quot;ext4&quot;;   label = \
&quot;logs&quot;; };<br> &gt;     boot.initrd.postMountCommands = &#39;&#39;<br>
&gt;        chmod 777 /media/logs<br>
&gt;     &#39;&#39;;<br>
&gt;<br>
&gt;     containers.dwarfs =<br>
&gt;        { bindMounts.&quot;/media/logs/dwarfs&quot;.hostPath = \
&quot;/media/logs/dwarfs&quot;;<br> &gt;           \
bindMounts.&quot;/media/logs/dwarfs&quot;.isReadOnly = false;<br> &gt;           \
config =<br> &gt;      { config, pkgs, ... }:<br>
&gt;      {<br>
&gt;               boot.postBootCommands = &#39;&#39;<br>
&gt;                          chmod 777 /media/logs/dwarfs<br>
&gt;                     &#39;&#39;;<br>
&gt;<br>
&gt; I&#39;d like for directory /media/logs/dwarfs to exist, but I don&#39;t know<br>
&gt; where to put _the_ mkdir.<br>
&gt;<br>
&gt; boot.initrd.postMountCommands is not exactly what I want, because I<br>
&gt; need to remount drive or reboot host for changes to apply, but plain<br>
&gt; nixos-rebuild switch doesn&#39;t execute postMountCommands.<br>
&gt;<br>
&gt; Also I&#39;d like to change directory mask in containers without container<br>
&gt; restart (instead of boot.postBootCommands)<br>
<br>
</div></div>Here is how one of my containers has its data dir in a special<br>
partition with special permissions:<br>
<a href="https://github.com/kampfschlaefer/nixconfig/blob/master/portal/containers/mpd.nix" \
rel="noreferrer" target="_blank">https://github.com/kampfschlaefer/nixconfig/blob/master/portal/containers/mpd.nix</a><br>
 Note that the directory is created by systemd before mounting partition.<br>
<br>
But maybe the bindMounts of containers need to be extended so they also<br>
create the target directory with the permissions you want. But what<br>
happens when you want a userid for permissions that exists only inside<br>
the container? Current bindmount stuff is outside the container…<br>
<span class="HOEnZb"><font color="#888888"><br>
- Arnold<br>
</font></span><br>_______________________________________________<br>
nix-dev mailing list<br>
<a href="mailto:nix-dev@lists.science.uu.nl">nix-dev@lists.science.uu.nl</a><br>
<a href="http://lists.science.uu.nl/mailman/listinfo/nix-dev" rel="noreferrer" \
target="_blank">http://lists.science.uu.nl/mailman/listinfo/nix-dev</a><br> \
<br></blockquote></div><br></div>



_______________________________________________
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic