🎨 move to nixfmt-rfc-style

This commit is contained in:
James Walker 2024-12-07 20:46:15 -05:00
parent 9ea7912596
commit a53ad5a5ae
Signed by: walkah
SSH Key Fingerprint: SHA256:f7Gn4jO4BFHZxWfKTTzEAfWz+cLW51IyGFl9MjDyZGI
36 changed files with 412 additions and 193 deletions

View File

@ -10,4 +10,5 @@
) )
{ {
src = ./.; src = ./.;
}).defaultNix }
).defaultNix

48
flake.lock generated
View File

@ -7,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1732603785, "lastModified": 1733570843,
"narHash": "sha256-AEjWTJwOmSnVYsSJCojKgoguGfFfwel6z/6ud6UFMU8=", "narHash": "sha256-sQJAxY1TYWD1UyibN/FnN97paTFuwBw3Vp3DNCyKsMk=",
"owner": "lnl7", "owner": "lnl7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "6ab87b7c84d4ee873e937108c4ff80c015a40c7a", "rev": "a35b08d09efda83625bef267eb24347b446c80b8",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -62,11 +62,11 @@
"flake-compat_2": { "flake-compat_2": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1732722421, "lastModified": 1733328505,
"narHash": "sha256-HRJ/18p+WoXpWJkcdsk9St5ZiukCqSDgbOGFa8Okehg=", "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
"owner": "edolstra", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "9ed2ac151eada2306ca8c418ebd97807bb08f6ac", "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -137,11 +137,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1732884235, "lastModified": 1733484277,
"narHash": "sha256-r8j6R3nrvwbT1aUp4EPQ1KC7gm0pu9VcV1aNaB+XG6Q=", "narHash": "sha256-i5ay20XsvpW91N4URET/nOc0VQWOAd4c4vbqYtcH8Rc=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "819f682269f4e002884702b87e445c82840c68f2", "rev": "d00c6f6d0ad16d598bf7e2956f52c1d9d5de3c3a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -186,11 +186,11 @@
}, },
"nixlib": { "nixlib": {
"locked": { "locked": {
"lastModified": 1732410305, "lastModified": 1733015484,
"narHash": "sha256-/hxIKRTBsdrnudJWDGaBN8wIjHovqVAVxXdi8ByVtck=", "narHash": "sha256-qiyO0GrTvbp869U4VGX5GhAZ00fSiPXszvosY1AgKQ8=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixpkgs.lib", "repo": "nixpkgs.lib",
"rev": "87b6978992e2eb605732fba842cad0a7e14b2047", "rev": "0e4fdd4a0ab733276b6d2274ff84ae353f17129e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -207,11 +207,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1732496924, "lastModified": 1733360821,
"narHash": "sha256-/MNhZLR0eh9z/d3l+ammq+F5XxHln0RHgO4Bhtjr0IM=", "narHash": "sha256-bNXO+OGxrOjAxv/Lnyj84tNDicJ/FdLyLJHzOKSzYU8=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixos-generators", "repo": "nixos-generators",
"rev": "098e8b6ff72c86944a8d54b64ddd7b7e6635830a", "rev": "8cdaf8885c9c85d9d27b594dbe882406aadfe00e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -222,11 +222,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1732937961, "lastModified": 1733376361,
"narHash": "sha256-B5pYT+IVaqcrfOekkwKvx/iToDnuQWzc2oyDxzzBDc4=", "narHash": "sha256-aLJxoTDDSqB+/3orsulE6/qdlX6MzDLIITLZqdgMpqo=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "4703b8d2c708e13a8cab03d865f90973536dcdf5", "rev": "929116e316068c7318c54eb4d827f7d9756d5e9c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -278,11 +278,11 @@
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1732021966, "lastModified": 1733318908,
"narHash": "sha256-mnTbjpdqF0luOkou8ZFi2asa1N3AA2CchR/RqCNmsGE=", "narHash": "sha256-SVQVsbafSM1dJ4fpgyBqLZ+Lft+jcQuMtEL3lQWx2Sk=",
"owner": "cachix", "owner": "cachix",
"repo": "pre-commit-hooks.nix", "repo": "pre-commit-hooks.nix",
"rev": "3308484d1a443fc5bc92012435d79e80458fe43c", "rev": "6f4e2a2112050951a314d2733a994fbab94864c6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -441,11 +441,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1732575825, "lastModified": 1733128155,
"narHash": "sha256-xtt95+c7OUMoqZf4OvA/7AemiH3aVuWHQbErYQoPwFk=", "narHash": "sha256-m6/qwJAJYcidGMEdLqjKzRIjapK4nUfMq7rDCTmZajc=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "3433ea14fbd9e6671d0ff0dd45ed15ee4c156ffa", "rev": "c6134b6fff6bda95a1ac872a2a9d5f32e3c37856",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -42,9 +42,17 @@
}; };
}; };
outputs = { self, nixpkgs, flake-utils, deploy-rs, pre-commit-hooks, ... }@inputs: outputs =
flake-utils.lib.eachDefaultSystem {
(system: self,
nixpkgs,
flake-utils,
deploy-rs,
pre-commit-hooks,
...
}@inputs:
flake-utils.lib.eachDefaultSystem (
system:
let let
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
@ -52,10 +60,19 @@
}; };
in in
{ {
checks = import ./nix/checks.nix { inherit self pkgs deploy-rs system pre-commit-hooks; }; checks = import ./nix/checks.nix {
inherit
self
pkgs
deploy-rs
system
pre-commit-hooks
;
};
devShells = import ./nix/shells.nix { inherit self pkgs system; }; devShells = import ./nix/shells.nix { inherit self pkgs system; };
formatter = pkgs.nixpkgs-fmt; formatter = pkgs.nixfmt-rfc-style;
}) }
)
// { // {
hosts = import ./nix/hosts.nix; hosts = import ./nix/hosts.nix;
overlays.default = nixpkgs.lib.composeManyExtensions [ ]; overlays.default = nixpkgs.lib.composeManyExtensions [ ];

View File

@ -1,11 +1,18 @@
{ self, system, deploy-rs, pre-commit-hooks, ... }: {
self,
system,
deploy-rs,
pre-commit-hooks,
...
}:
{ {
pre-commit-check = pre-commit-hooks.lib.${system}.run { pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.; src = ./.;
hooks = { hooks = {
deadnix.enable = true; deadnix.enable = true;
nixpkgs-fmt.enable = true; nixfmt-rfc-style.enable = true;
statix.enable = true; statix.enable = true;
}; };
}; };
} // (deploy-rs.lib.${system}.deployChecks self.deploy) }
// (deploy-rs.lib.${system}.deployChecks self.deploy)

View File

@ -1,6 +1,12 @@
{ self, darwin, home-manager, ... }: {
self,
darwin,
home-manager,
...
}:
let let
mkDarwin = hostName: modules: mkDarwin =
hostName: modules:
let let
hostSystem = self.hosts.${hostName}.system; hostSystem = self.hosts.${hostName}.system;
in in

View File

@ -1,8 +1,19 @@
{ self, nixpkgs, deploy-rs, ... }: {
self,
nixpkgs,
deploy-rs,
...
}:
let let
mkDeploy = hostName: mkDeploy =
hostName:
let let
inherit (self.hosts.${hostName}) type address system sshUser; inherit (self.hosts.${hostName})
type
address
system
sshUser
;
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
deployPkgs = import nixpkgs { deployPkgs = import nixpkgs {
inherit system; inherit system;
@ -10,7 +21,8 @@ let
deploy-rs.overlays.default deploy-rs.overlays.default
(_self: super: { (_self: super: {
deploy-rs = { deploy-rs = {
inherit (pkgs) deploy-rs; inherit (super.deploy-rs) lib; inherit (pkgs) deploy-rs;
inherit (super.deploy-rs) lib;
}; };
}) })
]; ];

View File

@ -60,6 +60,9 @@
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ0mE4MyMnfd1b2nlBJT7kpZ6Vov+ILuGNfzdp5ZBNQe walkah@walkah.net" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ0mE4MyMnfd1b2nlBJT7kpZ6Vov+ILuGNfzdp5ZBNQe walkah@walkah.net"
]; ];
environment.systemPackages = with pkgs; [ libraspberrypi raspberrypi-eeprom ]; environment.systemPackages = with pkgs; [
libraspberrypi
raspberrypi-eeprom
];
security.sudo.wheelNeedsPassword = false; security.sudo.wheelNeedsPassword = false;
} }

View File

@ -8,7 +8,11 @@ _:
"homebrew/services" "homebrew/services"
]; ];
brews = [ "code-server" "coreutils" "mosh" ]; brews = [
"code-server"
"coreutils"
"mosh"
];
casks = [ casks = [
"1password" "1password"

View File

@ -56,7 +56,11 @@ in
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC5spf4diguK+w7iYLFr565++6DjHukWfvpN2ru9dCRk nixbuild" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC5spf4diguK+w7iYLFr565++6DjHukWfvpN2ru9dCRk nixbuild"
]; ];
environment.systemPackages = with pkgs; [ cifs-utils pinentry weechat ]; environment.systemPackages = with pkgs; [
cifs-utils
pinentry
weechat
];
fileSystems = { fileSystems = {
"/mnt/downloads" = { "/mnt/downloads" = {
device = "//parthenon/Downloads"; device = "//parthenon/Downloads";
@ -82,7 +86,6 @@ in
}; };
}; };
power.ups = { power.ups = {
enable = true; enable = true;
mode = "netserver"; mode = "netserver";
@ -144,7 +147,8 @@ in
scrapeConfigs = [ scrapeConfigs = [
{ {
job_name = "node"; job_name = "node";
static_configs = [{ static_configs = [
{
targets = [ targets = [
"plato:9100" "plato:9100"
"agent:9100" "agent:9100"
@ -153,18 +157,26 @@ in
"purpose:9100" "purpose:9100"
"socrates:9100" "socrates:9100"
]; ];
}]; }
];
} }
{ {
job_name = "coredns"; job_name = "coredns";
static_configs = [{ targets = [ "plato:9153" ]; }]; static_configs = [ { targets = [ "plato:9153" ]; } ];
} }
{ {
job_name = "ipfs"; job_name = "ipfs";
metrics_path = "/debug/metrics/prometheus"; metrics_path = "/debug/metrics/prometheus";
static_configs = [{ static_configs = [
targets = [ "agent:5001" "form:5001" "matter:5001" "purpose:5001" ]; {
}]; targets = [
"agent:5001"
"form:5001"
"matter:5001"
"purpose:5001"
];
}
];
} }
]; ];
}; };
@ -173,7 +185,9 @@ in
}; };
}; };
walkah.coredns = { enable = true; }; walkah.coredns = {
enable = true;
};
virtualisation.docker = { virtualisation.docker = {
enable = true; enable = true;

View File

@ -18,7 +18,10 @@
"sr_mod" "sr_mod"
]; ];
initrd.kernelModules = [ ]; initrd.kernelModules = [ ];
kernelModules = [ "kvm-intel" "wl" ]; kernelModules = [
"kvm-intel"
"wl"
];
extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ]; extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
}; };
@ -32,7 +35,6 @@
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = swapDevices = [ { device = "/dev/disk/by-uuid/3a812874-3def-4e46-b20d-cd55fa7bdd5f"; } ];
[{ device = "/dev/disk/by-uuid/3a812874-3def-4e46-b20d-cd55fa7bdd5f"; }];
} }

View File

@ -1,4 +1,5 @@
{ pkgs, ... }: { { pkgs, ... }:
{
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
./networking.nix # generated at runtime by nixos-infect ./networking.nix # generated at runtime by nixos-infect
@ -26,14 +27,20 @@
hostName = "socrates"; hostName = "socrates";
firewall = { firewall = {
allowPing = true; allowPing = true;
allowedTCPPorts = [ 80 443 ]; allowedTCPPorts = [
80
443
];
trustedInterfaces = [ "tailscale0" ]; trustedInterfaces = [ "tailscale0" ];
checkReversePath = "loose"; checkReversePath = "loose";
}; };
}; };
nix = { nix = {
settings.trusted-users = [ "@wheel" "root" ]; settings.trusted-users = [
"@wheel"
"root"
];
}; };
security = { security = {

View File

@ -2,5 +2,8 @@
{ {
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
boot.loader.grub.device = "/dev/vda"; boot.loader.grub.device = "/dev/vda";
fileSystems."/" = { device = "/dev/vda1"; fsType = "ext4"; }; fileSystems."/" = {
device = "/dev/vda1";
fsType = "ext4";
};
} }

View File

@ -1,4 +1,5 @@
{ lib, ... }: { { lib, ... }:
{
# This file was populated at runtime with the networking # This file was populated at runtime with the networking
# details gathered from the active system. # details gathered from the active system.
networking = { networking = {
@ -28,14 +29,18 @@
prefixLength = 64; prefixLength = 64;
} }
]; ];
ipv4.routes = [{ ipv4.routes = [
{
address = "167.99.176.1"; address = "167.99.176.1";
prefixLength = 32; prefixLength = 32;
}]; }
ipv6.routes = [{ ];
ipv6.routes = [
{
address = "2604:a880:cad:d0::1"; address = "2604:a880:cad:d0::1";
prefixLength = 32; prefixLength = 32;
}]; }
];
}; };
}; };

View File

@ -41,9 +41,15 @@ in
}; };
"Pleroma.Web.Endpoint" = { "Pleroma.Web.Endpoint" = {
secret_key_base = { _secret = secrets.akkoma-secret-key-base.path; }; secret_key_base = {
signing_salt = { _secret = secrets.akkoma-signing-salt.path; }; _secret = secrets.akkoma-secret-key-base.path;
live_view.signing_salt = { _secret = secrets.akkoma-signing-salt.path; }; };
signing_salt = {
_secret = secrets.akkoma-signing-salt.path;
};
live_view.signing_salt = {
_secret = secrets.akkoma-signing-salt.path;
};
url = { url = {
host = "walkah.social"; host = "walkah.social";
scheme = "https"; scheme = "https";
@ -57,12 +63,18 @@ in
}; };
":web_push_encryption" = { ":web_push_encryption" = {
":vapid_details" = { ":vapid_details" = {
private_key = { _secret = secrets.akkoma-vapid-private-key.path; }; private_key = {
public_key = { _secret = secrets.akkoma-vapid-public-key.path; }; _secret = secrets.akkoma-vapid-private-key.path;
};
public_key = {
_secret = secrets.akkoma-vapid-public-key.path;
};
}; };
}; };
":joken" = { ":joken" = {
":default_signer" = { _secret = secrets.akkoma-joken-signer.path; }; ":default_signer" = {
_secret = secrets.akkoma-joken-signer.path;
};
}; };
}; };
nginx = null; # doing this manually nginx = null; # doing this manually

View File

@ -1,5 +1,4 @@
_: _: {
{
services.nginx = { services.nginx = {
enable = true; enable = true;
virtualHosts = { virtualHosts = {

View File

@ -1,6 +1,10 @@
{ ... }: { { ... }:
{
imports = [ ./common.nix ../../users ]; imports = [
./common.nix
../../users
];
nix = { nix = {
configureBuildUsers = true; configureBuildUsers = true;
@ -18,7 +22,10 @@
options = "--delete-older-than 30d"; options = "--delete-older-than 30d";
}; };
settings = { settings = {
trusted-users = [ "root" "@admin" ]; trusted-users = [
"root"
"@admin"
];
}; };
}; };

View File

@ -1,6 +1,11 @@
{ config, pkgs, ... }: { { config, pkgs, ... }:
{
imports = [ ./common.nix ../monitoring ../../users ]; imports = [
./common.nix
../monitoring
../../users
];
documentation = { documentation = {
enable = false; enable = false;
@ -22,7 +27,10 @@
settings = { settings = {
auto-optimise-store = true; auto-optimise-store = true;
trusted-users = [ "root" "walkah" ]; trusted-users = [
"root"
"walkah"
];
}; };
}; };
@ -40,7 +48,11 @@
enable = true; enable = true;
flake = "github:walkah/athens#${config.networking.hostName}"; flake = "github:walkah/athens#${config.networking.hostName}";
dates = "hourly"; dates = "hourly";
flags = [ "--option" "tarball-ttl" "0" ]; flags = [
"--option"
"tarball-ttl"
"0"
];
}; };
stateVersion = "23.05"; stateVersion = "23.05";
}; };

View File

@ -4,9 +4,16 @@ _: {
buildMachines = [ buildMachines = [
{ {
hostName = "plato"; hostName = "plato";
systems = [ "x86_64-linux" "aarch64-linux" ]; systems = [
"x86_64-linux"
"aarch64-linux"
];
maxJobs = 6; maxJobs = 6;
supportedFeatures = [ "benchmark" "big-parallel" "kvm" ]; supportedFeatures = [
"benchmark"
"big-parallel"
"kvm"
];
} }
]; ];
extraOptions = '' extraOptions = ''

View File

@ -1,7 +1,8 @@
{ config, lib, ... }: { config, lib, ... }:
with lib; with lib;
let cfg = config.walkah.coredns; let
cfg = config.walkah.coredns;
in in
{ {
options.walkah.coredns = { options.walkah.coredns = {

View File

@ -6,6 +6,6 @@
cachix cachix
nixd nixd
nixf nixf
nixpkgs-fmt nixfmt-rfc-style
]; ];
} }

View File

@ -1,4 +1,5 @@
{ pkgs, config, ... }: { { pkgs, config, ... }:
{
sops.secrets.drone = { sops.secrets.drone = {
owner = "drone"; owner = "drone";
}; };

View File

@ -1,4 +1,5 @@
{ pkgs, config, ... }: { { pkgs, config, ... }:
{
systemd.services.drone-runner-docker = { systemd.services.drone-runner-docker = {
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
serviceConfig = { serviceConfig = {

View File

@ -36,14 +36,14 @@
"/etc/passwd:/etc/passwd" "/etc/passwd:/etc/passwd"
"/etc/group:/etc/group" "/etc/group:/etc/group"
"/nix/var/nix/profiles/system/etc/nix:/etc/nix" "/nix/var/nix/profiles/system/etc/nix:/etc/nix"
"${config.environment.etc."ssl/certs/ca-certificates.crt".source}:/etc/ssl/certs/ca-certificates.crt"
"${config.environment.etc."ssh/ssh_known_hosts".source}:/etc/ssh/ssh_known_hosts"
"${ "${
builtins.toFile "ssh_config" '' config.environment.etc."ssl/certs/ca-certificates.crt".source
}:/etc/ssl/certs/ca-certificates.crt"
"${config.environment.etc."ssh/ssh_known_hosts".source}:/etc/ssh/ssh_known_hosts"
"${builtins.toFile "ssh_config" ''
Host eve.thalheim.io Host eve.thalheim.io
ForwardAgent yes ForwardAgent yes
'' ''}:/etc/ssh/ssh_config"
}:/etc/ssh/ssh_config"
"/etc/machine-id" "/etc/machine-id"
# channels are dynamic paths in the nix store, therefore we need to bind mount the whole thing # channels are dynamic paths in the nix store, therefore we need to bind mount the whole thing
"/nix/" "/nix/"

View File

@ -1,6 +1,7 @@
{ config, ... }: { config, ... }:
let cfg = config.services.gitea; let
cfg = config.services.gitea;
in in
{ {
users.users.git = { users.users.git = {
@ -20,9 +21,15 @@ in
lfs.enable = true; lfs.enable = true;
settings = { settings = {
log = { LEVEL = "Error"; }; log = {
other = { SHOW_FOOTER_VERSION = false; }; LEVEL = "Error";
repository = { DEFAULT_BRANCH = "main"; }; };
other = {
SHOW_FOOTER_VERSION = false;
};
repository = {
DEFAULT_BRANCH = "main";
};
server = { server = {
DOMAIN = "walkah.dev"; DOMAIN = "walkah.dev";
HTTP_ADDR = "0.0.0.0"; HTTP_ADDR = "0.0.0.0";
@ -30,8 +37,12 @@ in
ROOT_URL = "https://walkah.dev/"; ROOT_URL = "https://walkah.dev/";
SSH_DOMAIN = "git.walkah.dev"; SSH_DOMAIN = "git.walkah.dev";
}; };
service = { DISABLE_REGISTRATION = true; }; service = {
session = { COOKIE_SECURE = true; }; DISABLE_REGISTRATION = true;
};
session = {
COOKIE_SECURE = true;
};
}; };
dump.enable = false; dump.enable = false;

View File

@ -10,7 +10,11 @@
kubo = { kubo = {
enable = true; enable = true;
settings = { settings = {
Discovery = { MDNS = { Enabled = true; }; }; Discovery = {
MDNS = {
Enabled = true;
};
};
Swarm = { Swarm = {
AddrFilters = null; AddrFilters = null;
ConnMgr = { ConnMgr = {

View File

@ -17,8 +17,14 @@ _:
"/ip6/::/udp/4001/quic" "/ip6/::/udp/4001/quic"
]; ];
}; };
API = { HTTPHeaders = { Access-Control-Allow-Origin = [ "*" ]; }; }; API = {
Routing = { Type = "dht"; }; HTTPHeaders = {
Access-Control-Allow-Origin = [ "*" ];
};
};
Routing = {
Type = "dht";
};
}; };
}; };
}; };

View File

@ -40,9 +40,17 @@ in
kubo = { kubo = {
enable = true; enable = true;
settings = { settings = {
Discovery = { MDNS = { Enabled = false; }; }; Discovery = {
Peering = { Peers = peers; }; MDNS = {
Swarm = { AddrFilters = null; }; Enabled = false;
};
};
Peering = {
Peers = peers;
};
Swarm = {
AddrFilters = null;
};
}; };
}; };
nginx = { nginx = {
@ -50,14 +58,18 @@ in
virtualHosts."walkah.cloud" = { virtualHosts."walkah.cloud" = {
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
locations."/" = { proxyPass = "http://127.0.0.1:8080"; }; locations."/" = {
proxyPass = "http://127.0.0.1:8080";
};
}; };
# Hosted Sites # Hosted Sites
virtualHosts."walkah.net" = { virtualHosts."walkah.net" = {
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
locations."/" = { proxyPass = "http://127.0.0.1:8080"; }; locations."/" = {
proxyPass = "http://127.0.0.1:8080";
};
serverAliases = [ serverAliases = [
"www.walkah.net" "www.walkah.net"
]; ];

View File

@ -17,7 +17,10 @@
LC_CTYPE = "C"; LC_CTYPE = "C";
''; '';
}; };
postgresqlBackup.databases = [ "matrix" "matrix-syncv3" ]; postgresqlBackup.databases = [
"matrix"
"matrix-syncv3"
];
matrix-synapse = { matrix-synapse = {
enable = true; enable = true;
@ -28,9 +31,12 @@
enable_registration = false; enable_registration = false;
database = { database = {
name = "psycopg2"; name = "psycopg2";
args = { database = "matrix"; }; args = {
database = "matrix";
}; };
listeners = [{ };
listeners = [
{
bind_addresses = [ bind_addresses = [
"0.0.0.0" "0.0.0.0"
]; ];
@ -38,11 +44,17 @@
type = "http"; type = "http";
tls = false; tls = false;
x_forwarded = true; x_forwarded = true;
resources = [{ resources = [
{
compress = false; compress = false;
names = [ "client" "federation" ]; names = [
}]; "client"
}]; "federation"
];
}
];
}
];
}; };
extraConfigFiles = [ extraConfigFiles = [
config.sops.secrets.matrix-registration-secret.path config.sops.secrets.matrix-registration-secret.path

View File

@ -7,13 +7,17 @@
"matrix.walkah.chat" = { "matrix.walkah.chat" = {
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
locations."/" = { proxyPass = "http://100.111.208.75:8008"; }; locations."/" = {
proxyPass = "http://100.111.208.75:8008";
};
}; };
"syncv3.walkah.chat" = { "syncv3.walkah.chat" = {
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
locations."/" = { proxyPass = "http://100.111.208.75:8088"; }; locations."/" = {
proxyPass = "http://100.111.208.75:8088";
};
}; };
"walkah.chat" = { "walkah.chat" = {
@ -21,7 +25,10 @@
enableACME = true; enableACME = true;
locations = { locations = {
"= /.well-known/matrix/server".extraConfig = "= /.well-known/matrix/server".extraConfig =
let server = { "m.server" = "matrix.walkah.chat:443"; }; let
server = {
"m.server" = "matrix.walkah.chat:443";
};
in in
'' ''
default_type application/json; default_type application/json;
@ -31,8 +38,12 @@
"= /.well-known/matrix/client".extraConfig = "= /.well-known/matrix/client".extraConfig =
let let
client = { client = {
"m.homeserver" = { "base_url" = "https://matrix.walkah.chat"; }; "m.homeserver" = {
"org.matrix.msc3575.proxy" = { "url" = "https://syncv3.walkah.chat"; }; "base_url" = "https://matrix.walkah.chat";
};
"org.matrix.msc3575.proxy" = {
"url" = "https://syncv3.walkah.chat";
};
}; };
in in
'' ''
@ -40,7 +51,9 @@
add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Origin *;
return 200 '${builtins.toJSON client}'; return 200 '${builtins.toJSON client}';
''; '';
"/" = { root = pkgs.element-web; }; "/" = {
root = pkgs.element-web;
};
}; };
}; };
}; };

View File

@ -1,4 +1,5 @@
{ pkgs, config, ... }: { { pkgs, config, ... }:
{
services = { services = {
postgresql = { postgresql = {
enable = true; enable = true;

View File

@ -1,6 +1,14 @@
{ self, nixpkgs, home-manager, raspberry-pi-nix, sops-nix, ... }: {
self,
nixpkgs,
home-manager,
raspberry-pi-nix,
sops-nix,
...
}:
let let
mkSystem = hostName: modules: mkSystem =
hostName: modules:
let let
hostSystem = self.hosts.${hostName}.system; hostSystem = self.hosts.${hostName}.system;
in in

View File

@ -1,5 +1,10 @@
## From https://github.com/NixOS/nixpkgs/pull/100871 ## From https://github.com/NixOS/nixpkgs/pull/100871
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
with lib; with lib;
let let
cfg = config.services.ipfs-cluster; cfg = config.services.ipfs-cluster;
@ -14,8 +19,7 @@ in
###### interface ###### interface
options = { options = {
services.ipfs-cluster = { services.ipfs-cluster = {
enable = mkEnableOption enable = mkEnableOption "Pinset orchestration for IPFS - requires ipfs daemon to be useful";
"Pinset orchestration for IPFS - requires ipfs daemon to be useful";
user = mkOption { user = mkOption {
type = types.str; type = types.str;
@ -30,7 +34,10 @@ in
}; };
consensus = mkOption { consensus = mkOption {
type = types.enum [ "raft" "crdt" ]; type = types.enum [
"raft"
"crdt"
];
description = "Consensus protocol - 'raft' or 'crdt'. https://cluster.ipfs.io/documentation/guides/consensus/"; description = "Consensus protocol - 'raft' or 'crdt'. https://cluster.ipfs.io/documentation/guides/consensus/";
}; };
@ -74,15 +81,18 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.ipfs-cluster ]; environment.systemPackages = [ pkgs.ipfs-cluster ];
systemd = { systemd = {
tmpfiles.rules = tmpfiles.rules = [ "d '${cfg.dataDir}' - ${cfg.user} ${cfg.group} - -" ];
[ "d '${cfg.dataDir}' - ${cfg.user} ${cfg.group} - -" ];
services.ipfs-cluster-init = { services.ipfs-cluster-init = {
path = [ "/run/wrappers" pkgs.ipfs-cluster ]; path = [
"/run/wrappers"
pkgs.ipfs-cluster
];
environment.IPFS_CLUSTER_PATH = cfg.dataDir; environment.IPFS_CLUSTER_PATH = cfg.dataDir;
wantedBy = [ "default.target" ]; wantedBy = [ "default.target" ];
serviceConfig = { serviceConfig =
{
# "" clears exec list (man systemd.service -> execStart) # "" clears exec list (man systemd.service -> execStart)
ExecStart = [ ExecStart = [
"" ""
@ -92,7 +102,8 @@ in
RemainAfterExit = true; RemainAfterExit = true;
User = cfg.user; User = cfg.user;
Group = cfg.group; Group = cfg.group;
} // optionalAttrs (cfg.secretFile != null) { }
// optionalAttrs (cfg.secretFile != null) {
EnvironmentFile = cfg.secretFile; EnvironmentFile = cfg.secretFile;
}; };
unitConfig.ConditionDirectoryNotEmpty = "!${cfg.dataDir}"; unitConfig.ConditionDirectoryNotEmpty = "!${cfg.dataDir}";
@ -105,16 +116,23 @@ in
wants = [ "ipfs-cluster-init.service" ]; wants = [ "ipfs-cluster-init.service" ];
after = [ "ipfs-cluster-init.service" ]; after = [ "ipfs-cluster-init.service" ];
serviceConfig = { serviceConfig =
ExecStart = {
[ "" "${pkgs.ipfs-cluster}/bin/ipfs-cluster-service daemon" ]; ExecStart = [
""
"${pkgs.ipfs-cluster}/bin/ipfs-cluster-service daemon"
];
User = cfg.user; User = cfg.user;
Group = cfg.group; Group = cfg.group;
} // optionalAttrs (cfg.secretFile != null) { }
// optionalAttrs (cfg.secretFile != null) {
EnvironmentFile = cfg.secretFile; EnvironmentFile = cfg.secretFile;
}; };
}; };
}; };
networking.firewall.allowedTCPPorts = mkIf cfg.openSwarmPort [ 9094 9096 ]; networking.firewall.allowedTCPPorts = mkIf cfg.openSwarmPort [
9094
9096
];
}; };
} }

View File

@ -1,4 +1,10 @@
{ system, pkgs, self, ... }: { {
system,
pkgs,
self,
...
}:
{
default = pkgs.mkShell { default = pkgs.mkShell {
name = "athens"; name = "athens";
buildInputs = with pkgs; [ buildInputs = with pkgs; [

View File

@ -1,15 +1,20 @@
{ lib, pkgs, ... }: { lib, pkgs, ... }:
{ {
users.users.walkah = { users.users.walkah =
{
home = if pkgs.stdenv.isDarwin then "/Users/walkah" else "/home/walkah"; home = if pkgs.stdenv.isDarwin then "/Users/walkah" else "/home/walkah";
shell = pkgs.zsh; shell = pkgs.zsh;
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ0mE4MyMnfd1b2nlBJT7kpZ6Vov+ILuGNfzdp5ZBNQe walkah@walkah.net" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ0mE4MyMnfd1b2nlBJT7kpZ6Vov+ILuGNfzdp5ZBNQe walkah@walkah.net"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM8YMax7PGIrcPNIHkpuNRFgn3HJK6Wepm+ycZWO6jfR walkah@walkah-ipadpro11" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM8YMax7PGIrcPNIHkpuNRFgn3HJK6Wepm+ycZWO6jfR walkah@walkah-ipadpro11"
]; ];
} // lib.optionalAttrs pkgs.stdenv.isLinux { }
extraGroups = [ "wheel" "docker" ]; // lib.optionalAttrs pkgs.stdenv.isLinux {
extraGroups = [
"wheel"
"docker"
];
group = "walkah"; group = "walkah";
isNormalUser = true; isNormalUser = true;
}; };

View File

@ -1,4 +1,5 @@
{ lib, pkgs, ... }: { { lib, pkgs, ... }:
{
home = { home = {
packages = with pkgs; [ packages = with pkgs; [
chezmoi chezmoi

View File

@ -10,4 +10,5 @@
) )
{ {
src = ./.; src = ./.;
}).shellNix }
).shellNix