mirror of
https://github.com/oqyude/nixos.git
synced 2026-08-08 23:53:11 +03:00
termux: drop tailscaled (cannot run in proot, SELinux netlink), export SVDIR=/etc/service in zshenv
This commit is contained in:
+6
-1
@@ -80,6 +80,11 @@
|
|||||||
theme = "robbyrussell";
|
theme = "robbyrussell";
|
||||||
};
|
};
|
||||||
loginExtra = "clear && fastfetch && cd ~/.config/nix-on-droid";
|
loginExtra = "clear && fastfetch && cd ~/.config/nix-on-droid";
|
||||||
|
# .zshenv — sourced by zsh in ALL sessions incl. non-login ssh commands.
|
||||||
|
# runit from nixpkgs defaults to /var/service as SVDIR, but our tree
|
||||||
|
# lives at ~/service (symlinked as /etc/service). Export it so that
|
||||||
|
# `sv status sshd` works without qualifying the path.
|
||||||
|
envExtra = "export SVDIR=/etc/service";
|
||||||
initContent = ''
|
initContent = ''
|
||||||
beet-p() {
|
beet-p() {
|
||||||
local base="${config.home.homeDirectory}/.config/beets/My"
|
local base="${config.home.homeDirectory}/.config/beets/My"
|
||||||
@@ -110,7 +115,7 @@
|
|||||||
z-proxy = "export ALL_PROXY=socks5://localhost:10808";
|
z-proxy = "export ALL_PROXY=socks5://localhost:10808";
|
||||||
zh-proxy = "export HTTPS_PROXY=http://localhost:10808 && export HTTP_PROXY=http://localhost:10808";
|
zh-proxy = "export HTTPS_PROXY=http://localhost:10808 && export HTTP_PROXY=http://localhost:10808";
|
||||||
nix-dir = "cd ~/.config/nix-on-droid";
|
nix-dir = "cd ~/.config/nix-on-droid";
|
||||||
q-ssh = "sv-start"; # start all supervised services (sshd, tailscaled, ...); manage with `sv status sshd` etc
|
q-ssh = "sv-start"; # start all supervised services (sshd, ...); manage with `sv status sshd` etc
|
||||||
|
|
||||||
# beets
|
# beets
|
||||||
beet-ima = "beet im ./ -A";
|
beet-ima = "beet im ./ -A";
|
||||||
|
|||||||
@@ -9,20 +9,12 @@ let
|
|||||||
sshdTmpDir = "${config.user.home}/sshd-tmp";
|
sshdTmpDir = "${config.user.home}/sshd-tmp";
|
||||||
port = 8022;
|
port = 8022;
|
||||||
serviceDir = "${config.user.home}/service";
|
serviceDir = "${config.user.home}/service";
|
||||||
tailscaleState = "${config.user.home}/tailscale/tailscaled.state";
|
|
||||||
|
|
||||||
# runit run-scripts (executable store paths, linked into ~/service).
|
# runit run-scripts (executable store paths, linked into ~/service).
|
||||||
sshdRun = pkgs.writeScriptBin "sshd-run" ''
|
sshdRun = pkgs.writeScriptBin "sshd-run" ''
|
||||||
#!${pkgs.runtimeShell}
|
#!${pkgs.runtimeShell}
|
||||||
exec ${pkgs.openssh}/bin/sshd -f /etc/ssh/sshd_config -D
|
exec ${pkgs.openssh}/bin/sshd -f /etc/ssh/sshd_config -D
|
||||||
'';
|
'';
|
||||||
tailscaledRun = pkgs.writeScriptBin "tailscaled-run" ''
|
|
||||||
#!${pkgs.runtimeShell}
|
|
||||||
# real tun: requires /dev/net/tun access (root: su -c 'chmod 666 /dev/net/tun').
|
|
||||||
# If unavailable, fall back to userspace networking:
|
|
||||||
# exec ${pkgs.tailscale}/bin/tailscaled --tun=userspace-networking --socks5-server=localhost:1055 --state=${tailscaleState}
|
|
||||||
exec ${pkgs.tailscale}/bin/tailscaled --state=${tailscaleState}
|
|
||||||
'';
|
|
||||||
svLogRun = pkgs.writeScriptBin "sv-log-run" ''
|
svLogRun = pkgs.writeScriptBin "sv-log-run" ''
|
||||||
#!${pkgs.runtimeShell}
|
#!${pkgs.runtimeShell}
|
||||||
mkdir -p ./main
|
mkdir -p ./main
|
||||||
@@ -60,20 +52,21 @@ in
|
|||||||
# runit service tree: ~/service/<name>/{run,log/run}. run/ and log/run are
|
# runit service tree: ~/service/<name>/{run,log/run}. run/ and log/run are
|
||||||
# symlinks into the nix store (read-only is fine; runsvdir writes only to
|
# symlinks into the nix store (read-only is fine; runsvdir writes only to
|
||||||
# the <name>/supervise dirs). /etc/service is symlinked for `sv status`.
|
# the <name>/supervise dirs). /etc/service is symlinked for `sv status`.
|
||||||
|
# NOTE: tailscaled was removed — nixpkgs' linux build cannot run inside
|
||||||
|
# proot (SELinux blocks netlink; needs GOOS=android or root). Re-add only
|
||||||
|
# if that gets solved.
|
||||||
build.activation.services = ''
|
build.activation.services = ''
|
||||||
$DRY_RUN_CMD mkdir -p ${serviceDir}/sshd/log ${serviceDir}/tailscaled/log
|
$DRY_RUN_CMD rm -rf ${serviceDir}/tailscaled
|
||||||
|
$DRY_RUN_CMD mkdir -p ${serviceDir}/sshd/log
|
||||||
$DRY_RUN_CMD ln -sfn ${sshdRun}/bin/sshd-run ${serviceDir}/sshd/run
|
$DRY_RUN_CMD ln -sfn ${sshdRun}/bin/sshd-run ${serviceDir}/sshd/run
|
||||||
$DRY_RUN_CMD ln -sfn ${svLogRun}/bin/sv-log-run ${serviceDir}/sshd/log/run
|
$DRY_RUN_CMD ln -sfn ${svLogRun}/bin/sv-log-run ${serviceDir}/sshd/log/run
|
||||||
$DRY_RUN_CMD ln -sfn ${tailscaledRun}/bin/tailscaled-run ${serviceDir}/tailscaled/run
|
|
||||||
$DRY_RUN_CMD ln -sfn ${svLogRun}/bin/sv-log-run ${serviceDir}/tailscaled/log/run
|
|
||||||
$DRY_RUN_CMD ln -sfn ${serviceDir} /etc/service
|
$DRY_RUN_CMD ln -sfn ${serviceDir} /etc/service
|
||||||
'';
|
'';
|
||||||
|
|
||||||
environment.packages = [
|
environment.packages = [
|
||||||
pkgs.runit
|
pkgs.runit
|
||||||
pkgs.tailscale
|
|
||||||
|
|
||||||
# one command brings up all supervised services (sshd, tailscaled, ...)
|
# one command brings up all supervised services (sshd, ...)
|
||||||
svStart
|
svStart
|
||||||
|
|
||||||
# manual fallback for sshd only
|
# manual fallback for sshd only
|
||||||
|
|||||||
Reference in New Issue
Block a user