Add shared Nix configuration for machine setups

Introduces a shared configuration file to streamline machine-specific settings for NixOS deployments. This includes:

- Hostname configuration
- Common system packages (vim, git, htop)
- SSH service enablement
- Nginx setup with virtual host configuration
- Firewall rules for HTTP/HTTPS access

Updates machine-specific configurations to import shared settings, reducing redundancy and improving maintainability.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
This commit is contained in:
padreug 2025-10-08 16:46:52 +02:00
parent d6749ef0ba
commit ea697275ba

33
config/shared.nix Normal file
View file

@ -0,0 +1,33 @@
{ config, pkgs, hostName, ... }:
{
# Set hostname (passed as parameter)
networking.hostName = hostName;
# System packages
environment.systemPackages = with pkgs; [
vim
git
htop
];
# Enable SSH
services.openssh.enable = true;
# Enable and configure nginx
services.nginx = {
enable = true;
virtualHosts."${hostName}" = {
root = "/var/src/web-app-dist";
locations."/" = {
index = "index.html";
};
};
};
# Open firewall for HTTP/HTTPS
networking.firewall.allowedTCPPorts = [ 80 443 ];
# NixOS release version
system.stateVersion = "25.05";
}