diff --git a/common/default.nix b/common/default.nix index ae7347bd..e159da1a 100644 --- a/common/default.nix +++ b/common/default.nix @@ -1,10 +1,20 @@ -{ config, home-manager, lib, nixpkgs, nur, nix-melt, nurl, pkgs, ... }: { - +{ config +, home-manager +, lib +, nixpkgs +, nur +, nix-melt +, nurl +, pkgs +, ... +}: { imports = [ home-manager.nixosModules.default ./modules/programs.nix ./modules/locale.nix ./overlays + + ./hostvars.nix ]; nixpkgs.config.allowUnfree = true; @@ -38,6 +48,11 @@ ./modules/bash ./modules/git ./modules/neovim + + ./hostvars.nix + ({ osConfig, ... }: { + services.hostvars = osConfig.services.hostvars; + }) ]; home.packages = [ diff --git a/common/hostvars.nix b/common/hostvars.nix new file mode 100644 index 00000000..6eaa1c19 --- /dev/null +++ b/common/hostvars.nix @@ -0,0 +1,21 @@ +{ lib, ... }: { + options.services.hostvars = with lib; { + username = mkOption { + description = '' + Username that was defined at the initial setup process + ''; + type = types.nullOr types.str; + }; + + configDir = mkOption { + description = '' + The path to where most of the hosts' configs are in the .nix folder + ''; + type = types.nullOr types.str; + }; + + fontSize = mkOption { + type = types.nullOr types.float; + }; + }; +} diff --git a/hosts/binto/configuration.nix b/hosts/binto/configuration.nix index 4a6aec50..0cbfc640 100644 --- a/hosts/binto/configuration.nix +++ b/hosts/binto/configuration.nix @@ -10,6 +10,11 @@ ./modules/nix-gaming.nix ]; + services.hostvars = { + username = "matt"; + fontSize = 10; + }; + networking = { hostName = "binto"; networkmanager.enable = true; @@ -75,7 +80,6 @@ ../../modules/dconf.nix ../../modules/firefox ]; - programs.alacritty.settings.font.size = 10; home.stateVersion = "23.11"; }; diff --git a/hosts/wim/configuration.nix b/hosts/wim/configuration.nix index 84acd56b..6c39f4df 100644 --- a/hosts/wim/configuration.nix +++ b/hosts/wim/configuration.nix @@ -13,6 +13,12 @@ ./modules/security.nix ]; + services.hostvars = { + username = "matt"; + configDir = "/home/matt/.nix/hosts/wim/config"; + fontSize = 12.5; + }; + users.users.matt = { isNormalUser = true; extraGroups = [ "wheel" "input" "uinput" "adm" "mlocate" "video" "libvirtd" ]; diff --git a/hosts/wim/home/hyprland.nix b/hosts/wim/home/hyprland.nix index fd809d05..ad96c975 100644 --- a/hosts/wim/home/hyprland.nix +++ b/hosts/wim/home/hyprland.nix @@ -1,13 +1,12 @@ { pkgs, config, hyprland, hyprgrass, ags, nixpkgs-wayland, ... }: let waypkgs = nixpkgs-wayland.packages.x86_64-linux; - configDir = (import ../vars.nix).configDir; + configDir = config.services.hostvars.configDir; symlink = config.lib.file.mkOutOfStoreSymlink; gset = pkgs.gsettings-desktop-schemas; polkit = pkgs.plasma5Packages.polkit-kde-agent; -in -{ +in { imports = [ ags.homeManagerModules.default ]; diff --git a/hosts/wim/home/theme.nix b/hosts/wim/home/theme.nix index 67110a53..2db2cd73 100644 --- a/hosts/wim/home/theme.nix +++ b/hosts/wim/home/theme.nix @@ -1,5 +1,5 @@ -{ pkgs, lib, ... }: let - font-size = 12; +{ pkgs, lib, config, ... }: let + fontSize = config.services.hostvars.fontSize; dracula-xresources = pkgs.fetchFromGitHub { owner = "dracula"; repo = "xresources"; @@ -35,7 +35,7 @@ in font = { name = "Sans Serif"; - size = font-size; + size = fontSize; }; }; @@ -53,8 +53,8 @@ in xdg.configFile = let qtconf = '' [Fonts] - fixed="Sans Serif,${lib.strings.floatToString font-size},-1,5,50,0,0,0,0,0" - general="Sans Serif,${lib.strings.floatToString font-size},-1,5,50,0,0,0,0,0" + fixed="Sans Serif,${lib.strings.floatToString fontSize},-1,5,50,0,0,0,0,0" + general="Sans Serif,${lib.strings.floatToString fontSize},-1,5,50,0,0,0,0,0" [Appearance] icon_theme=Flat-Remix-Violet-Dark diff --git a/hosts/wim/modules/dotfiles.nix b/hosts/wim/modules/dotfiles.nix index dcca048f..37ceccf7 100644 --- a/hosts/wim/modules/dotfiles.nix +++ b/hosts/wim/modules/dotfiles.nix @@ -1,5 +1,5 @@ { config, pkgs, ... }: let - configDir = (import ../vars.nix).configDir; + configDir = config.services.hostvars.configDir; symlink = config.lib.file.mkOutOfStoreSymlink; in { diff --git a/hosts/wim/vars.nix b/hosts/wim/vars.nix deleted file mode 100644 index 627cd36a..00000000 --- a/hosts/wim/vars.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - configDir = "/home/matt/.nix/hosts/wim/config"; -} diff --git a/modules/alacritty.nix b/modules/alacritty.nix index 8438df21..00877c48 100644 --- a/modules/alacritty.nix +++ b/modules/alacritty.nix @@ -1,6 +1,6 @@ # Home-manager module -{ lib, ... }: { +{ lib, config, ... }: { programs.alacritty = { enable = true; settings = { @@ -38,7 +38,7 @@ family = "JetBrainsMono Nerd Font"; style = "Italic"; }; - size = lib.mkDefault 12.5; + size = config.services.hostvars.fontSize; }; # https://github.com/dracula/alacritty/blob/05faff15c0158712be87d200081633d9f4850a7d/dracula.yml