refactor(sys): systemModules -> ooknet

This commit is contained in:
ooks-io 2024-05-26 17:41:49 +12:00
parent 63c39a89ed
commit 104df464f9
52 changed files with 69 additions and 69 deletions

View file

@ -3,7 +3,7 @@
let let
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (builtins) elem; inherit (builtins) elem;
host = osConfig.systemModules.host; host = osConfig.ooknet.host;
in in
{ {

View file

@ -9,7 +9,7 @@ in
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
systemModules.host = { ooknet.host = {
name = "ooksdesk"; name = "ooksdesk";
type = "desktop"; type = "desktop";
function = [ "workstation" "gaming" ]; function = [ "workstation" "gaming" ];
@ -27,7 +27,7 @@ in
}; };
}; };
systemModules.networking.tailscale = { ooknet.networking.tailscale = {
enable = true; enable = true;
client = true; client = true;
}; };

View file

@ -9,7 +9,7 @@ in
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
systemModules.host = { ooknet.host = {
name = "ooksmedia"; name = "ooksmedia";
type = "desktop"; type = "desktop";
function = [ function = [
@ -35,7 +35,7 @@ in
}; };
}; };
systemModules.networking.tailscale = { ooknet.networking.tailscale = {
enable = true; enable = true;
server = true; server = true;
}; };

View file

@ -8,12 +8,12 @@
activeProfiles = ["base" "laptop"]; activeProfiles = ["base" "laptop"];
systemModules.user = { ooknet.user = {
ooks.enable = true; ooks.enable = true;
shell.fish.enable = true; shell.fish.enable = true;
}; };
systemModules.laptop.power = { ooknet.laptop.power = {
powersave = { powersave = {
minFreq = 800; minFreq = 800;
maxFreq = 1600; maxFreq = 1600;

View file

@ -11,7 +11,7 @@ in
]; ];
systemModules.host = { ooknet.host = {
name = "ookst480s"; name = "ookst480s";
type = "laptop"; type = "laptop";
function = [ "workstation" ]; function = [ "workstation" ];

View file

@ -10,7 +10,7 @@ in
# ./grub # ./grub
]; ];
options.systemModules.boot.loader = mkOption { options.ooknet.boot.loader = mkOption {
type = types.enum ["systemd" "grub"]; type = types.enum ["systemd" "grub"];
default = "systemd"; default = "systemd";
}; };

View file

@ -2,7 +2,7 @@
let let
inherit (lib) mkIf; inherit (lib) mkIf;
bootloader = config.systemModules.boot.loader; bootloader = config.ooknet.boot.loader;
in in
{ {

View file

@ -2,11 +2,11 @@
let let
inherit (lib) mkIf mkEnableOption; inherit (lib) mkIf mkEnableOption;
cfg = config.systemModules.boot.plymouth; cfg = config.sys.boot.plymouth;
in in
{ {
options.systemModules.boot.plymouth.enable = mkEnableOption ""; options.sys.boot.plymouth.enable = mkEnableOption "";
config = mkIf cfg.enable { config = mkIf cfg.enable {
boot.plymouth = { boot.plymouth = {

View file

@ -15,7 +15,7 @@
]; ];
options.systemModules = { options.ooknet = {
virtualisation = { virtualisation = {
enable = lib.mkEnableOption "Enable virtualisation module"; enable = lib.mkEnableOption "Enable virtualisation module";
}; };

View file

@ -2,7 +2,7 @@
let let
inherit (lib) mkIf; inherit (lib) mkIf;
tuigreet = "${pkgs.greetd.tuigreet}/bin/tuigreet"; tuigreet = "${pkgs.greetd.tuigreet}/bin/tuigreet";
host = config.systemModules.host; host = config.ooknet.host;
in in
{ {
config = mkIf (host.type != "phone") { config = mkIf (host.type != "phone") {

View file

@ -1,14 +1,14 @@
{ lib, config, pkgs, inputs, outputs, self, ... }: { lib, config, pkgs, inputs, outputs, self, ... }:
let let
cfg = config.systemModules.host.admin; cfg = config.ooknet.host.admin;
host = config.systemModules.host; host = config.ooknet.host;
ifTheyExist = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups; ifTheyExist = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups;
inherit (lib) mkIf types mkOption; inherit (lib) mkIf types mkOption;
in in
{ {
options.systemModules.host.admin = { options.ooknet.host.admin = {
name = mkOption { name = mkOption {
type = types.str; type = types.str;
default = "ooks"; default = "ooks";

View file

@ -2,7 +2,7 @@
let let
inherit (lib) mkIf; inherit (lib) mkIf;
host = config.systemModules.host; host = config.ooknet.host;
in in
{ {

View file

@ -3,7 +3,7 @@
let let
inherit (lib) mkMerge mkEnableOption mkIf versionAtLeast versionOlder; inherit (lib) mkMerge mkEnableOption mkIf versionAtLeast versionOlder;
inherit (builtins) elem; inherit (builtins) elem;
cpu = config.systemModules.host.hardware.cpu; cpu = config.ooknet.host.hardware.cpu;
cfg = cpu.amd; cfg = cpu.amd;
kernelVersion = config.boot.kernelPackages.kernel.version; kernelVersion = config.boot.kernelPackages.kernel.version;
kernelVersionAtLeast = versionAtLeast kernelVersion; kernelVersionAtLeast = versionAtLeast kernelVersion;
@ -11,7 +11,7 @@ let
in in
{ {
options.systemModules.host.hardware.cpu.amd.pstate.enable = mkEnableOption "Enable amd pstate module"; options.ooknet.host.hardware.cpu.amd.pstate.enable = mkEnableOption "Enable amd pstate module";
config = mkIf (elem cpu.type ["amd"]) { config = mkIf (elem cpu.type ["amd"]) {
environment.systemPackages = [pkgs.amdctl]; environment.systemPackages = [pkgs.amdctl];

View file

@ -10,7 +10,7 @@ in
./intel.nix ./intel.nix
]; ];
options.systemModules.host.hardware.cpu.type = mkOption { options.ooknet.host.hardware.cpu.type = mkOption {
type = with types; nullOr (enum ["intel" "amd"]); type = with types; nullOr (enum ["intel" "amd"]);
default = null; default = null;
description = "Type of cpu system module to use"; description = "Type of cpu system module to use";

View file

@ -3,13 +3,13 @@
let let
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (builtins) elem; inherit (builtins) elem;
hardware = config.systemModules.host.hardware.cpu; cpu = config.ooknet.host.hardware.cpu;
in in
{ {
# TODO: put kvm/gvt behind virtualization module flag # TODO: put kvm/gvt behind virtualization module flag
config = mkIf (elem hardware.type ["intel"]) { config = mkIf (elem cpu.type ["intel"]) {
boot = { boot = {
kernelModules = ["kvm-intel"]; kernelModules = ["kvm-intel"];
kernelParams = ["i915.fastboot=1" "enable_gvt=1"]; kernelParams = ["i915.fastboot=1" "enable_gvt=1"];

View file

@ -5,7 +5,7 @@ let
inherit (lib.generators) toLua; inherit (lib.generators) toLua;
inherit (lib.lists) elem optionals; inherit (lib.lists) elem optionals;
# inherit (builtins) elem; # inherit (builtins) elem;
features = config.systemModules.host.hardware.features; features = config.ooknet.host.hardware.features;
hasBT = (elem "bluetooth" features); hasBT = (elem "bluetooth" features);
in in

View file

@ -1,7 +1,7 @@
{ lib, config, ... }: { lib, config, ... }:
let let
features = config.systemModules.host.hardware.features; features = config.ooknet.host.hardware.features;
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (builtins) elem; inherit (builtins) elem;
in in

View file

@ -2,15 +2,15 @@
{ lib, config, pkgs, ... }: { lib, config, pkgs, ... }:
let let
features = config.systemModules.host.hardware.features; features = config.ooknet.host.hardware.features;
cfg = config.systemModules.host.hardware.battery; cfg = config.ooknet.host.hardware.battery;
inherit (lib) mkIf mkDefault mkOption types; inherit (lib) mkIf mkDefault mkOption types;
inherit (builtins) elem; inherit (builtins) elem;
MHz = x: x * 1000; MHz = x: x * 1000;
in in
{ {
options.systemModules.host.hardware.battery = { options.ooknet.host.hardware.battery = {
powersave = { powersave = {
minFreq = mkOption { minFreq = mkOption {
type = types.int; type = types.int;

View file

@ -1,7 +1,7 @@
{ config, lib, pkgs, self, ... }: { config, lib, pkgs, self, ... }:
let let
features = config.systemModules.host.hardware.features; features = config.ooknet.host.hardware.features;
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (builtins) elem; inherit (builtins) elem;
in in

View file

@ -14,7 +14,7 @@ in
./video.nix ./video.nix
]; ];
options.systemModules.host.hardware.features = mkOption { options.ooknet.host.hardware.features = mkOption {
type = with types; listOf (enum ["audio" "video" "bluetooth" "backlight" "battery" "ssd"]); type = with types; listOf (enum ["audio" "video" "bluetooth" "backlight" "battery" "ssd"]);
default = []; default = [];
description = "What extra hardware feature system modules to use"; description = "What extra hardware feature system modules to use";

View file

@ -1,7 +1,7 @@
{ lib, config, ... }: { lib, config, ... }:
let let
features = config.systemModules.host.hardware.features; features = config.ooknet.host.hardware.features;
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (builtins) elem; inherit (builtins) elem;
in in

View file

@ -4,7 +4,7 @@ let
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (builtins) elem; inherit (builtins) elem;
isx86Linux = pkgs: with pkgs.stdenv; hostPlatform.isLinux && hostPlatform.isx86; isx86Linux = pkgs: with pkgs.stdenv; hostPlatform.isLinux && hostPlatform.isx86;
features = config.systemModules.host.hardware.features; features = config.ooknet.host.hardware.features;
in in
{ {

View file

@ -1,7 +1,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
gpu = config.systemModules.host.hardware.gpu; gpu = config.ooknet.host.hardware.gpu;
inherit (lib) mkIf mkDefault; inherit (lib) mkIf mkDefault;
inherit (builtins) elem; inherit (builtins) elem;
in in

View file

@ -11,7 +11,7 @@ in
./nvidia.nix ./nvidia.nix
]; ];
options.systemModules.host.hardware.gpu.type = mkOption { options.ooknet.host.hardware.gpu.type = mkOption {
type = with types; nullOr (enum ["intel" "amd" "nvidia"]); type = with types; nullOr (enum ["intel" "amd" "nvidia"]);
default = null; default = null;
description = "Type of gpu system module to use"; description = "Type of gpu system module to use";

View file

@ -1,7 +1,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
gpu = config.systemModules.host.hardware.gpu; gpu = config.ooknet.host.hardware.gpu;
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (builtins) elem; inherit (builtins) elem;

View file

@ -1,7 +1,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
gpu = config.systemModules.host.hardware.gpu; gpu = config.ooknet.host.hardware.gpu;
inherit (lib) mkIf mkDefault; inherit (lib) mkIf mkDefault;
inherit (builtins) elem; inherit (builtins) elem;
production = config.boot.kernelPackages.nvidiaPackages.production; production = config.boot.kernelPackages.nvidiaPackages.production;

View file

@ -2,11 +2,11 @@
let let
inherit (lib) types mkOption; inherit (lib) types mkOption;
cfg = config.systemModules.host; cfg = config.ooknet.host;
in in
{ {
options.systemModules.host = { options.ooknet.host = {
name = mkOption { name = mkOption {
type = types.str; type = types.str;
default = "ooksgeneric"; default = "ooksgeneric";

View file

@ -5,7 +5,7 @@ let
in in
{ {
options.systemModules.host.function = mkOption { options.ooknet.host.function = mkOption {
type = with types; listOf (enum ["gaming" "workstation" "media-server"]); type = with types; listOf (enum ["gaming" "workstation" "media-server"]);
default = []; default = [];
description = "Host's primary function/s"; description = "Host's primary function/s";

View file

@ -5,7 +5,7 @@ let
in in
{ {
options.systemModules.host.type = mkOption { options.ooknet.host.type = mkOption {
type = types.enum ["desktop" "laptop" "mixed" "server" "phone" "laptop" "micro" "vm"]; type = types.enum ["desktop" "laptop" "mixed" "server" "phone" "laptop" "micro" "vm"];
default = ""; default = "";
description = "Declare what type of device the host is"; description = "Declare what type of device the host is";

View file

@ -2,7 +2,7 @@
let let
inherit (lib) mkIf; inherit (lib) mkIf;
host = config.systemModules.host; host = config.ooknet.host;
in in
{ {

View file

@ -2,7 +2,7 @@
let let
inherit (lib) mkIf; inherit (lib) mkIf;
host = config.systemModules.host; host = config.ooknet.host;
in in
{ {

View file

@ -2,7 +2,7 @@
let let
inherit (lib) mkIf; inherit (lib) mkIf;
host = config.systemModules.host; host = config.ooknet.host;
in in
{ {

View file

@ -4,7 +4,7 @@ let
inherit (lib) mkIf mkDefault; inherit (lib) mkIf mkDefault;
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBn3ff3HaZHIyH4K13k8Mwqu/o7jIABJ8rANK+r2PfJk"; key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBn3ff3HaZHIyH4K13k8Mwqu/o7jIABJ8rANK+r2PfJk";
phoneKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINredx07UAk2l1wUPujYnmJci1+XEmcUuSX0DIYg6Vzz"; phoneKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINredx07UAk2l1wUPujYnmJci1+XEmcUuSX0DIYg6Vzz";
host = config.systemModules.host; host = config.ooknet.host;
in in
{ {

View file

@ -1,7 +1,7 @@
{ lib, config, pkgs, ... }: { lib, config, pkgs, ... }:
let let
cfg = config.systemModules.networking.tailscale; cfg = config.ooknet.networking.tailscale;
inherit (config.services) tailscale; inherit (config.services) tailscale;
inherit (lib.lists) optionals; inherit (lib.lists) optionals;
inherit (lib.types) bool listOf str; inherit (lib.types) bool listOf str;
@ -10,7 +10,7 @@ let
in in
{ {
options.systemModules.networking.tailscale = { options.ooknet.networking.tailscale = {
enable = mkEnableOption "Enable tailscale system module"; enable = mkEnableOption "Enable tailscale system module";
server = mkOption { server = mkOption {
type = bool; type = bool;

View file

@ -2,7 +2,7 @@
let let
inherit (lib) mkIf; inherit (lib) mkIf;
host = config.systemModules.host; host = config.ooknet.host;
in in
{ {

View file

@ -2,7 +2,7 @@
let let
inherit (lib) mkIf mapAttrs mapAttrsToList; inherit (lib) mkIf mapAttrs mapAttrsToList;
host = config.systemModules.host; host = config.ooknet.host;
in in
{ {

View file

@ -2,7 +2,7 @@
let let
inherit (lib) mkIf; inherit (lib) mkIf;
host = config.systemModules.host; host = config.ooknet.host;
in in
{ {

View file

@ -2,7 +2,7 @@
let let
inherit (lib) mkIf; inherit (lib) mkIf;
host = config.systemModules.host; host = config.ooknet.host;
in in
{ {

View file

@ -2,7 +2,7 @@
let let
inherit (lib) mkIf; inherit (lib) mkIf;
host = config.systemModules.host; host = config.ooknet.host;
in in
{ {

View file

@ -3,7 +3,7 @@
let let
inherit (lib) optionals mkForce concatLists; inherit (lib) optionals mkForce concatLists;
inherit (builtins) elem; inherit (builtins) elem;
features = config.systemModules.host.hardware.features; features = config.ooknet.host.hardware.features;
in in
{ {

View file

@ -3,7 +3,7 @@
let let
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (lib.lists) any elem; inherit (lib.lists) any elem;
hasFunction = f: elem f config.systemModules.host.function; hasFunction = f: elem f config.ooknet.host.function;
in in
{ {

View file

@ -2,7 +2,7 @@
let let
inherit (lib) mkIf; inherit (lib) mkIf;
host = config.systemModules.host; host = config.ooknet.host;
in in
{ {

View file

@ -2,7 +2,7 @@
let let
inherit (lib) mkIf; inherit (lib) mkIf;
host = config.systemModules.host; host = config.ooknet.host;
in in
{ {

View file

@ -2,7 +2,7 @@
let let
inherit (lib) mkIf; inherit (lib) mkIf;
host = config.systemModules.host; host = config.ooknet.host;
in in
{ {

View file

@ -2,8 +2,8 @@
let let
inherit (lib) mkIf; inherit (lib) mkIf;
adminShell = config.systemModules.host.admin.shell; adminShell = config.ooknet.host.admin.shell;
cfg = config.systemModules.shell.zsh; cfg = config.ooknet.shell.zsh;
in in
{ {

View file

@ -2,12 +2,12 @@
let let
inherit (lib) mkIf mkEnableOption; inherit (lib) mkIf mkEnableOption;
adminShell = config.systemModules.host.admin.shell; adminShell = config.ooknet.host.admin.shell;
cfg = config.systemModules.shell.fish; cfg = config.ooknet.shell.fish;
in in
{ {
options.systemModules.shell.fish.enable = mkEnableOption "Enable fish module"; options.ooknet.shell.fish.enable = mkEnableOption "Enable fish module";
config = mkIf (adminShell == "fish" || cfg.enable) { config = mkIf (adminShell == "fish" || cfg.enable) {
programs.fish = { programs.fish = {

View file

@ -2,13 +2,13 @@
let let
inherit (lib) mkIf mkEnableOption; inherit (lib) mkIf mkEnableOption;
adminShell = config.systemModules.host.admin.shell; adminShell = config.ooknet.host.admin.shell;
cfg = config.systemModules.shell.zsh; cfg = config.ooknet.shell.zsh;
in in
{ {
options.systemModules.shell.zsh.enable = mkEnableOption "Enable zsh module"; options.ooknet.shell.zsh.enable = mkEnableOption "Enable zsh module";
config = mkIf (adminShell == "zsh" || cfg.enable) { config = mkIf (adminShell == "zsh" || cfg.enable) {
programs.zsh = { programs.zsh = {

View file

@ -1,7 +1,7 @@
{ lib, config, pkgs, ... }: { lib, config, pkgs, ... }:
let let
cfg = config.systemModules.virtualisation; cfg = config.ooknet.virtualisation;
in in
{ {

View file

@ -22,7 +22,7 @@ let
gtk3-x11 gtk3-x11
]; ];
}; };
host = config.systemModules.host; host = config.ooknet.host;
in in
{ {

View file

@ -1,7 +1,7 @@
{ config, inputs, ... }: { config, inputs, ... }:
let let
admin = config.systemModules.host.admin; admin = config.ooknet.host.admin;
in in
{ {

View file

@ -2,7 +2,7 @@
let let
inherit (lib) mkIf; inherit (lib) mkIf;
host = config.systemModules.host; host = config.ooknet.host;
in in
{ {

View file

@ -3,7 +3,7 @@
let let
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (builtins) elem; inherit (builtins) elem;
host = config.systemModules.host; host = config.ooknet.host;
in in
{ {