functional home assistant

This commit is contained in:
mjallen18
2025-07-18 14:50:13 -05:00
parent 407f8ede87
commit 91be65bc39
41 changed files with 337 additions and 304 deletions

View File

@@ -1,7 +1,7 @@
{ config, lib, namespace, ... }:
{ config, lib, ... }:
with lib;
let
cfg = config.${namespace}.desktop.extra.btop;
cfg = config.mjallen.desktop.extra.btop;
nord = import ../../theme/nord.nix;
in
{

View File

@@ -1,7 +1,7 @@
{ lib, namespace, ... }:
{ lib, ... }:
with lib;
{
options.${namespace}.desktop.extra.btop = {
options.mjallen.desktop.extra.btop = {
enable = mkEnableOption "enable btop";
};
}

View File

@@ -1,7 +1,7 @@
{ lib, config, namespace, ... }:
{ lib, config, ... }:
with lib;
let
cfg = config.${namespace}.desktop.extra.kitty;
cfg = config.mjallen.desktop.extra.kitty;
in
{
imports = [ ./options.nix ];

View File

@@ -1,7 +1,7 @@
{ lib, namespace, ... }:
{ lib, ... }:
with lib;
{
options.${namespace}.desktop.extra.kitty = {
options.mjallen.desktop.extra.kitty = {
enable = mkEnableOption "enable kitty terminal";
font = {

View File

@@ -1,7 +1,7 @@
{ config, lib, namespace, ... }:
{ config, lib, ... }:
with lib;
let
cfg = config.${namespace}.desktop.extra.mako;
cfg = config.mjallen.desktop.extra.mako;
nord = import ../../theme/nord.nix;
in
{

View File

@@ -1,7 +1,7 @@
{ lib, namespace, ... }:
{ lib, ... }:
with lib;
{
options.${namespace}.desktop.extra.mako = {
options.mjallen.desktop.extra.mako = {
enable = mkEnableOption "enable mako";
fontName = mkOption {

View File

@@ -1,7 +1,7 @@
{ config, lib, namespace, ... }:
{ config, lib, ... }:
with lib;
let
cfg = config.${namespace}.desktop.extra.nwg-dock;
cfg = config.mjallen.desktop.extra.nwg-dock;
nord = import ../../theme/nord.nix;
in
{

View File

@@ -1,7 +1,7 @@
{ lib, namespace, ... }:
{ lib, ... }:
with lib;
{
options.${namespace}.desktop.extra.nwg-dock = {
options.mjallen.desktop.extra.nwg-dock = {
enable = mkEnableOption "enable nwg-dock";
};
}

View File

@@ -1,7 +1,7 @@
{ config, lib, namespace, ... }:
{ config, lib, ... }:
with lib;
let
cfg = config.${namespace}.desktop.extra.nwg-drawer;
cfg = config.mjallen.desktop.extra.nwg-drawer;
nord = import ../../theme/nord.nix;
in
{

View File

@@ -1,7 +1,7 @@
{ lib, namespace, ... }:
{ lib, ... }:
with lib;
{
options.${namespace}.desktop.extra.nwg-drawer = {
options.mjallen.desktop.extra.nwg-drawer = {
enable = mkEnableOption "enable nwg-drawer";
};
}

View File

@@ -1,7 +1,7 @@
{ config, lib, namespace, ... }:
{ config, lib, ... }:
with lib;
let
cfg = config.${namespace}.desktop.extra.nwg-dock;
cfg = config.mjallen.desktop.extra.nwg-dock;
in
{
imports = [ ./options.nix ];

View File

@@ -1,7 +1,7 @@
{ lib, namespace, ... }:
{ lib, ... }:
with lib;
{
options.${namespace}.desktop.extra.nwg-panel = {
options.mjallen.desktop.extra.nwg-panel = {
enable = mkEnableOption "enable nwg-panel";
defaultApps = mkOption {

View File

@@ -1,7 +1,7 @@
{ config, lib, namespace, ... }:
{ config, lib, ... }:
with lib;
let
cfg = config.${namespace}.desktop.extra.waybar;
cfg = config.mjallen.desktop.extra.waybar;
nord = import ../../theme/nord.nix;
defaultOpacity = "opacity: 0.85;";
@@ -33,13 +33,13 @@ let
'';
in
{
imports = [ ./options.nix ];
imports = [
./options.nix
./scripts/hass.nix
./scripts/weather.nix
];
config = mkIf cfg.enable {
imports = [
./scripts/hass.nix
./scripts/weather.nix
];
# https://github.com/Alexays/Waybar/wiki/Module:-Hyprland
# https://www.nerdfonts.com/cheat-sheet

View File

@@ -1,7 +1,7 @@
{ lib, namespace, ... }:
{ lib, ... }:
with lib;
{
options.${namespace}.desktop.extra.waybar = {
options.mjallen.desktop.extra.waybar = {
enable = mkEnableOption "enable waybar";
layer = mkOption {

View File

@@ -1,43 +1,10 @@
{ pkgs, ... }:
{ config, lib, namespace, ... }:
with lib;
let
homeassistant-api = pkgs.python3.pkgs.buildPythonPackage rec {
pname = "homeassistant_api";
version = "5.0.0";
format = "pyproject";
src = pkgs.fetchPypi {
inherit pname version;
sha256 = "sha256-UNKTtgInrVJtjHb1WVlUbcbhjBOtTX00eHmm54ww0rY=";
};
# do not run tests
doCheck = false;
nativeBuildInputs = with pkgs.python3.pkgs; [ poetry-core requests-cache ];
dependencies = with pkgs.python3.pkgs; [
requests-cache
pydantic
websockets
];
propagatedBuildInputs = with pkgs.python3.pkgs; [
aiohttp
aiohttp-client-cache
pydantic
requests
requests-cache
simplejson
websockets
];
pythonRelaxDeps = [
"requests-cache"
"pydantic"
"websockets"
];
pythonImportsCheck = [
"homeassistant_api"
];
};
cfg = config.mjallen.desktop.extra.waybar;
pythonEnv = pkgs.python3.withPackages (ps: [
homeassistant-api
pkgs.${namespace}.homeassistant-api
]);
waybar-hass = pkgs.writeScriptBin "waybar-hass" ''
@@ -102,5 +69,9 @@ let
'';
in
{
home.packages = [ waybar-hass ];
imports = [ ../options.nix ];
config = lib.mkIf cfg.enable {
home.packages = [ waybar-hass ];
};
}

View File

@@ -1,5 +1,8 @@
{ pkgs, ... }:
{ config, lib, namespace, ... }:
with lib;
let
cfg = config.mjallen.desktop.extra.waybar;
waybar-weather = pkgs.writeScriptBin "waybar-weather" ''
#!/usr/bin/env nix-shell
#! nix-shell -i python3 --pure
@@ -429,5 +432,9 @@ let
'';
in
{
home.packages = [ waybar-weather ];
imports = [ ../options.nix ];
config = lib.mkIf cfg.enable {
home.packages = [ waybar-weather ];
};
}

View File

@@ -1,7 +1,7 @@
{ config, lib, namespace, ... }:
{ config, lib, ... }:
with lib;
let
cfg = config.${namespace}.desktop.extra.wlogout;
cfg = config.mjallen.desktop.extra.wlogout;
nord = import ../../theme/nord.nix;
in
{

View File

@@ -1,8 +1,8 @@
{ lib, namespace, ... }:
{ lib, ... }:
with lib;
{
options.${namespace}.desktop.extra.wofi = {
enable = mkEnableOption "enable wofi";
options.mjallen.desktop.extra.wlogout = {
enable = mkEnableOption "enable wlogout";
fontName = mkOption {
type = types.str;

View File

@@ -1,11 +1,12 @@
{ config, lib, namespace, ... }:
{ config, lib, ... }:
with lib;
let
cfg = config.${namespace}.desktop.extra.wofi;
cfg = config.mjallen.desktop.extra.wofi;
nord = import ../../theme/nord.nix;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {
programs.wofi = {
enable = true;

View File

@@ -1,7 +1,7 @@
{ lib, namespace, ... }:
{ lib, ... }:
with lib;
{
options.${namespace}.desktop.extra.wofi = {
options.mjallen.desktop.extra.wofi = {
enable = mkEnableOption "enable wofi";
fontName = mkOption {

View File

@@ -1,6 +1,6 @@
{ config, lib, pkgs, namespace, ... }:
{ config, lib, pkgs, ... }:
let
cfg = config.${namespace}.desktop.gnome;
cfg = config.mjallen.desktop.gnome;
in
{
imports = [ ./options.nix ];

View File

@@ -1,7 +1,7 @@
{ lib, namespace, ... }:
{ lib, ... }:
with lib;
{
options.${namespace}.desktop.gnome = {
options.mjallen.desktop.gnome = {
enable = mkEnableOption "enable gnome settings";
};
}

View File

@@ -1,21 +1,18 @@
{ config, lib, namespace, pkgs, ... }:
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.${namespace}.desktop.hyprland;
cfg = config.mjallen.desktop.hyprland;
drawer = "nwg-drawer -fm nautilus -term kitty -mb 10 -mt 10 -ml 10 -mr 10 -pbuseicontheme -i ${config.home-manager.users.matt.gtk.iconTheme.name}";
in
{
imports = [ ./options.nix ];
imports = [
./options.nix
./packages.nix
./theme.nix
./variables.nix
];
config = mkIf cfg.enable {
imports = [
./services/hypridle
./services/hyprlock
./services/hyprpaper
./packages.nix
./theme.nix
./variables.nix
];
services = {
hyprpolkitagent.enable = true;

View File

@@ -1,7 +1,7 @@
{ lib, namespace, ... }:
{ lib, pkgs, ... }:
with lib;
{
options.${namespace}.desktop.hyprland = {
options.mjallen.desktop.hyprland = {
enable = mkEnableOption "enable hyprland desktop";
primaryDisplay = mkOption {
@@ -45,8 +45,19 @@ with lib;
};
defaultApps = mkOption {
type = attrs;
default = { };
type = types.submodule {
options = {
browser = mkOption { type = types.package; default = pkgs.firefox; };
editor = mkOption { type = types.package; default = pkgs.micro; };
fileExplorer = mkOption { type = types.package; default = pkgs.nemo; };
visual = mkOption { type = types.package; default = pkgs.vscodium; };
terminal = mkOption { type = types.package; default = pkgs.kitty; };
office = mkOption { type = types.package; default = pkgs.onlyoffice-bin_latest; };
video = mkOption { type = types.package; default = pkgs.vlc; };
imageViewer = mkOption { type = types.package; default = pkgs.gnome-photos; };
};
};
description = "Default applications used across the system.";
};
hyprIdle = {

View File

@@ -1,60 +1,66 @@
{ pkgs, ... }:
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.mjallen.desktop.hyprland;
in
{
home.packages = with pkgs; [
box64
brightnessctl
ddcutil
dunst
egl-wayland
file-roller
glib
gnome-calculator
gnome-calendar
gnome-disk-utility
gnome-firmware
gnome-firmware-updater
gnome-font-viewer
gnome-logs
gnome-photos
gnome-tweaks
gnome-weather
gsettings-desktop-schemas
hyprcursor
hyprland
hyprpaper
hyprshot
hyprsysteminfo
kdePackages.qtmultimedia
libnotify
libz
mako
meson
nautilus
networkmanagerapplet
nm-tray
nwg-look
overskride
pamixer
pavucontrol
playerctl
polkit
polkit_gnome
qt5.qtwayland
qt6.qtwayland
rofi-wayland
waybar
wayland-protocols
wayland-utils
waypaper
wev
wl-clipboard
wlogout
wlroots
xdg-desktop-portal-hyprland
xdg-desktop-portal-gtk
xdg-desktop-portal-wlr
xorg.xhost
xsettingsd
xwayland
];
config = mkIf cfg.enable {
home.packages = with pkgs; [
box64
brightnessctl
ddcutil
dunst
egl-wayland
file-roller
glib
gnome-calculator
gnome-calendar
gnome-disk-utility
gnome-firmware
gnome-firmware-updater
gnome-font-viewer
gnome-logs
gnome-photos
gnome-tweaks
gnome-weather
gsettings-desktop-schemas
hyprcursor
hyprland
hyprpaper
hyprshot
hyprsysteminfo
kdePackages.qtmultimedia
libnotify
libz
mako
meson
nautilus
networkmanagerapplet
nm-tray
nwg-look
overskride
pamixer
pavucontrol
playerctl
polkit
polkit_gnome
qt5.qtwayland
qt6.qtwayland
rofi-wayland
waybar
wayland-protocols
wayland-utils
waypaper
wev
wl-clipboard
wlogout
wlroots
xdg-desktop-portal-hyprland
xdg-desktop-portal-gtk
xdg-desktop-portal-wlr
xorg.xhost
xsettingsd
xwayland
];
};
}

View File

@@ -1,5 +1,8 @@
{ pkgs, ... }:
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.mjallen.desktop.hyprland;
themeSize = "compact"; # [ "standard" "compact" ]
themeAccent = "all"; # [ "default" "purple" "pink" "red" "orange" "yellow" "green" "teal" "grey" "all" ]
themeVariant = "nord"; # [ "nord" "dracula" "gruvbox" "everforest" "catppuccin" "all" "black" "rimless" "normal" "float" ]
@@ -39,55 +42,57 @@ let
fontSize = 12;
in
{
home = {
pointerCursor = {
gtk.enable = true;
package = cursorThemePkg;
name = cursorTheme;
size = cursorSize;
};
};
dconf = {
enable = true;
settings = {
"org/gnome/desktop/interface".color-scheme = "prefer-dark";
"org/gnome/desktop/interface".cursor-theme = cursorTheme;
"org/gnome/desktop/interface".gtk-theme = gtkTheme;
"org/gnome/desktop/interface".icon-theme = iconTheme;
};
};
gtk = {
enable = true;
cursorTheme = {
name = cursorTheme;
package = cursorThemePkg;
config = mkIf cfg.enable {
home = {
pointerCursor = {
gtk.enable = true;
package = cursorThemePkg;
name = cursorTheme;
size = cursorSize;
};
};
theme = {
name = gtkTheme;
package = gtkThemePkg;
dconf = {
enable = true;
settings = {
"org/gnome/desktop/interface".color-scheme = "prefer-dark";
"org/gnome/desktop/interface".cursor-theme = cursorTheme;
"org/gnome/desktop/interface".gtk-theme = gtkTheme;
"org/gnome/desktop/interface".icon-theme = iconTheme;
};
};
iconTheme = {
name = iconTheme;
package = iconThemePkg;
};
gtk = {
enable = true;
gtk3.extraConfig = {
gtk-application-prefer-dark-theme = true;
};
cursorTheme = {
name = cursorTheme;
package = cursorThemePkg;
};
gtk4.extraConfig = {
gtk-application-prefer-dark-theme = true;
};
theme = {
name = gtkTheme;
package = gtkThemePkg;
};
font = {
name = fontName;
package = fontPackage;
size = fontSize;
iconTheme = {
name = iconTheme;
package = iconThemePkg;
};
gtk3.extraConfig = {
gtk-application-prefer-dark-theme = true;
};
gtk4.extraConfig = {
gtk-application-prefer-dark-theme = true;
};
font = {
name = fontName;
package = fontPackage;
size = fontSize;
};
};
};
}

View File

@@ -1,37 +1,39 @@
{ config, lib, ... }:
with lib;
let
cfg = config.desktop.hyprland;
cfg = config.mjallen.desktop.hyprland;
in
{
sessionVariables = {
BROWSER = "${cfg.defaultApps.browser.pname}";
CLUTTER_BACKEND = "wayland";
EDITOR = "${cfg.defaultApps.editor.pname}";
VISUAL = "${cfg.defaultApps.visual.pname}";
ICON_THEME = settings.iconTheme;
GTK_CSD = "0";
GTK_THEME = settings.gtkTheme;
GTK_USE_PORTAL = "1";
HYPRCURSOR_THEME = config.home-manager.users.matt.pointerCursor.name;
HYPRCURSOR_SIZE = config.home-manager.users.matt.pointerCursor.size;
MOZ_ENABLE_WAYLAND = "1";
NIXOS_OZONE_WL = "1";
NIXOS_XDG_OPEN_USE_PORTAL = "1";
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
QT_QPA_PLATFORM = "wayland-egl";
QT_QPA_PLATFORMTHEME = "gtk3";
QT_SCALE_FACTOR = "1";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
SDL_VIDEODRIVER = "wayland";
TERMINAL = "${cfg.defaultApps.terminal.pname}";
XCURSOR_THEME = config.home-manager.users.matt.pointerCursor.name;
XCURSOR_SIZE = config.home-manager.users.matt.pointerCursor.size;
XDG_CACHE_HOME = "\${HOME}/.cache";
XDG_CONFIG_HOME = "\${HOME}/.config";
XDG_CURRENT_DESKTOP = "Hyprland";
XDG_DATA_HOME = "\${HOME}/.local/share";
XDG_SESSION_DESKTOP = "Hyprland";
XDG_SESSION_TYPE = "wayland";
config = mkIf cfg.enable {
home.sessionVariables = {
BROWSER = "${cfg.defaultApps.browser.pname}";
CLUTTER_BACKEND = "wayland";
EDITOR = "${cfg.defaultApps.editor.pname}";
VISUAL = "${cfg.defaultApps.visual.pname}";
ICON_THEME = settings.iconTheme;
GTK_CSD = "0";
GTK_THEME = settings.gtkTheme;
GTK_USE_PORTAL = "1";
HYPRCURSOR_THEME = config.home-manager.users.matt.pointerCursor.name;
HYPRCURSOR_SIZE = config.home-manager.users.matt.pointerCursor.size;
MOZ_ENABLE_WAYLAND = "1";
NIXOS_OZONE_WL = "1";
NIXOS_XDG_OPEN_USE_PORTAL = "1";
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
QT_QPA_PLATFORM = "wayland-egl";
QT_QPA_PLATFORMTHEME = "gtk3";
QT_SCALE_FACTOR = "1";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
SDL_VIDEODRIVER = "wayland";
TERMINAL = "${cfg.defaultApps.terminal.pname}";
XCURSOR_THEME = config.home-manager.users.matt.pointerCursor.name;
XCURSOR_SIZE = config.home-manager.users.matt.pointerCursor.size;
XDG_CACHE_HOME = "\${HOME}/.cache";
XDG_CONFIG_HOME = "\${HOME}/.config";
XDG_CURRENT_DESKTOP = "Hyprland";
XDG_DATA_HOME = "\${HOME}/.local/share";
XDG_SESSION_DESKTOP = "Hyprland";
XDG_SESSION_TYPE = "wayland";
};
};
}