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 = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
impermanence.url = "github:nix-community/impermanence"; 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 = [ imports = [
./configuration.nix ./configuration.nix
]; ];
@ -16,6 +17,7 @@
modules = [ modules = [
./hosts/orion ./hosts/orion
impermanence.nixosModules.impermanence impermanence.nixosModules.impermanence
agenix.nixosModules.default
]; ];
}; };
nixosConfigurations.luna = nixpkgs.lib.nixosSystem { nixosConfigurations.luna = nixpkgs.lib.nixosSystem {
@ -24,6 +26,7 @@
modules = [ modules = [
./hosts/luna ./hosts/luna
impermanence.nixosModules.impermanence impermanence.nixosModules.impermanence
agenix.nixosModules.default
]; ];
}; };
}; };

View File

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

View File

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

View File

@ -12,6 +12,10 @@
}; };
environment.systemPackages = with pkgs; [ 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 = { services.openssh = {
enable = true; enable = true;
settings = { settings = {
passwordAuthentication = false; PasswordAuthentication = false;
PermitRootLogin = "prohibit-password"; PermitRootLogin = "prohibit-password";
startWhenNeeded = true;
}; };
ports = [ ports = [
2200 2200

View File

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

View File

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

View File

@ -38,21 +38,6 @@
"/etc/machine-id" "/etc/machine-id"
"/etc/nix/id_rsa" "/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"
];
};
}; };
}; };
} }