Compare commits
4 commits
e9a1b42e61
...
0bbbe9a293
Author | SHA1 | Date | |
---|---|---|---|
|
0bbbe9a293 | ||
|
c3d019a46e | ||
|
01ad8403a1 | ||
|
2cdcb2b6e7 |
29
modules/nixos/services/openssh/default.nix
Normal file
29
modules/nixos/services/openssh/default.nix
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
namespace,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.${namespace}.services.openssh;
|
||||||
|
inherit (lib) mkIf mkEnableOption;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.${namespace}.services.openssh = {
|
||||||
|
enable = mkEnableOption "Enable SSH";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
services.openssh = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
PasswordAuthentication = false;
|
||||||
|
KbdInteractiveAuthentication = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.fail2ban = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
48
modules/nixos/services/remotebuild/default.nix
Normal file
48
modules/nixos/services/remotebuild/default.nix
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
namespace,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.${namespace}.services.remotebuild;
|
||||||
|
inherit (lib) mkIf mkEnableOption;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.${namespace}.services.remotebuild = {
|
||||||
|
enable = mkEnableOption "Enable remotebuild";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
users.users.remotebuild = {
|
||||||
|
isNormalUser = true;
|
||||||
|
createHome = false;
|
||||||
|
group = "remotebuild";
|
||||||
|
|
||||||
|
openssh.authorizedKeys.keys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJYZjG+XPNoVHVdCel5MK4mwvtoFCqDY1WMI1yoU71Rd root@yggdrasil"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
users.groups.remotebuild = { };
|
||||||
|
|
||||||
|
nix = {
|
||||||
|
nrBuildUsers = 64;
|
||||||
|
settings = {
|
||||||
|
trusted-users = [ "remotebuild" ];
|
||||||
|
|
||||||
|
min-free = 10 * 1024 * 1024;
|
||||||
|
max-free = 200 * 1024 * 1024;
|
||||||
|
|
||||||
|
max-jobs = "auto";
|
||||||
|
cores = 0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.nix-daemon.serviceConfig = {
|
||||||
|
MemoryAccounting = true;
|
||||||
|
MemoryMax = "90%";
|
||||||
|
OOMScoreAdjust = 500;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -4,6 +4,7 @@
|
||||||
lib,
|
lib,
|
||||||
modulesPath,
|
modulesPath,
|
||||||
namespace,
|
namespace,
|
||||||
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
@ -16,52 +17,19 @@ in
|
||||||
{
|
{
|
||||||
imports = with inputs.nixos-hardware.nixosModules; [
|
imports = with inputs.nixos-hardware.nixosModules; [
|
||||||
(modulesPath + "/installer/scan/not-detected.nix")
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
raspberry-pi-5
|
|
||||||
];
|
];
|
||||||
|
|
||||||
security.sudo.wheelNeedsPassword = false;
|
|
||||||
users.users.remotebuild = {
|
|
||||||
isNormalUser = true;
|
|
||||||
createHome = false;
|
|
||||||
group = "remotebuild";
|
|
||||||
|
|
||||||
openssh.authorizedKeys.keys = [
|
|
||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJYZjG+XPNoVHVdCel5MK4mwvtoFCqDY1WMI1yoU71Rd root@yggdrasil"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
users.groups.remotebuild = { };
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = {
|
nixpkgs.hostPlatform = {
|
||||||
system = "aarch64-linux";
|
system = "aarch64-linux";
|
||||||
};
|
};
|
||||||
|
|
||||||
nix = {
|
|
||||||
nrBuildUsers = 64;
|
|
||||||
settings = {
|
|
||||||
trusted-users = [ "remotebuild" ];
|
|
||||||
|
|
||||||
min-free = 10 * 1024 * 1024;
|
|
||||||
max-free = 200 * 1024 * 1024;
|
|
||||||
|
|
||||||
max-jobs = "auto";
|
|
||||||
cores = 0;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.services.nix-daemon.serviceConfig = {
|
|
||||||
MemoryAccounting = true;
|
|
||||||
MemoryMax = "90%";
|
|
||||||
OOMScoreAdjust = 500;
|
|
||||||
};
|
|
||||||
|
|
||||||
services.tailscale = {
|
services.tailscale = {
|
||||||
enable = true;
|
enable = true;
|
||||||
useRoutingFeatures = "server";
|
useRoutingFeatures = "server";
|
||||||
};
|
};
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
interfaces.wlan0 = {
|
interfaces.end0 = {
|
||||||
ipv4.addresses = [
|
ipv4.addresses = [
|
||||||
{
|
{
|
||||||
address = ipAddress;
|
address = ipAddress;
|
||||||
|
@ -70,6 +38,15 @@ in
|
||||||
];
|
];
|
||||||
useDHCP = true;
|
useDHCP = true;
|
||||||
};
|
};
|
||||||
|
interfaces.wlan0 = {
|
||||||
|
ipv4.addresses = [
|
||||||
|
{
|
||||||
|
address = "192.168.178.3";
|
||||||
|
prefixLength = 24;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
useDHCP = true;
|
||||||
|
};
|
||||||
defaultGateway = {
|
defaultGateway = {
|
||||||
address = "192.168.178.1";
|
address = "192.168.178.1";
|
||||||
interface = "wlan0";
|
interface = "wlan0";
|
||||||
|
@ -83,9 +60,7 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
firewall = {
|
||||||
|
|
||||||
networking.firewall = {
|
|
||||||
allowedTCPPorts = [
|
allowedTCPPorts = [
|
||||||
53
|
53
|
||||||
80
|
80
|
||||||
|
@ -94,6 +69,7 @@ in
|
||||||
53
|
53
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
services.adguardhome = {
|
services.adguardhome = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -135,6 +111,10 @@ in
|
||||||
"https://adguardteam.github.io/HostlistsRegistry/assets/filter_47.txt"
|
"https://adguardteam.github.io/HostlistsRegistry/assets/filter_47.txt"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
statistics = {
|
||||||
|
enabled = true;
|
||||||
|
interval = "8760h";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -165,17 +145,16 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services.openssh = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
PasswordAuthentication = false;
|
|
||||||
KbdInteractiveAuthentication = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
${namespace} = {
|
${namespace} = {
|
||||||
submodules.basics = enabled;
|
submodules.basics = enabled;
|
||||||
|
|
||||||
|
services = {
|
||||||
|
openssh = enabled;
|
||||||
|
remotebuild = enabled;
|
||||||
|
};
|
||||||
|
|
||||||
|
apps.cli-apps.helix.pkg = pkgs.helix;
|
||||||
|
|
||||||
system = {
|
system = {
|
||||||
# cachemiss for webkit gtk
|
# cachemiss for webkit gtk
|
||||||
hardware.networking.enable = mkForce false;
|
hardware.networking.enable = mkForce false;
|
||||||
|
|
|
@ -39,18 +39,6 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services.openssh = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
PasswordAuthentication = false;
|
|
||||||
KbdInteractiveAuthentication = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
services.fail2ban = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
enable = true;
|
enable = true;
|
||||||
recommendedProxySettings = true;
|
recommendedProxySettings = true;
|
||||||
|
@ -199,6 +187,7 @@ in
|
||||||
enable = true;
|
enable = true;
|
||||||
inherit sopsFile;
|
inherit sopsFile;
|
||||||
};
|
};
|
||||||
|
openssh = enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
security = {
|
security = {
|
||||||
|
|
Loading…
Reference in a new issue