add suggested changes via NixOS discord

This commit is contained in:
randomuser 2023-07-08 16:22:38 -05:00
parent c7b00fac22
commit 11deac87c5
3 changed files with 198 additions and 227 deletions

View File

@ -1,16 +1,9 @@
{ lib, config, pkgs, ... }: { lib, config, pkgs, ... }:
let
hostname = "virtbox";
isVirtbox = hostname == "virtbox";
isNetbox = hostname == "netbox";
in
{ {
imports = imports =
[ [
./hardware-configuration.nix # include the results of the hardware scan ./hardware-configuration.nix # include the results of the hardware scan
./virtbox.nix
./netbox.nix
]; ];
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
@ -35,13 +28,4 @@ in
system.copySystemConfiguration = true; system.copySystemConfiguration = true;
system.stateVersion = "23.05"; # don't change this, lol system.stateVersion = "23.05"; # don't change this, lol
# branch and enable different capabilities based on the system
test = lib.mkIf isVirtbox {
services.virtbox.enable = true;
};
test_ = lib.mkIf isNetbox {
services.netbox.enable = true;
};
} }

View File

@ -1,134 +1,127 @@
{ lib, config, pkgs, ... }: { lib, config, pkgs, ... }:
let {
cfg = config.services.netbox;
in {
options.serviecs.netbox = {
enable = lib.mkEnableOption "netbox configs";
};
imports = imports =
[ [
./mail.nix ./mail.nix
./configuration.nix
]; ];
config = lib.mkIf cfg.enable { boot.loader.grub.enable = true;
boot.loader.grub.enable = true; boot.loader.grub.device = "/dev/vda";
boot.loader.grub.device = "/dev/vda";
networking.hostName = "netbox"; networking.hostName = "netbox";
users.users.useracc = { users.users.useracc = {
isNormalUser = true; isNormalUser = true;
extraGroups = [ "wheel" "docker" ]; extraGroups = [ "wheel" "docker" ];
};
environment.systemPackages = with pkgs; [
# nothing more needed, at the moment
];
services.openssh = {
enable = true;
ports = [55555];
};
networking.usePredictableInterfaceNames = false;
services.nixosmail.enable = true;
services.gitea = {
enable = true;
appName = "crappy code"; # Give the site a name
database = {
type = "postgres";
passwordFile = "/etc/gittea-pass";
};
settings.server = {
DOMAIN = "git.beepboop.systems";
ROOT_URL = "https://git.beepboop.systems/";
HTTP_PORT = 3001;
};
};
services.postgresql = {
enable = true; # Ensure postgresql is enabled
authentication = ''
local gitea all ident map=gitea-users
'';
identMap = # Map the gitea user to postgresql
''
gitea-users gitea gitea
'';
};
services.nginx.enable = true;
services.nginx.clientMaxBodySize = "100m";
services.nginx.virtualHosts."beepboop.systems" = {
forceSSL = true;
enableACME = true;
root = "/var/www/beepboop.systems";
};
services.nginx.virtualHosts."git.beepboop.systems" = {
forceSSL = true;
enableACME = true;
locations."/".proxyPass = "http://localhost:3001";
};
services.nginx.virtualHosts."paperless.beepboop.systems" = {
forceSSL = true;
enableACME = true;
locations."/".proxyPass = "http://localhost:3004";
};
services.nginx.virtualHosts."bitwarden.beepboop.systems" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://127.0.0.1:8000";
};
};
services.nginx.virtualHosts."skillissue.agency" = {
forceSSL = true;
enableACME = true;
root = "/var/www/skillissue.agency";
};
security.acme = {
acceptTerms = true;
email = "nickforanick@protonmail.com";
};
services.roundcube = {
enable = true;
# this is the url of the vhost, not necessarily the same as the fqdn of
# the mailserver
hostName = "cube.beepboop.systems";
extraConfig = ''
# starttls needed for authentication, so the fqdn required to match
# the certificate
$config['smtp_server'] = "tls://${config.mailserver.fqdn}";
$config['smtp_user'] = "%u";
$config['smtp_pass'] = "%p";
'';
};
services.paperless = {
enable = true;
passwordFile = "/etc/paperless-password";
port = 3004;
address = "localhost";
extraConfig = {
PAPERLESS_URL = "https://paperless.beepboop.systems";
};
};
services.vaultwarden.enable = true;
# Open ports in the firewall.
networking.firewall.enable = false;
networking.firewall.allowedTCPPorts = [ 55555 80 443 ];
}; };
environment.systemPackages = with pkgs; [
# nothing more needed, at the moment
];
services.openssh = {
enable = true;
ports = [55555];
};
networking.usePredictableInterfaceNames = false;
services.nixosmail.enable = true;
services.gitea = {
enable = true;
appName = "crappy code"; # Give the site a name
database = {
type = "postgres";
passwordFile = "/etc/gittea-pass";
};
settings.server = {
DOMAIN = "git.beepboop.systems";
ROOT_URL = "https://git.beepboop.systems/";
HTTP_PORT = 3001;
};
};
services.postgresql = {
enable = true; # Ensure postgresql is enabled
authentication = ''
local gitea all ident map=gitea-users
'';
identMap = # Map the gitea user to postgresql
''
gitea-users gitea gitea
'';
};
services.nginx.enable = true;
services.nginx.clientMaxBodySize = "100m";
services.nginx.virtualHosts."beepboop.systems" = {
forceSSL = true;
enableACME = true;
root = "/var/www/beepboop.systems";
};
services.nginx.virtualHosts."git.beepboop.systems" = {
forceSSL = true;
enableACME = true;
locations."/".proxyPass = "http://localhost:3001";
};
services.nginx.virtualHosts."paperless.beepboop.systems" = {
forceSSL = true;
enableACME = true;
locations."/".proxyPass = "http://localhost:3004";
};
services.nginx.virtualHosts."bitwarden.beepboop.systems" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://127.0.0.1:8000";
};
};
services.nginx.virtualHosts."skillissue.agency" = {
forceSSL = true;
enableACME = true;
root = "/var/www/skillissue.agency";
};
security.acme = {
acceptTerms = true;
email = "nickforanick@protonmail.com";
};
services.roundcube = {
enable = true;
# this is the url of the vhost, not necessarily the same as the fqdn of
# the mailserver
hostName = "cube.beepboop.systems";
extraConfig = ''
# starttls needed for authentication, so the fqdn required to match
# the certificate
$config['smtp_server'] = "tls://${config.mailserver.fqdn}";
$config['smtp_user'] = "%u";
$config['smtp_pass'] = "%p";
'';
};
services.paperless = {
enable = true;
passwordFile = "/etc/paperless-password";
port = 3004;
address = "localhost";
extraConfig = {
PAPERLESS_URL = "https://paperless.beepboop.systems";
};
};
services.vaultwarden.enable = true;
# Open ports in the firewall.
networking.firewall.enable = false;
networking.firewall.allowedTCPPorts = [ 55555 80 443 ];
} }

View File

@ -1,115 +1,109 @@
{ lib, config, pkgs, ...}: { lib, config, pkgs, ...}:
let let
cfg = config.services.virtbox;
home-manager = builtins.fetchTarball { home-manager = builtins.fetchTarball {
url = "https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz"; url = "https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz";
sha256 = "0dfshsgj93ikfkcihf4c5z876h4dwjds998kvgv7sqbfv0z6a4bc"; sha256 = "0dfshsgj93ikfkcihf4c5z876h4dwjds998kvgv7sqbfv0z6a4bc";
}; };
in { in {
options.services.virtbox = {
enable = lib.mkEnableOption "virtbox configs";
};
imports = [ imports = [
(import "${home-manager}/nixos") (import "${home-manager}/nixos")
./configuration.nix
]; ];
config = lib.mkIf cfg.enable { boot.loader.grub.enable = true;
boot.loader.grub.enable = true; boot.loader.grub.device = "/dev/vda";
boot.loader.grub.device = "/dev/vda";
networking.hostName = "virtbox"; networking.hostName = "virtbox";
services.xserver = { services.xserver = {
enable = true; enable = true;
libinput.enable = true; libinput.enable = true;
layout = "us"; layout = "us";
# we're going to be pulling a sneaky # we're going to be pulling a sneaky
# we don't actually use startx, it just gets lightdm out of the way # we don't actually use startx, it just gets lightdm out of the way
displayManager.startx.enable = true; displayManager.startx.enable = true;
}; };
sound.enable = true; sound.enable = true;
hardware.pulseaudio.enable = true; hardware.pulseaudio.enable = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
sx sx
(pkgs.callPackage ./builds/utils.nix {}) (pkgs.callPackage ./builds/utils.nix {})
];
users.users.usr = {
isNormalUser = true;
extraGroups = [ "wheel" ];
packages = with pkgs; [
firefox
tree
bspwm
sxhkd
]; ];
};
users.users.usr = {
isNormalUser = true;
extraGroups = [ "wheel" ];
packages = with pkgs; [
firefox
tree
bspwm
sxhkd
];
};
# honking impure, but who's counting anyway? # honking impure, but who's counting anyway?
system.activationScripts.test-script.text = '' system.activationScripts.test-script.text = ''
#!${pkgs.bash}/bin/bash #!${pkgs.bash}/bin/bash
if [ "$(${pkgs.coreutils}/bin/whoami)" = "usr"]; then if [ "$(${pkgs.coreutils}/bin/whoami)" = "usr"]; then
${pkgs.coreutils}/bin/mkdir -p /home/usr/git ${pkgs.coreutils}/bin/mkdir -p /home/usr/git
${pkgs.git}/bin/git https://git.beepboop.systems/rndusr/dot /home/usr/git/dot ${pkgs.git}/bin/git https://git.beepboop.systems/rndusr/dot /home/usr/git/dot
fi fi
''; '';
home-manager.users.usr.home = { home-manager.users.usr.home = {
stateVersion = "23.05"; stateVersion = "23.05";
file = { file = {
".config/bash" = { ".config/bash" = {
source = ./config/bash; source = ./config/bash;
recursive = true; recursive = true;
}; };
".config/bspwm" = { ".config/bspwm" = {
source = ./config/bspwm; source = ./config/bspwm;
recursive = true; recursive = true;
}; };
".config/git" = { ".config/git" = {
source = ./config/git; source = ./config/git;
recursive = true; recursive = true;
}; };
".config/htop" = { ".config/htop" = {
source = ./config/htop; source = ./config/htop;
recursive = true; recursive = true;
}; };
".config/nvim" = { ".config/nvim" = {
source = ./config/nvim; source = ./config/nvim;
recursive = true; recursive = true;
}; };
".config/python" = { ".config/python" = {
source = ./config/python; source = ./config/python;
recursive = true; recursive = true;
}; };
".config/sx" = { ".config/sx" = {
source = ./config/sx; source = ./config/sx;
recursive = true; recursive = true;
}; };
".config/sxhkd" = { ".config/sxhkd" = {
source = ./config/sxhkd; source = ./config/sxhkd;
recursive = true; recursive = true;
}; };
".config/tridactyl" = { ".config/tridactyl" = {
source = ./config/tridactyl; source = ./config/tridactyl;
recursive = true; recursive = true;
}; };
".config/zathura" = { ".config/zathura" = {
source = ./config/zathura; source = ./config/zathura;
recursive = true; recursive = true;
}; };
".local/share/wallpapers" = { ".local/share/wallpapers" = {
source = ./wallpapers; source = ./wallpapers;
recursive = true; recursive = true;
};
}; };
}; };
}; };