feat(nix): Move all the gui stuff behind a bool

This commit is contained in:
uttarayan21
2024-04-04 21:51:27 +05:30
parent ae43c82e5c
commit 03a24ae5e6
13 changed files with 75 additions and 43 deletions

View File

@@ -4,7 +4,7 @@
... ...
}: { }: {
programs.firefox = { programs.firefox = {
enable = device.isLinux; enable = device.hasGui;
profiles.default = { profiles.default = {
userChrome = let userChrome = let
# TODO: Move to subflake # TODO: Move to subflake

33
common/gui.nix Normal file
View File

@@ -0,0 +1,33 @@
{
pkgs,
device,
lib,
...
}:
lib.attrsets.optionalAttrs device.hasGui {
home.packages = with pkgs;
[]
++ lib.optionals device.isLinux [
ferdium
psst
sony-headphones-client
abaddon
catppuccinThemes.gtk
catppuccinThemes.papirus-folders
gnome.seahorse
gnome.nautilus
nextcloud-client
gparted
polkit_gnome
mullvad-vpn
mullvad-closest
mullvad-browser
steam-run
webcord-vencord
spotify
wl-clipboard
];
}

View File

@@ -35,13 +35,15 @@ in {
imports = imports =
[ [
inputs.nix-index-database.hmModules.nix-index inputs.nix-index-database.hmModules.nix-index
./tmux.nix
./wezterm.nix ./wezterm.nix
./kitty.nix
./gui.nix
./tmux.nix
./nvim.nix ./nvim.nix
./goread.nix ./goread.nix
./ncmpcpp.nix ./ncmpcpp.nix
./zellij.nix ./zellij.nix
./kitty.nix
../modules ../modules
] ]
++ lib.optionals device.isLinux [../linux]; ++ lib.optionals device.isLinux [../linux];
@@ -95,32 +97,14 @@ in {
(pkgs.mpv-unwrapped.override {sixelSupport = true;}) {}) (pkgs.mpv-unwrapped.override {sixelSupport = true;}) {})
] ]
++ lib.optionals device.isLinux [ ++ lib.optionals device.isLinux [
ferdium
psst
sony-headphones-client
abaddon
rr rr
catppuccinThemes.gtk
catppuccinThemes.papirus-folders
gnome.seahorse
gnome.nautilus
nextcloud-client
sbctl sbctl
gparted
gptfdisk gptfdisk
polkit_gnome
dig dig
mullvad-vpn
mullvad-closest
mullvad-browser
steam-run
usbutils usbutils
handlr-regex handlr-regex
handlr-xdg handlr-xdg
webcord-vencord
spotify
lsof lsof
wl-clipboard
ncpamixer ncpamixer
] ]
++ lib.optionals device.isMac []; ++ lib.optionals device.isMac [];

View File

@@ -1,6 +1,10 @@
{pkgs, ...}: { {
pkgs,
device,
...
}: {
programs.kitty = { programs.kitty = {
enable = true; enable = device.hasGui;
font = { font = {
name = "Hasklug Nerd Font Mono"; name = "Hasklug Nerd Font Mono";
size = 13; size = 13;

View File

@@ -1,6 +1,10 @@
{pkgs, ...}: { {
pkgs,
device,
...
}: {
programs.wezterm = { programs.wezterm = {
enable = true; enable = device.hasGui;
extraConfig = extraConfig =
/* /*
lua lua

View File

@@ -102,6 +102,7 @@
name = "genzai"; name = "genzai";
system = "x86_64-linux"; system = "x86_64-linux";
user = "fs0c131y"; user = "fs0c131y";
hasGui = false; # Don't wan't to run GUI apps on a headless server
} }
{ {
name = "Uttarayans-MacBook-Pro"; name = "Uttarayans-MacBook-Pro";
@@ -112,11 +113,13 @@
name = "Serviuss-iMac-Pro"; name = "Serviuss-iMac-Pro";
system = "x86_64-darwin"; system = "x86_64-darwin";
user = "servius"; user = "servius";
hasGui = false; # It's a vm so no GUI apps are used
} }
{ {
name = "SteamDeck"; name = "SteamDeck";
system = "x86_64-linux"; system = "x86_64-linux";
user = "deck"; user = "deck";
hasGui = false; # Don't wan't to run GUI apps on the SteamDeck
} }
]; ];
@@ -127,6 +130,10 @@
then device.isNix then device.isNix
else false; else false;
isMac = !isNull (builtins.match ".*-darwin" device.system); isMac = !isNull (builtins.match ".*-darwin" device.system);
hasGui =
if (builtins.hasAttr "hasGui" device)
then device.hasGui
else true;
system = device.system; system = device.system;
name = device.name; name = device.name;
user = device.user; user = device.user;

View File

@@ -7,7 +7,7 @@
}: { }: {
imports = [inputs.anyrun.nixosModules.home-manager]; imports = [inputs.anyrun.nixosModules.home-manager];
programs.anyrun = { programs.anyrun = {
enable = true; enable = device.hasGui;
config = { config = {
plugins = with inputs.anyrun.packages.${pkgs.system}; [ plugins = with inputs.anyrun.packages.${pkgs.system}; [
inputs.anyrun-nixos-options.packages.${pkgs.system}.default inputs.anyrun-nixos-options.packages.${pkgs.system}.default

View File

@@ -1,8 +1,6 @@
{ {
pkgs, pkgs,
device, device,
nur,
inputs,
... ...
}: { }: {
imports = [ imports = [
@@ -15,11 +13,11 @@
../linux/mpd.nix ../linux/mpd.nix
]; ];
services.kdeconnect.enable = true; services.kdeconnect.enable = device.hasGui;
services.kdeconnect.indicator = true; services.kdeconnect.indicator = device.hasGui;
services.swayosd.enable = true; services.swayosd.enable = device.hasGui;
services.nextcloud-client = { services.nextcloud-client = {
enable = true; enable = device.hasGui;
startInBackground = true; startInBackground = true;
}; };

View File

@@ -1,6 +1,10 @@
{pkgs, ...}: { {
pkgs,
device,
...
}: {
programs.foot = { programs.foot = {
enable = pkgs.stdenv.isLinux; enable = device.hasGui;
server.enable = true; server.enable = true;
settings = { settings = {
main = { main = {

View File

@@ -1,6 +1,6 @@
{pkgs, ...}: { {pkgs, device, ...}: {
gtk = { gtk = {
enable = true; enable = device.hasGui;
theme = { theme = {
name = "Catppuccin-Mocha-Standard-Mauve-Dark"; name = "Catppuccin-Mocha-Standard-Mauve-Dark";
package = pkgs.catppuccin-gtk.override { package = pkgs.catppuccin-gtk.override {

View File

@@ -1,6 +1,7 @@
{ {
pkgs, pkgs,
inputs, inputs,
device,
... ...
}: { }: {
imports = [../modules/hyprpaper.nix inputs.hyprlock.homeManagerModules.hyprlock]; imports = [../modules/hyprpaper.nix inputs.hyprlock.homeManagerModules.hyprlock];
@@ -8,7 +9,7 @@
programs.hyprpaper = let programs.hyprpaper = let
wallpapers = import ../utils/wallhaven.nix {inherit pkgs;}; wallpapers = import ../utils/wallhaven.nix {inherit pkgs;};
in { in {
enable = true; enable = device.hasGui;
systemd.enable = true; systemd.enable = true;
systemd.target = "hyprland-session.target"; systemd.target = "hyprland-session.target";
settings.preload = wallpapers.all; settings.preload = wallpapers.all;

View File

@@ -1,11 +1,12 @@
{ {
inputs, inputs,
pkgs, pkgs,
device,
... ...
}: { }: {
imports = [inputs.ironbar.homeManagerModules.default]; imports = [inputs.ironbar.homeManagerModules.default];
programs.ironbar = { programs.ironbar = {
enable = true; enable = device.hasGui;
config.monitors = { config.monitors = {
DP-1 = { DP-1 = {
position = "bottom"; position = "bottom";

View File

@@ -1,8 +1,4 @@
{ {...}: {
# pkgs,
# config,
...
}: {
services.mpd = { services.mpd = {
enable = true; enable = true;
}; };