diff --git a/modules/default.nix b/modules/default.nix index eecd825..a7c1dc4 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,3 +1,7 @@ { - imports = [./theme]; + imports = [ + ./systemVars.nix + ./homeVars.nix + ./theme + ]; } diff --git a/modules/homeVars.nix b/modules/homeVars.nix new file mode 100644 index 0000000..3b2688c --- /dev/null +++ b/modules/homeVars.nix @@ -0,0 +1,31 @@ +{ + config, + lib, + options, + ... +}: let + inherit (lib) mkIf mkOption; + inherit (lib.types) str; +in { + options.local.homeVars = { + fullName = mkOption { + type = str; + description = "your full name (used for git commits and user description)"; + default = null; + }; + email = mkOption { + type = str; + description = "your email (used for git commits)"; + default = null; + }; + }; + + config.assertions = mkIf (!config.local.systemVars.isServer) [ + { + assertion = options.local.homeVars.fullName.isDefined; + } + { + assertion = options.local.homeVars.email.isDefined; + } + ]; +} diff --git a/modules/systemVars.nix b/modules/systemVars.nix new file mode 100644 index 0000000..cb8d169 --- /dev/null +++ b/modules/systemVars.nix @@ -0,0 +1,35 @@ +{ + lib, + options, + ... +}: let + inherit (lib) mkOption; + inherit (lib.types) bool str; +in { + options.local.systemVars = { + hostName = mkOption { + type = str; + description = "hostname for the current host"; + default = null; + }; + username = mkOption { + type = str; + description = "username for the home directory"; + default = null; + }; + isServer = mkOption { + type = bool; + description = "whether or not this host is a server"; + default = false; + }; + }; + + config.assertions = [ + { + assertion = options.local.systemVars.hostName.isDefined; + } + { + assertion = options.local.systemVars.username.isDefined; + } + ]; +}