add /nix mount service
This commit is contained in:
parent
fb37b3aa4e
commit
892ac475cc
2 changed files with 23 additions and 0 deletions
|
|
@ -48,6 +48,9 @@ COPY etc /etc
|
||||||
# Copy /usr
|
# Copy /usr
|
||||||
COPY usr /usr
|
COPY usr /usr
|
||||||
|
|
||||||
|
# Enable /nix mount service
|
||||||
|
RUN systemctl enable mount-nix-prepare.service
|
||||||
|
|
||||||
# Clear cache, /var and /tmp and commit ostree
|
# Clear cache, /var and /tmp and commit ostree
|
||||||
RUN rm -rf /tmp/* /var/* && mkdir -p /var/tmp && chmod -R 1777 /var/tmp && \
|
RUN rm -rf /tmp/* /var/* && mkdir -p /var/tmp && chmod -R 1777 /var/tmp && \
|
||||||
ostree container commit
|
ostree container commit
|
||||||
|
|
|
||||||
20
etc/systemd/system/mount-nix-prepare.service
Normal file
20
etc/systemd/system/mount-nix-prepare.service
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Prepare nix mount points
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStartPre=chattr -i /
|
||||||
|
ExecStart=/bin/sh -c "mkdir -p /nix"
|
||||||
|
ExecStart=/bin/sh -c "mkdir -p /var/lib/nix"
|
||||||
|
ExecStart=/bin/sh -c "mount --bind /var/lib/nix /nix"
|
||||||
|
# We need to restart systemd and load the nix-daemon again
|
||||||
|
# as the nix-daemon files are actually inside the /nix folder
|
||||||
|
# which hasn't been mounted until now
|
||||||
|
ExecStart=/bin/sh -c "systemctl daemon-reload"
|
||||||
|
# This will fail the first time as we haven't installed nix yet
|
||||||
|
ExecStart=-/bin/sh -c "systemctl start nix-daemon.socket"
|
||||||
|
ExecStopPost=chattr +i /
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=local-fs.target
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue