# nix-channel --add https://nixos.org/channels/nixos-unstable nixos # nix-channel --update # { config, pkgs, lib, ... }: let var = import ./var.nix; in { imports = [ ./hardware-configuration.nix ]; boot.loader.grub.enable = true; boot.loader.grub.device = "/dev/vda"; swapDevices = [ { device = "/var/swapfile"; size = 2048; # MiB } ]; networking.hostName = builtins.replaceStrings ["."] ["-"] "${var.hostname}"; networking.firewall = { enable = true; allowedTCPPorts = [ 80 443 ]; }; users.extraUsers.root = { openssh.authorizedKeys.keys = [ var.pubkey ]; }; services.openssh.enable = true; environment.systemPackages = with pkgs; [ vim ]; services.gitea = { enable = true; appName = "${var.hostname}"; settings = { server = { ROOT_URL = "https://${var.hostname}"; DOMAIN = "${var.hostname}"; }; service = { DISABLE_REGISTRATION = true; }; attachment = { ENABLED = false; }; other = { SHOW_FOOTER_VERSION = false; }; "repository.signing" = { DEFAULT_TRUST_MODEL = "committer"; }; }; }; security.acme.defaults.email = var.email; security.acme.acceptTerms = true; services.nginx = { enable = true; virtualHosts."${var.hostname}" = { enableACME = true; forceSSL = true; locations."/".proxyPass = "http://127.0.0.1:3000"; }; }; system.autoUpgrade = { enable = true; allowReboot = true; }; system.stateVersion = "19.03"; nix = { optimise.automatic = true; gc = { automatic = true; options = "--delete-older-than 7d"; }; }; }