about summary refs log tree commit diff
path: root/configs
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-02-07T11·01+0000
committerWilliam Carroll <wpcarro@gmail.com>2020-02-07T11·01+0000
commit938c1a4eb06a37cb0eec7e31b392bb0c3a843d4b (patch)
tree3d4722d298abe439ab65e65443c3b52bd33e863e /configs
parent048b7867bfd6c1dc45bb2dac840e714c5901af36 (diff)
Start lorri with sytemd
Whenever possible, prefer starting things as systemd units instead of
instantiating them in ~/.profile and other dotfiles.
Diffstat (limited to 'configs')
-rw-r--r--configs/shared/.config/systemd/user/lorri.service12
-rw-r--r--configs/shared/.config/systemd/user/lorri.socket9
-rw-r--r--configs/shared/.profile8
3 files changed, 24 insertions, 5 deletions
diff --git a/configs/shared/.config/systemd/user/lorri.service b/configs/shared/.config/systemd/user/lorri.service
new file mode 100644
index 000000000000..a72646813a66
--- /dev/null
+++ b/configs/shared/.config/systemd/user/lorri.service
@@ -0,0 +1,12 @@
+[Unit]
+ConditionUser=!@system
+Description=Lorri build daemon
+After=lorri.socket
+Wants=lorri.socket
+
+[Service]
+ExecStart=%h/.nix-profile/bin/lorri daemon
+PrivateTmp=true
+ProtectSystem=strict
+Restart=on-failure
+WorkingDirectory=%h
\ No newline at end of file
diff --git a/configs/shared/.config/systemd/user/lorri.socket b/configs/shared/.config/systemd/user/lorri.socket
new file mode 100644
index 000000000000..b752fa0fa5d6
--- /dev/null
+++ b/configs/shared/.config/systemd/user/lorri.socket
@@ -0,0 +1,9 @@
+[Unit]
+Description=Lorri build daemon
+
+[Socket]
+ListenStream=%t/lorri/daemon.socket
+RuntimeDirectory=lorri
+
+[Install]
+WantedBy=sockets.target
\ No newline at end of file
diff --git a/configs/shared/.profile b/configs/shared/.profile
index 1ec3a33aa0b6..64fab4d51da6 100644
--- a/configs/shared/.profile
+++ b/configs/shared/.profile
@@ -51,6 +51,9 @@ eval "$(ssh-agent -s)"
 # TODO: Prefer `systemctl start docker.service`
 dockerd &
 
+# Start lorri
+systemctl --user start lorri.service
+
 # Set environment variables for Nix. Don't run this for systems running NixOS.
 # TODO: Learn why I can't use the variables from ~/briefcase/.envrc.
 case $(hostname) in
@@ -58,8 +61,3 @@ case $(hostname) in
   seneca) . ~/.nix-profile/etc/profile.d/nix.sh;;
   wpcarro.c.googlers.com) . ~/.nix-profile/etc/profile.d/nix.sh;;
 esac
-
-# NOTE: `lorri` needs to be below the calls to source Nix environment since it's
-# installed with `nix-env -iA nixpkgs.lorri`.
-# Start lorri daemon
-lorri daemon &