Add formatter & reformat.
This commit is contained in:
@@ -13,18 +13,22 @@
|
||||
fileSystems."/data/media" = {
|
||||
device = "//fractal/media";
|
||||
fsType = "cifs";
|
||||
options = let
|
||||
# this line prevents hanging on network split
|
||||
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
|
||||
in ["${automount_opts},credentials=/etc/nixos/smb-secrets"];
|
||||
options =
|
||||
let
|
||||
# this line prevents hanging on network split
|
||||
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
|
||||
in
|
||||
[ "${automount_opts},credentials=/etc/nixos/smb-secrets" ];
|
||||
};
|
||||
|
||||
fileSystems."/data/shared" = {
|
||||
device = "//fractal/shared";
|
||||
fsType = "cifs";
|
||||
options = let
|
||||
# this line prevents hanging on network split
|
||||
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
|
||||
in ["${automount_opts},credentials=/etc/nixos/smb-secrets"];
|
||||
options =
|
||||
let
|
||||
# this line prevents hanging on network split
|
||||
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
|
||||
in
|
||||
[ "${automount_opts},credentials=/etc/nixos/smb-secrets" ];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
{ pkgs, config, ... }:
|
||||
let
|
||||
servers = [ "c1" "c2" "c3" ];
|
||||
servers = [
|
||||
"c1"
|
||||
"c2"
|
||||
"c3"
|
||||
];
|
||||
server_enabled = builtins.elem config.networking.hostName servers;
|
||||
in
|
||||
{
|
||||
@@ -21,12 +25,20 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
environment.persistence."/persist".directories = [
|
||||
"/var/lib/consul"
|
||||
];
|
||||
environment.persistence."/persist".directories = [ "/var/lib/consul" ];
|
||||
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = [ 8600 8500 8301 8302 8300 ];
|
||||
allowedUDPPorts = [ 8600 8301 8302 ];
|
||||
allowedTCPPorts = [
|
||||
8600
|
||||
8500
|
||||
8301
|
||||
8302
|
||||
8300
|
||||
];
|
||||
allowedUDPPorts = [
|
||||
8600
|
||||
8301
|
||||
8302
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
{
|
||||
virtualisation.docker.enable = true;
|
||||
}
|
||||
{ virtualisation.docker.enable = true; }
|
||||
|
||||
@@ -32,7 +32,7 @@ in
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [
|
||||
"umask=0077" # to avoid the random seed being world readable
|
||||
"umask=0077" # to avoid the random seed being world readable
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
{
|
||||
powerManagement.cpuFreqGovernor = "ondemand";
|
||||
}
|
||||
{ powerManagement.cpuFreqGovernor = "ondemand"; }
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
{
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
nix.settings.experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
{
|
||||
time.timeZone = "Europe/Lisbon";
|
||||
}
|
||||
{ time.timeZone = "Europe/Lisbon"; }
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
};
|
||||
|
||||
environment.persistence."/persist" = {
|
||||
directories = [
|
||||
"/var/db/dhcpcd"
|
||||
];
|
||||
directories = [ "/var/db/dhcpcd" ];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{
|
||||
nix.settings.trusted-users = [ "root" "@wheel" ];
|
||||
nix.settings.trusted-users = [
|
||||
"root"
|
||||
"@wheel"
|
||||
];
|
||||
nix.gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
{ pkgs, config, lib, ... }:
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
system.activationScripts.show-update-changelog = ''
|
||||
if [[ -e /run/current-system ]]; then
|
||||
echo "[show-update-changelog] System Changelog"
|
||||
${lib.getExe pkgs.nvd} --nix-bin-dir='${config.nix.package}/bin' diff /run/current-system "$systemConfig"
|
||||
fi
|
||||
if [[ -e /run/current-system ]]; then
|
||||
echo "[show-update-changelog] System Changelog"
|
||||
${lib.getExe pkgs.nvd} --nix-bin-dir='${config.nix.package}/bin' diff /run/current-system "$systemConfig"
|
||||
fi
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -8,7 +8,5 @@ in
|
||||
|
||||
services.tailscale.package = pkgs.unstable.tailscale;
|
||||
|
||||
environment.persistence."/persist".directories = [
|
||||
"/var/lib/tailscale"
|
||||
];
|
||||
environment.persistence."/persist".directories = [ "/var/lib/tailscale" ];
|
||||
}
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
# https://guekka.github.io/nixos-server-2/
|
||||
{ config, lib, pkgs, ... }:
|
||||
with lib; let
|
||||
cfg = config.services.tailscaleAutoconnect;
|
||||
in {
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.services.tailscaleAutoconnect;
|
||||
in
|
||||
{
|
||||
options.services.tailscaleAutoconnect = {
|
||||
enable = mkEnableOption "tailscaleAutoconnect";
|
||||
|
||||
@@ -56,9 +63,15 @@ in {
|
||||
description = "Automatic connection to Tailscale";
|
||||
|
||||
# make sure tailscale is running before trying to connect to tailscale
|
||||
after = ["network-pre.target" "tailscale.service"];
|
||||
wants = ["network-pre.target" "tailscale.service"];
|
||||
wantedBy = ["multi-user.target"];
|
||||
after = [
|
||||
"network-pre.target"
|
||||
"tailscale.service"
|
||||
];
|
||||
wants = [
|
||||
"network-pre.target"
|
||||
"tailscale.service"
|
||||
];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig.Type = "oneshot";
|
||||
|
||||
|
||||
@@ -1,13 +1,24 @@
|
||||
{ pkgs, config, lib, ... }:
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
services.glusterfs = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
environment.persistence."/persist".directories = [
|
||||
"/var/lib/glusterd"
|
||||
];
|
||||
environment.persistence."/persist".directories = [ "/var/lib/glusterd" ];
|
||||
|
||||
# TODO: each volume needs its own port starting at 49152
|
||||
networking.firewall.allowedTCPPorts = [ 24007 24008 24009 49152 49153 49154 49155 ];
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
24007
|
||||
24008
|
||||
24009
|
||||
49152
|
||||
49153
|
||||
49154
|
||||
49155
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
{ pkgs, inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
inputs.impermanence.nixosModules.impermanence
|
||||
];
|
||||
imports = [ inputs.impermanence.nixosModules.impermanence ];
|
||||
|
||||
environment.persistence."/persist" = {
|
||||
directories = [
|
||||
"/var/lib/nixos"
|
||||
];
|
||||
directories = [ "/var/lib/nixos" ];
|
||||
files = [
|
||||
"/etc/machine-id"
|
||||
"/etc/ssh/ssh_host_ed25519_key"
|
||||
@@ -17,11 +13,23 @@
|
||||
];
|
||||
};
|
||||
|
||||
fileSystems."/".options = ["compress=zstd" "noatime" ];
|
||||
fileSystems."/nix".options = ["compress=zstd" "noatime" ];
|
||||
fileSystems."/persist".options = ["compress=zstd" "noatime" ];
|
||||
fileSystems."/".options = [
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
fileSystems."/nix".options = [
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
fileSystems."/persist".options = [
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
fileSystems."/persist".neededForBoot = true;
|
||||
fileSystems."/var/log".options = ["compress=zstd" "noatime" ];
|
||||
fileSystems."/var/log".options = [
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
fileSystems."/var/log".neededForBoot = true;
|
||||
|
||||
users.mutableUsers = false;
|
||||
@@ -58,4 +66,3 @@
|
||||
umount /mnt
|
||||
'';
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
# inspiration: https://github.com/astro/skyflake/blob/main/nixos-modules/nomad.nix
|
||||
{ pkgs, config, ... }:
|
||||
let
|
||||
servers = [ "c1" "c2" "c3" ];
|
||||
servers = [
|
||||
"c1"
|
||||
"c2"
|
||||
"c3"
|
||||
];
|
||||
server_enabled = builtins.elem config.networking.hostName servers;
|
||||
in
|
||||
{
|
||||
@@ -58,7 +62,7 @@ in
|
||||
allow_privileged = true;
|
||||
# for keepalived, though only really needing "NET_ADMIN","NET_BROADCAST","NET_RAW" on top of default
|
||||
# TODO: trim this down
|
||||
allow_caps = ["all"];
|
||||
allow_caps = [ "all" ];
|
||||
volumes.enabled = true;
|
||||
extra_labels = [
|
||||
"job_name"
|
||||
@@ -83,7 +87,15 @@ in
|
||||
];
|
||||
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = if server_enabled then [ 4646 4647 4648 ] else [ 4646 ];
|
||||
allowedUDPPorts = if server_enabled then [ 4648 ] else [];
|
||||
allowedTCPPorts =
|
||||
if server_enabled then
|
||||
[
|
||||
4646
|
||||
4647
|
||||
4648
|
||||
]
|
||||
else
|
||||
[ 4646 ];
|
||||
allowedUDPPorts = if server_enabled then [ 4648 ] else [ ];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,9 +5,7 @@
|
||||
# This could list the owner user but I'm not sure if it's already created at
|
||||
# the time impermanence setup runs.
|
||||
# Note: chown syncthing:syncthing /data/sync && chmod 700 /data/sync also seems to work
|
||||
environment.persistence."/persist".directories = [
|
||||
"/data/sync"
|
||||
];
|
||||
environment.persistence."/persist".directories = [ "/data/sync" ];
|
||||
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
@@ -18,10 +16,18 @@
|
||||
overrideFolders = true;
|
||||
settings = {
|
||||
devices = {
|
||||
"c1" = { id = "53JGRHQ-VGBYIGH-7IT6Z5S-3IMRY2I-LJZAE3B-QUDH3QF-4F4QKVC-VBWPJQ4"; };
|
||||
"c2" = { id = "Z3D476N-PUV6WAD-DSJWVBO-TWEOD4I-KDDMNRB-QEBOP6T-BYPGYTX-RAAYGAW"; };
|
||||
"c3" = { id = "D3C3YII-A3QGUNF-LHOGZNX-GJ4ZF3X-VVLMNY5-BBKF3BO-KNHKJMD-EA5QYQJ"; };
|
||||
"zippy" = { id = "WXDYZWN-JG2OBQH-CC42RMM-LPJGTS6-Y2BV37J-TYSLHL4-VHGYL5M-URI42QJ"; };
|
||||
"c1" = {
|
||||
id = "53JGRHQ-VGBYIGH-7IT6Z5S-3IMRY2I-LJZAE3B-QUDH3QF-4F4QKVC-VBWPJQ4";
|
||||
};
|
||||
"c2" = {
|
||||
id = "Z3D476N-PUV6WAD-DSJWVBO-TWEOD4I-KDDMNRB-QEBOP6T-BYPGYTX-RAAYGAW";
|
||||
};
|
||||
"c3" = {
|
||||
id = "D3C3YII-A3QGUNF-LHOGZNX-GJ4ZF3X-VVLMNY5-BBKF3BO-KNHKJMD-EA5QYQJ";
|
||||
};
|
||||
"zippy" = {
|
||||
id = "WXDYZWN-JG2OBQH-CC42RMM-LPJGTS6-Y2BV37J-TYSLHL4-VHGYL5M-URI42QJ";
|
||||
};
|
||||
};
|
||||
folders = {
|
||||
"wordpress" = {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
boot.initrd.kernelModules = [ "usb_storage" ];
|
||||
boot.initrd.luks.devices."luksroot" = {
|
||||
allowDiscards = true;
|
||||
bypassWorkqueues = true;
|
||||
keyFileSize = 4096;
|
||||
allowDiscards = true;
|
||||
bypassWorkqueues = true;
|
||||
keyFileSize = 4096;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user