2022-03-20 16:33:00 +00:00
|
|
|
# nix-channel --add https://nixos.org/channels/nixos-unstable nixos
|
2019-07-24 06:33:16 +00:00
|
|
|
# nix-channel --update
|
|
|
|
#
|
2019-12-04 17:33:37 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
2019-02-02 19:45:05 +00:00
|
|
|
let
|
|
|
|
secrets = import ./secrets.nix;
|
|
|
|
hostname = "code.dumpstack.io";
|
|
|
|
in {
|
2019-07-24 06:33:16 +00:00
|
|
|
imports = [
|
|
|
|
./hardware-configuration.nix
|
|
|
|
];
|
2019-02-02 19:45:05 +00:00
|
|
|
|
|
|
|
boot.loader.grub.enable = true;
|
|
|
|
boot.loader.grub.device = "/dev/vda";
|
|
|
|
|
2022-03-20 16:33:00 +00:00
|
|
|
swapDevices = [
|
|
|
|
{ device = "/var/swapfile";
|
|
|
|
size = 2048; # MiB
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
networking.hostName = builtins.replaceStrings ["."] ["-"] "${hostname}";
|
2019-02-02 19:45:05 +00:00
|
|
|
|
|
|
|
networking.firewall = {
|
|
|
|
enable = true;
|
|
|
|
allowedTCPPorts = [ 80 443 ];
|
|
|
|
};
|
|
|
|
|
|
|
|
users.extraUsers.root = {
|
|
|
|
openssh.authorizedKeys.keys = [ secrets.pubkey ];
|
|
|
|
};
|
|
|
|
|
|
|
|
services.openssh.enable = true;
|
|
|
|
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
vim
|
|
|
|
];
|
|
|
|
|
|
|
|
services.gitea = {
|
|
|
|
enable = true;
|
|
|
|
appName = "${hostname}";
|
2024-06-24 10:12:16 +00:00
|
|
|
|
2022-03-20 16:33:00 +00:00
|
|
|
settings = {
|
2024-06-24 10:12:16 +00:00
|
|
|
server = {
|
|
|
|
ROOT_URL = "https://${hostname}";
|
|
|
|
DOMAIN = "${hostname}";
|
|
|
|
};
|
|
|
|
service = {
|
|
|
|
DISABLE_REGISTRATION = true;
|
2022-03-20 16:33:00 +00:00
|
|
|
};
|
2024-06-24 10:12:16 +00:00
|
|
|
attachment = {
|
|
|
|
ENABLED = false;
|
2022-03-20 16:33:00 +00:00
|
|
|
};
|
2024-06-24 10:12:16 +00:00
|
|
|
other = {
|
2022-03-20 16:33:00 +00:00
|
|
|
SHOW_FOOTER_VERSION = false;
|
|
|
|
};
|
2024-06-24 10:12:16 +00:00
|
|
|
repository = {
|
|
|
|
signing = {
|
|
|
|
DEFAULT_TRUST_MODEL = "committer";
|
|
|
|
};
|
2022-03-20 16:33:00 +00:00
|
|
|
};
|
|
|
|
};
|
2019-02-02 19:45:05 +00:00
|
|
|
};
|
2019-12-04 17:33:37 +00:00
|
|
|
|
2024-06-24 10:12:16 +00:00
|
|
|
security.acme.defaults.email = "letsencrypt@dumpstack.io";
|
2022-03-20 16:33:00 +00:00
|
|
|
security.acme.acceptTerms = true;
|
2019-02-02 19:45:05 +00:00
|
|
|
|
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
virtualHosts."${hostname}" = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
|
|
|
|
locations."/".proxyPass = "http://127.0.0.1:3000";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-03-20 16:33:00 +00:00
|
|
|
system.autoUpgrade = {
|
|
|
|
enable = true;
|
|
|
|
allowReboot = true;
|
|
|
|
};
|
2019-04-12 17:24:45 +00:00
|
|
|
|
2019-07-24 06:33:16 +00:00
|
|
|
system.stateVersion = "19.03";
|
2019-04-12 17:25:39 +00:00
|
|
|
|
2019-04-12 17:41:59 +00:00
|
|
|
nix = {
|
|
|
|
optimise.automatic = true;
|
|
|
|
gc = {
|
|
|
|
automatic = true;
|
|
|
|
options = "--delete-older-than 7d";
|
|
|
|
};
|
|
|
|
};
|
2019-02-02 19:45:05 +00:00
|
|
|
}
|