convoluted solution looking for a problem

unified modules structure
This commit is contained in:
Vinzenz Schroeter 2023-09-24 10:15:53 +02:00
parent bf3946e06f
commit 1b7989336e
14 changed files with 61 additions and 44 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
.directory
result

View file

@ -1,13 +1,13 @@
{...}: {
{pkgs, ...}: {
imports = [
./modules/server
(import ./modules/hardware "hetzner-vpn1")
(import ./modules {
hostName = "hetzner-vpn1";
enableDesktop = false;
})
];
config = {
my = {
server.enable = true;
};
my.server.enable = true;
users.users.root.openssh.authorizedKeys.keys = [
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICdYqY3Y1/f1bsAi5Qfyr/UWuX9ixu96IeAlhoQaJkbf''

View file

@ -1,6 +0,0 @@
{...}: {
imports = [
./i18n.nix
./nixpkgs.nix
];
}

16
modules/default.nix Normal file
View file

@ -0,0 +1,16 @@
modulesCfg: {lib, ...}: {
imports =
[
./i18n.nix
./nixpkgs.nix
./server.nix
]
++ (map (path: (import path modulesCfg)) [
./desktop
./hardware
]);
config = {
my.modulesCfg = modulesCfg;
};
}

View file

@ -1,14 +1,14 @@
{
modulesCfg: {
config,
pkgs,
lib,
...
}: let
isEnabled = modulesCfg.enableDesktop;
cfg = config.my.desktop;
in {
imports = [
imports = lib.optionals isEnabled [
<home-manager/nixos>
../_common
./gnome.nix
./kde.nix
./vinzenz.nix
@ -16,9 +16,11 @@ in {
./gaming.nix
];
options.my.modulesCfg.enableDesktop = lib.mkEnableOption "enable desktop module";
options.my.desktop = {
enable = lib.mkEnableOption "desktop";
gnome .enable = lib.mkEnableOption "gnome desktop";
gnome.enable = lib.mkEnableOption "gnome desktop";
kde.enable = lib.mkEnableOption "KDE desktop";
ronja.enable = lib.mkEnableOption "user ronja";
vinzenz.enable = lib.mkEnableOption "user vinzenz";

View file

@ -1,9 +1,14 @@
{
lib,
pkgs,
config,
...
}: {
config = {
}: let
isEnabled = config.my.hardware.enableCommonDesktopSettings;
in {
options.my.hardware.enableCommonDesktopSettings = lib.mkEnableOption "common hw settings for desktops";
config = lib.mkIf isEnabled {
boot = {
kernelPackages = pkgs.linuxPackages_zen;
kernelParams = ["quiet" "udev.log_level=3"];

View file

@ -1,13 +1,20 @@
hostName: {
modulesCfg: {
modulesPath,
lib,
...
}: {
}: let
hostName = modulesCfg.hostName;
in {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
(builtins.toString ./. + "/${hostName}.nix")
./common-desktop.nix
];
options.my.modulesCfg.hostName = lib.mkOption {
type = lib.types.str;
};
config = {
networking.hostName = hostName;

View file

@ -1,9 +1,7 @@
{...}: {
imports = [
./common-desktop.nix
];
config = {
my.hardware.enableCommonDesktopSettings = true;
boot = {
initrd.availableKernelModules = ["xhci_pci" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci"];
initrd.kernelModules = [];

View file

@ -1,9 +1,7 @@
{...}: {
imports = [
./common-desktop.nix
];
config = {
my.hardware.enableCommonDesktopSettings = true;
boot = {
initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "sd_mod"]; # "usb_storage"
initrd.kernelModules = [];

View file

@ -6,10 +6,6 @@
}: let
cfg = config.my.server;
in {
imports = [
../_common
];
options.my.server = {
enable = lib.mkEnableOption "server role";
};

View file

@ -1,17 +1,16 @@
{...}: {
imports = [
./modules/desktop
(import ./modules/hardware "vinzenz-lpt")
(import ./modules {
hostName = "vinzenz-lpt";
enableDesktop = true;
})
];
config = {
my = {
desktop = {
enable = true;
gnome.enable = true;
vinzenz.enable = true;
gaming.enable = true;
};
my.desktop = {
gnome.enable = true;
vinzenz.enable = true;
gaming.enable = true;
};
# flatpak xdg-portal-kde crashes, otherwise this would be global

View file

@ -1,12 +1,13 @@
{pkgs, ...}: {
imports = [
./modules/desktop
(import ./modules/hardware "vinzenz-pc2")
(import ./modules {
hostName = "vinzenz-pc2";
enableDesktop = true;
})
];
config = {
my.desktop = {
enable = true;
kde.enable = true;
vinzenz.enable = true;
ronja.enable = true;