refactor: get rid of useless global vars
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-11-18 12:30:54 -05:00
parent 2d39d81560
commit 155a9884ee
16 changed files with 25 additions and 50 deletions

View file

@ -1,5 +1,6 @@
{ {
config, config,
osConfig,
pkgs, pkgs,
lib, lib,
nixd, nixd,
@ -7,7 +8,8 @@
... ...
}: let }: let
inherit (lib) getExe hasPrefix mkIf removePrefix; inherit (lib) getExe hasPrefix mkIf removePrefix;
inherit (config.vars) hostName mainUser neovimIde; inherit (config.vars) mainUser neovimIde;
inherit (osConfig.networking) hostName;
defaultFormatter = self.formatter.${pkgs.system}; defaultFormatter = self.formatter.${pkgs.system};

View file

@ -4,7 +4,6 @@
... ...
}: let }: let
inherit (lib) mkDefault mkOption types; inherit (lib) mkDefault mkOption types;
flakeDir = config.environment.variables.FLAKE;
cfg = config.vars; cfg = config.vars;
in { in {
options.vars = { options.vars = {
@ -15,13 +14,6 @@ in {
''; '';
}; };
hostName = mkOption {
type = types.str;
description = ''
Hostname that was defined at the initial setup process
'';
};
promptMainColor = mkOption { promptMainColor = mkOption {
type = types.enum (import ./prompt-schemes.nix {}); type = types.enum (import ./prompt-schemes.nix {});
default = "purple"; default = "purple";
@ -48,14 +40,6 @@ in {
}; };
}; };
configDir = mkOption {
type = types.str;
default = "${flakeDir}/devices/${cfg.hostName}/config";
description = ''
The path to where most of the devices' configs are in the .nix folder
'';
};
neovimIde = mkOption { neovimIde = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;

View file

@ -24,7 +24,6 @@ In every device's `default.nix`, you'll find these [settings](https://git.nelim.
vars = { vars = {
mainUser = "matt"; mainUser = "matt";
hostName = "wim";
... ...
}; };
``` ```

View file

@ -6,7 +6,6 @@
}: { }: {
vars = { vars = {
mainUser = "nix-on-droid"; mainUser = "nix-on-droid";
hostName = "localhost";
neovimIde = false; neovimIde = false;
}; };

View file

@ -3,7 +3,7 @@
self, self,
... ...
}: let }: let
inherit (config.vars) mainUser hostName; inherit (config.vars) mainUser;
in { in {
# ------------------------------------------------ # ------------------------------------------------
# Imports # Imports
@ -26,7 +26,6 @@ in {
# ------------------------------------------------ # ------------------------------------------------
vars = { vars = {
mainUser = "mariah"; mainUser = "mariah";
hostName = "bbsteamie";
promptMainColor = "pink"; promptMainColor = "pink";
}; };
@ -39,7 +38,7 @@ in {
}; };
networking = { networking = {
inherit hostName; hostName = "bbsteamie";
networkmanager.enable = true; networkmanager.enable = true;
}; };

View file

@ -3,7 +3,7 @@
self, self,
... ...
}: let }: let
inherit (config.vars) mainUser hostName; inherit (config.vars) mainUser;
in { in {
# ------------------------------------------------ # ------------------------------------------------
# Imports # Imports
@ -31,7 +31,6 @@ in {
# ------------------------------------------------ # ------------------------------------------------
vars = { vars = {
mainUser = "matt"; mainUser = "matt";
hostName = "binto";
promptMainColor = "purple"; promptMainColor = "purple";
}; };
@ -48,7 +47,7 @@ in {
}; };
networking = { networking = {
inherit hostName; hostName = "binto";
networkmanager.enable = true; networkmanager.enable = true;
firewall.enable = false; firewall.enable = false;
}; };

View file

@ -3,7 +3,7 @@ deviceName: {
self, self,
... ...
}: let }: let
inherit (config.vars) mainUser hostName; inherit (config.vars) mainUser;
clusterIP = config.services.pcsd.virtualIps.caddy-vip.ip; clusterIP = config.services.pcsd.virtualIps.caddy-vip.ip;
in { in {
@ -27,7 +27,6 @@ in {
# ------------------------------------------------ # ------------------------------------------------
vars = { vars = {
mainUser = "matt"; mainUser = "matt";
hostName = deviceName;
promptMainColor = promptMainColor =
if deviceName == "thingone" if deviceName == "thingone"
then "green" then "green"
@ -45,7 +44,7 @@ in {
}; };
networking = { networking = {
inherit hostName; hostName = deviceName;
resolvconf.enable = true; resolvconf.enable = true;
nameservers = [ nameservers = [
clusterIP clusterIP

View file

@ -4,8 +4,9 @@
config, config,
... ...
}: let }: let
inherit (config.vars) hostName mainUser;
inherit (config.sops) secrets; inherit (config.sops) secrets;
inherit (config.vars) mainUser;
inherit (config.networking) hostName;
caddy = caddy-plugins.packages.${pkgs.system}.default; caddy = caddy-plugins.packages.${pkgs.system}.default;
in { in {

View file

@ -1,5 +1,6 @@
{config, ...}: let {config, ...}: let
inherit (config.vars) mainUser hostName; inherit (config.vars) mainUser;
inherit (config.networking) hostName;
clusterIP = config.services.pcsd.virtualIps.caddy-vip.ip; clusterIP = config.services.pcsd.virtualIps.caddy-vip.ip;
in { in {

View file

@ -11,7 +11,8 @@
else b)) {} else b)) {}
list; list;
inherit (config.vars) mainUser hostName; inherit (config.vars) mainUser;
inherit (config.networking) hostName;
serviviIP = "100.64.0.7"; serviviIP = "100.64.0.7";
caddyIp = caddyIp =

View file

@ -3,7 +3,7 @@
self, self,
... ...
}: let }: let
inherit (config.vars) mainUser hostName; inherit (config.vars) mainUser;
in { in {
# ------------------------------------------------ # ------------------------------------------------
# Imports # Imports
@ -26,7 +26,6 @@ in {
# ------------------------------------------------ # ------------------------------------------------
vars = { vars = {
mainUser = "matt"; mainUser = "matt";
hostName = "homie";
promptMainColor = "yellow"; promptMainColor = "yellow";
}; };
@ -39,7 +38,7 @@ in {
}; };
networking = { networking = {
inherit hostName; hostName = "homie";
resolvconf.enable = true; resolvconf.enable = true;
firewall.enable = false; firewall.enable = false;
}; };

View file

@ -3,7 +3,7 @@
self, self,
... ...
}: let }: let
inherit (config.vars) mainUser hostName; inherit (config.vars) mainUser;
in { in {
# ------------------------------------------------ # ------------------------------------------------
# Imports # Imports
@ -26,7 +26,6 @@ in {
# ------------------------------------------------ # ------------------------------------------------
vars = { vars = {
mainUser = "matt"; mainUser = "matt";
hostName = "nos";
promptMainColor = "orange"; promptMainColor = "orange";
}; };
@ -40,7 +39,7 @@ in {
}; };
networking = { networking = {
inherit hostName; hostName = "nos";
resolvconf.enable = true; resolvconf.enable = true;
firewall.enable = false; firewall.enable = false;
}; };

View file

@ -3,7 +3,7 @@
self, self,
... ...
}: let }: let
inherit (config.vars) mainUser hostName; inherit (config.vars) mainUser;
in { in {
# ------------------------------------------------ # ------------------------------------------------
# Imports # Imports
@ -26,7 +26,6 @@ in {
# ------------------------------------------------ # ------------------------------------------------
vars = { vars = {
mainUser = "matt"; mainUser = "matt";
hostName = "servivi";
promptMainColor = "blue"; promptMainColor = "blue";
}; };
@ -53,7 +52,7 @@ in {
}; };
networking = { networking = {
inherit hostName; hostName = "servivi";
resolvconf.enable = true; resolvconf.enable = true;
firewall.enable = false; firewall.enable = false;
}; };

View file

@ -4,7 +4,7 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (config.vars) mainUser hostName; inherit (config.vars) mainUser;
in { in {
# ------------------------------------------------ # ------------------------------------------------
# Imports # Imports
@ -34,7 +34,6 @@ in {
# ------------------------------------------------ # ------------------------------------------------
vars = { vars = {
mainUser = "matt"; mainUser = "matt";
hostName = "wim";
promptMainColor = "purple"; promptMainColor = "purple";
}; };
@ -51,7 +50,7 @@ in {
}; };
networking = { networking = {
inherit hostName; hostName = "wim";
networkmanager = { networkmanager = {
enable = true; enable = true;

View file

@ -9,7 +9,7 @@
inherit (lib.attrsets) attrValues hasAttr listToAttrs mapAttrs removeAttrs; inherit (lib.attrsets) attrValues hasAttr listToAttrs mapAttrs removeAttrs;
inherit (config.sops) secrets; inherit (config.sops) secrets;
inherit (config.vars) hostName; inherit (config.networking) hostName;
cfg = config.services.borgbackup; cfg = config.services.borgbackup;
in { in {

View file

@ -120,12 +120,7 @@
live-image = mkNixOS { live-image = mkNixOS {
extraModules = [ extraModules = [
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix" "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
{ {vars.mainUser = "nixos";}
vars = {
mainUser = "nixos";
hostName = "nixos";
};
}
]; ];
}; };
}; };