From 7cd76b2b63131260de70276a42930756dd763f0d Mon Sep 17 00:00:00 2001 From: LavaDesu Date: Thu, 15 Jul 2021 13:46:01 +0700 Subject: [PATCH] add enableGUI option, with conditional modules depending on it --- flake.nix | 10 ++++++++-- users/rin/home.nix | 48 ++++++++++++++++++++++++---------------------- 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/flake.nix b/flake.nix index 7ca353a..6372738 100644 --- a/flake.nix +++ b/flake.nix @@ -54,7 +54,10 @@ home-manager = { useGlobalPkgs = true; useUserPackages = true; - extraSpecialArgs = { inherit inputs; }; + extraSpecialArgs = { + inherit inputs; + enableGUI = true; + }; }; }; in @@ -67,7 +70,10 @@ ./hosts/winter secrets.nixosModules.winter ]; - specialArgs = { inherit inputs; }; + specialArgs = { + inherit inputs; + enableGUI = true; + }; }; packages.x86_64-linux = customPackages nixpkgs.legacyPackages.x86_64-linux; diff --git a/users/rin/home.nix b/users/rin/home.nix index d9821c3..21d6beb 100644 --- a/users/rin/home.nix +++ b/users/rin/home.nix @@ -1,42 +1,43 @@ -{ config, pkgs, ... }: rec { +{ config, enableGUI, lib, pkgs, ... }: { home = { username = "rin"; homeDirectory = "/home/rin"; stateVersion = "21.05"; packages = with pkgs; [ appimage-run - brave - discord-canary - element-desktop - feh ffmpeg - gnome.file-roller - ghidra-bin - gimp gnupg - inkscape - kotatogram-desktop lf - lxappearance - maim mps-youtube neofetch nodejs-16_x pamixer - pavucontrol rnix-lsp - tor-browser-bundle-bin transcrypt - transmission-remote-gtk unrar - vlc wine-osu (winetricks.override { wine = wine-osu; }) - xclip - xorg.xgamma youtube-dl nodePackages_latest.pnpm + ] ++ lib.optionals enableGUI [ + brave + discord-canary + element-desktop + feh + gnome.file-roller + ghidra-bin + gimp + inkscape + kotatogram-desktop + lxappearance + maim + pavucontrol + tor-browser-bundle-bin + transmission-remote-gtk + vlc + xclip + xorg.xgamma ]; sessionVariables = { @@ -67,17 +68,18 @@ }; imports = [ + ./neovim.nix + ./npm.nix + ./zsh.nix + ] ++ lib.optionals enableGUI [ ./theming.nix ./xdg.nix # ./alacritty.nix ./kitty.nix ./mpv.nix - ./neovim.nix - ./npm.nix ./rofi.nix # ./urxvt.nix - ./zsh.nix ./dunst.nix ./picom.nix @@ -91,7 +93,7 @@ ]; programs = { - feh.enable = true; + feh.enable = enableGUI; direnv = { enable = true; @@ -123,7 +125,7 @@ clipmenu.enable = false; gpg-agent = { enable = true; - pinentryFlavor = "gnome3"; + pinentryFlavor = if enableGUI then "gnome3" else "tty"; }; };