feat(luna): additional configuration

This commit is contained in:
Price Hiller 2023-10-27 23:02:52 -05:00
parent 2a6dae19d0
commit e2cd2b02aa
Signed by: Price
SSH Key Fingerprint: SHA256:Y4S9ZzYphRn1W1kbJerJFO6GGsfu9O70VaBSxJO7dF8
12 changed files with 94 additions and 34 deletions

View File

@ -4,9 +4,10 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
impermanence.url = "github:nix-community/impermanence";
agenix.url = "github:ryantm/agenix";
};
outputs = inputs @ { self, nixpkgs, impermanence, ... }: rec {
outputs = inputs @ { self, nixpkgs, impermanence, agenix, ... }: rec {
imports = [
./configuration.nix
];
@ -16,6 +17,7 @@
modules = [
./hosts/orion
impermanence.nixosModules.impermanence
agenix.nixosModules.default
];
};
nixosConfigurations.luna = nixpkgs.lib.nixosSystem {
@ -24,6 +26,7 @@
modules = [
./hosts/luna
impermanence.nixosModules.impermanence
agenix.nixosModules.default
];
};
};

View File

@ -1,7 +1,12 @@
{ config, pkgs, lib, ... }:
{
# imports = [ ];
# ...
# TODO: Actually get these configs in place
imports = [
./services
./nix.nix
./networking.nix
./programs.nix
./user.nix
./virtualisation.nix
];
}

View File

@ -3,8 +3,8 @@
let
hostname = "luna";
networks_dhcp_use_dns = "no";
networks_dhcp = "yes";
networks_multicast_dns = "yes";
networks_dhcp = "ipv4";
networks_multicast_dns = "no";
networks_ipv6_privacy = "yes";
networks_ipv6_accept_ra = "yes";
networks_network_config = {
@ -40,7 +40,7 @@ in
};
};
"10-ethernet" = {
matchConfig.name = [ "en*" "eth*" ];
matchConfig.Name = [ "en*" "eth*" ];
networkConfig = networks_network_config;
dhcpV4Config = {
RouteMetric = 100;
@ -52,7 +52,7 @@ in
};
};
"10-wwan" = {
matchConfig.name = [ "ww*" ];
matchConfig.Name = [ "ww*" ];
networkConfig = networks_network_config;
dhcpV4Config = {
RouteMetric = 700;
@ -70,7 +70,7 @@ in
services.resolved = {
enable = true;
dnssec = "allow-downgrade";
domains = resolved_nameservers;
domains = [ "~." ];
fallbackDns = resolved_fallback_nameservers;
llmnr = "resolve";
extraConfig = ''
@ -78,11 +78,19 @@ in
DNSOverTLS=yes
CacheFromLocalhost=no
Cache=yes
Domains=~.
'';
};
networking = {
nameservers = resolved_nameservers;
nftables.enable = true;
firewall = {
enable = true;
allowedTCPPorts = [
80
443
2200
];
};
hostName = "${hostname}";
};
}

View File

@ -12,6 +12,10 @@
};
environment.systemPackages = with pkgs; [
"vim"
vim
curl
git
jq
rsync
];
}

View File

@ -0,0 +1,9 @@
{ ... }:
{
imports = [
./openssh.nix
./fail2ban.nix
# ./gitlab.nix
# ./nginx.nix
];
}

View File

@ -0,0 +1,7 @@
{ ... }:
{
services.fail2ban = {
enable = true;
maxretry = 5;
};
}

View File

@ -0,0 +1,15 @@
{ pkgs, ... }:
{
services.gitlab = {
enable = true;
port = 80;
databasePasswordFile = pkgs.writeText "dbPassword" "test123";
initialRootPasswordFile = pkgs.writeText "rootPassword" "test123";
secrets = rec {
secretFile = pkgs.writeText "secret" "Aig5zaic";
otpFile = pkgs.writeText "otpsecret" "Riew9mue";
dbFile = pkgs.writeText "dbsecret" "we2quaeZ";
jwsFile = pkgs.runCommand "oidcKeyBase" { } "${pkgs.openssl}/bin/openssl genrsa 2048 > $out";
};
};
}

View File

@ -0,0 +1,22 @@
{ config, ... }:
{
services.nginx = {
enable = true;
recommendedProxySettings = true;
recommendedOptimisation = true;
recommendedGzipSettings = true;
recommendedTlsSettings = true;
virtualHosts = {
"gitlab.orion-technologies.io" = {
locations."/".proxyPass = "http://unix:/var/gitlab/state/tmp/sockets/gitlab.socket";
forceSSL = true;
enableACME = true;
root = "/var/www/gitlab";
};
};
};
security.acme = {
acceptTerms = true;
defaults.email = "price@orion-technologies.io";
};
}

View File

@ -1,12 +1,10 @@
{ pkgs, ... }:
{ ... }:
{
services.openssh = {
enable = true;
settings = {
passwordAuthentication = false;
PasswordAuthentication = false;
PermitRootLogin = "prohibit-password";
startWhenNeeded = true;
};
ports = [
2200

View File

@ -1,8 +1,5 @@
{ pkgs, user, ... }:
let
user = "price";
in
{
users.users = {
root = {

View File

@ -0,0 +1,7 @@
{ ... }:
{
virtualisation.docker = {
enable = true;
autoPrune.enable = true;
};
}

View File

@ -38,21 +38,6 @@
"/etc/machine-id"
"/etc/nix/id_rsa"
];
users.price = {
directories = [
"Git"
"ISOs"
"Downloads"
"Keep"
"Notes"
".local/share"
{ directory = ".gnupg"; mode = "0700"; }
{ directory = ".ssh"; mode = "0700"; }
];
files = [
".zsh_history"
];
};
};
};
}