chore: make namespace generic so people can copy easier

This commit is contained in:
Christoph Hollizeck 2024-10-11 00:17:03 +02:00
parent 0158f7ff06
commit 0562818aa7
Signed by: Daholli
GPG key ID: 249300664F2AF2C7
45 changed files with 249 additions and 217 deletions

View file

@ -1,17 +1,19 @@
{
options,
config,
lib,
namespace,
options,
pkgs,
...
}:
with lib;
with lib.wyrdgard;
with lib.${namespace};
let
cfg = config.wyrdgard.apps.cli-apps.fish;
inherit (lib) mkIf;
inherit (lib.${namespace}) mkBoolOpt;
cfg = config.${namespace}.apps.cli-apps.fish;
in
{
options.wyrdgard.apps.cli-apps.fish = with types; {
options.${namespace}.apps.cli-apps.fish = {
enable = mkBoolOpt true "Whether or not to enable the fish shell";
};

View file

@ -1,11 +1,16 @@
{ lib, config, ... }:
with lib;
with lib.wyrdgard;
{
config,
lib,
namespace,
...
}:
let
cfg = config.wyrdgard.apps.cli-apps.home-manager;
inherit (lib) mkIf;
inherit (lib.${namespace}) mkBoolOpt enabled;
cfg = config.${namespace}.apps.cli-apps.home-manager;
in
{
options.wyrdgard.apps.cli-apps.home-manager = {
options.${namespace}.apps.cli-apps.home-manager = {
enable = mkBoolOpt true "Enable home-manager";
};

View file

@ -1,17 +1,17 @@
{
options,
config,
lib,
pkgs,
namespace,
options,
...
}:
with lib;
with lib.wyrdgard;
let
cfg = config.wyrdgard.apps.cli-apps.starship;
inherit (lib) mkIf;
inherit (lib.${namespace}) mkBoolOpt;
cfg = config.${namespace}.apps.cli-apps.starship;
in
{
options.wyrdgard.apps.cli-apps.starship = with types; {
options.${namespace}.apps.cli-apps.starship = {
enable = mkBoolOpt true "Whether or not to enable starship shell";
};

View file

@ -1,16 +1,17 @@
{
lib,
config,
lib,
namespace,
pkgs,
...
}:
with lib;
with lib.wyrdgard;
let
cfg = config.wyrdgard.apps.graphviz;
inherit (lib) mkIf;
inherit (lib.${namespace}) mkBoolOpt;
cfg = config.${namespace}.apps.graphviz;
in
{
options.wyrdgard.apps.graphviz = {
options.${namespace}.apps.graphviz = {
enable = mkBoolOpt true "Whether or not you want to install graphviz";
};

View file

@ -1,17 +1,17 @@
{
options,
config,
lib,
pkgs,
namespace,
options,
...
}:
with lib;
with lib.wyrdgard;
let
cfg = config.wyrdgard.tools.direnv;
inherit (lib) mkIf;
inherit (lib.${namespace}) mkBoolOpt enabled;
cfg = config.${namespace}.tools.direnv;
in
{
options.wyrdgard.tools.direnv = with types; {
options.${namespace}.tools.direnv = {
enable = mkBoolOpt false "Whether or not to enable direnv.";
};

View file

@ -1,18 +1,18 @@
{
options,
lib,
config,
pkgs,
lib,
namespace,
options,
...
}:
with lib;
with lib.wyrdgard;
with lib.${namespace};
let
cfg = config.wyrdgard.tools.git;
user = config.wyrdgard.user;
inherit (lib) mkIf types;
cfg = config.${namespace}.tools.git;
user = config.${namespace}.user;
in
{
options.wyrdgard.tools.git = {
options.${namespace}.tools.git = {
enable = mkBoolOpt true "Enable Git (Default true)";
userName = mkOpt types.str user.fullName "The name to configure git with.";
userEmail = mkOpt types.str user.email "The email to configure git with.";

View file

@ -1,8 +1,7 @@
{
lib,
config,
pkgs,
osConfig ? { },
namespace,
...
}:
let
@ -12,23 +11,14 @@ let
mkDefault
mkMerge
;
inherit (lib.wyrdgard) mkOpt;
inherit (lib.${namespace}) mkOpt;
cfg = config.wyrdgard.user;
cfg = config.${namespace}.user;
is-linux = pkgs.stdenv.isLinux;
is-darwin = pkgs.stdenv.isDarwin;
home-directory =
if cfg.name == null then
null
else if is-darwin then
"/Users/${cfg.name}"
else
"/home/${cfg.name}";
home-directory = if cfg.name == null then null else "/home/${cfg.name}";
in
{
options.wyrdgard.user = {
options.${namespace}.user = {
enable = mkOpt types.bool true "Whether to configure the user account.";
name = mkOpt (types.nullOr types.str) (config.snowfallorg.user.name or "cholli"
) "The user account.";
@ -44,11 +34,11 @@ in
assertions = [
{
assertion = cfg.name != null;
message = "wyrdgard.user.name must be set";
message = "${namespace}.user.name must be set";
}
{
assertion = cfg.home != null;
message = "wyrdgard.user.home must be set";
message = "${namespace}.user.home must be set";
}
];