feat: add global variables for nix configs

This commit is contained in:
matt1432 2023-10-18 13:50:00 -04:00
parent 32e2e974ca
commit e946124478
9 changed files with 59 additions and 17 deletions

View file

@ -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 = [

21
common/hostvars.nix Normal file
View file

@ -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;
};
};
}

View file

@ -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";
};

View file

@ -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" ];

View file

@ -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
];

View file

@ -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

View file

@ -1,5 +1,5 @@
{ config, pkgs, ... }: let
configDir = (import ../vars.nix).configDir;
configDir = config.services.hostvars.configDir;
symlink = config.lib.file.mkOutOfStoreSymlink;
in
{

View file

@ -1,3 +0,0 @@
{
configDir = "/home/matt/.nix/hosts/wim/config";
}

View file

@ -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