From f174b610d830020c0e5cb92cb56489e04cf0fe4b Mon Sep 17 00:00:00 2001 From: Chris Kruining Date: Sun, 2 Mar 2025 13:54:21 +0100 Subject: [PATCH] add ssh for server, add vscodium for pc, refactor hostnames --- hosts/chris-laptop/default.nix | 3 ++- hosts/chris-pc/default.nix | 4 +++- hosts/chris-server/default.nix | 4 +++- hosts/mam-laptop/default.nix | 3 ++- modules/desktop/editors/vscodium.nix | 18 ++++++++++++++++++ modules/networking/ssh.nix | 27 +++++++++++++++++++++++++++ modules/system/networking.nix | 4 ---- 7 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 modules/desktop/editors/vscodium.nix create mode 100644 modules/networking/ssh.nix diff --git a/hosts/chris-laptop/default.nix b/hosts/chris-laptop/default.nix index b578d19..23f2005 100644 --- a/hosts/chris-laptop/default.nix +++ b/hosts/chris-laptop/default.nix @@ -2,6 +2,8 @@ { imports = [ ./hardware-configuration.nix ]; + networking.hostName = "chris-laptop"; + modules = { themes = { enable = true; @@ -38,4 +40,3 @@ }; }; } - diff --git a/hosts/chris-pc/default.nix b/hosts/chris-pc/default.nix index 72315cc..0d7980d 100644 --- a/hosts/chris-pc/default.nix +++ b/hosts/chris-pc/default.nix @@ -13,6 +13,8 @@ options = [ "rw" "uid=chris" ]; }; + networking.hostName = "chris-pc"; + modules = { themes = { enable = true; @@ -54,6 +56,7 @@ editors = { default = "nano"; + vscodium.enable = true; zed.enable = true; nvim.enable = true; nano.enable = true; @@ -72,4 +75,3 @@ }; }; } - diff --git a/hosts/chris-server/default.nix b/hosts/chris-server/default.nix index 3c2d145..45f5bed 100644 --- a/hosts/chris-server/default.nix +++ b/hosts/chris-server/default.nix @@ -7,6 +7,8 @@ fsType = "ext4"; }; + networking.hostName = "chris-server"; + modules = { themes = { enable = true; @@ -15,6 +17,7 @@ }; networking.enable = true; + networking.ssh.enable = true; services = { enable = true; @@ -43,4 +46,3 @@ }; }; } - diff --git a/hosts/mam-laptop/default.nix b/hosts/mam-laptop/default.nix index 73ab25a..319a8b1 100644 --- a/hosts/mam-laptop/default.nix +++ b/hosts/mam-laptop/default.nix @@ -2,6 +2,8 @@ { imports = [ ./hardware-configuration.nix ]; + networking.hostName = "mam-laptop"; + modules = { themes = { enable = true; @@ -37,4 +39,3 @@ }; }; } - diff --git a/modules/desktop/editors/vscodium.nix b/modules/desktop/editors/vscodium.nix new file mode 100644 index 0000000..73e5889 --- /dev/null +++ b/modules/desktop/editors/vscodium.nix @@ -0,0 +1,18 @@ +{ config, options, lib, pkgs, ... }: +let + inherit (lib.meta) getExe; + inherit (lib.modules) mkIf; + + cfg = config.modules.desktop.editors.vscodium; +in +{ + options.modules.desktop.editors.vscodium = let + inherit (lib.options) mkEnableOption; + in { enable = mkEnableOption "vscodium"; }; + + config = mkIf cfg.enable { + user.packages = attrValues { + inherit (pkgs) vscodium; + }; + }; +} diff --git a/modules/networking/ssh.nix b/modules/networking/ssh.nix new file mode 100644 index 0000000..7d254c9 --- /dev/null +++ b/modules/networking/ssh.nix @@ -0,0 +1,27 @@ +{ config, options, lib, pkgs, ... }: +let + inherit (lib.modules) mkIf; +in +{ + options.modules.networking.ssh = let + inherit (lib.options) mkEnableOption; + in { + enable = mkEnableOption "enable ssh"; + }; + + config = mkIf config.modules.networking.ssh.enable { + services.openssh = { + enable = true; + openFirewall = true; + ports = [ 22 ]; + settings = { + PassswordAuthentication = true; + AllowUsers = [ "chris", "root" ]; + UseDns = true; + UsePAM = true; + PermitRootLogin = "prohibit-password"; + PermitEmptyPasswords = "no"; + }; + }; + }; +} diff --git a/modules/system/networking.nix b/modules/system/networking.nix index 605476a..6e5b8c3 100644 --- a/modules/system/networking.nix +++ b/modules/system/networking.nix @@ -1,7 +1,3 @@ { pkgs, ... }: { - networking = { - hostName = "chris-pc"; - networkmanager.enable = true; - }; }