dotfiles/provision/hosts/torus/configuration.nix

161 lines
3.9 KiB
Nix
Raw Normal View History

2023-07-23 14:38:24 -07:00
{ config, pkgs, user, lib, ... }:
{
imports = [
../../modules
./wireguard-server.nix
2023-10-07 02:11:46 -07:00
./samba-server.nix
./syncthing.nix
2023-11-09 15:44:24 -08:00
./obsidian-vault.nix
./share.nix
./rss.nix
./home-assistant
];
2023-07-23 14:38:24 -07:00
nix = {
package = pkgs.nixFlakes;
extraOptions = "experimental-features = nix-command flakes";
settings.auto-optimise-store = true;
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
};
# Add non-free packages
nixpkgs.config.allowUnfree = true;
nixpkgs.overlays = import ../../lib/overlays.nix;
2023-07-23 14:59:13 -07:00
# Use normal kernel
boot.kernelPackages = pkgs.linuxPackages;
2023-07-23 14:38:24 -07:00
2023-07-25 15:23:07 -07:00
# Set kernel modules
boot.kernelModules = [ "sg" ];
2023-07-23 14:38:24 -07:00
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Set networking options
2023-07-23 14:59:13 -07:00
networking.hostName = "torus";
2023-10-07 02:00:29 -07:00
# Needed for wireguard-server
boot.kernel.sysctl = {
"net.ipv4.conf.all.forwarding" = true;
};
networking.firewall.enable = true;
2023-07-23 14:38:24 -07:00
networking.firewall.checkReversePath = "loose";
2023-10-07 02:00:29 -07:00
networking.firewall.allowedTCPPorts = [ 80 443 ];
networking.firewall.allowedUDPPorts = [ 80 443 ];
2023-07-23 14:38:24 -07:00
# Set your time zone.
time.timeZone = "America/Los_Angeles";
i18n.defaultLocale = "en_US.UTF-8";
# Enable virtualisation
virtualisation.docker.enable = true;
virtualisation.docker.storageDriver = "btrfs";
2023-07-25 15:23:07 -07:00
virtualisation.docker.enableNvidia = true;
services.xserver.videoDrivers = [ "nvidia" ];
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
setLdLibraryPath = true;
};
2023-07-23 14:38:24 -07:00
# Define user account.
users.users.${user} = {
isNormalUser = true;
extraGroups = [ "wheel" "docker" ]; # Enable sudo for the user.
2023-09-12 22:18:09 -07:00
shell = pkgs.bash;
2023-07-23 14:38:24 -07:00
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
2023-09-02 17:47:18 -07:00
docker-compose
2023-09-12 22:20:31 -07:00
python3
zk
gollum
2023-07-23 14:38:24 -07:00
];
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.pcscd.enable = true;
programs.gnupg.agent = {
enable = true;
pinentryFlavor = "curses";
enableSSHSupport = true;
};
2023-09-02 17:47:18 -07:00
security.acme = {
acceptTerms = true;
defaults.email = "starrtyler88@gmail.com";
};
2023-09-12 22:20:31 -07:00
security.pam.services.nginx.setEnvironment = false;
systemd.services.nginx.serviceConfig = {
SupplementaryGroups = [ "shadow" ];
};
networking.nameservers = [ "8.8.8.8" "8.8.4.4" ];
2023-09-02 17:47:18 -07:00
services.nginx = {
enable = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
2023-09-12 22:20:31 -07:00
additionalModules = [ pkgs.nginxModules.pam ];
virtualHosts = let
SSL = {
enableACME = true;
forceSSL = true;
}; in {
2023-11-05 00:43:29 -07:00
"rss.tstarr.us" = (SSL // {
locations."/".proxyPass = "http://localhost:8081/";
});
"home.tstarr.us" = (SSL // {
locations."/".proxyPass = "http://localhost:8123/";
2023-11-05 00:43:29 -07:00
});
2023-09-12 22:20:31 -07:00
"media.tstarr.us" = (SSL // {
locations."/".proxyPass = "http://localhost:8096/";
});
2023-11-09 15:44:24 -08:00
"vault.tstarr.us" = (SSL // {
locations."/".proxyPass = "http://localhost:5000/";
extraConfig = ''
auth_pam "Password Required";
auth_pam_service_name "nginx";
'';
});
"share.tstarr.us" = (SSL // {
locations."/".proxyPass = "http://localhost:5001/";
2023-09-12 22:20:31 -07:00
extraConfig = ''
auth_pam "Password Required";
auth_pam_service_name "nginx";
'';
});
};
2023-09-02 17:47:18 -07:00
};
2023-07-23 14:38:24 -07:00
# Enable modules
modules = {
2023-09-12 22:18:09 -07:00
devel = {
tooling.enable = true;
};
2023-07-23 14:38:24 -07:00
services = {
2023-07-25 15:23:07 -07:00
jellyfin.enable = true;
2023-07-23 14:38:24 -07:00
};
2023-09-12 22:18:09 -07:00
system = {
terminal.enable = true;
ssh.enable = true;
2023-11-19 23:43:26 -08:00
secrets.enable = true;
2023-07-23 17:10:08 -07:00
};
2023-07-23 14:38:24 -07:00
};
2023-09-12 22:18:09 -07:00
# Did you read the comment?
system.stateVersion = "23.11";
2023-07-23 14:38:24 -07:00
}