refactor: full module system implemented

This commit is contained in:
Leon Schwarzäugl 2025-04-17 11:03:15 +02:00
parent cf9349168f
commit e15ab08adf
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
24 changed files with 933 additions and 546 deletions

View file

@ -1,6 +1,13 @@
{ self, config, pkgs, lib, primaryUser, ... }:
{ self, inputs, config, pkgs, lib, primaryUser, ... }:
let
modulesPath = "${self}/modules";
sharedOptions = {
isBtrfs = false;
isLinux = true;
isPublic = true;
profiles = {
chaostheatre = true;
};
};
in
{
@ -10,7 +17,15 @@ in
{
_module.args.diskDevice = config.swarselsystems.rootDisk;
}
"${modulesPath}/nixos/optional/autologin.nix"
"${self}/hosts/nixos/chaostheatre/options.nix"
inputs.home-manager.nixosModules.home-manager
{
home-manager.users."${primaryUser}".imports = [
"${self}/modules/home/common/settings.nix"
"${self}/hosts/nixos/chaostheatre/options-home.nix"
"${self}/modules/home/common/sharedsetup.nix"
];
}
];
environment.variables = {
@ -31,21 +46,25 @@ in
};
swarselsystems = {
wallpaper = self + /wallpaper/lenovowp.png;
initialSetup = true;
isPublic = true;
isLinux = true;
isImpermanence = true;
isCrypted = true;
isSecureBoot = false;
isSwap = true;
swapSize = "4G";
rootDisk = "/dev/vda";
};
swarselsystems = lib.recursiveUpdate
{
wallpaper = self + /wallpaper/lenovowp.png;
initialSetup = true;
isImpermanence = true;
isCrypted = true;
isSecureBoot = false;
isSwap = true;
swapSize = "4G";
rootDisk = "/dev/vda";
}
sharedOptions;
home-manager.users."${primaryUser}".swarselsystems = {
isNixos = true;
isPublic = true;
home-manager.users."${primaryUser}" = {
home.stateVersion = lib.mkForce "23.05";
swarselsystems = lib.recursiveUpdate
{
isNixos = true;
}
sharedOptions;
};
}

View file

@ -0,0 +1,2 @@
_:
{ }

View file

@ -0,0 +1,2 @@
_:
{ }

View file

@ -21,12 +21,16 @@ in
}
];
home-manager.users."${primaryUser}".home = {
file = {
".bash_history" = {
source = self + /programs/bash/.bash_history;
home-manager.users."${primaryUser}" = {
home = {
stateVersion = "23.05";
file = {
".bash_history" = {
source = self + /programs/bash/.bash_history;
};
};
};
swarselsystems.modules.general = lib.mkForce true;
};
home-manager.users.root.home = {
stateVersion = "23.05";

View file

@ -1,7 +1,6 @@
{ self, inputs, lib, primaryUser, ... }:
let
secretsDirectory = builtins.toString inputs.nix-secrets;
modulesPath = "${self}/modules";
sharedOptions = {
isBtrfs = true;
isLinux = true;
@ -21,24 +20,6 @@ in
./disk-config.nix
./hardware-configuration.nix
"${modulesPath}/nixos/optional/virtualbox.nix"
# "${modulesPath}/nixos/optional/vmware.nix"
"${modulesPath}/nixos/optional/autologin.nix"
"${modulesPath}/nixos/optional/nswitch-rcm.nix"
"${modulesPath}/nixos/optional/gaming.nix"
"${modulesPath}/nixos/optional/work.nix"
"${self}/profiles/nixos"
"${modulesPath}/nixos/server"
inputs.home-manager.nixosModules.home-manager
{
home-manager.users."${primaryUser}".imports = [
"${self}/profiles/home"
"${modulesPath}/home/server"
"${modulesPath}/home/optional/gaming.nix"
"${modulesPath}/home/optional/work.nix"
];
}
];

View file

@ -1,22 +1,13 @@
{ self, inputs, lib, primaryUser, ... }:
{ lib, primaryUser, ... }:
let
modulesPath = "${self}/modules";
sharedOptions = {
isBtrfs = false;
isLinux = true;
};
in
{
imports = [
"${modulesPath}/nixos/server"
"${modulesPath}/nixos/common/sharedsetup.nix"
"${modulesPath}/home/common/sharedsetup.nix"
./hardware-configuration.nix
inputs.home-manager.nixosModules.home-manager
{
home-manager.users."${primaryUser}".imports = [
"${modulesPath}/home/server"
"${modulesPath}/home/common/sharedsetup.nix"
];
}
];
sops = {
@ -51,7 +42,7 @@ in
};
};
# system.stateVersion = "23.11"; # TEMPLATE - but probably no need to change
system.stateVersion = "23.11"; # TEMPLATE - but probably no need to change
services = {
nginx = {
@ -80,16 +71,23 @@ in
};
};
swarselsystems = lib.recursiveUpdate
{
flakePath = "/root/.dotfiles";
isImpermanence = false;
isSecureBoot = false;
isCrypted = false;
profiles = {
server.sync = true;
};
}
sharedOptions;
swarselsystems = {
isImpermanence = false;
isLinux = true;
isBtrfs = false;
flakePath = "/root/.dotfiles";
modules.server = {
forgejo = true;
ankisync = true;
};
home-manager.users."${primaryUser}" = {
home.stateVersion = lib.mkForce "23.05";
swarselsystems = lib.recursiveUpdate
{ }
sharedOptions;
};
}

View file

@ -4,35 +4,27 @@ let
sharedOptions = {
isBtrfs = true;
isLinux = true;
profiles = {
toto = true;
};
};
in
{
imports = [
"${self}/hosts/nixos/toto/disk-config.nix"
./disk-config.nix
./hardware-configuration.nix
"${modulesPath}/nixos/optional/autologin.nix"
"${modulesPath}/nixos/common/settings.nix"
"${modulesPath}/nixos/common/sharedsetup.nix"
"${modulesPath}/nixos/common/home-manager.nix"
"${modulesPath}/nixos/common/home-manager-extra.nix"
"${modulesPath}/nixos/common/xserver.nix"
"${modulesPath}/nixos/common/users.nix"
"${modulesPath}/nixos/common/impermanence.nix"
"${modulesPath}/nixos/common/lanzaboote.nix"
"${modulesPath}/nixos/common/sops.nix"
"${modulesPath}/nixos/server/ssh.nix"
"${modulesPath}/home/common/sharedsetup.nix"
"${self}/profiles/nixos"
inputs.home-manager.nixosModules.home-manager
{
home-manager.users."${primaryUser}".imports = [
inputs.sops-nix.homeManagerModules.sops
"${modulesPath}/home/common/settings.nix"
"${modulesPath}/home/common/sops.nix"
"${modulesPath}/home/common/ssh.nix"
"${modulesPath}/home/common/sharedsetup.nix"
"${self}/profiles/home"
];
}
];
@ -76,11 +68,13 @@ in
}
sharedOptions;
home-manager.users."${primaryUser}".swarselsystems = lib.recursiveUpdate
{
isLaptop = false;
isNixos = true;
}
sharedOptions;
home-manager.users."${primaryUser}" = {
home.stateVersion = lib.mkForce "23.05";
swarselsystems = lib.recursiveUpdate
{
isLaptop = false;
isNixos = true;
}
sharedOptions;
};
}

View file

@ -1,21 +1,17 @@
{ self, inputs, primaryUser, ... }:
{ lib, primaryUser, ... }:
let
modulesPath = "${self}/modules";
sharedOptions = {
isBtrfs = false;
isLinux = true;
profiles = {
server.local = true;
};
};
in
{
imports = [
./hardware-configuration.nix
"${modulesPath}/nixos/optional/autologin.nix"
"${modulesPath}/nixos/server"
inputs.home-manager.nixosModules.home-manager
{
home-manager.users."${primaryUser}".imports = [
"${modulesPath}/home/server"
];
}
];
boot = {
@ -31,25 +27,19 @@ in
firewall.allowedTCPPorts = [ 80 443 ];
};
swarselsystems = {
isImpermanence = false;
isBtrfs = false;
isLinux = true;
server = {
kavita = true;
navidrome = true;
jellyfin = true;
spotifyd = true;
mpd = false;
matrix = true;
nextcloud = true;
immich = true;
paperless = true;
transmission = true;
syncthing = true;
monitoring = true;
freshrss = true;
};
};
swarselsystems = lib.recursiveUpdate
{
isImpermanence = false;
isSecureBoot = true;
isCrypted = true;
}
sharedOptions;
home-manager.users."${primaryUser}" = {
home.stateVersion = lib.mkForce "23.05";
swarselsystems = lib.recursiveUpdate
{ }
sharedOptions;
};
}