split server desktop, move stuff

This commit is contained in:
Vinzenz Schroeter 2023-09-11 19:16:26 +02:00
parent 69026cb461
commit 5e9a74280e
19 changed files with 107 additions and 127 deletions

View file

@ -1,7 +0,0 @@
{lib, ...}: {
mkIfElse = p: yes: no:
lib.mkMerge [
(lib.mkIf p yes)
(lib.mkIf (!p) no)
];
}

View file

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

View file

@ -1,55 +0,0 @@
{
config,
pkgs,
...
}: let
cfg = config.my;
helpers = import ../helpers;
in {
imports = [
./home
./desktop
./i18n.nix
./nixpkgs.nix
];
config = {
networking = {
networkmanager.enable = true;
firewall.enable = true;
};
# Enable the OpenSSH daemon.
services.openssh = {
enable = true;
settings = {
# PermitRootLogin = "no"; # this is managed through authorized keys
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
};
};
systemd.extraConfig = ''
DefaultTimeoutStopSec=12s
'';
programs = {
zsh.enable = true;
git = {
enable = true;
package = pkgs.gitFull;
};
};
environment = {
pathsToLink = ["/share/zsh"];
systemPackages = with pkgs; [
lm_sensors
tldr
ncdu
];
};
};
}

View file

@ -7,8 +7,13 @@
cfg = config.my.desktop; cfg = config.my.desktop;
in { in {
imports = [ imports = [
<home-manager/nixos>
./gnome.nix ./gnome.nix
./kde.nix ./kde.nix
./i18n.nix
./nixpkgs.nix
./vinzenz.nix
./ronja.nix
]; ];
options.my.desktop = { options.my.desktop = {
@ -16,6 +21,9 @@ in {
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home-manager.useUserPackages = true;
home-manager.useGlobalPkgs = true;
services = { services = {
# Enable the X11 windowing system / wayland depending on DE # Enable the X11 windowing system / wayland depending on DE
xserver.enable = true; xserver.enable = true;
@ -23,7 +31,15 @@ in {
# Enable CUPS to print documents. # Enable CUPS to print documents.
printing.enable = true; printing.enable = true;
openssh.settings.PermitRootLogin = "no"; # Enable the OpenSSH daemon.
openssh = {
enable = true;
settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
};
};
}; };
# Enable sound with pipewire. # Enable sound with pipewire.
@ -46,7 +62,11 @@ in {
}; };
# unblock kde connect / gsconnect # unblock kde connect / gsconnect
networking.firewall = { networking = {
networkmanager.enable = true;
firewall.enable = true;
firewall = {
allowedTCPPortRanges = [ allowedTCPPortRanges = [
{ {
# KDE Connect # KDE Connect
@ -63,4 +83,28 @@ in {
]; ];
}; };
}; };
systemd.extraConfig = ''
DefaultTimeoutStopSec=12s
'';
programs = {
zsh.enable = true;
git = {
enable = true;
package = pkgs.gitFull;
};
};
environment = {
pathsToLink = ["/share/zsh"];
systemPackages = with pkgs; [
lm_sensors
tldr
ncdu
];
};
};
} }

View file

@ -4,7 +4,9 @@
lib, lib,
... ...
}: let }: let
cfg = config.my.gnome; desktopCfg = config.my.desktop;
cfg = desktopCfg.gnome;
applyGnomeUserSettings = { applyGnomeUserSettings = {
home.packages = with pkgs; [ home.packages = with pkgs; [
gnome.gpaste gnome.gpaste
@ -17,7 +19,7 @@
}; };
}; };
in { in {
options.my.gnome = { options.my.desktop.gnome = {
enable = lib.mkEnableOption "gnome desktop"; enable = lib.mkEnableOption "gnome desktop";
}; };
@ -56,8 +58,8 @@ in {
]; ];
home-manager.users = { home-manager.users = {
vinzenz = lib.mkIf config.my.home.vinzenz.enable applyGnomeUserSettings; vinzenz = lib.mkIf desktopCfg.vinzenz.enable applyGnomeUserSettings;
ronja = lib.mkIf config.my.home.ronja.enable applyGnomeUserSettings; ronja = lib.mkIf desktopCfg.ronja.enable applyGnomeUserSettings;
}; };
}; };
} }

View file

@ -4,7 +4,8 @@
lib, lib,
... ...
}: let }: let
cfg = config.my.kde; desktopCfg = config.my.desktop;
cfg = desktopCfg.kde;
applyKdeUserSettings = { applyKdeUserSettings = {
home = { home = {
@ -17,7 +18,7 @@
}; };
}; };
in { in {
options.my.kde = { options.my.desktop.kde = {
enable = lib.mkEnableOption "KDE desktop"; enable = lib.mkEnableOption "KDE desktop";
}; };
@ -56,8 +57,8 @@ in {
}; };
home-manager.users = { home-manager.users = {
vinzenz = lib.mkIf config.my.home.vinzenz.enable applyKdeUserSettings; vinzenz = lib.mkIf desktopCfg.vinzenz.enable applyKdeUserSettings;
ronja = lib.mkIf config.my.home.ronja.enable applyKdeUserSettings; ronja = lib.mkIf desktopCfg.ronja.enable applyKdeUserSettings;
}; };
}; };
} }

View file

@ -5,9 +5,9 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.my.home.ronja; cfg = config.my.desktop.ronja;
in { in {
options.my.home.ronja = { options.my.desktop.ronja = {
enable = lib.mkEnableOption "user ronja"; enable = lib.mkEnableOption "user ronja";
}; };
@ -21,7 +21,6 @@ in {
}; };
# home manager # home manager
my.home.enable = true;
home-manager.users.ronja = { home-manager.users.ronja = {
config, config,
pkgs, pkgs,

View file

@ -4,9 +4,9 @@
lib, lib,
... ...
}: let }: let
cfg = config.my.home.vinzenz; cfg = config.my.desktop.vinzenz;
in { in {
options.my.home.vinzenz = { options.my.desktop.vinzenz = {
enable = lib.mkEnableOption "user vinzenz"; enable = lib.mkEnableOption "user vinzenz";
}; };
@ -20,7 +20,6 @@ in {
}; };
# home manager # home manager
my.home.enable = true;
home-manager.users.vinzenz = { home-manager.users.vinzenz = {
config, config,
pkgs, pkgs,

View file

@ -1,25 +0,0 @@
{
config,
pkgs,
lib,
...
}: let
cfg = config.my.home;
in {
imports =
[
./vinzenz.nix
./ronja.nix
# enable home manager
]
++ lib.optional (builtins.pathExists <home-manager/nixos>) <home-manager/nixos>;
options.my.home = {
enable = lib.mkEnableOption "my home management";
};
config = lib.mkIf cfg.enable {
home-manager.useUserPackages = true;
home-manager.useGlobalPkgs = true;
};
}

View file

@ -14,13 +14,25 @@ in {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
services = { services = {
services.openssh.enable = true; # Enable the OpenSSH daemon.
services.openssh = {
enable = true;
settings = {
# PermitRootLogin = "no"; # this is managed through authorized keys
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
};
};
}; };
programs = { programs = {
git.enable = true;
zsh.enable = true;
}; };
networking.firewall = { networking.firewall = {
enable = true;
allowedTCPPortRanges = [ allowedTCPPortRanges = [
{ {
# ssh # ssh
@ -29,5 +41,11 @@ in {
} }
]; ];
}; };
environment = {
systemPackages = with pkgs; [
ncdu
];
};
}; };
} }

View file

@ -1,13 +1,16 @@
{...}: { {...}: {
imports = [ imports = [
./modules ./modules/desktop
(import ./hardware "vinzenz-lpt") (import ./modules/hardware "vinzenz-lpt")
]; ];
config = { config = {
my = { my = {
desktop = {
enable = true;
gnome.enable = true; gnome.enable = true;
home.vinzenz.enable = true; vinzenz.enable = true;
};
}; };
services.flatpak.enable = true; services.flatpak.enable = true;

View file

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