feat(nix): add graphical module, pass option to nixosSystem

This commit is contained in:
Mohammad Rafiq 2025-07-07 22:19:38 +08:00
parent c2bae8cd85
commit df06e092d6
No known key found for this signature in database
5 changed files with 73 additions and 29 deletions

View file

@ -22,7 +22,10 @@ let
name: value:
if class == "nixos" then
nixosSystem {
specialArgs.hostName = name;
specialArgs = {
inherit (value) graphical;
hostName = name;
};
modules = [
cfg.modules.nixos.default
inputs.home-manager.nixosModules.home-manager

View file

@ -5,7 +5,7 @@
"stremio-server"
];
flake.homes.rafiq =
{ osConfig, pkgs, ... }:
{ pkgs, config, ... }:
let
inherit (lib.modules) mkMerge mkIf;
inherit (builtins) map listToAttrs;
@ -25,7 +25,6 @@
profileCfg = id: {
inherit id;
settings."extensions.autoDisableScopes" = 0; # Auto enable extensions
#TODO: add default seach unduck and add rest of extensions
extensions = {
force = true;
packages = with firefox-addons; [
@ -37,7 +36,7 @@
};
};
in
mkIf osConfig.desktop.enable {
mkIf config.graphical {
persistDirs = [
"docs"
"repos"
@ -46,9 +45,15 @@
".cache/Smart Code ltd/Stremio"
".local/share/Smart Code ltd/Stremio"
".mozilla/firefox"
".tor project"
];
home = {
packages = with pkgs; [ stremio ];
packages = with pkgs; [
stremio
tor-browser
vlc
wl-clipboard-rs
];
sessionVariables = {
BROWSER = "firefox";
LAUNCHER = "fuzzel";
@ -58,8 +63,8 @@
STATUS_BAR = "waybar";
};
};
# TODO: add gamescope here or in nixos desktop module
programs = {
fuzzel.enable = true;
obs-studio.enable = true;
vesktop.enable = true;
thunderbird.enable = true;
@ -105,7 +110,6 @@
enable = true;
settings = [
{
#TODO: review the rest of the modules to see what else can be added
layer = "top";
modules-left = [
"pulseaudio"
@ -149,12 +153,24 @@
}
'';
};
};
services = {
mako.enable = true;
mako.settings.default-timeout = 10000;
};
wayland.windowManager.hyprland.settings = mkMerge [
wayland.windowManager.hyprland = {
enable = true;
# This is needed for UWSM
systemd.enable = false;
# Null the packages since we use them system wide
package = null;
portalPackage = null;
# settings.monitor = [
# "${mainMonitor.id}, ${mainMonitor.resolution}@${mainMonitor.refresh-rate}, auto, ${mainMonitor.scale}"
# ];
settings = mkMerge [
(import ./_hyprland/decoration.nix)
(import ./_hyprland/keybinds.nix { inherit pkgs; })
{
@ -169,4 +185,16 @@
}
];
};
# xdg.configFile."uwsm/env".text = # sh
# ''
# # Force apps to scale right with Wayland
# export GDK_SCALE=${mainMonitor.scale}
# export STEAM_FORCE_DESKTOPUI_SCALING=${mainMonitor.scale}
# '';
# xdg.configFile."uwsm/env-hyprland".text = # sh
# ''
# export GDK_SCALE=${mainMonitor.scale}
# export STEAM_FORCE_DESKTOPUI_SCALING=${mainMonitor.scale}
# '';
};
}

View file

@ -9,6 +9,7 @@
};
hosts.nixos = {
nemesis = {
graphical = true;
machine = {
platform = "amd";
gpu = "nvidia";
@ -22,9 +23,9 @@
}
];
};
extraCfg.desktop.enable = true;
};
apollo = {
graphical = false;
machine = {
platform = "intel";
root.drive = "/dev/disk/by-id/nvme-eui.002538d221b47b01";

View file

@ -1,7 +0,0 @@
{ lib, ... }:
let
inherit (lib.options) mkEnableOption;
in
{
flake.modules.nixos.default.options.desktop.enable = mkEnableOption "";
}

View file

@ -0,0 +1,19 @@
{ lib, ... }:
let
inherit (lib.modules) mkIf;
inherit (lib.options) mkEnableOption;
in
{
flake.modules.nixos.default =
{ graphical, ... }:
{
config = mkIf graphical {
home-manager.sharedModules = [ { graphical = true; } ];
services.pipewire = {
enable = true;
pulse.enable = true;
};
};
};
flake.modules.homeManager.default.options.graphical = mkEnableOption "";
}