From d060cd355044d7d225c88939ce26a00a1b17973a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Sat, 26 Feb 2022 11:18:01 +0100 Subject: [PATCH] Avoid pulling in desktop components on servers This fixes #15 --- config/home-manager/base.nix | 8 ++++---- config/home-manager/darkkirb.nix | 2 +- config/home-manager/miifox.nix | 2 +- config/home-manager/root.nix | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config/home-manager/base.nix b/config/home-manager/base.nix index fa3161ad..dd2600a5 100644 --- a/config/home-manager/base.nix +++ b/config/home-manager/base.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +desktop: { pkgs, ... }: { imports = [ ../programs/zsh.nix ../programs/vim.nix @@ -21,8 +21,8 @@ SESSION_NAME="$USER" if [[ $SSH_CLIENT ]]; then SESSION_NAME="$SESSION_NAME-$(echo $SSH_CLIENT | ${pkgs.gawk}/bin/awk '{print $1}' | sed 's/[\.\:]/_/g')" - elif [[ $WAYLAND_DISPLAY ]]; then - SESSION_NAME="$SESSION_NAME-$(${pkgs.sway}/bin/swaymsg -t get_tree | ${pkgs.jq}/bin/jq -r '.. | select(.focused?) | .rect | "\(.width)x\(.height)"')" + ${if desktop then ''elif [[ $WAYLAND_DISPLAY ]]; then + SESSION_NAME="$SESSION_NAME-$(${pkgs.sway}/bin/swaymsg -t get_tree | ${pkgs.jq}/bin/jq -r '.. | select(.focused?) | .rect | "\(.width)x\(.height)"')"'' else ""} fi ${pkgs.tmux}/bin/tmux attach-session -t "$SESSION_NAME" || ${pkgs.tmux}/bin/tmux new-session -s "$SESSION_NAME" fi @@ -63,7 +63,7 @@ enable = true; boxes = [ "Inbox" ]; onNotify = "${pkgs.isync}/bin/mbsync -a"; - onNotifyPost = "${pkgs.notmuch}/bin/notmuch new && ${pkgs.libnotify}/bin/notify-send 'New mail arrived'"; + onNotifyPost = if desktop then "${pkgs.notmuch}/bin/notmuch new && ${pkgs.libnotify}/bin/notify-send 'New mail arrived'" else "${pkgs.notmuch}/bin/notmuch new"; }; mbsync = { enable = true; diff --git a/config/home-manager/darkkirb.nix b/config/home-manager/darkkirb.nix index e9a6cf18..66aa154e 100644 --- a/config/home-manager/darkkirb.nix +++ b/config/home-manager/darkkirb.nix @@ -1,6 +1,6 @@ desktop: { pkgs, ... }: { imports = [ - ./base.nix + (import ./base.nix desktop) ../programs/gpg.nix ../programs/git.nix ] ++ (if desktop then [ diff --git a/config/home-manager/miifox.nix b/config/home-manager/miifox.nix index a0d18b1b..8e4f4a7b 100644 --- a/config/home-manager/miifox.nix +++ b/config/home-manager/miifox.nix @@ -1,5 +1,5 @@ { pkgs, ... }: { imports = [ - ./base.nix + (import ./base.nix false) ]; } diff --git a/config/home-manager/root.nix b/config/home-manager/root.nix index a0d18b1b..8e4f4a7b 100644 --- a/config/home-manager/root.nix +++ b/config/home-manager/root.nix @@ -1,5 +1,5 @@ { pkgs, ... }: { imports = [ - ./base.nix + (import ./base.nix false) ]; }