2023-07-23 14:38:24 -07:00
|
|
|
|
{ config, pkgs, user, lib, ... }:
|
|
|
|
|
{
|
2023-10-07 02:04:31 -07:00
|
|
|
|
imports = [
|
2023-10-13 21:11:40 -07:00
|
|
|
|
../../modules
|
2023-10-07 02:04:31 -07:00
|
|
|
|
./wireguard-server.nix
|
2023-10-07 02:11:46 -07:00
|
|
|
|
./samba-server.nix
|
2023-10-13 21:11:40 -07:00
|
|
|
|
./syncthing.nix
|
2023-11-09 15:44:24 -08:00
|
|
|
|
./share.nix
|
2023-11-26 23:27:58 -08:00
|
|
|
|
./rss.nix
|
2023-12-03 11:59:29 -08:00
|
|
|
|
./home-assistant
|
2024-01-01 00:13:30 -08:00
|
|
|
|
./gitea.nix
|
2023-10-07 02:04:31 -07:00
|
|
|
|
];
|
|
|
|
|
|
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;
|
2023-12-31 17:23:47 -08:00
|
|
|
|
nixpkgs.config.permittedInsecurePackages = [ "openssl-1.1.1w" ];
|
2023-07-23 14:38:24 -07:00
|
|
|
|
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
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
environment.systemPackages = with pkgs; [
|
2024-04-21 10:37:47 -07:00
|
|
|
|
docker-compose # Tool for defining and running multi-container Docker applications.
|
|
|
|
|
python3 # Interpreted, high-level programming language known for its simplicity and versatility.
|
|
|
|
|
zk # Command-line tool for interacting with Apache ZooKeeper, a centralized service for distributed systems.
|
|
|
|
|
gollum # Wiki software that provides a simple, Git-based wiki engine.
|
2023-07-23 14:38:24 -07:00
|
|
|
|
];
|
|
|
|
|
|
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 // {
|
2023-12-03 11:59:59 -08:00
|
|
|
|
locations."/".proxyPass = "http://localhost:8087/";
|
2023-11-26 23:27:58 -08:00
|
|
|
|
});
|
2023-09-12 22:20:31 -07:00
|
|
|
|
"media.tstarr.us" = (SSL // {
|
|
|
|
|
locations."/".proxyPass = "http://localhost:8096/";
|
|
|
|
|
});
|
2024-01-01 00:13:30 -08:00
|
|
|
|
"git.tstarr.us" = (SSL // {
|
|
|
|
|
locations."/".proxyPass = "http://localhost:3001/";
|
|
|
|
|
});
|
2024-05-04 16:17:59 -07:00
|
|
|
|
"workspace.tstarr.us" = (SSL // {
|
|
|
|
|
locations."/".proxyPass = "http://localhost:5000/";
|
|
|
|
|
});
|
|
|
|
|
"code.tstarr.us" = (SSL // {
|
|
|
|
|
locations."/" = {
|
|
|
|
|
proxyPass = "http://localhost:8443/";
|
|
|
|
|
proxyWebsockets = true;
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
"plot.tstarr.us" = (SSL // {
|
|
|
|
|
locations."/".proxyPass = "http://localhost:8988/";
|
|
|
|
|
});
|
2023-11-09 15:44:24 -08:00
|
|
|
|
"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?
|
2023-11-23 01:21:58 -08:00
|
|
|
|
system.stateVersion = "23.11";
|
2023-07-23 14:38:24 -07:00
|
|
|
|
}
|