refactor
This commit is contained in:
parent
66c05f9093
commit
45d6f4b0f3
205 changed files with 9040 additions and 342 deletions
24
modules/nixos/system/boot/default.nix
Normal file
24
modules/nixos/system/boot/default.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{ options
|
||||
, config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
}:
|
||||
with lib;
|
||||
with lib.plusultra; let
|
||||
cfg = config.plusultra.system.boot;
|
||||
in
|
||||
{
|
||||
options.plusultra.system.boot = with types; {
|
||||
enable = mkBoolOpt false "Whether or not to enable booting.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.systemd-boot.configurationLimit = 10;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
# https://github.com/NixOS/nixpkgs/blob/c32c39d6f3b1fe6514598fa40ad2cf9ce22c3fb7/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix#L66
|
||||
boot.loader.systemd-boot.editor = false;
|
||||
};
|
||||
}
|
39
modules/nixos/system/env/default.nix
vendored
Normal file
39
modules/nixos/system/env/default.nix
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
{ options, config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
with lib.plusultra;
|
||||
let cfg = config.plusultra.system.env;
|
||||
in
|
||||
{
|
||||
options.plusultra.system.env = with types;
|
||||
mkOption {
|
||||
type = attrsOf (oneOf [ str path (listOf (either str path)) ]);
|
||||
apply = mapAttrs (n: v:
|
||||
if isList v then
|
||||
concatMapStringsSep ":" (x: toString x) v
|
||||
else
|
||||
(toString v));
|
||||
default = { };
|
||||
description = "A set of environment variables to set.";
|
||||
};
|
||||
|
||||
config = {
|
||||
environment = {
|
||||
sessionVariables = {
|
||||
XDG_CACHE_HOME = "$HOME/.cache";
|
||||
XDG_CONFIG_HOME = "$HOME/.config";
|
||||
XDG_DATA_HOME = "$HOME/.local/share";
|
||||
XDG_BIN_HOME = "$HOME/.local/bin";
|
||||
# To prevent firefox from creating ~/Desktop.
|
||||
XDG_DESKTOP_DIR = "$HOME";
|
||||
};
|
||||
variables = {
|
||||
# Make some programs "XDG" compliant.
|
||||
LESSHISTFILE = "$XDG_CACHE_HOME/less.history";
|
||||
WGETRC = "$XDG_CONFIG_HOME/wgetrc";
|
||||
};
|
||||
extraInit = concatStringsSep "\n"
|
||||
(mapAttrsToList (n: v: ''export ${n}="${v}"'') cfg);
|
||||
};
|
||||
};
|
||||
}
|
35
modules/nixos/system/fonts/default.nix
Normal file
35
modules/nixos/system/fonts/default.nix
Normal file
|
@ -0,0 +1,35 @@
|
|||
{ options
|
||||
, config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
}:
|
||||
with lib;
|
||||
with lib.plusultra; let
|
||||
cfg = config.plusultra.system.fonts;
|
||||
in
|
||||
{
|
||||
options.plusultra.system.fonts = with types; {
|
||||
enable = mkBoolOpt false "Whether or not to manage fonts.";
|
||||
fonts = mkOpt (listOf package) [ ] "Custom font packages to install.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.variables = {
|
||||
# Enable icons in tooling since we have nerdfonts.
|
||||
LOG_ICONS = "true";
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [ font-manager ];
|
||||
|
||||
fonts.packages = with pkgs;
|
||||
[
|
||||
noto-fonts
|
||||
noto-fonts-cjk-sans
|
||||
noto-fonts-cjk-serif
|
||||
noto-fonts-emoji
|
||||
(nerdfonts.override { fonts = [ "Hack" ]; })
|
||||
]
|
||||
++ cfg.fonts;
|
||||
};
|
||||
}
|
17
modules/nixos/system/locale/default.nix
Normal file
17
modules/nixos/system/locale/default.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ options, config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
with lib.plusultra;
|
||||
let cfg = config.plusultra.system.locale;
|
||||
in
|
||||
{
|
||||
options.plusultra.system.locale = with types; {
|
||||
enable = mkBoolOpt false "Whether or not to manage locale settings.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
console = { keyMap = mkForce "us"; };
|
||||
};
|
||||
}
|
14
modules/nixos/system/time/default.nix
Normal file
14
modules/nixos/system/time/default.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{ options, config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
with lib.plusultra;
|
||||
let cfg = config.plusultra.system.time;
|
||||
in
|
||||
{
|
||||
options.plusultra.system.time = with types; {
|
||||
enable =
|
||||
mkBoolOpt false "Whether or not to configure timezone information.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable { time.timeZone = "America/Los_Angeles"; };
|
||||
}
|
19
modules/nixos/system/xkb/default.nix
Normal file
19
modules/nixos/system/xkb/default.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{ options, config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
with lib.plusultra;
|
||||
let cfg = config.plusultra.system.xkb;
|
||||
in
|
||||
{
|
||||
options.plusultra.system.xkb = with types; {
|
||||
enable = mkBoolOpt false "Whether or not to configure xkb.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
console.useXkbConfig = true;
|
||||
services.xserver = {
|
||||
layout = "us";
|
||||
xkbOptions = "caps:escape";
|
||||
};
|
||||
};
|
||||
}
|
47
modules/nixos/system/zfs/default.nix
Normal file
47
modules/nixos/system/zfs/default.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.plusultra.system.zfs;
|
||||
|
||||
inherit (lib) mkEnableOption mkIf mkDefault;
|
||||
inherit (lib.plusultra) mkOpt enabled;
|
||||
inherit (lib.types) listOf str;
|
||||
in
|
||||
{
|
||||
options.plusultra.system.zfs = {
|
||||
enable = mkEnableOption "ZFS support";
|
||||
|
||||
pools = mkOpt (listOf str) [ "rpool" ] "The ZFS pools to manage.";
|
||||
|
||||
auto-snapshot = {
|
||||
enable = mkEnableOption "ZFS auto snapshotting";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
|
||||
|
||||
services.zfs = {
|
||||
autoScrub = {
|
||||
enable = true;
|
||||
pools = cfg.pools;
|
||||
};
|
||||
|
||||
autoSnapshot = mkIf cfg.auto-snapshot.enable {
|
||||
enable = true;
|
||||
flags = "-k -p --utc";
|
||||
weekly = mkDefault 3;
|
||||
daily = mkDefault 3;
|
||||
hourly = mkDefault 0;
|
||||
frequent = mkDefault 0;
|
||||
monthly = mkDefault 2;
|
||||
};
|
||||
};
|
||||
|
||||
plusultra = {
|
||||
tools = {
|
||||
icehouse = enabled;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue