From 63aefa9edf4313037a5d68f936c4844b0e1ebb05 Mon Sep 17 00:00:00 2001 From: Sean Buckley Date: Fri, 18 Oct 2024 00:10:30 -0400 Subject: [PATCH] make sure desktops apps only install on desktops --- modules/desktop/alacritty.nix | 16 +++++---- modules/desktop/vscode.nix | 64 ++++++++++++++++++----------------- 2 files changed, 42 insertions(+), 38 deletions(-) diff --git a/modules/desktop/alacritty.nix b/modules/desktop/alacritty.nix index 04c8bd6..43fcd62 100644 --- a/modules/desktop/alacritty.nix +++ b/modules/desktop/alacritty.nix @@ -1,7 +1,7 @@ -{ lib, pkgs, ... }: +{ config, lib, pkgs, ... }: let - config = (pkgs.formats.toml { }).generate "alacritty.toml" + aconfig = (pkgs.formats.toml { }).generate "alacritty.toml" { env.TERM = "xterm-256color"; font.size = 12; @@ -32,9 +32,11 @@ let in { - environment.etc."xdg/alacritty.toml".source = config; - environment.systemPackages = [ - (lib.hiPrio notify-fix) - pkgs.alacritty - ]; + config = lib.mkIf (config.sconfig.desktop.enable) { + environment.etc."xdg/alacritty.toml".source = aconfig; + environment.systemPackages = [ + (lib.hiPrio notify-fix) + pkgs.alacritty + ]; + }; } diff --git a/modules/desktop/vscode.nix b/modules/desktop/vscode.nix index 90af686..f3f6784 100644 --- a/modules/desktop/vscode.nix +++ b/modules/desktop/vscode.nix @@ -1,35 +1,37 @@ -{ pkgs, ... }: +{ config, lib, pkgs, ... }: { - environment.systemPackages = with pkgs; [ - (vscode-with-extensions.override { - vscodeExtensions = with pkgs.vscode-extensions; [ - esbenp.prettier-vscode - jnoortheen.nix-ide - ms-azuretools.vscode-docker - ms-python.python - redhat.vscode-yaml - shardulm94.trailing-spaces - ]; - }) - ]; + config = lib.mkIf (config.sconfig.desktop.enable) { + environment.systemPackages = with pkgs; [ + (vscode-with-extensions.override { + vscodeExtensions = with pkgs.vscode-extensions; [ + esbenp.prettier-vscode + jnoortheen.nix-ide + ms-azuretools.vscode-docker + ms-python.python + redhat.vscode-yaml + shardulm94.trailing-spaces + ]; + }) + ]; - environment.etc."bck-settings.sh".text = '' - mkdir -p ~/.config/Code/User - ln -sf /etc/vscode-settings.json ~/.config/Code/User/settings.json - ln -sf /etc/vscode-keybindings.json ~/.config/Code/User/keybindings.json - ''; + environment.etc."bck-settings.sh".text = '' + mkdir -p ~/.config/Code/User + ln -sf /etc/vscode-settings.json ~/.config/Code/User/settings.json + ln -sf /etc/vscode-keybindings.json ~/.config/Code/User/keybindings.json + ''; - environment.etc."vscode-keybindings.json".source = ./vscode-keybindings.json; - environment.etc."vscode-settings.json".text = builtins.toJSON ( - ( - builtins.fromJSON (builtins.readFile ./vscode-settings.json) - ) // { - # NixOS-specific vscode settings: - "extensions.autoCheckUpdates" = false; - "extensions.autoUpdate" = false; - "terminal.external.linuxExec" = "x-terminal-emulator"; - "terminal.integrated.fontFamily" = "DejaVuSansM Nerd Font"; - "update.mode" = "none"; - } - ); + environment.etc."vscode-keybindings.json".source = ./vscode-keybindings.json; + environment.etc."vscode-settings.json".text = builtins.toJSON ( + ( + builtins.fromJSON (builtins.readFile ./vscode-settings.json) + ) // { + # NixOS-specific vscode settings: + "extensions.autoCheckUpdates" = false; + "extensions.autoUpdate" = false; + "terminal.external.linuxExec" = "x-terminal-emulator"; + "terminal.integrated.fontFamily" = "DejaVuSansM Nerd Font"; + "update.mode" = "none"; + } + ); + }; }