initial commit
This commit is contained in:
9
modules/common/default.nix
Normal file
9
modules/common/default.nix
Normal file
@@ -0,0 +1,9 @@
|
||||
# Add your reusable modules that are common across both home and hosts to this directory, in their own file (https://wiki.nixos.org/wiki/NixOS_modules).
|
||||
# They will automatically be imported below but must be enabled elsewhere in the config, such as in common/core,
|
||||
# common/optional, or common/hosts files for example.
|
||||
# These are modules not specific to either nixos, darwin, or home-manger that you would share with others, not your personal configurations.
|
||||
|
||||
{ lib, ... }:
|
||||
{
|
||||
imports = lib.custom.scanPaths ./.;
|
||||
}
|
||||
153
modules/common/host-spec.nix
Normal file
153
modules/common/host-spec.nix
Normal file
@@ -0,0 +1,153 @@
|
||||
# Specifications For Differentiating Hosts
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
options.hostSpec = {
|
||||
# Data variables that don't dictate configuration settings
|
||||
username = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "The username of the host";
|
||||
};
|
||||
hostName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "The hostname of the host";
|
||||
};
|
||||
email = lib.mkOption {
|
||||
type = lib.types.attrsOf lib.types.str;
|
||||
description = "The email of the user";
|
||||
};
|
||||
work = lib.mkOption {
|
||||
default = { };
|
||||
type = lib.types.attrsOf lib.types.anything;
|
||||
description = "An attribute set of work-related information if isWork is true";
|
||||
};
|
||||
networking = lib.mkOption {
|
||||
default = { };
|
||||
type = lib.types.attrsOf lib.types.anything;
|
||||
description = "An attribute set of networking information";
|
||||
};
|
||||
wifi = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Used to indicate if a host has wifi";
|
||||
};
|
||||
domain = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "The domain of the host";
|
||||
};
|
||||
userFullName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "The full name of the user";
|
||||
};
|
||||
handle = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "The handle of the user (eg: github user)";
|
||||
};
|
||||
home = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "The home directory of the user";
|
||||
default =
|
||||
let
|
||||
user = config.hostSpec.username;
|
||||
in
|
||||
if pkgs.stdenv.isLinux then "/home/${user}" else "/Users/${user}";
|
||||
};
|
||||
persistFolder = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "The folder to persist data if impermenance is enabled";
|
||||
default = "";
|
||||
};
|
||||
|
||||
# Configuration Settings
|
||||
isMinimal = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Used to indicate a minimal host";
|
||||
};
|
||||
isProduction = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Used to indicate a production host";
|
||||
};
|
||||
isServer = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Used to indicate a server host";
|
||||
};
|
||||
isWork = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Used to indicate a host that uses work resources";
|
||||
};
|
||||
# Sometimes we can't use pkgs.stdenv.isLinux due to infinite recursion
|
||||
isDarwin = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Used to indicate a host that is darwin";
|
||||
};
|
||||
useYubikey = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Used to indicate if the host uses a yubikey";
|
||||
};
|
||||
voiceCoding = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Used to indicate a host that uses voice coding";
|
||||
};
|
||||
isAutoStyled = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Used to indicate a host that wants auto styling like stylix";
|
||||
};
|
||||
useNeovimTerminal = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Used to indicate a host that uses neovim for terminals";
|
||||
};
|
||||
useWindowManager = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Used to indicate a host that uses a window manager";
|
||||
};
|
||||
useAtticCache = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Used to indicate a host that uses LAN atticd for caching";
|
||||
};
|
||||
hdr = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Used to indicate a host that uses HDR";
|
||||
};
|
||||
scaling = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "1";
|
||||
description = "Used to indicate what scaling to use. Floating point number";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
assertions =
|
||||
let
|
||||
# We import these options to HM and NixOS, so need to not fail on HM
|
||||
isImpermanent =
|
||||
config ? "system" && config.system ? "impermanence" && config.system.impermanence.enable;
|
||||
in
|
||||
[
|
||||
{
|
||||
assertion =
|
||||
!config.hostSpec.isWork || (config.hostSpec.isWork && !builtins.isNull config.hostSpec.work);
|
||||
message = "isWork is true but no work attribute set is provided";
|
||||
}
|
||||
{
|
||||
assertion = !isImpermanent || (isImpermanent && !("${config.hostSpec.persistFolder}" == ""));
|
||||
message = "config.system.impermanence.enable is true but no persistFolder path is provided";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
9
modules/home/default.nix
Normal file
9
modules/home/default.nix
Normal file
@@ -0,0 +1,9 @@
|
||||
# Add your reusable home-manager modules to this directory, in their own file (https://wiki.nixos.org/wiki/NixOS_modules).
|
||||
# They will automatically be imported below but must be enabled elsewhere in the config, such as in common/core,
|
||||
# common/optional, or common/hosts files for example.
|
||||
# These are modules you would share with others, not your personal configurations.
|
||||
|
||||
{ lib, ... }:
|
||||
{
|
||||
imports = lib.custom.scanPaths ./.;
|
||||
}
|
||||
10
modules/hosts/common/default.nix
Normal file
10
modules/hosts/common/default.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
# Add your reusable host-level modules that are common across both nixos and darwin to this directory, in
|
||||
# their own file (https://wiki.nixos.org/wiki/NixOS_modules).
|
||||
# They will automatically be imported below but must be enabled elsewhere in the config, such as in common/core,
|
||||
# common/optional, or common/hosts files for example.
|
||||
# These are modules you would share with others, not your personal configurations.
|
||||
|
||||
{ lib, ... }:
|
||||
{
|
||||
imports = lib.custom.scanPaths ./.;
|
||||
}
|
||||
9
modules/hosts/darwin/default.nix
Normal file
9
modules/hosts/darwin/default.nix
Normal file
@@ -0,0 +1,9 @@
|
||||
# Add your reusable nix-darwin modules to this directory, in their own file (https://wiki.nixos.org/wiki/NixOS_modules).
|
||||
# They will automatically be imported below but must be enabled elsewhere in the config, such as in common/core,
|
||||
# common/optional, or common/hosts files for example.
|
||||
# These are modules you would share with others, not your personal configurations.
|
||||
|
||||
{ lib, ... }:
|
||||
{
|
||||
imports = lib.custom.scanPaths ./.;
|
||||
}
|
||||
9
modules/hosts/nixos/default.nix
Normal file
9
modules/hosts/nixos/default.nix
Normal file
@@ -0,0 +1,9 @@
|
||||
# Add your reusable NixOS modules to this directory, in their own file (https://wiki.nixos.org/wiki/NixOS_modules).
|
||||
# They will automatically be imported below but must be enabled elsewhere in the config, such as in common/core,
|
||||
# common/optional, or common/hosts files for example.
|
||||
# These are modules you would share with others, not your personal configurations.
|
||||
|
||||
{ lib, ... }:
|
||||
{
|
||||
imports = lib.custom.scanPaths ./.;
|
||||
}
|
||||
Reference in New Issue
Block a user