refactor ssh and add WOL to laptop

This commit is contained in:
Kopatz
2023-11-16 18:28:18 +01:00
parent f37d03337f
commit b584dafa8c
8 changed files with 36 additions and 22 deletions

View File

@@ -66,17 +66,24 @@
]; ];
specialArgs = { specialArgs = {
## Custom variables (e.g. ip, interface, etc) ## Custom variables (e.g. ip, interface, etc)
vars = (import ./systems/server/userdata.nix); vars = (import ./systems/server/userdata.nix);
inherit inputs ; inherit inputs ;
}; };
}; };
nixosConfigurations."nix-laptop" = nixpkgs.lib.nixosSystem { nixosConfigurations."nix-laptop" = nixpkgs.lib.nixosSystem {
inherit system; inherit system;
specialArgs = {inherit inputs; }; specialArgs = {
## Custom variables (e.g. ip, interface, etc)
vars = (import ./systems/laptop/userdata.nix);
inherit inputs ;
};
modules = [ modules = [
./users/kopatz.nix ./users/kopatz.nix
# Todo: refactor file layout
./laptop/configuration.nix ./laptop/configuration.nix
./modules/virt-manager.nix ./modules/virt-manager.nix
./modules/ssh.nix
./modules/wake-on-lan.nix
nixos-hardware.nixosModules.dell-xps-15-7590-nvidia nixos-hardware.nixosModules.dell-xps-15-7590-nvidia
agenix.nixosModules.default agenix.nixosModules.default
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
@@ -84,10 +91,17 @@
}; };
nixosConfigurations."nix-laptop-no-gpu" = nixpkgs.lib.nixosSystem { nixosConfigurations."nix-laptop-no-gpu" = nixpkgs.lib.nixosSystem {
inherit system; inherit system;
specialArgs = {inherit inputs; }; specialArgs = {
## Custom variables (e.g. ip, interface, etc)
vars = (import ./systems/laptop/userdata.nix);
inherit inputs ;
};
modules = [ modules = [
./users/kopatz.nix ./users/kopatz.nix
./laptop/configuration.nix ./laptop/configuration.nix
./modules/virt-manager.nix
./modules/ssh.nix
./modules/wake-on-lan.nix
nixos-hardware.nixosModules.dell-xps-15-7590 nixos-hardware.nixosModules.dell-xps-15-7590
agenix.nixosModules.default agenix.nixosModules.default
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
@@ -95,7 +109,7 @@
}; };
nixosConfigurations."wsl" = nixpkgs.lib.nixosSystem { nixosConfigurations."wsl" = nixpkgs.lib.nixosSystem {
inherit system; inherit system;
specialArgs = { inherit inputs; }; specialArgs = {inherit inputs ;};
modules = [ modules = [
#"${nixpkgs}/nixos/modules/profiles/minimal.nix" #"${nixpkgs}/nixos/modules/profiles/minimal.nix"
./users/anon.nix ./users/anon.nix

View File

@@ -18,7 +18,6 @@ in
[ # Include the results of the hardware scan. [ # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
./modules/battery.nix ./modules/battery.nix
./modules/ssh.nix
#./modules/wireguard.nix #./modules/wireguard.nix
## -- set in flake.nix ## -- set in flake.nix
#<nixos-hardware/dell/xps/15-7590/nvidia> #<nixos-hardware/dell/xps/15-7590/nvidia>
@@ -99,7 +98,7 @@ in
]; ];
networking.firewall = { networking.firewall = {
enable = false; enable = true;
allowedTCPPortRanges = [ allowedTCPPortRanges = [
{ from = 1714; to = 1764; } # KDE Connect { from = 1714; to = 1764; } # KDE Connect
]; ];

View File

@@ -1,11 +0,0 @@
{
services.openssh = {
enable = true;
ports = [];
openFirewall = false;
settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
};
};
}

View File

@@ -7,9 +7,4 @@
settings.PermitRootLogin = "no"; settings.PermitRootLogin = "no";
settings.X11Forwarding = true; settings.X11Forwarding = true;
}; };
users.users.anon.openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDb14svyGa2WprTNrtaI5yRl9KP+wzmLueFsHQww0Y6D2CZ5ZEEwoGFg7PrjWzVa/tXYn5AO1ng5eMCRbZPjtX03of448HTAEV8B0BFV9BuemoIBf14TRZ6lhGfQvD7BlTVZ5jKGUUJBfRdf0CZ8Ed5dk77u0xGV8+p3dYAQXowOmOyYFiDg6baKQcLM5Pz2zVxK1GySehEJ4n7GYNjyv7hJhfWMbaE10rIB0V0TuM8yeYvBvIxfGfMzlm4izOHbuSYR1v6RCuQKn1JOQiYqAkYCsXG/4XssMXpl2KxGvp67OJNotIHzap8zRDr7KH8Sk8jHuBFCnqbxDEqzs72Qtan Kopatz@Kopatz-PC"
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCsicFT8H/XHR3c0nN6f3dmChxLlkIYalUEQPqP2qROkX7Na6cMXoFiRvegvVPBCgR+DKagp7G2fttZVZ51yBBZ4G/rzDMgKIFgTDNaDeyGWx2n2zCHM5/wletoqTU6ezOUKOEvOfpsZnpcUqVmYtxlrMpakItrtSO+5mawlTKiDTqtazxLfFuyQFzlXVfVcJacxEupd+Ilmp8Y/e8pp6+jGYZ9asNuQKuGDaCepkhsPEGq/cK9AqaATdx/F81H1metV+kf6A3eDlcyzZy+x41GSofiR6HFgUzYafe5uddMVtL7JIKHHPQVpMMqPxkD3tphozh0fq3C9v8aThcqkvoU9eFD7PcN+8U6guA6Qf7cysGXb3pnvrfSeKGlxxpUAxLcpHlJnP66c7/TVRe2buAYFQqykrmRmJfLwqpY2UHoshpcGTwULslEHCMC5/wgc3BPgVGUB148d7F36bS1jTJlRGqwzf712CKnwW122xTZawgybrr8A5Q/bSRFtpz5wys= kopatz@Kopatz-PC2"
];
} }

7
modules/wake-on-lan.nix Normal file
View File

@@ -0,0 +1,7 @@
{ config, pkgs, lib, vars, ... }:
let
interface = vars.interface;
in
{
networking.interfaces.${interface}.wakeOnLan.enable;
}

View File

@@ -0,0 +1,4 @@
{
interface = "enp0s31f6";
}

View File

@@ -44,5 +44,8 @@ in
packages = with pkgs; [ packages = with pkgs; [
firefox firefox
]; ];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFeP6qtVqE/gu72ZUZE8cdRi3INiUW9NqDR7SjXIzTw2 lukas"
];
}; };
} }

View File

@@ -48,5 +48,8 @@ in
librewolf librewolf
ungoogled-chromium ungoogled-chromium
]; ];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFeP6qtVqE/gu72ZUZE8cdRi3INiUW9NqDR7SjXIzTw2 lukas"
];
}; };
} }