mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-10 19:23:03 +03:00
feat(desktop): add polkit & vpn shepherd services
This commit is contained in:
parent
4785f72fec
commit
57b757a78f
7 changed files with 60 additions and 12 deletions
|
|
@ -1,5 +1,6 @@
|
|||
(specifications->manifest
|
||||
'(
|
||||
"polkit-gnome"
|
||||
"fontconfig"
|
||||
"qbittorrent"
|
||||
"gnome-font-viewer"
|
||||
|
|
|
|||
|
|
@ -63,6 +63,20 @@
|
|||
#:one-shot? #t
|
||||
#:start (make-system-constructor "ln -sf {app/com.discordapp.Discord,$XDG_RUNTIME_DIR}/discord-ipc-0")))
|
||||
|
||||
(define polkit-gnome
|
||||
(make <service>
|
||||
#:provides '(polkit-gnome)
|
||||
#:respawn? #t
|
||||
#:start (make-forkexec-constructor '("/home/pavel/.guix-extra-profiles/desktop/desktop/libexec/polkit-gnome-authentication-agent-1"))
|
||||
#:stop (make-kill-destructor)))
|
||||
|
||||
(define vpn
|
||||
(make <service>
|
||||
#:provides '(vpn)
|
||||
#:respawn? #t
|
||||
#:start (make-forkexec-constructor '("/home/pavel/bin/scripts/vpn-start"))
|
||||
#:stop (make-kill-destructor)))
|
||||
|
||||
(register-services
|
||||
mpd
|
||||
mpd-watcher
|
||||
|
|
@ -72,8 +86,10 @@
|
|||
aw-watcher-window
|
||||
pulseeffects
|
||||
xsettingsd
|
||||
discord-rich-presence)
|
||||
discord-rich-presence
|
||||
polkit-gnome
|
||||
vpn)
|
||||
|
||||
(action 'shepherd 'daemonize)
|
||||
|
||||
(for-each start '(mpd mpd-watcher mcron aw-server aw-watcher-afk aw-watcher-window pulseeffects xsettingsd discord-rich-presence))
|
||||
(for-each start '(mpd mpd-watcher mcron aw-server aw-watcher-afk aw-watcher-window pulseeffects xsettingsd discord-rich-presence polkit-gnome))
|
||||
|
|
|
|||
29
Desktop.org
29
Desktop.org
|
|
@ -2325,6 +2325,28 @@ References:
|
|||
#:one-shot? #t
|
||||
#:start (make-system-constructor "ln -sf {app/com.discordapp.Discord,$XDG_RUNTIME_DIR}/discord-ipc-0")))
|
||||
#+end_src
|
||||
** Polkit Authentication agent
|
||||
Launch an authentication agent. Necessary for stuff like =pkexec=. I suspect I'm not doing that the intended way, but it seems to work.
|
||||
|
||||
#+begin_src scheme
|
||||
(define polkit-gnome
|
||||
(make <service>
|
||||
#:provides '(polkit-gnome)
|
||||
#:respawn? #t
|
||||
#:start (make-forkexec-constructor '("/home/pavel/.guix-extra-profiles/desktop/desktop/libexec/polkit-gnome-authentication-agent-1"))
|
||||
#:stop (make-kill-destructor)))
|
||||
#+end_src
|
||||
** VPN
|
||||
Run my [[file:Guix.org::*VPN][OpenVPN setup]]. Not lauching this automatially, as it requires an active connection.
|
||||
|
||||
#+begin_src scheme
|
||||
(define vpn
|
||||
(make <service>
|
||||
#:provides '(vpn)
|
||||
#:respawn? #t
|
||||
#:start (make-forkexec-constructor '("/home/pavel/bin/scripts/vpn-start"))
|
||||
#:stop (make-kill-destructor)))
|
||||
#+end_src
|
||||
** Shepherd config
|
||||
Register services
|
||||
#+begin_src scheme
|
||||
|
|
@ -2337,7 +2359,9 @@ Register services
|
|||
aw-watcher-window
|
||||
pulseeffects
|
||||
xsettingsd
|
||||
discord-rich-presence)
|
||||
discord-rich-presence
|
||||
polkit-gnome
|
||||
vpn)
|
||||
#+end_src
|
||||
|
||||
Daemonize shepherd
|
||||
|
|
@ -2347,7 +2371,7 @@ Daemonize shepherd
|
|||
|
||||
Run services
|
||||
#+begin_src scheme
|
||||
(for-each start '(mpd mpd-watcher mcron aw-server aw-watcher-afk aw-watcher-window pulseeffects xsettingsd discord-rich-presence))
|
||||
(for-each start '(mpd mpd-watcher mcron aw-server aw-watcher-afk aw-watcher-window pulseeffects xsettingsd discord-rich-presence polkit-gnome))
|
||||
#+end_src
|
||||
** Sync
|
||||
| Guix dependency |
|
||||
|
|
@ -2374,6 +2398,7 @@ Other desktop programs I use are listed below.
|
|||
| gnome-font-viewer | view fonts |
|
||||
| qbittorrent | torrent client |
|
||||
| fontconfig | |
|
||||
| polkit-gnome | Polkit authentication agent |
|
||||
|
||||
#+NAME: packages
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
|
|
|
|||
9
Guix.org
9
Guix.org
|
|
@ -567,18 +567,21 @@ I'm currently using CyberGhost VPN. =~/.vpn= folder stores its OpenVPN config (=
|
|||
As of now, CyberGhost doesn't provide ipv6, so we have to disable it.
|
||||
|
||||
#+begin_src bash :tangle ~/bin/scripts/vpn-start
|
||||
export DISPLAY=:0
|
||||
CONN=$(nmcli -f NAME con show --active | grep -Ev "(.*docker.*|NAME|br-.*|veth.*|tun.*)" | sed 's/ *$//g')
|
||||
|
||||
if [ -z "$CONN" ]; then
|
||||
echo "No connection!"
|
||||
notify-send "VPN" "No connection for VPN to run"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "Connection: $CONN"
|
||||
notify-send "VPN" "Initializing for connection: $CONN"
|
||||
|
||||
sudo nmcli con modify "$CONN" ipv6.method ignore
|
||||
pkexec nmcli con modify "$CONN" ipv6.method ignore
|
||||
nmcli connection up "$CONN"
|
||||
sudo openvpn --config ~/.vpn/openvpn.ovpn
|
||||
pkexec openvpn --config ~/.vpn/openvpn.ovpn
|
||||
#+end_src
|
||||
|
||||
*** vpn-stop
|
||||
|
|
@ -588,7 +591,7 @@ Also a script to reverse the changes.
|
|||
CONN=$(nmcli -f NAME con show --active | grep -Ev "(.*docker.*|NAME|br-.*|veth.*|tun.*)" | sed 's/ *$//g')
|
||||
echo "Connection: $CONN"
|
||||
|
||||
sudo nmcli con modify "$CONN" ipv6.method auto
|
||||
pkexec nmcli con modify "$CONN" ipv6.method auto
|
||||
nmcli connection up "$CONN"
|
||||
#+end_src
|
||||
** flatpak
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
# [[file:../../Desktop.org::*Screen settings][Screen settings:1]]
|
||||
# [[file:../../Desktop.org::*Device-specific settings][Device-specific settings:1]]
|
||||
hostname=$(hostname)
|
||||
if [ "$hostname" = "indigo" ]; then
|
||||
xrandr --output DisplayPort-0 --off --output HDMI-A-0 --mode 1920x1080 --pos 0x0 --rotate normal --output DVI-D-0 --mode 1366x768 --pos 1920x312 --rotate normal
|
||||
elif [ "$hostname" = "eminence" ]; then
|
||||
xgamma -gamma 1.25
|
||||
fi
|
||||
# Screen settings:1 ends here
|
||||
# Device-specific settings:1 ends here
|
||||
|
|
|
|||
|
|
@ -1,15 +1,18 @@
|
|||
#!/usr/bin/env bash
|
||||
# [[file:../../Guix.org::*vpn-start][vpn-start:1]]
|
||||
export DISPLAY=:0
|
||||
CONN=$(nmcli -f NAME con show --active | grep -Ev "(.*docker.*|NAME|br-.*|veth.*|tun.*)" | sed 's/ *$//g')
|
||||
|
||||
if [ -z "$CONN" ]; then
|
||||
echo "No connection!"
|
||||
notify-send "VPN" "No connection for VPN to run"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "Connection: $CONN"
|
||||
notify-send "VPN" "Initializing for connection: $CONN"
|
||||
|
||||
sudo nmcli con modify "$CONN" ipv6.method ignore
|
||||
pkexec nmcli con modify "$CONN" ipv6.method ignore
|
||||
nmcli connection up "$CONN"
|
||||
sudo openvpn --config ~/.vpn/openvpn.ovpn
|
||||
pkexec openvpn --config ~/.vpn/openvpn.ovpn
|
||||
# vpn-start:1 ends here
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@
|
|||
CONN=$(nmcli -f NAME con show --active | grep -Ev "(.*docker.*|NAME|br-.*|veth.*|tun.*)" | sed 's/ *$//g')
|
||||
echo "Connection: $CONN"
|
||||
|
||||
nmcli con modify "$CONN" ipv6.method auto
|
||||
pkexec nmcli con modify "$CONN" ipv6.method auto
|
||||
nmcli connection up "$CONN"
|
||||
# vpn-stop:1 ends here
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue