restructure config
This commit is contained in:
parent
1c6a1a4305
commit
ef0c9157f4
46 changed files with 656 additions and 716 deletions
339
system/servers/atagen-vps/reflector.nix
Normal file
339
system/servers/atagen-vps/reflector.nix
Normal file
|
@ -0,0 +1,339 @@
|
|||
# Edit this configuration file to define what should be installed on
|
||||
# your system. Help is available in the configuration.nix(5) man page
|
||||
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
wekan-compose = pkgs.fetchurl {
|
||||
url = "https://github.com/wekan/wekan/raw/v6.68/docker-compose.yml";
|
||||
sha256 = "sha256-gLZ8bZZ8ZMo1NGz3ooIgXRH6JuMoEMp+to7lfqAvc6E=";
|
||||
};
|
||||
# wekan-private = pkgs.runCommand "wekan-private" {} ''
|
||||
# cp ${wekan-compose} $out
|
||||
# sed -i '/localtime/d' $out
|
||||
# sed -i '/timezone/d' $out
|
||||
# sed -i 's/80:8080/7897:8080/g' $out
|
||||
# sed -i 's/ROOT_URL=.*/ROOT_URL=https:\/\/reflector\.beam\/kanban\//' $out
|
||||
# '';
|
||||
wekan-rhizome = pkgs.runCommand "wekan-rhizome" {} ''
|
||||
cp ${wekan-compose} $out
|
||||
sed -i '/localtime/d' $out
|
||||
sed -i '/timezone/d' $out
|
||||
sed -i 's/80:8080/7897:8080/g' $out
|
||||
sed -i 's/ROOT_URL=.*/ROOT_URL=https:\/\/board\.rhizome\.tf\//' $out
|
||||
'';
|
||||
foswiki-compose = pkgs.fetchurl {
|
||||
url = "https://raw.githubusercontent.com/timlegge/docker-foswiki/master/docker-compose.1-simple.yml";
|
||||
sha256 = "sha256-XqGWGTZ/URKsIdDEEpBQUK7xoIdZ164lRhHEiWdnKpM=";
|
||||
};
|
||||
in {
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
# ./cachix.nix
|
||||
# (import (builtins.fetchTarball "https://github.com/jonascarpay/declarative-cachix/archive/master.tar.gz"))
|
||||
];
|
||||
|
||||
# cachix = [
|
||||
# "nix-community"
|
||||
# ];
|
||||
|
||||
nix.settings.experimental-features = ["flakes" "nix-command"];
|
||||
# systemd.services.NetworkManager-wait-online.enable = false;
|
||||
|
||||
# Use the GRUB 2 boot loader.
|
||||
boot.loader.grub.enable = true;
|
||||
boot.loader.grub.version = 2;
|
||||
boot.loader.grub.device = "/dev/vda"; # or "nodev" for efi only
|
||||
|
||||
networking.hostName = "reflector"; # Define your hostname.
|
||||
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
|
||||
|
||||
# Set your time zone.
|
||||
time.timeZone = "Australia/Sydney";
|
||||
|
||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||
users.users.sunshine = {
|
||||
isNormalUser = true;
|
||||
extraGroups = ["wheel"]; # Enable ‘sudo’ for the user.
|
||||
packages = with pkgs; [];
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDSQC8VgKLzoU5BSynJJuC8BFqAEN8JlSIzsZ2Vg9rfXHM7T4vbWtnxSCSbNw3CEnZCfrdDQTeRum7Uq+gvrcHWd9Aj+rVmubTdud70ybW7T7SlGv3b5TYBhMNbrAz0JIJjLnFMy3/pWids1v6mKW3i7k6Kbq8fSt7jva5Yg5x1jtkUUwvjSZjPg/E/Zl0hAcnx8fWe4foFTcYYsUbfEpp6bxdN2QuVmb17UKnLrMz6JTj88Jd2uYZkeKxGOwk+uwrd0WArY8JIiRi1NcPA3I42aAQfZKxCUY/xmVyRlF+l6K8caD4CZlysms9aXQzBhmPPDIY87AwyRlVK5JsRbaMEBMsffX2xk8DdV+2+9RbztgeXOoYk7WjJX1/+WcxY3RGn8QsUfrGALmrQTRGXgYRbtM/ZJq1m9aP6IvVQeKE1NOpKguXpmokB7JsyKPcWk/PCMVYyXM/qYspc6hRPJgGWiJsayj7myO6X5Ssl9uQnHpNNyrQNY+cx3/boBu2J1sM= bolt@quiver"
|
||||
];
|
||||
};
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
environment.systemPackages = with pkgs; [
|
||||
helix
|
||||
ripgrep
|
||||
fd
|
||||
curl
|
||||
|
||||
cachix
|
||||
headscale
|
||||
|
||||
comma
|
||||
|
||||
woodpecker-agent
|
||||
woodpecker-server
|
||||
|
||||
# podman
|
||||
# podman-compose
|
||||
# shadow
|
||||
|
||||
dufs
|
||||
];
|
||||
|
||||
virtualisation = {
|
||||
docker.enable = true;
|
||||
# podman = {
|
||||
# enable = true;
|
||||
# dockerCompat = true;
|
||||
# defaultNetwork.dnsname.enable = true;
|
||||
# };
|
||||
};
|
||||
|
||||
# services.resolved = {
|
||||
# enable = true;
|
||||
# fallbackDns = [ "103.1.206.179" "168.138.8.38" "168.138.12.137" ];
|
||||
# dnssec = "false";
|
||||
# };
|
||||
|
||||
services.fail2ban.enable = true;
|
||||
|
||||
services.tailscale.enable = true;
|
||||
|
||||
services.headscale = {
|
||||
enable = true;
|
||||
serverUrl = "https://net.atagen.co";
|
||||
dns = {
|
||||
nameservers = ["103.1.206.179" "168.138.8.38" "168.138.12.137"];
|
||||
magicDns = true;
|
||||
};
|
||||
};
|
||||
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
extraOptions = {
|
||||
gui = {
|
||||
insecureSkipHostcheck = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.gitea = {
|
||||
enable = true;
|
||||
appName = "atagen gitea";
|
||||
domain = "git.atagen.co";
|
||||
httpPort = 3033;
|
||||
settings.server = {
|
||||
START_SSH_SERVER = true;
|
||||
SSH_PORT = 6660;
|
||||
SSH_DOMAIN = "git.atagen.co";
|
||||
DISABLE_SSH = false;
|
||||
};
|
||||
rootUrl = "https://git.atagen.co";
|
||||
settings.service.DISABLE_REGISTRATION = true;
|
||||
settings.webhook.ALLOWED_HOST_LIST = "external,loopback";
|
||||
};
|
||||
|
||||
users.users.ci = {
|
||||
isSystemUser = true;
|
||||
createHome = true;
|
||||
group = "ci";
|
||||
extraGroups = ["docker" "wheel"];
|
||||
};
|
||||
users.groups.ci = {};
|
||||
|
||||
users.users.ci-agent = {
|
||||
isSystemUser = true;
|
||||
createHome = true;
|
||||
group = "ci";
|
||||
extraGroups = ["docker" "wheel"];
|
||||
};
|
||||
users.groups.ci = {};
|
||||
|
||||
users.users.dufs = {
|
||||
isSystemUser = true;
|
||||
createHome = true;
|
||||
group = "dufs";
|
||||
};
|
||||
users.groups.dufs = {};
|
||||
|
||||
systemd.services.woodpecker-server = {
|
||||
wantedBy = ["multi-user.target"];
|
||||
description = "woodpecker CI/CD server";
|
||||
serviceConfig = {
|
||||
Environment = [
|
||||
"WOODPECKER_OPEN=true"
|
||||
"WOODPECKER_ADMIN=atagen"
|
||||
"WOODPECKER_REPO_OWNERS=rhizome"
|
||||
"WOODPECKER_HOST=https://ci.atagen.co"
|
||||
"WOODPECKER_GITEA=true"
|
||||
"WOODPECKER_GITEA_URL=https://git.atagen.co"
|
||||
"WOODPECKER_GITEA_CLIENT=1418f1d9-e2ce-4e8f-b8b2-7cf714baa07e"
|
||||
"WOODPECKER_GITEA_SECRET=gto_chpk65trvfbnrqs4cog62kn7sgmvpizg5wbr4zknb54o4gxlssba"
|
||||
"WOODPECKER_GITEA_SKIP_VERIFY=true"
|
||||
"WOODPECKER_AGENT_SECRET=71a0ac7d617aef46fb93811c6e2a300e041a324727df12b4805d5f4e9e1f3326"
|
||||
"WOODPECKER_DATABASE_DATASOURCE=/var/lib/woodpecker/woodpecker.sqlite"
|
||||
];
|
||||
Restart = "always";
|
||||
ExecStart = "${pkgs.woodpecker-server}/bin/woodpecker-server";
|
||||
User = "ci";
|
||||
Group = "ci";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.woodpecker-agent = {
|
||||
wantedBy = ["multi-user.target"];
|
||||
description = "woodpecker CI/CD agent";
|
||||
serviceConfig = {
|
||||
Environment = [
|
||||
"WOODPECKER_SERVER=localhost:9000"
|
||||
"WOODPECKER_AGENT_SECRET=71a0ac7d617aef46fb93811c6e2a300e041a324727df12b4805d5f4e9e1f3326"
|
||||
];
|
||||
Restart = "always";
|
||||
ExecStart = "${pkgs.woodpecker-agent}/bin/woodpecker-agent";
|
||||
User = "ci-agent";
|
||||
};
|
||||
};
|
||||
|
||||
# systemd.services.wekan-private = {
|
||||
# wantedBy = [ "multi-user.target" ];
|
||||
# after = [ "network.target" "docker.service" ];
|
||||
# requires = [ "docker.service" ];
|
||||
# description = "wekan kanban board";
|
||||
# serviceConfig = {
|
||||
# Restart = "always";
|
||||
# User = "root";
|
||||
# ExecStart = "${pkgs.docker}/bin/docker compose -f ${wekan-private} up";
|
||||
# ExecStop = "${pkgs.docker}/bin/docker compose -f ${wekan-private} down";
|
||||
# };
|
||||
# };
|
||||
|
||||
systemd.services.wekan-rhizome = {
|
||||
wantedBy = ["multi-user.target"];
|
||||
after = ["network.target" "docker.service"];
|
||||
requires = ["docker.service"];
|
||||
description = "wekan kanban board for rhizomers";
|
||||
serviceConfig = {
|
||||
Restart = "always";
|
||||
User = "root";
|
||||
ExecStart = "${pkgs.docker}/bin/docker compose -f ${wekan-rhizome} up";
|
||||
ExecStop = "${pkgs.docker}/bin/docker compose -f ${wekan-rhizome} down";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.dufs = {
|
||||
wantedBy = ["multi-user.target"];
|
||||
after = ["network.target"];
|
||||
description = "dufs webdav server";
|
||||
serviceConfig = {
|
||||
User = "dufs";
|
||||
Restart = "always";
|
||||
ExecStart = "${pkgs.dufs}/bin/dufs -b 127.0.0.1 -p 8083 /home/dufs/files";
|
||||
};
|
||||
};
|
||||
|
||||
# systemd.services.foswiki = {
|
||||
# wantedBy = [ "multi-user.target" ];
|
||||
# after = [ "network.target" "docker.service" ];
|
||||
# requires = [ "docker.service" ];
|
||||
# description = "foswiki wiki site";
|
||||
# serviceConfig = {
|
||||
# Restart = "always";
|
||||
# User = "root";
|
||||
# ExecStart = "${pkgs.docker}/bin/docker compose -f ${foswiki-compose} up";
|
||||
# ExecStop = "${pkgs.docker}/bin/docker compose -f ${foswiki-compose} down";
|
||||
# };
|
||||
# };
|
||||
|
||||
services.caddy = {
|
||||
enable = true;
|
||||
virtualHosts = {
|
||||
"atagen.co" = {
|
||||
serverAliases = ["www.atagen.co"];
|
||||
extraConfig = ''
|
||||
respond "i live.. again"
|
||||
'';
|
||||
};
|
||||
|
||||
"iced-rs.info".extraConfig = ''
|
||||
reverse_proxy http://127.0.0.1:8765
|
||||
'';
|
||||
|
||||
"ci.atagen.co".extraConfig = ''
|
||||
reverse_proxy http://127.0.0.1:8000
|
||||
'';
|
||||
|
||||
# "ci.rhizome.tf".extraConfig = ''
|
||||
# reverse_proxy http://127.0.0.1:8000
|
||||
# '';
|
||||
|
||||
"git.atagen.co".extraConfig = ''
|
||||
reverse_proxy http://127.0.0.1:3033
|
||||
'';
|
||||
|
||||
# "git.rhizome.tf".extraConfig = ''
|
||||
# reverse_proxy http://127.0.0.1:3033
|
||||
# '';
|
||||
|
||||
"board.rhizome.tf".extraConfig = ''
|
||||
reverse_proxy http://127.0.0.1:7897
|
||||
'';
|
||||
|
||||
"net.atagen.co".extraConfig = ''
|
||||
reverse_proxy http://127.0.0.1:8080
|
||||
'';
|
||||
|
||||
"reflector.beam".extraConfig = ''
|
||||
tls /etc/selfsigned/cert.pem /etc/selfsigned/key.pem
|
||||
|
||||
route /sync/* {
|
||||
uri strip_prefix /sync
|
||||
reverse_proxy http://127.0.0.1:8384
|
||||
}
|
||||
|
||||
route /philez/* {
|
||||
uri strip_prefix /philez
|
||||
reverse_proxy http://127.0.0.1:8083
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# Enable the OpenSSH daemon.
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
passwordAuthentication = false;
|
||||
kbdInteractiveAuthentication = false;
|
||||
permitRootLogin = "no";
|
||||
};
|
||||
|
||||
networking.firewall = {
|
||||
enable = true;
|
||||
trustedInterfaces = ["tailscale0"];
|
||||
checkReversePath = "loose";
|
||||
allowedTCPPorts = [80 443 6660];
|
||||
allowedUDPPorts = [80 443 41641 6660];
|
||||
};
|
||||
|
||||
# Copy the NixOS configuration file and link it from the resulting system
|
||||
# (/run/current-system/configuration.nix). This is useful in case you
|
||||
# accidentally delete configuration.nix.
|
||||
system.copySystemConfiguration = true;
|
||||
|
||||
# This value determines the NixOS release from which the default
|
||||
# settings for stateful data, like file locations and database versions
|
||||
# on your system were taken. It‘s perfectly fine and recommended to leave
|
||||
# this value at the release version of the first install of this system.
|
||||
# Before changing this value read the documentation for this option
|
||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||
system.stateVersion = "22.11"; # Did you read the comment?
|
||||
}
|
278
system/servers/rhizome-vps/configuration.nix
Normal file
278
system/servers/rhizome-vps/configuration.nix
Normal file
|
@ -0,0 +1,278 @@
|
|||
# Edit this configuration file to define what should be installed on
|
||||
# your system. Help is available in the configuration.nix(5) man page
|
||||
# and in the NixOS manual (accessible by running `nixos-help`).
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
nix.settings.experimental-features = ["nix-command" "flakes"];
|
||||
nix.extraOptions = ''
|
||||
keep-outputs = true
|
||||
keep-derivations = true
|
||||
'';
|
||||
|
||||
environment.pathsToLink = ["/share/zsh"];
|
||||
programs.zsh.enable = true;
|
||||
users.defaultUserShell = pkgs.zsh;
|
||||
|
||||
users.users.felix = {
|
||||
isSystemUser = true;
|
||||
group = "www";
|
||||
extraGroups = ["docker"];
|
||||
};
|
||||
|
||||
users.users.spore = {
|
||||
isSystemUser = true;
|
||||
home = "/home/spore";
|
||||
createHome = true;
|
||||
useDefaultShell = true;
|
||||
group = "www";
|
||||
extraGroups = ["docker"];
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL9VRcCnmjCyV7DpCm8ir3+xPTbyMDBJhgSkhpmdFL5d spore@server.rhizome.tf"
|
||||
];
|
||||
};
|
||||
|
||||
users.groups.www = {
|
||||
members = ["acme" "felix" "spore"];
|
||||
};
|
||||
|
||||
boot.loader.grub.enable = true;
|
||||
boot.loader.grub.device = "/dev/vda"; # or "nodev" for efi only
|
||||
|
||||
networking.hostName = "filament"; # Define your hostname.
|
||||
time.timeZone = "Australia/Sydney";
|
||||
|
||||
i18n.defaultLocale = "en_AU.UTF-8";
|
||||
|
||||
users.users.rhizome = {
|
||||
isNormalUser = true;
|
||||
extraGroups = ["wheel"]; # Enable ‘sudo’ for the user.
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDSQC8VgKLzoU5BSynJJuC8BFqAEN8JlSIzsZ2Vg9rfXHM7T4vbWtnxSCSbNw3CEnZCfrdDQTeRum7Uq+gvrcHWd9Aj+rVmubTdud70ybW7T7SlGv3b5TYBhMNbrAz0JIJjLnFMy3/pWids1v6mKW3i7k6Kbq8fSt7jva5Yg5x1jtkUUwvjSZjPg/E/Zl0hAcnx8fWe4foFTcYYsUbfEpp6bxdN2QuVmb17UKnLrMz6JTj88Jd2uYZkeKxGOwk+uwrd0WArY8JIiRi1NcPA3I42aAQfZKxCUY/xmVyRlF+l6K8caD4CZlysms9aXQzBhmPPDIY87AwyRlVK5JsRbaMEBMsffX2xk8DdV+2+9RbztgeXOoYk7WjJX1/+WcxY3RGn8QsUfrGALmrQTRGXgYRbtM/ZJq1m9aP6IvVQeKE1NOpKguXpmokB7JsyKPcWk/PCMVYyXM/qYspc6hRPJgGWiJsayj7myO6X5Ssl9uQnHpNNyrQNY+cx3/boBu2J1sM= bolt@quiver"
|
||||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDW/YjnlHiEf2bV0RapVl+jWEtsNYrbXsaJJhXUkAaf61rsTZ2jpda7FmOVGjyJiOkTNYANoT83YhGxvKt3Ukcx5xG0JhcrilEGKfOR43/QLlXetCh4aFed//CXYNQo8obDovx9A8YamzfZWJo0nhshEAt1aDvNGlyPgHZI3r5vYNB6OpMlaSnr873i5hp6S9dxURoF0FjpdZwTWk5DiYUoZCezs6TfG6PzHbSsB88o4AUNZ6O+h1KD0lITSXH/v/M1zG8fkUzfZHFQoZ6VaIMhIVwLmbybvyb630IIfhx6KUoCWzCRlKBjVOGsQ1xZWEnjPgHB6atX5eNc/L8/bdyZOJ4aE2wSdVNMyriYuiyc3t/RwSvcRpfmzaxWUImDpjH3mxCrDymrZIQQTrNuC6o5O3mz3NCZRcFUZmuZXeYphyrzuNgAfsvHKMd8Fu+PdddSPCHkgYEIRuGD4flaujM8eUHZYqKkpmmiMwKk6jupBscN+1uwBqGQbaR0InXR+4c= custard"
|
||||
];
|
||||
};
|
||||
|
||||
users.users.ci = {
|
||||
isSystemUser = true;
|
||||
createHome = true;
|
||||
group = "ci";
|
||||
extraGroups = ["docker"];
|
||||
};
|
||||
|
||||
users.users.ci-agent = {
|
||||
isSystemUser = true;
|
||||
createHome = true;
|
||||
group = "ci";
|
||||
extraGroups = ["docker"];
|
||||
};
|
||||
|
||||
users.groups.ci = {};
|
||||
|
||||
virtualisation = {
|
||||
docker.enable = true;
|
||||
# podman = {
|
||||
# enable = true;
|
||||
# dockerCompat = true;
|
||||
# defaultNetwork.settings.dns_enabled = true;
|
||||
# };
|
||||
};
|
||||
|
||||
services.fail2ban.enable = true;
|
||||
|
||||
services.redis.servers."".enable = true;
|
||||
|
||||
services.gitea = {
|
||||
enable = true;
|
||||
appName = "rhizome gitea";
|
||||
domain = "git.rhizome.tf";
|
||||
httpPort = 3036;
|
||||
settings.server = {
|
||||
START_SSH_SERVER = true;
|
||||
SSH_PORT = 6660;
|
||||
SSH_DOMAIN = "git.rhizome.tf";
|
||||
DISABLE_SSH = false;
|
||||
};
|
||||
rootUrl = "https://git.rhizome.tf";
|
||||
settings.service.DISABLE_REGISTRATION = true;
|
||||
settings.webhook.ALLOWED_HOST_LIST = "external,loopback";
|
||||
};
|
||||
|
||||
# systemd.services.spore = {
|
||||
# wantedBy = [ "multi-user.target" ];
|
||||
# description = "Spore Deployment Tool";
|
||||
# serviceConfig = {
|
||||
# User = "spore";
|
||||
# Restart = "on-failure";
|
||||
# ExecStart = "${lib.getExe pkgs.spore}";
|
||||
|
||||
# };
|
||||
# };
|
||||
|
||||
systemd.services.grab-keys = {
|
||||
description = "Server Key Grabber";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "spore";
|
||||
Restart = "on-failure";
|
||||
ExecStart = "${pkgs.openssh}/bin/scp spore@server.rhizome.tf:/etc/letsencrypt/live/server.rhizome.tf/cert.pem /var/www/server.pem";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.timers.grab-keys = {
|
||||
description = "Server Key Grabber";
|
||||
timerConfig = {
|
||||
Persistent = "yes";
|
||||
OnCalendar = "daily";
|
||||
Unit = "grab-keys.service";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.woodpecker-server = {
|
||||
wantedBy = ["multi-user.target"];
|
||||
description = "woodpecker CI/CD server";
|
||||
serviceConfig = {
|
||||
Environment = [
|
||||
"WOODPECKER_OPEN=true"
|
||||
"WOODPECKER_ADMIN=dbx"
|
||||
"WOODPECKER_REPO_OWNERS=rhizome"
|
||||
"WOODPECKER_HOST=https://ci.rhizome.tf"
|
||||
"WOODPECKER_GITEA=true"
|
||||
"WOODPECKER_GITEA_URL=https://git.rhizome.tf"
|
||||
"WOODPECKER_GITEA_CLIENT=86bb265b-8914-4abd-a3eb-f843fabbd79d"
|
||||
"WOODPECKER_GITEA_SECRET=gto_474i24aku3vda6wjbumdgfdcjdllclecfplfb4wsz2ibkemhdrwq"
|
||||
"WOODPECKER_GITEA_SKIP_VERIFY=true"
|
||||
"WOODPECKER_AGENT_SECRET=71a0ac7d617aef46fb93811c6e2a300e041a324727df12b4805d5f4e9e1f3326"
|
||||
"WOODPECKER_DATABASE_DATASOURCE=/var/lib/woodpecker/woodpecker.sqlite"
|
||||
];
|
||||
Restart = "on-failure";
|
||||
ExecStart = "${lib.getExe pkgs.woodpecker-server}";
|
||||
User = "ci";
|
||||
Group = "ci";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.woodpecker-agent = {
|
||||
wantedBy = ["multi-user.target"];
|
||||
description = "woodpecker CI/CD agent";
|
||||
serviceConfig = {
|
||||
Environment = [
|
||||
"WOODPECKER_AGENT_SECRET=71a0ac7d617aef46fb93811c6e2a300e041a324727df12b4805d5f4e9e1f3326"
|
||||
];
|
||||
Restart = "always";
|
||||
ExecStart = "${lib.getExe pkgs.woodpecker-agent}";
|
||||
User = "ci-agent";
|
||||
Group = "ci";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.felix = {
|
||||
wantedBy = ["multi-user.target"];
|
||||
description = "gilles on testing";
|
||||
serviceConfig = {
|
||||
ExecStart = ''${lib.getExe pkgs.docker} run --network host -v /var/lib/acme/rhizome.tf:/var/lib/acme/rhizome.tf --env-file /var/www/felix_env git.rhizome.tf/rhizome/gilles:latest'';
|
||||
Group = "www";
|
||||
User = "felix";
|
||||
Restart = "always";
|
||||
};
|
||||
};
|
||||
|
||||
services.caddy = {
|
||||
enable = true;
|
||||
virtualHosts = {
|
||||
"rhizome.tf".extraConfig = ''
|
||||
route /.well-known/acme-challenge/* {
|
||||
root * /var/www/acme-challenge
|
||||
file_server
|
||||
}
|
||||
root * /var/www/rhizome.tf
|
||||
file_server
|
||||
handle_errors {
|
||||
@404 {
|
||||
expression {http.error.status_code} == 404
|
||||
}
|
||||
rewrite @404 /404.html
|
||||
file_server
|
||||
}
|
||||
'';
|
||||
"git.rhizome.tf".extraConfig = ''
|
||||
reverse_proxy http://localhost:3036
|
||||
'';
|
||||
"ci.rhizome.tf".extraConfig = ''
|
||||
reverse_proxy http://localhost:8000
|
||||
'';
|
||||
};
|
||||
group = "www";
|
||||
};
|
||||
|
||||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
environment.systemPackages = with pkgs; [
|
||||
kitty
|
||||
helix
|
||||
ripgrep
|
||||
fd
|
||||
exa
|
||||
bat
|
||||
nix-index
|
||||
comma
|
||||
alejandra
|
||||
curl
|
||||
cachix
|
||||
git
|
||||
man-pages
|
||||
man-pages-posix
|
||||
rnix-lsp
|
||||
zellij
|
||||
zoxide
|
||||
fzf
|
||||
btop
|
||||
];
|
||||
documentation.dev.enable = true;
|
||||
documentation.man.enable = true;
|
||||
documentation.enable = true;
|
||||
programs.nix-index-database.comma.enable = true;
|
||||
programs.nix-index.enableZshIntegration = false;
|
||||
programs.nix-index.enableBashIntegration = false;
|
||||
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
passwordAuthentication = false;
|
||||
kbdInteractiveAuthentication = false;
|
||||
permitRootLogin = "no";
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [22 80 443 5539 5559 6660];
|
||||
networking.firewall.allowedUDPPorts = [443 6660];
|
||||
|
||||
security.acme = {
|
||||
acceptTerms = true;
|
||||
defaults.email = "admin@rhizome.tf";
|
||||
defaults.group = "www";
|
||||
certs."rhizome.tf" = {
|
||||
webroot = "/var/www/acme-challenge";
|
||||
};
|
||||
};
|
||||
|
||||
# This value determines the NixOS release from which the default
|
||||
# settings for stateful data, like file locations and database versions
|
||||
# on your system were taken. It's perfectly fine and recommended to leave
|
||||
# this value at the release version of the first install of this system.
|
||||
# Before changing this value read the documentation for this option
|
||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||
system.stateVersion = "23.05"; # Did you read the comment?
|
||||
|
||||
system.activationScripts = {
|
||||
acls.text = ''
|
||||
${pkgs.acl}/bin/setfacl -Rm spore:rx /var/lib/acme/rhizome.tf
|
||||
'';
|
||||
};
|
||||
}
|
125
system/servers/rhizome-vps/flake.lock
generated
Normal file
125
system/servers/rhizome-vps/flake.lock
generated
Normal file
|
@ -0,0 +1,125 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1688466019,
|
||||
"narHash": "sha256-VeM2akYrBYMsb4W/MmBo1zmaMfgbL4cH3Pu8PGyIwJ0=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "8e8d955c22df93dbe24f19ea04f47a74adbdc5ec",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1689068808,
|
||||
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1687871164,
|
||||
"narHash": "sha256-bBFlPthuYX322xOlpJvkjUBz0C+MOBjZdDOOJJ+G2jU=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "07c347bb50994691d7b0095f45ebd8838cf6bc38",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "release-23.05",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-index-database": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1688874465,
|
||||
"narHash": "sha256-BUwl+tq40EjkufTZkqf3lWFzxOA/mYBTHz+p5uJtjaY=",
|
||||
"owner": "Mic92",
|
||||
"repo": "nix-index-database",
|
||||
"rev": "757114749d4613cf71f3748e780a1be8a67a5d3c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Mic92",
|
||||
"repo": "nix-index-database",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1689326639,
|
||||
"narHash": "sha256-79zi0t83Dcc2dE0NuYZ+2hqtKXZN1yWVq5mtx8D2d7Y=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9fdfaeb7b96f05e869f838c73cde8d98c640c649",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"flake-utils": "flake-utils",
|
||||
"home-manager": "home-manager",
|
||||
"nix-index-database": "nix-index-database",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
53
system/servers/rhizome-vps/flake.nix
Normal file
53
system/servers/rhizome-vps/flake.nix
Normal file
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
description = "rhizome dev server";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
|
||||
|
||||
flake-parts = {
|
||||
url = "github:hercules-ci/flake-parts";
|
||||
inputs.nixpkgs-lib.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager/release-23.05";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
nix-index-database = {
|
||||
url = "github:Mic92/nix-index-database";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
home-manager,
|
||||
nix-index-database,
|
||||
...
|
||||
} @ inputs: let
|
||||
inherit (self) outputs;
|
||||
forAllSystems = nixpkgs.lib.genAttrs [
|
||||
"x86_64-linux"
|
||||
];
|
||||
in rec {
|
||||
nixosConfigurations = {
|
||||
"filament" = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = {inherit inputs outputs;};
|
||||
modules = [
|
||||
./configuration.nix
|
||||
nix-index-database.nixosModules.nix-index
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.extraSpecialArgs = {inherit inputs outputs;};
|
||||
home-manager.users.rhizome.imports = [./rhizome.nix];
|
||||
} # hm
|
||||
]; # modules
|
||||
}; # filament
|
||||
};
|
||||
}; # rec
|
||||
}
|
34
system/servers/rhizome-vps/hardware-configuration.nix
Normal file
34
system/servers/rhizome-vps/hardware-configuration.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
imports = [];
|
||||
|
||||
boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk"];
|
||||
boot.initrd.kernelModules = [];
|
||||
boot.kernelModules = [];
|
||||
boot.extraModulePackages = [];
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/f4889546-f71c-4e3c-ab47-e183a72dc52e";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
swapDevices = [];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
# still possible to use this option, but it's recommended to use it in conjunction
|
||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.ens3.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
virtualisation.hypervGuest.enable = true;
|
||||
}
|
130
system/servers/rhizome-vps/rhizome.nix
Normal file
130
system/servers/rhizome-vps/rhizome.nix
Normal file
|
@ -0,0 +1,130 @@
|
|||
{
|
||||
inputs,
|
||||
outputs,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs; [
|
||||
lazygit
|
||||
alejandra
|
||||
];
|
||||
|
||||
home = {
|
||||
username = "rhizome";
|
||||
homeDirectory = "/home/rhizome";
|
||||
};
|
||||
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = "rhizome";
|
||||
userEmail = "filament@rhizome.tf";
|
||||
};
|
||||
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
|
||||
programs.helix = {
|
||||
enable = true;
|
||||
settings = {
|
||||
theme = "base16_terminal";
|
||||
editor.lsp.display-messages = true;
|
||||
};
|
||||
};
|
||||
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableAutosuggestions = true;
|
||||
enableCompletion = true;
|
||||
enableSyntaxHighlighting = true;
|
||||
enableVteIntegration = true;
|
||||
autocd = true;
|
||||
defaultKeymap = "viins";
|
||||
initExtra = ''
|
||||
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
||||
alias ...='cd ../..'
|
||||
alias ....='cd ../../..'
|
||||
alias .....='cd ../../../..'
|
||||
alias chmox='chmod +x'
|
||||
alias gs='git status'
|
||||
alias gcl='git clone'
|
||||
alias ga='git add'
|
||||
alias gcb='git checkout -b'
|
||||
alias gco='git checkout'
|
||||
alias gl='git pull'
|
||||
alias gp='git push'
|
||||
alias gd='git diff'
|
||||
alias gcam='git commit -am'
|
||||
alias gcm='git commit -m'
|
||||
alias gr='git restore'
|
||||
alias gm='git merge'
|
||||
alias l='exa -lh --group-directories-first --icons --color=always'
|
||||
alias la='exa -lha --group-directories-first --icons --color=always'
|
||||
eval "$(zoxide init zsh)"
|
||||
'';
|
||||
plugins = [
|
||||
{
|
||||
name = "powerlevel10k";
|
||||
src = pkgs.zsh-powerlevel10k;
|
||||
file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
|
||||
}
|
||||
{
|
||||
name = "zsh-vi-mode";
|
||||
src = pkgs.zsh-vi-mode;
|
||||
file = "share/zsh-vi-mode/zsh-vi-mode.zsh";
|
||||
}
|
||||
{
|
||||
name = "zsh-autopair";
|
||||
src = pkgs.zsh-autopair;
|
||||
file = "share/zsh-autopair/zsh-autopair.zsh";
|
||||
}
|
||||
{
|
||||
name = "zsh-completions";
|
||||
src = pkgs.zsh-completions;
|
||||
file = "share/zsh-completions/zsh-completions.zsh";
|
||||
}
|
||||
{
|
||||
name = "zsh-command-time";
|
||||
src = pkgs.zsh-command-time;
|
||||
file = "share/zsh-completions/zsh-command-time.zsh";
|
||||
}
|
||||
{
|
||||
name = "zsh-autocomplete";
|
||||
src = pkgs.zsh-autocomplete;
|
||||
file = "share/zsh-autocomplete/zsh-autocomplete.zsh";
|
||||
}
|
||||
{
|
||||
name = "zsh-fast-syntax-highlighting";
|
||||
src = pkgs.zsh-fast-syntax-highlighting;
|
||||
file = "share/zsh-fast-syntax-highlighting/zsh-fast-syntax-highlighting.zsh";
|
||||
}
|
||||
{
|
||||
name = "zsh-nix-shell";
|
||||
src = pkgs.zsh-nix-shell;
|
||||
file = "share/zsh-nix-shell/zsh-nix-shell.zsh";
|
||||
}
|
||||
{
|
||||
name = "any-nix-shell";
|
||||
src = pkgs.any-nix-shell;
|
||||
file = "share/any-nix-shell/any-nix-shell.zsh";
|
||||
}
|
||||
{
|
||||
name = "nix-zsh-completions";
|
||||
src = pkgs.nix-zsh-completions;
|
||||
file = "share/nix-zsh-completions/nix-zsh-completions.zsh";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
home.stateVersion = "23.05";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue