s6: migrate to /run/user/$id/s6
This commit is contained in:
parent
5b83d4d944
commit
7f8cae42ff
|
@ -10,12 +10,16 @@
|
|||
# note that one can still manually specify --live; later definitions will override earlier definitions.
|
||||
postInstall = (upstream.postInstall or "") + ''
|
||||
for prog in s6-rc s6-rc-bundle s6-rc-db s6-rc-format-upgrade s6-rc-init s6-rc-update; do
|
||||
wrapProgram "$out/bin/$prog" \
|
||||
--add-flags '--live $XDG_RUNTIME_DIR/s6'
|
||||
wrapProgram "$bin/bin/$prog" \
|
||||
--add-flags '-l $XDG_RUNTIME_DIR/s6/live'
|
||||
done
|
||||
'';
|
||||
});
|
||||
|
||||
persist.private = [
|
||||
".local/share/s6/logs"
|
||||
];
|
||||
|
||||
sandbox.enable = false; # service manager
|
||||
suggestedPrograms = [
|
||||
"s6-rc-man-pages"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ lib, pkgs, ... }:
|
||||
let
|
||||
logBase = "$HOME/.local/state/s6/logs";
|
||||
logBase = "$HOME/.local/share/s6/logs";
|
||||
maybe = cond: value: if cond then value else null;
|
||||
|
||||
# create a derivation whose output is the on-disk representation of some attrset.
|
||||
|
@ -193,28 +193,30 @@ in
|
|||
)
|
||||
);
|
||||
in {
|
||||
# N.B.: `compiled` needs to be writable (for locks -- maybe i can use symlinks to dodge this someday):
|
||||
# i populate it to ~/.config as a well-known place, and then copy it to /run before actually using it live.
|
||||
fs.".config/s6/compiled".symlink.target = compileServices sources;
|
||||
# exposed only for convenience
|
||||
fs.".config/s6/sources".symlink.target = sources;
|
||||
# N.B.: `compiled` needs to be writable (for locks -- maybe i can use symlinks to dodge this someday),
|
||||
# so write this nearby and copy it over to `compiled` later
|
||||
fs.".config/s6/compiled-static".symlink.target = compileServices sources;
|
||||
|
||||
fs.".profile".symlink.text = ''
|
||||
function startS6() {
|
||||
local S6_TARGET="''${1:-default}"
|
||||
|
||||
local COMPILED="$HOME/.config/s6/compiled"
|
||||
local LIVE="$HOME/.config/s6/live"
|
||||
local SCANDIR="$HOME/.config/s6/scandir"
|
||||
local S6_RUN_DIR="$XDG_RUNTIME_DIR/s6"
|
||||
local COMPILED="$S6_RUN_DIR/compiled"
|
||||
local LIVE="$S6_RUN_DIR/live"
|
||||
local SCANDIR="$S6_RUN_DIR/scandir"
|
||||
|
||||
rm -rf "$SCANDIR"
|
||||
mkdir "$SCANDIR"
|
||||
mkdir -p "$SCANDIR"
|
||||
s6-svscan "$SCANDIR" &
|
||||
local SVSCAN=$!
|
||||
|
||||
# the scandir is just links back into the compiled dir,
|
||||
# so the compiled dir therefore needs to be writable:
|
||||
rm -rf "$COMPILED"
|
||||
cp --dereference -R "$COMPILED-static" "$COMPILED"
|
||||
cp --dereference -R "$HOME/.config/s6/compiled" "$COMPILED"
|
||||
chmod -R 0700 "$COMPILED"
|
||||
|
||||
s6-rc-init -c "$COMPILED" -l "$LIVE" -d "$SCANDIR"
|
||||
|
@ -227,7 +229,7 @@ in
|
|||
wait "$SVSCAN"
|
||||
}
|
||||
function startS6WithLogging() {
|
||||
# TODO: might not want to create log dir here: move to nix fs/persistence.
|
||||
# the log dir should already exist by now (nixos persistence); create it just in case something went wrong.
|
||||
mkdir -p "${logBase}"
|
||||
startS6 2>&1 | tee /dev/stderr | s6-log -- T "${logBase}/catchall"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue