This commit is contained in:
2026-05-31 10:56:54 +01:00
parent 73f436b560
commit fb5aa85711
9 changed files with 103 additions and 109 deletions

View File

@@ -1,39 +0,0 @@
{ config, lib, pkgs, ... }:
{
# Shared users
users.mutableUsers = false;
users.users.phoenix = {
isNormalUser = true;
description = "Phoenix";
extraGroups = [ "wheel" ];
shell = pkgs.bash;
home = "/home/phoenix";
createHome = true;
useDefaultShell = true;
};
# Shared packages
environment.systemPackages = with pkgs; [
nano
vim
git
curl
wget
sops
age
];
# Shared services
services.openssh.enable = true;
services.openssh.permitRootLogin = "no";
# Timezone and locale
time.timeZone = "Europe/London";
i18n.defaultLocale = "en_US.UTF-8";
console.keyMap = "uk";
# Firewall
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [ 22 ]; # SSH
}

View File

@@ -1,10 +1,9 @@
{ {
description = "Colmena Remote NixOS Management"; description = "NixOS at Home - Colmena Remote Management";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-22.11"; nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-22.11";
colmena.url = "github:zhaofengli/colmena"; colmena.url = "github:zhaofengli/colmena";
}; };
@@ -16,7 +15,6 @@
system = "x86_64-linux"; system = "x86_64-linux";
overlays = []; overlays = [];
}; };
specialArgs = { specialArgs = {
inherit inputs; inherit inputs;
}; };
@@ -25,4 +23,4 @@
blade = import ./hosts/blade; blade = import ./hosts/blade;
}; };
}; };
} }

View File

@@ -9,39 +9,26 @@
{ {
deployment = { deployment = {
targetHost = "192.168.1.69"; # also supports an IP address targetHost = "192.168.1.69";
targetPort = 22; targetPort = 22;
targetUser = "phoenix"; targetUser = "phoenix";
buildOnTarget = true; buildOnTarget = true;
keys.phoenix.keyFile = "/home/nixos/.ssh/id_ed25519.pub"; keys.phoenix.keyFile = "/home/nixos/.ssh/id_ed25519.pub";
tags = [ tags = [
"homelab" "homelab"
]; ];
}; };
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
../../modules/common.nix
]; ];
# boot.loader.grub.enable = true;
networking.useDHCP = false;
networking.interfaces.eth0.useDHCP = true; networking.interfaces.eth0.useDHCP = true;
time.timeZone = "America/New_York";
networking.hostName = "blade"; networking.hostName = "blade";
services.xserver.xkb.layout = "uk";
i18n.defaultLocale = "en_US.UTF-8";
nix.settings.trusted-users = [
"root"
"@wheel"
];
users.users.phoenix = { users.users.phoenix = {
isNormalUser = true; extraGroups = [ "wheel" "networkmanager" ];
extraGroups = [
"wheel"
"networkmanager"
];
home = "/home/phoenix"; home = "/home/phoenix";
packages = with pkgs; [ packages = with pkgs; [
vim vim
@@ -55,60 +42,13 @@
}; };
users.users.deploy = { users.users.deploy = {
isNormalUser = true; extraGroups = [ "wheel" "networkmanager" ];
extraGroups = [
"wheel"
"networkmanager"
];
home = "/home/deploy"; home = "/home/deploy";
# packages = with pkgs; [
# vim
# tree
# lego
# ];
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"sk-ecdsa-sha2-nistp256@openssh.com AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBMPNyAyMrqlI3tUI39TqcgYBciIC+aY2UNAunFqylhhzTVA14rluMjFqHf9HKs9SHZ52nLEV58/BxlnMeMtRc+cAAAAEc3NoOg== phoenix@DESKTOP-1A9MAJO" "sk-ecdsa-sha2-nistp256@openssh.com AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBMPNyAyMrqlI3tUI39TqcgYBciIC+aY2UNAunFqylhhzTVA14rluMjFqHf9HKs9SHZ52nLEV58/BxlnMeMtRc+cAAAAEc3NoOg== phoenix@DESKTOP-1A9MAJO"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMoM3FANeYtWLJIiTL+nU0XzZft2psiSgbCmNfQZBXgy nixos@nixos" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMoM3FANeYtWLJIiTL+nU0XzZft2psiSgbCmNfQZBXgy nixos@nixos"
]; ];
}; };
# systemd.user.enable = false; networking.firewall.allowedTCPPorts = [ 22 80 443 ];
security.sudo.extraRules = [
{
users = [ "phoenix" ];
commands = [
{
command = "ALL";
options = [ "NOPASSWD" ]; # "SETENV" # Adding the following could be a good idea
}
];
}
];
environment.systemPackages = with pkgs; [
inetutils
mtr
sysstat
dig
openssl
];
services.openssh = {
enable = true;
settings.PermitRootLogin = "yes";
};
networking.firewall.allowedTCPPorts = [
22
80
443
];
# networking.firewall.allowedUDPPorts = [ ... ];
networking.firewall.enable = true;
networking.usePredictableInterfaceNames = false;
# Bootloader
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
system.stateVersion = "25.11";
} }

11
modules/common.nix Normal file
View File

@@ -0,0 +1,11 @@
{ config, lib, pkgs, ... }:
{
imports = [
./common/users.nix
./common/packages.nix
./common/services.nix
./common/networking.nix
./common/system.nix
];
}

View File

@@ -0,0 +1,15 @@
{ config, lib, pkgs, ... }:
{
time.timeZone = "Europe/London";
i18n.defaultLocale = "en_US.UTF-8";
console.keyMap = "uk";
networking = {
firewall.enable = true;
firewall.allowedTCPPorts = [ 22 ]; # SSH
hostName = config.networking.hostName or "nixos";
useDHCP = false;
usePredictableInterfaceNames = false;
};
}

View File

@@ -0,0 +1,18 @@
{ config, lib, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
nano
vim
git
curl
wget
sops
age
inetutils
mtr
sysstat
dig
openssl
];
}

View File

@@ -0,0 +1,6 @@
{ config, lib, pkgs, ... }:
{
services.openssh.enable = true;
services.openssh.permitRootLogin = "no";
}

10
modules/common/system.nix Normal file
View File

@@ -0,0 +1,10 @@
{ config, lib, pkgs, ... }:
{
system.stateVersion = "25.11";
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
services.xserver.xkb.layout = "uk";
}

35
modules/common/users.nix Normal file
View File

@@ -0,0 +1,35 @@
{ config, lib, pkgs, ... }:
{
users.mutableUsers = false;
users.users.phoenix = {
isNormalUser = true;
description = "Phoenix";
extraGroups = [ "wheel" "networkmanager" ];
shell = pkgs.bash;
home = "/home/phoenix";
createHome = true;
useDefaultShell = true;
};
users.users.deploy = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" ];
home = "/home/deploy";
};
security.sudo.extraRules = [
{
users = [ "phoenix" ];
commands = [
{
command = "ALL";
options = [ "NOPASSWD" ];
}
];
}
];
nix.settings.trusted-users = [ "root" "@wheel" ];
}