mirror of
https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git
synced 2026-01-12 10:28:25 +01:00
Compare commits
207 Commits
d88dd0a45c
...
bindmount-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0a49f87d5 | ||
|
|
a619125dcb | ||
|
|
c9d90203d4 | ||
|
|
bde6ebc6ad | ||
| 0491df32f7 | |||
|
|
f1c89fd22a | ||
|
|
f58c935966 | ||
|
|
a238540e04 | ||
|
|
bd4b8c876f | ||
|
|
88ea686b59 | ||
|
|
0a8702e3ba | ||
|
|
3a9efb2b1f | ||
|
|
f1bdd71192 | ||
|
|
6d171ef0d2 | ||
|
|
1d08131076 | ||
|
|
ad137081c7 | ||
|
|
f04596b752 | ||
|
|
f154d58f32 | ||
|
|
22fb43fa63 | ||
|
|
0e1ab4c85c | ||
|
|
cdb72b972d | ||
|
|
12dcd1551b | ||
|
|
dbbe06f628 | ||
|
|
ebff173946 | ||
|
|
3dc6ae6d58 | ||
|
|
ca3ab5415a | ||
|
|
79ddc28c9f | ||
|
|
3ae26bc53f | ||
|
|
86a8d2e2f1 | ||
|
|
b5513dd6af | ||
|
|
252f5a6f94 | ||
|
|
d666aa6c33 | ||
|
|
e9bebc8119 | ||
|
|
c2bc84dc6f | ||
|
|
c722650eab | ||
|
|
30472c478b | ||
|
|
938e916025 | ||
|
|
c5dce0fa0f | ||
|
|
d9a9fcfef1 | ||
|
|
ab04d573ed | ||
|
|
50e346c9bb | ||
|
|
39977eeb5c | ||
|
|
3faad36418 | ||
|
|
0b74907f76 | ||
|
|
bacfdeff23 | ||
|
|
9e51bdb373 | ||
|
|
df5557698f | ||
|
|
c7930b793a | ||
|
|
dbe9dbe6f4 | ||
|
|
2e75f31d3e | ||
|
|
1166161858 | ||
|
|
a0164a4038 | ||
|
|
470cc451e0 | ||
|
|
a803de2b23 | ||
|
|
1dc78b6101 | ||
|
|
54434b7f93 | ||
| 736dc44008 | |||
|
|
9e68287f1b | ||
|
|
b821d36f40 | ||
|
|
0b7fbcac32 | ||
|
|
f3c60d0551 | ||
|
|
f0d2d989d1 | ||
|
|
57d0c6247b | ||
|
|
95840bfa3c | ||
|
|
72da80f93f | ||
|
|
8ffc2acea7 | ||
|
|
0d1423ab22 | ||
|
|
809fcefbcf | ||
|
|
203358a207 | ||
|
|
d11b189f95 | ||
|
|
b439ddd6f6 | ||
|
|
a22747bb66 | ||
|
|
efc79ee189 | ||
|
|
8715fb220f | ||
|
|
649c21de01 | ||
|
|
2010556643 | ||
|
|
8dcd471a6f | ||
|
|
234a7030f0 | ||
|
|
0a7f559869 | ||
|
|
d482eb332d | ||
|
|
0600fce2ca | ||
|
|
f5fed06381 | ||
|
|
579ed180a3 | ||
|
|
043099eb37 | ||
|
|
59969b9ec8 | ||
| febc0940f8 | |||
|
|
76c251c277 | ||
|
|
1d48a63e3d | ||
|
|
ddd405f534 | ||
|
|
a2dcd3019f | ||
|
|
410d4e44a8 | ||
|
|
195163fd7b | ||
|
|
4fa544b430 | ||
|
|
7601734651 | ||
|
|
cafeef827f | ||
|
|
9e00d143f8 | ||
|
|
eceb2ce4c7 | ||
|
|
518008527d | ||
|
|
9e82ca3d15 | ||
|
|
da7cb17f9e | ||
|
|
1caa0cc7be | ||
|
|
752141f97f | ||
|
|
23c1c17607 | ||
|
|
9560eab82b | ||
|
|
5e4ededab3 | ||
|
|
7fb3e29d7b | ||
|
|
9053dda57c | ||
|
|
4ab133e541 | ||
|
|
e5b38cd2c1 | ||
|
|
3e156a8649 | ||
|
|
b40cde891e | ||
|
|
dca6862045 | ||
|
|
4e44da29b5 | ||
|
|
ca9ac0e0fc | ||
|
|
c8d29c363f | ||
|
|
e387656be8 | ||
|
|
48a5f4e79e | ||
|
|
29c4029486 | ||
|
|
5d704840ce | ||
|
|
43d3ef1fed | ||
|
|
e8df081894 | ||
|
|
f40f2ae89d | ||
|
|
a3c3ceac49 | ||
|
|
7f3d288a15 | ||
|
|
f9f2304939 | ||
|
|
02c752e596 | ||
|
|
e44b2e8d0d | ||
|
|
13a270b8ed | ||
|
|
20ade0d619 | ||
|
|
20e3f89b79 | ||
|
|
f0e6521fbb | ||
|
|
d59a3f6ec0 | ||
|
|
b730bdc34d | ||
|
|
f1f4da9ff6 | ||
|
|
cd40bd6178 | ||
|
|
41e7f09c8b | ||
|
|
30bedecd72 | ||
|
|
29ad65bfef | ||
|
|
b5a95eac90 | ||
|
|
b2adb38a8b | ||
|
|
3a707b00d3 | ||
|
|
decd69d9ae | ||
|
|
b7fca76ea5 | ||
|
|
c6b7e7f555 | ||
|
|
32a529e60f | ||
|
|
493ab057f4 | ||
|
|
c683e2184a | ||
|
|
5c32798dcf | ||
|
|
e5cbd66769 | ||
|
|
8b34f31e3f | ||
|
|
08b010cb93 | ||
|
|
a408ef6688 | ||
| c83005983e | |||
|
|
30d31956c6 | ||
|
|
c8bf3b7c01 | ||
|
|
069da36895 | ||
|
|
83f83a91b7 | ||
|
|
6372a4111e | ||
|
|
bdfb7384c2 | ||
|
|
ace351c0a7 | ||
|
|
cd5c2c0e01 | ||
|
|
2be9eb16fe | ||
|
|
64bd33a213 | ||
|
|
7b5e114944 | ||
|
|
ee8965e18c | ||
|
|
7125fd2478 | ||
|
|
0c1762619a | ||
|
|
84d1ae13c0 | ||
|
|
a3c88b7869 | ||
|
|
4aa994e7a3 | ||
|
|
fc64139739 | ||
|
|
75b0c00212 | ||
|
|
94d73b34ad | ||
|
|
bf50d6478b | ||
|
|
e9dc0d85a0 | ||
|
|
4f28815018 | ||
|
|
bdaa765dbb | ||
| c0e551eb8b | |||
|
|
a009b05977 | ||
|
|
8a8f5659fb | ||
| 13c921c47b | |||
|
|
819fcef4c2 | ||
|
|
102a6f9011 | ||
|
|
86e68f496e | ||
|
|
394ff94033 | ||
|
|
6cb7f576a5 | ||
|
|
edb448f7a0 | ||
|
|
4507ffe2ab | ||
| 882a8f2e88 | |||
|
|
65da25da7e | ||
|
|
fd81d61a56 | ||
|
|
2776273a27 | ||
|
|
ebc5b269ef | ||
|
|
850d0b0ec5 | ||
|
|
02792fc20e | ||
|
|
40dd069a52 | ||
|
|
04a838fc62 | ||
|
|
1f85208587 | ||
|
|
c10c6d5a09 | ||
|
|
6301688c95 | ||
|
|
0ed0a3a504 | ||
|
|
5242d99260 | ||
|
|
c60597dc5a | ||
|
|
69462bf486 | ||
|
|
7d4ccf1972 | ||
|
|
c87a81eeee | ||
|
|
3bdfb4c297 |
@@ -4,10 +4,10 @@ on:
|
||||
push:
|
||||
jobs:
|
||||
evals:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: debian-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v6
|
||||
- run: apt-get update && apt-get -y install sudo
|
||||
- uses: https://github.com/cachix/install-nix-action@v23
|
||||
- uses: https://github.com/cachix/install-nix-action@v31
|
||||
- run: echo -e "show-trace = true\nmax-jobs = auto\ntrusted-users = root\nexperimental-features = nix-command flakes\nbuild-users-group =" > /etc/nix/nix.conf
|
||||
- run: nix flake check
|
||||
|
||||
25
.mailmap
Normal file
25
.mailmap
Normal file
@@ -0,0 +1,25 @@
|
||||
Daniel Løvbrøtte Olsen <danio@pvv.ntnu.no> <daniel.olsen99@gmail.com>
|
||||
Daniel Løvbrøtte Olsen <danio@pvv.ntnu.no> Daniel <danio@pvv.ntnu.no>
|
||||
Daniel Løvbrøtte Olsen <danio@pvv.ntnu.no> Daniel Lovbrotte Olsen <danio@pvv.ntnu.no>
|
||||
Daniel Løvbrøtte Olsen <danio@pvv.ntnu.no> Daniel Olsen <danio@pvv.ntnu.no>
|
||||
Daniel Løvbrøtte Olsen <danio@pvv.ntnu.no> danio <danio@pvv.ntnu.no>
|
||||
Daniel Løvbrøtte Olsen <danio@pvv.ntnu.no> Daniel Olsen <danio@bicep.pvv.ntnu.no>
|
||||
|
||||
|
||||
Øystein Kristoffer Tveit <oysteikt@pvv.ntnu.no> h7x4 <h7x4@nani.wtf>
|
||||
Øystein Kristoffer Tveit <oysteikt@pvv.ntnu.no> Øystein Tveit <oysteikt@pvv.ntnu.no>
|
||||
Øystein Kristoffer Tveit <oysteikt@pvv.ntnu.no> oysteikt <oysteikt@pvv.ntnu.no>
|
||||
Øystein Kristoffer Tveit <oysteikt@pvv.ntnu.no> Øystein <oysteikt@pvv.org>
|
||||
Øystein Kristoffer Tveit <oysteikt@pvv.ntnu.no> Oystein Kristoffer Tveit <oysteikt@pvv.ntnu.no>
|
||||
|
||||
Felix Albrigtsen <felixalb@pvv.ntnu.no> <felix@albrigtsen.it>
|
||||
Felix Albrigtsen <felixalb@pvv.ntnu.no> <felixalbrigtsen@gmail.com>
|
||||
Felix Albrigtsen <felixalb@pvv.ntnu.no> felixalb <felixalb@pvv.ntnu.no>
|
||||
|
||||
Peder Bergebakken Sundt <pederbs@pvv.ntnu.no> <pbsds@hotmail.com>
|
||||
|
||||
Adrian Gunnar Lauterer <adriangl@pvv.ntnu.no> Adrian G L <adrian@lauterer.it>
|
||||
Adrian Gunnar Lauterer <adriangl@pvv.ntnu.no> Adrian Gunnar Lauterer <adrian@lauterer.it>
|
||||
|
||||
Fredrik Robertsen <frero@pvv.ntnu.no> frero <frero@pvv.ntnu.no>
|
||||
Fredrik Robertsen <frero@pvv.ntnu.no> fredrikr79 <fredrikrobertsen7@gmail.com>
|
||||
73
.sops.yaml
73
.sops.yaml
@@ -1,18 +1,25 @@
|
||||
keys:
|
||||
# Users
|
||||
- &user_danio age17tagmpwqjk3mdy45rfesrfey6h863x8wfq38wh33tkrlrywxducs0k6tpq
|
||||
- &user_danio age1ug30gg4y7ftuya0wdv7q0vh4egn00wlv2th7mt7cgc2ze46wmvyq9lq6ge
|
||||
- &user_eirikwit age1ju7rd26llahz3g8tz7cy5ld52swj8gsmg0flrmrxngc0nj0avq3ssh0sn5
|
||||
- &user_felixalb age1mrnldl334l2nszuta6ywvewng0fswv2dz9l5g4qcwe3nj4yxf92qjskdx6
|
||||
- &user_oysteikt F7D37890228A907440E1FD4846B9228E814A2AAC
|
||||
- &user_eirikwit age1ju7rd26llahz3g8tz7cy5ld52swj8gsmg0flrmrxngc0nj0avq3ssh0sn5
|
||||
- &user_pederbs_sopp age1hmpdk4h69wxpwqk9tkud39f66hprhehxtzhgw97r6dvr7v0mx5jscsuhkn
|
||||
- &user_pederbs_nord age1wrssr4z4g6vl3fd3qme5cewchmmhm0j2xe6wf2meu4r6ycn37anse98mfs
|
||||
- &user_pederbs_bjarte age1zhxul786an743u0fascv4wtc5xduu7qfy803lfs539yzhgmlq5ds2lznt5
|
||||
- &user_pederbs_nord age1wrssr4z4g6vl3fd3qme5cewchmmhm0j2xe6wf2meu4r6ycn37anse98mfs
|
||||
- &user_pederbs_sopp age1hmpdk4h69wxpwqk9tkud39f66hprhehxtzhgw97r6dvr7v0mx5jscsuhkn
|
||||
|
||||
# Hosts
|
||||
- &host_jokum age1gp8ye4g2mmw3may5xg0zsy7mm04glfz3788mmdx9cvcsdxs9hg0s0cc9kt
|
||||
- &host_ildkule age1x28hmzvuv6f2n66c0jtqcca3h9rput8d7j5uek6jcpx8n9egd52sqpejq0
|
||||
- &host_bakke age1syted6kt48sumjjucggh6r3uca4x2ppp4mfungf3lamkt2le05csc99633
|
||||
- &host_bekkalokk age12nj59tguy9wg882updc2vjdusx5srnxmjyfaqve4zx6jnnsaw3qsyjq6zd
|
||||
- &host_bicep age1sl43gc9cw939z5tgha2lpwf0xxxgcnlw7w4xem4sqgmt2pt264vq0dmwx2
|
||||
- &host_bicep age19nk55kcs7s0358jpkn75xnr57dfq6fq3p43nartvsprx0su22v7qcgcjdx
|
||||
- &host_ildkule age1x28hmzvuv6f2n66c0jtqcca3h9rput8d7j5uek6jcpx8n9egd52sqpejq0
|
||||
- &host_kommode age1mt4d0hg5g76qp7j0884llemy0k2ymr5up8vfudz6vzvsflk5nptqqd32ly
|
||||
- &host_lupine-1 age1fkrypl6fu4ldsa7te4g3v4qsegnk7sd6qhkquuwzh04vguy96qus08902e
|
||||
- &host_lupine-2 age1mu0ej57n4s30ghealhyju3enls83qyjua69986la35t2yh0q2s0seruz5n
|
||||
- &host_lupine-3 age1j2u876z8hu87q5npfxzzpfgllyw8ypj66d7cgelmzmnrf3xud34qzkntp9
|
||||
- &host_lupine-4 age1t8zlawqkmhye737pn8yx0z3p9cl947d9ktv2cajdc6hnvn52d3fsc59s2k
|
||||
- &host_lupine-5 age199zkqq4jp4yc3d0hx2q0ksxdtp42xhmjsqwyngh8tswuck34ke3smrfyqu
|
||||
- &host_ustetind age1hffjafs4slznksefmtqrlj7rdaqgzqncn4un938rhr053237ry8s3rs0v8
|
||||
|
||||
creation_rules:
|
||||
# Global secrets
|
||||
@@ -43,6 +50,18 @@ creation_rules:
|
||||
pgp:
|
||||
- *user_oysteikt
|
||||
|
||||
- path_regex: secrets/kommode/[^/]+\.yaml$
|
||||
key_groups:
|
||||
- age:
|
||||
- *host_kommode
|
||||
- *user_danio
|
||||
- *user_felixalb
|
||||
- *user_pederbs_sopp
|
||||
- *user_pederbs_nord
|
||||
- *user_pederbs_bjarte
|
||||
pgp:
|
||||
- *user_oysteikt
|
||||
|
||||
- path_regex: secrets/jokum/[^/]+\.yaml$
|
||||
key_groups:
|
||||
- age:
|
||||
@@ -78,3 +97,43 @@ creation_rules:
|
||||
- *user_pederbs_bjarte
|
||||
pgp:
|
||||
- *user_oysteikt
|
||||
|
||||
- path_regex: secrets/ustetind/[^/]+\.yaml$
|
||||
key_groups:
|
||||
- age:
|
||||
- *host_ustetind
|
||||
- *user_danio
|
||||
- *user_felixalb
|
||||
- *user_pederbs_sopp
|
||||
- *user_pederbs_nord
|
||||
- *user_pederbs_bjarte
|
||||
pgp:
|
||||
- *user_oysteikt
|
||||
|
||||
- path_regex: secrets/lupine/[^/]+\.yaml$
|
||||
key_groups:
|
||||
- age:
|
||||
- *host_lupine-1
|
||||
- *host_lupine-2
|
||||
- *host_lupine-3
|
||||
- *host_lupine-4
|
||||
- *host_lupine-5
|
||||
- *user_danio
|
||||
- *user_felixalb
|
||||
- *user_pederbs_sopp
|
||||
- *user_pederbs_nord
|
||||
- *user_pederbs_bjarte
|
||||
pgp:
|
||||
- *user_oysteikt
|
||||
|
||||
- path_regex: secrets/bakke/[^/]+\.yaml$
|
||||
key_groups:
|
||||
- age:
|
||||
- *host_bakke
|
||||
- *user_danio
|
||||
- *user_felixalb
|
||||
- *user_pederbs_sopp
|
||||
- *user_pederbs_nord
|
||||
- *user_pederbs_bjarte
|
||||
pgp:
|
||||
- *user_oysteikt
|
||||
|
||||
@@ -1,15 +1,25 @@
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
fp,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../users
|
||||
../modules/snakeoil-certs.nix
|
||||
(fp /users)
|
||||
(fp /modules/snakeoil-certs.nix)
|
||||
|
||||
./networking.nix
|
||||
./nix.nix
|
||||
./vm.nix
|
||||
./flake-input-exporter.nix
|
||||
|
||||
./services/acme.nix
|
||||
./services/uptimed.nix
|
||||
./services/auto-upgrade.nix
|
||||
./services/dbus.nix
|
||||
./services/fwupd.nix
|
||||
./services/irqbalance.nix
|
||||
./services/logrotate.nix
|
||||
./services/nginx.nix
|
||||
@@ -17,9 +27,12 @@
|
||||
./services/postfix.nix
|
||||
./services/smartd.nix
|
||||
./services/thermald.nix
|
||||
./services/userborn.nix
|
||||
./services/userdbd.nix
|
||||
];
|
||||
|
||||
boot.tmp.cleanOnBoot = lib.mkDefault true;
|
||||
boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
||||
|
||||
time.timeZone = "Europe/Oslo";
|
||||
|
||||
@@ -45,8 +58,22 @@
|
||||
kitty.terminfo
|
||||
];
|
||||
|
||||
# .bash_profile already works, but lets also use .bashrc like literally every other distro
|
||||
# https://man.archlinux.org/man/core/bash/bash.1.en#INVOCATION
|
||||
# home-manager usually handles this for you: https://github.com/nix-community/home-manager/blob/22a36aa709de7dd42b562a433b9cefecf104a6ee/modules/programs/bash.nix#L203-L209
|
||||
# btw, programs.bash.shellInit just goes into environment.shellInit which in turn goes into /etc/profile, spooky shit
|
||||
programs.bash.shellInit = ''
|
||||
if [ -n "''${BASH_VERSION:-}" ]; then
|
||||
if [[ ! -f ~/.bash_profile && ! -f ~/.bash_login ]]; then
|
||||
[[ -f ~/.bashrc ]] && . ~/.bashrc
|
||||
fi
|
||||
fi
|
||||
'';
|
||||
|
||||
programs.zsh.enable = true;
|
||||
|
||||
# security.lockKernelModules = true;
|
||||
security.protectKernelImage = true;
|
||||
security.sudo.execWheelOnly = true;
|
||||
security.sudo.extraConfig = ''
|
||||
Defaults lecture = never
|
||||
@@ -57,4 +84,3 @@
|
||||
# Trusted users on the nix builder machines
|
||||
users.groups."nix-builder-users".name = "nix-builder-users";
|
||||
}
|
||||
|
||||
|
||||
55
base/flake-input-exporter.nix
Normal file
55
base/flake-input-exporter.nix
Normal file
@@ -0,0 +1,55 @@
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
pkgs,
|
||||
values,
|
||||
...
|
||||
}:
|
||||
let
|
||||
data = lib.flip lib.mapAttrs inputs (
|
||||
name: input: {
|
||||
inherit (input)
|
||||
lastModified
|
||||
;
|
||||
}
|
||||
);
|
||||
folder = pkgs.writeTextDir "share/flake-inputs" (
|
||||
lib.concatMapStringsSep "\n" (
|
||||
{ name, value }: ''nixos_last_modified_input{flake="${name}"} ${toString value.lastModified}''
|
||||
) (lib.attrsToList data)
|
||||
);
|
||||
port = 9102;
|
||||
in
|
||||
{
|
||||
services.nginx.virtualHosts."${config.networking.fqdn}-nixos-metrics" = {
|
||||
serverName = config.networking.fqdn;
|
||||
serverAliases = [
|
||||
"${config.networking.hostName}.pvv.org"
|
||||
];
|
||||
locations."/metrics" = {
|
||||
root = "${folder}/share";
|
||||
tryFiles = "/flake-inputs =404";
|
||||
extraConfig = ''
|
||||
default_type text/plain;
|
||||
'';
|
||||
};
|
||||
listen = [
|
||||
{
|
||||
inherit port;
|
||||
addr = "0.0.0.0";
|
||||
}
|
||||
];
|
||||
extraConfig = ''
|
||||
allow ${values.hosts.ildkule.ipv4}/32;
|
||||
allow ${values.hosts.ildkule.ipv6}/128;
|
||||
allow 127.0.0.1/32;
|
||||
allow ::1/128;
|
||||
allow ${values.ipv4-space};
|
||||
allow ${values.ipv6-space};
|
||||
deny all;
|
||||
'';
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ port ];
|
||||
}
|
||||
16
base/nix.nix
16
base/nix.nix
@@ -1,16 +1,17 @@
|
||||
{ inputs, ... }:
|
||||
{ lib, config, inputs, ... }:
|
||||
{
|
||||
nix = {
|
||||
gc = {
|
||||
automatic = true;
|
||||
options = "--delete-older-than 2d";
|
||||
};
|
||||
optimise.automatic = true;
|
||||
|
||||
settings = {
|
||||
allow-dirty = true;
|
||||
auto-optimise-store = true;
|
||||
auto-allocate-uids = true;
|
||||
builders-use-substitutes = true;
|
||||
experimental-features = [ "nix-command" "flakes" ];
|
||||
experimental-features = [ "nix-command" "flakes" "auto-allocate-uids" ];
|
||||
log-lines = 50;
|
||||
use-xdg-base-directories = true;
|
||||
};
|
||||
@@ -21,11 +22,16 @@
|
||||
** use the same channel the system
|
||||
** was built with
|
||||
*/
|
||||
registry = {
|
||||
registry = lib.mkMerge [
|
||||
{
|
||||
"nixpkgs".flake = inputs.nixpkgs;
|
||||
"nixpkgs-unstable".flake = inputs.nixpkgs-unstable;
|
||||
}
|
||||
# We avoid the reference to self in vmVariant to get a stable system .outPath for equivalence testing
|
||||
(lib.mkIf (!config.virtualisation.isVmVariant) {
|
||||
"pvv-nix".flake = inputs.self;
|
||||
};
|
||||
})
|
||||
];
|
||||
nixPath = [
|
||||
"nixpkgs=${inputs.nixpkgs}"
|
||||
"unstable=${inputs.nixpkgs-unstable}"
|
||||
|
||||
@@ -1,21 +1,33 @@
|
||||
{ inputs, pkgs, lib, ... }:
|
||||
{ config, inputs, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
inputUrls = lib.mapAttrs (input: value: value.url) (import "${inputs.self}/flake.nix").inputs;
|
||||
in
|
||||
|
||||
{
|
||||
system.autoUpgrade = {
|
||||
enable = true;
|
||||
flake = "git+https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git?ref=pvvvvv";
|
||||
flake = "git+https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git";
|
||||
flags = [
|
||||
# --update-input is deprecated since nix 2.22, and removed in lix 2.90
|
||||
# https://git.lix.systems/lix-project/lix/issues/400
|
||||
"--refresh"
|
||||
"--override-input" "nixpkgs" "github:nixos/nixpkgs/nixos-24.05-small"
|
||||
"--override-input" "nixpkgs-unstable" "github:nixos/nixpkgs/nixos-unstable-small"
|
||||
"--no-write-lock-file"
|
||||
];
|
||||
# --update-input is deprecated since nix 2.22, and removed in lix 2.90
|
||||
# as such we instead use --override-input combined with --refresh
|
||||
# https://git.lix.systems/lix-project/lix/issues/400
|
||||
] ++ (lib.pipe inputUrls [
|
||||
(lib.intersectAttrs {
|
||||
nixpkgs = { };
|
||||
nixpkgs-unstable = { };
|
||||
})
|
||||
(lib.mapAttrsToList (input: url: ["--override-input" input url]))
|
||||
lib.concatLists
|
||||
]);
|
||||
};
|
||||
|
||||
# workaround for https://github.com/NixOS/nix/issues/6895
|
||||
# via https://git.lix.systems/lix-project/lix/issues/400
|
||||
environment.etc."current-system-flake-inputs.json".source
|
||||
environment.etc = lib.mkIf (!config.virtualisation.isVmVariant) {
|
||||
"current-system-flake-inputs.json".source
|
||||
= pkgs.writers.writeJSON "flake-inputs.json" (
|
||||
lib.flip lib.mapAttrs inputs (name: input:
|
||||
# inputs.*.sourceInfo sans outPath, since writeJSON will otherwise serialize sourceInfo like a derivation
|
||||
@@ -23,4 +35,5 @@
|
||||
// { store-path = input.outPath; } # comment this line if you don't want to retain a store reference to the flake inputs
|
||||
)
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
7
base/services/dbus.nix
Normal file
7
base/services/dbus.nix
Normal file
@@ -0,0 +1,7 @@
|
||||
{ ... }:
|
||||
{
|
||||
services.dbus = {
|
||||
enable = true;
|
||||
implementation = "broker";
|
||||
};
|
||||
}
|
||||
4
base/services/fwupd.nix
Normal file
4
base/services/fwupd.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{ ... }:
|
||||
{
|
||||
services.fwupd.enable = true;
|
||||
}
|
||||
@@ -1,42 +1,8 @@
|
||||
{ ... }:
|
||||
{
|
||||
# source: https://github.com/logrotate/logrotate/blob/main/examples/logrotate.service
|
||||
systemd.services.logrotate = {
|
||||
documentation = [ "man:logrotate(8)" "man:logrotate.conf(5)" ];
|
||||
unitConfig.RequiresMountsFor = "/var/log";
|
||||
serviceConfig = {
|
||||
Nice = 19;
|
||||
IOSchedulingClass = "best-effort";
|
||||
IOSchedulingPriority = 7;
|
||||
|
||||
ReadWritePaths = [ "/var/log" ];
|
||||
|
||||
AmbientCapabilities = [ "" ];
|
||||
CapabilityBoundingSet = [ "" ];
|
||||
DeviceAllow = [ "" ];
|
||||
LockPersonality = true;
|
||||
MemoryDenyWriteExecute = true;
|
||||
NoNewPrivileges = true; # disable for third party rotate scripts
|
||||
PrivateDevices = true;
|
||||
PrivateNetwork = true; # disable for mail delivery
|
||||
PrivateTmp = true;
|
||||
ProtectClock = true;
|
||||
ProtectControlGroups = true;
|
||||
ProtectHome = true; # disable for userdir logs
|
||||
ProtectHostname = true;
|
||||
ProtectKernelLogs = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectKernelTunables = true;
|
||||
ProtectProc = "invisible";
|
||||
ProtectSystem = "full";
|
||||
RestrictNamespaces = true;
|
||||
RestrictRealtime = true;
|
||||
RestrictSUIDSGID = true; # disable for creating setgid directories
|
||||
SocketBindDeny = [ "any" ];
|
||||
SystemCallArchitectures = "native";
|
||||
SystemCallFilter = [
|
||||
"@system-service"
|
||||
];
|
||||
};
|
||||
serviceConfig.ReadWritePaths = [ "/var/log" ];
|
||||
};
|
||||
}
|
||||
@@ -20,19 +20,23 @@
|
||||
recommendedGzipSettings = true;
|
||||
|
||||
appendConfig = ''
|
||||
pcre_jit on;
|
||||
# pcre_jit on;
|
||||
worker_processes auto;
|
||||
worker_rlimit_nofile 100000;
|
||||
'';
|
||||
eventsConfig = ''
|
||||
worker_connections 2048;
|
||||
use epoll;
|
||||
multi_accept on;
|
||||
# multi_accept on;
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.services.nginx.serviceConfig = lib.mkIf config.services.nginx.enable {
|
||||
LimitNOFILE = 65536;
|
||||
# We use jit my dudes
|
||||
MemoryDenyWriteExecute = lib.mkForce false;
|
||||
# What the fuck do we use that where the defaults are not enough???
|
||||
SystemCallFilter = lib.mkForce null;
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."_" = lib.mkIf config.services.nginx.enable {
|
||||
|
||||
@@ -6,18 +6,17 @@ in
|
||||
services.postfix = {
|
||||
enable = true;
|
||||
|
||||
hostname = "${config.networking.hostName}.pvv.ntnu.no";
|
||||
domain = "pvv.ntnu.no";
|
||||
settings.main = {
|
||||
myhostname = "${config.networking.hostName}.pvv.ntnu.no";
|
||||
mydomain = "pvv.ntnu.no";
|
||||
|
||||
relayHost = "smtp.pvv.ntnu.no";
|
||||
relayPort = 465;
|
||||
# Nothing should be delivered to this machine
|
||||
mydestination = [ ];
|
||||
|
||||
relayhost = [ "smtp.pvv.ntnu.no:465" ];
|
||||
|
||||
config = {
|
||||
smtp_tls_wrappermode = "yes";
|
||||
smtp_tls_security_level = "encrypt";
|
||||
};
|
||||
|
||||
# Nothing should be delivered to this machine
|
||||
destination = [ ];
|
||||
};
|
||||
}
|
||||
@@ -1,8 +1,20 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
services.smartd.enable = lib.mkDefault true;
|
||||
services.smartd = {
|
||||
enable = lib.mkDefault true;
|
||||
notifications = {
|
||||
mail = {
|
||||
enable = true;
|
||||
sender = "root@pvv.ntnu.no";
|
||||
recipient = "root@pvv.ntnu.no";
|
||||
};
|
||||
wall.enable = false;
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = lib.optionals config.services.smartd.enable (with pkgs; [
|
||||
smartmontools
|
||||
]);
|
||||
|
||||
systemd.services.smartd.unitConfig.ConditionVirtualization = "no";
|
||||
}
|
||||
59
base/services/uptimed.nix
Normal file
59
base/services/uptimed.nix
Normal file
@@ -0,0 +1,59 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
cfg = config.services.uptimed;
|
||||
in
|
||||
{
|
||||
options.services.uptimed.settings = lib.mkOption {
|
||||
description = "";
|
||||
default = { };
|
||||
type = lib.types.submodule {
|
||||
freeformType = with lib.types; attrsOf (either str (listOf str));
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
services.uptimed = {
|
||||
enable = true;
|
||||
|
||||
settings = let
|
||||
stateDir = "/var/lib/uptimed";
|
||||
in {
|
||||
PIDFILE = "${stateDir}/pid";
|
||||
SENDMAIL = lib.mkDefault "${pkgs.system-sendmail}/bin/sendmail -t";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.uptimed = lib.mkIf (cfg.enable) {
|
||||
serviceConfig = let
|
||||
uptimed = pkgs.uptimed.overrideAttrs (prev: {
|
||||
postPatch = ''
|
||||
substituteInPlace Makefile.am \
|
||||
--replace-fail '$(sysconfdir)/uptimed.conf' '/var/lib/uptimed/uptimed.conf'
|
||||
substituteInPlace src/Makefile.am \
|
||||
--replace-fail '$(sysconfdir)/uptimed.conf' '/var/lib/uptimed/uptimed.conf'
|
||||
'';
|
||||
});
|
||||
|
||||
in {
|
||||
Type = "notify";
|
||||
|
||||
ExecStart = lib.mkForce "${uptimed}/sbin/uptimed -f";
|
||||
|
||||
BindReadOnlyPaths = let
|
||||
configFile = lib.pipe cfg.settings [
|
||||
(lib.mapAttrsToList
|
||||
(k: v:
|
||||
if builtins.isList v
|
||||
then lib.mapConcatStringsSep "\n" (v': "${k}=${v'}") v
|
||||
else "${k}=${v}")
|
||||
)
|
||||
(lib.concatStringsSep "\n")
|
||||
(pkgs.writeText "uptimed.conf")
|
||||
];
|
||||
in [
|
||||
"${configFile}:/var/lib/uptimed/uptimed.conf"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
4
base/services/userborn.nix
Normal file
4
base/services/userborn.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{ ... }:
|
||||
{
|
||||
services.userborn.enable = true;
|
||||
}
|
||||
4
base/services/userdbd.nix
Normal file
4
base/services/userdbd.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{ ... }:
|
||||
{
|
||||
services.userdbd.enable = true;
|
||||
}
|
||||
15
base/vm.nix
Normal file
15
base/vm.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{ lib, ... }:
|
||||
|
||||
# This enables
|
||||
# lib.mkIf (!config.virtualisation.isVmVariant) { ... }
|
||||
|
||||
{
|
||||
options.virtualisation.isVmVariant = lib.mkOption {
|
||||
description = "`true` if system is build with 'nixos-rebuild build-vm'";
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
config.virtualisation.vmVariant = {
|
||||
virtualisation.isVmVariant = true;
|
||||
};
|
||||
}
|
||||
198
flake.lock
generated
198
flake.lock
generated
@@ -7,11 +7,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1729281548,
|
||||
"narHash": "sha256-MuojlSnwAJAwfhgmW8ZtZrwm2Sko4fqubCvReqbUzYw=",
|
||||
"lastModified": 1764627417,
|
||||
"narHash": "sha256-D6xc3Rl8Ab6wucJWdvjNsGYGSxNjQHzRc2EZ6eeQ6l4=",
|
||||
"owner": "nix-community",
|
||||
"repo": "disko",
|
||||
"rev": "a6a3179ddf396dfc28a078e2f169354d0c137125",
|
||||
"rev": "5a88a6eceb8fd732b983e72b732f6f4b8269bef3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -20,6 +20,26 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gergle": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1764868579,
|
||||
"narHash": "sha256-rfTUOIc0wnC4+19gLVfPbHfXx/ilfuUix6bWY+yaM2U=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "9c923d1d50daa6a3b28c3214ad2300bfaf6c8fcd",
|
||||
"revCount": 22,
|
||||
"type": "git",
|
||||
"url": "https://git.pvv.ntnu.no/Grzegorz/gergle.git"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://git.pvv.ntnu.no/Grzegorz/gergle.git"
|
||||
}
|
||||
},
|
||||
"greg-ng": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
@@ -28,17 +48,17 @@
|
||||
"rust-overlay": "rust-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1730249639,
|
||||
"narHash": "sha256-G3URSlqCcb+GIvGyki+HHrDM5ZanX/dP9BtppD/SdfI=",
|
||||
"lastModified": 1764868843,
|
||||
"narHash": "sha256-ZXYLXKO+VjAJr2f5zz+7SuKFICfI2eZnmTgS/626YE0=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "80e0447bcb79adad4f459ada5610f3eae987b4e3",
|
||||
"revCount": 34,
|
||||
"rev": "c095533c50e80dd18ac48046f1479cf4d83c631c",
|
||||
"revCount": 52,
|
||||
"type": "git",
|
||||
"url": "https://git.pvv.ntnu.no/Projects/greg-ng.git"
|
||||
"url": "https://git.pvv.ntnu.no/Grzegorz/greg-ng.git"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://git.pvv.ntnu.no/Projects/greg-ng.git"
|
||||
"url": "https://git.pvv.ntnu.no/Grzegorz/greg-ng.git"
|
||||
}
|
||||
},
|
||||
"grzegorz-clients": {
|
||||
@@ -48,17 +68,17 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1726861934,
|
||||
"narHash": "sha256-lOzPDwktd+pwszUTbpUdQg6iCzInS11fHLfkjmnvJrM=",
|
||||
"lastModified": 1764867811,
|
||||
"narHash": "sha256-UWHiwr8tIcGcVxMLvAdNxDbQ8QuHf3REHboyxvFkYEI=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "546d921ec46735dbf876e36f4af8df1064d09432",
|
||||
"revCount": 78,
|
||||
"rev": "c9983e947efe047ea9d6f97157a1f90e49d0eab3",
|
||||
"revCount": 81,
|
||||
"type": "git",
|
||||
"url": "https://git.pvv.ntnu.no/Projects/grzegorz-clients.git"
|
||||
"url": "https://git.pvv.ntnu.no/Grzegorz/grzegorz-clients.git"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://git.pvv.ntnu.no/Projects/grzegorz-clients.git"
|
||||
"url": "https://git.pvv.ntnu.no/Grzegorz/grzegorz-clients.git"
|
||||
}
|
||||
},
|
||||
"matrix-next": {
|
||||
@@ -68,33 +88,58 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1727410897,
|
||||
"narHash": "sha256-tWsyxvf421ieWUJYgjV7m1eTdr2ZkO3vId7vmtvfFpQ=",
|
||||
"lastModified": 1764844095,
|
||||
"narHash": "sha256-Drf1orxsmFDzO+UbPo85gHjXW7QzAM+6oTPvI7vOSik=",
|
||||
"owner": "dali99",
|
||||
"repo": "nixos-matrix-modules",
|
||||
"rev": "ff787d410cba17882cd7b6e2e22cc88d4064193c",
|
||||
"rev": "25b9f31ef1dbc3987b4c716de716239f2b283701",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "dali99",
|
||||
"ref": "v0.6.1",
|
||||
"ref": "v0.8.0",
|
||||
"repo": "nixos-matrix-modules",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"minecraft-data": {
|
||||
"minecraft-heatmap": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1725277886,
|
||||
"narHash": "sha256-Fw4VbbE3EfypQWSgPDFfvVH47BHeg3ptsO715NlUM8Q=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "1b4087bd3322a2e2ba84271c8fcc013e6b641a58",
|
||||
"revCount": 2,
|
||||
"lastModified": 1756124334,
|
||||
"narHash": "sha256-DXFmSpgI8FrqcdqY7wg5l/lpssWjslHq5ufvyp/5k4o=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "83760b1ebcd9722ddf58a4117d29555da65538ad",
|
||||
"revCount": 13,
|
||||
"type": "git",
|
||||
"url": "https://git.pvv.ntnu.no/Drift/minecraft-data.git"
|
||||
"url": "https://git.pvv.ntnu.no/Projects/minecraft-heatmap.git"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://git.pvv.ntnu.no/Drift/minecraft-data.git"
|
||||
"url": "https://git.pvv.ntnu.no/Projects/minecraft-heatmap.git"
|
||||
}
|
||||
},
|
||||
"minecraft-kartverket": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1765903589,
|
||||
"narHash": "sha256-JRLmckeM4G2hkH2V3VdfjHrrsWgJ8j7rZDYYjHTkRqA=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "7c86d342e68506fcd83cb74af3336f99ff522a0a",
|
||||
"revCount": 24,
|
||||
"type": "git",
|
||||
"url": "https://git.pvv.ntnu.no/Projects/minecraft-kartverket.git"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://git.pvv.ntnu.no/Projects/minecraft-kartverket.git"
|
||||
}
|
||||
},
|
||||
"nix-gitea-themes": {
|
||||
@@ -104,65 +149,43 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1714416973,
|
||||
"narHash": "sha256-aZUcvXjdETUC6wVQpWDVjLUzwpDAEca8yR0ITDeK39o=",
|
||||
"lastModified": 1743881366,
|
||||
"narHash": "sha256-ScGA2IHPk9ugf9bqEZnp+YB/OJgrkZblnG/XLEKvJAo=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "2b23c0ba8aae68d3cb6789f0f6e4891cef26cc6d",
|
||||
"revCount": 6,
|
||||
"rev": "db2e4becf1b11e5dfd33de12a90a7d089fcf68ec",
|
||||
"revCount": 11,
|
||||
"type": "git",
|
||||
"url": "https://git.pvv.ntnu.no/oysteikt/nix-gitea-themes.git"
|
||||
"url": "https://git.pvv.ntnu.no/Drift/nix-gitea-themes.git"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://git.pvv.ntnu.no/oysteikt/nix-gitea-themes.git"
|
||||
"url": "https://git.pvv.ntnu.no/Drift/nix-gitea-themes.git"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1729307008,
|
||||
"narHash": "sha256-QUvb6epgKi9pCu9CttRQW4y5NqJ+snKr1FZpG/x3Wtc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a9b86fc2290b69375c5542b622088eb6eca2a7c3",
|
||||
"type": "github"
|
||||
"lastModified": 1764806471,
|
||||
"narHash": "sha256-Qk0SArnS83KqyS9wNt1YoTkkYKDraNrjRWKUtB9DKoM=",
|
||||
"rev": "6707b1809330d0f912f5813963bb29f6f194ee81",
|
||||
"type": "tarball",
|
||||
"url": "https://releases.nixos.org/nixos/25.11-small/nixos-25.11.896.6707b1809330/nixexprs.tar.xz"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-24.05-small",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1728156290,
|
||||
"narHash": "sha256-uogSvuAp+1BYtdu6UWuObjHqSbBohpyARXDWqgI12Ss=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "17ae88b569bb15590549ff478bab6494dde4a907",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "release-24.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
"type": "tarball",
|
||||
"url": "https://nixos.org/channels/nixos-25.11-small/nixexprs.tar.xz"
|
||||
}
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1729308112,
|
||||
"narHash": "sha256-Ap+cPeiluam2KFZO+OWuFTl/IkIJfyGYGMgkT2pVCRY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "61253596816c4cd65e2a0f474cbc0ac0c6e0f7cf",
|
||||
"type": "github"
|
||||
"lastModified": 1764854611,
|
||||
"narHash": "sha256-MVzFp4ZKwdh6U1wy4fJe/GY3Hb4cvvyJbAZOhaeBQoo=",
|
||||
"rev": "3a4b875aef660bbd148e86b92cffea2a360c3275",
|
||||
"type": "tarball",
|
||||
"url": "https://releases.nixos.org/nixos/unstable-small/nixos-26.05pre906534.3a4b875aef66/nixexprs.tar.xz"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable-small",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
"type": "tarball",
|
||||
"url": "https://nixos.org/channels/nixos-unstable-small/nixexprs.tar.xz"
|
||||
}
|
||||
},
|
||||
"pvv-calendar-bot": {
|
||||
@@ -172,11 +195,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1723850344,
|
||||
"narHash": "sha256-aT37O9l9eclWEnqxASVNBL1dKwDHZUOqdbA4VO9DJvw=",
|
||||
"lastModified": 1764869785,
|
||||
"narHash": "sha256-FGTIpC7gB4lbeL0bfYzn1Ge0PaCpd7VqWBLhJBx0i4A=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "38b66677ab8c01aee10cd59e745af9ce3ea88092",
|
||||
"revCount": 19,
|
||||
"rev": "8ce7fb0b1918bdb3d1489a40d73895693955e8b2",
|
||||
"revCount": 23,
|
||||
"type": "git",
|
||||
"url": "https://git.pvv.ntnu.no/Projects/calendar-bot.git"
|
||||
},
|
||||
@@ -192,11 +215,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1725212759,
|
||||
"narHash": "sha256-yZBsefIarFUEhFRj+rCGMp9Zvag3MCafqV/JfGVRVwc=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "e7b66b4bc6a89bab74bac45b87e9434f5165355f",
|
||||
"revCount": 473,
|
||||
"lastModified": 1757332682,
|
||||
"narHash": "sha256-4p4aVQWs7jHu3xb6TJlGik20lqbUU/Fc0/EHpzoRlO0=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "da1113341ad9881d8d333d1e29790317bd7701e7",
|
||||
"revCount": 518,
|
||||
"type": "git",
|
||||
"url": "https://git.pvv.ntnu.no/Projects/nettsiden.git"
|
||||
},
|
||||
@@ -208,10 +231,12 @@
|
||||
"root": {
|
||||
"inputs": {
|
||||
"disko": "disko",
|
||||
"gergle": "gergle",
|
||||
"greg-ng": "greg-ng",
|
||||
"grzegorz-clients": "grzegorz-clients",
|
||||
"matrix-next": "matrix-next",
|
||||
"minecraft-data": "minecraft-data",
|
||||
"minecraft-heatmap": "minecraft-heatmap",
|
||||
"minecraft-kartverket": "minecraft-kartverket",
|
||||
"nix-gitea-themes": "nix-gitea-themes",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
@@ -228,11 +253,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1729391507,
|
||||
"narHash": "sha256-as0I9xieJUHf7kiK2a9znDsVZQTFWhM1pLivII43Gi0=",
|
||||
"lastModified": 1764816035,
|
||||
"narHash": "sha256-F0IQSmSj4t2ThkbWZooAhkCTO+YpZSd2Pqiv2uoYEHo=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "784981a9feeba406de38c1c9a3decf966d853cca",
|
||||
"rev": "74d9abb7c5c030469f90d97a67d127cc5d76c238",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -245,15 +270,14 @@
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1728345710,
|
||||
"narHash": "sha256-lpunY1+bf90ts+sA2/FgxVNIegPDKCpEoWwOPu4ITTQ=",
|
||||
"lastModified": 1764483358,
|
||||
"narHash": "sha256-EyyvCzXoHrbL467YSsQBTWWg4sR96MH1sPpKoSOelB4=",
|
||||
"owner": "Mic92",
|
||||
"repo": "sops-nix",
|
||||
"rev": "06535d0e3d0201e6a8080dd32dbfde339b94f01b",
|
||||
"rev": "5aca6ff67264321d47856a2ed183729271107c9c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
151
flake.nix
151
flake.nix
@@ -2,8 +2,8 @@
|
||||
description = "PVV System flake";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05-small"; # remember to also update the url in base/services/auto-upgrade.nix
|
||||
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable-small";
|
||||
nixpkgs.url = "https://nixos.org/channels/nixos-25.11-small/nixexprs.tar.xz";
|
||||
nixpkgs-unstable.url = "https://nixos.org/channels/nixos-unstable-small/nixexprs.tar.xz";
|
||||
|
||||
sops-nix.url = "github:Mic92/sops-nix";
|
||||
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
|
||||
@@ -17,29 +17,35 @@
|
||||
pvv-calendar-bot.url = "git+https://git.pvv.ntnu.no/Projects/calendar-bot.git";
|
||||
pvv-calendar-bot.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
matrix-next.url = "github:dali99/nixos-matrix-modules/v0.6.1";
|
||||
matrix-next.url = "github:dali99/nixos-matrix-modules/v0.8.0";
|
||||
matrix-next.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
nix-gitea-themes.url = "git+https://git.pvv.ntnu.no/oysteikt/nix-gitea-themes.git";
|
||||
nix-gitea-themes.url = "git+https://git.pvv.ntnu.no/Drift/nix-gitea-themes.git";
|
||||
nix-gitea-themes.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
greg-ng.url = "git+https://git.pvv.ntnu.no/Projects/greg-ng.git";
|
||||
minecraft-heatmap.url = "git+https://git.pvv.ntnu.no/Projects/minecraft-heatmap.git";
|
||||
minecraft-heatmap.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
greg-ng.url = "git+https://git.pvv.ntnu.no/Grzegorz/greg-ng.git";
|
||||
greg-ng.inputs.nixpkgs.follows = "nixpkgs";
|
||||
grzegorz-clients.url = "git+https://git.pvv.ntnu.no/Projects/grzegorz-clients.git";
|
||||
gergle.url = "git+https://git.pvv.ntnu.no/Grzegorz/gergle.git";
|
||||
gergle.inputs.nixpkgs.follows = "nixpkgs";
|
||||
grzegorz-clients.url = "git+https://git.pvv.ntnu.no/Grzegorz/grzegorz-clients.git";
|
||||
grzegorz-clients.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
minecraft-data.url = "git+https://git.pvv.ntnu.no/Drift/minecraft-data.git";
|
||||
minecraft-kartverket.url = "git+https://git.pvv.ntnu.no/Projects/minecraft-kartverket.git";
|
||||
minecraft-kartverket.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, nixpkgs-unstable, sops-nix, disko, ... }@inputs:
|
||||
let
|
||||
nixlib = nixpkgs.lib;
|
||||
inherit (nixpkgs) lib;
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
forAllSystems = f: nixlib.genAttrs systems f;
|
||||
forAllSystems = f: lib.genAttrs systems f;
|
||||
allMachines = builtins.attrNames self.nixosConfigurations;
|
||||
importantMachines = [
|
||||
"bekkalokk"
|
||||
@@ -49,43 +55,74 @@
|
||||
"ildkule"
|
||||
];
|
||||
in {
|
||||
inherit inputs;
|
||||
inputs = lib.mapAttrs (_: src: src.outPath) inputs;
|
||||
|
||||
nixosConfigurations = let
|
||||
unstablePkgs = nixpkgs-unstable.legacyPackages.x86_64-linux;
|
||||
nixosConfig = nixpkgs: name: config: nixpkgs.lib.nixosSystem (nixpkgs.lib.recursiveUpdate
|
||||
rec {
|
||||
|
||||
nixosConfig =
|
||||
nixpkgs:
|
||||
name:
|
||||
configurationPath:
|
||||
extraArgs:
|
||||
lib.nixosSystem (lib.recursiveUpdate
|
||||
(let
|
||||
system = "x86_64-linux";
|
||||
in {
|
||||
inherit system;
|
||||
|
||||
specialArgs = {
|
||||
inherit unstablePkgs inputs;
|
||||
values = import ./values.nix;
|
||||
};
|
||||
fp = path: ./${path};
|
||||
} // extraArgs.specialArgs or { };
|
||||
|
||||
modules = [
|
||||
./hosts/${name}/configuration.nix
|
||||
configurationPath
|
||||
sops-nix.nixosModules.sops
|
||||
] ++ config.modules or [];
|
||||
] ++ extraArgs.modules or [];
|
||||
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg)
|
||||
[
|
||||
"nvidia-x11"
|
||||
"nvidia-settings"
|
||||
];
|
||||
overlays = [
|
||||
# Global overlays go here
|
||||
] ++ config.overlays or [ ];
|
||||
] ++ extraArgs.overlays or [ ];
|
||||
};
|
||||
}
|
||||
(removeAttrs config [ "modules" "overlays" ])
|
||||
})
|
||||
(builtins.removeAttrs extraArgs [
|
||||
"modules"
|
||||
"overlays"
|
||||
"specialArgs"
|
||||
])
|
||||
);
|
||||
|
||||
stableNixosConfig = nixosConfig nixpkgs;
|
||||
unstableNixosConfig = nixosConfig nixpkgs-unstable;
|
||||
stableNixosConfig = name: extraArgs:
|
||||
nixosConfig nixpkgs name ./hosts/${name}/configuration.nix extraArgs;
|
||||
in {
|
||||
bakke = stableNixosConfig "bakke" {
|
||||
modules = [
|
||||
disko.nixosModules.disko
|
||||
];
|
||||
};
|
||||
bicep = stableNixosConfig "bicep" {
|
||||
modules = [
|
||||
inputs.matrix-next.nixosModules.default
|
||||
inputs.pvv-calendar-bot.nixosModules.default
|
||||
inputs.minecraft-heatmap.nixosModules.default
|
||||
self.nixosModules.gickup
|
||||
self.nixosModules.matrix-ooye
|
||||
];
|
||||
overlays = [
|
||||
inputs.pvv-calendar-bot.overlays.x86_64-linux.default
|
||||
inputs.pvv-calendar-bot.overlays.default
|
||||
inputs.minecraft-heatmap.overlays.default
|
||||
(final: prev: {
|
||||
inherit (self.packages.${prev.system}) out-of-your-element;
|
||||
})
|
||||
];
|
||||
};
|
||||
bekkalokk = stableNixosConfig "bekkalokk" {
|
||||
@@ -96,57 +133,84 @@
|
||||
simplesamlphp = final.callPackage ./packages/simplesamlphp { };
|
||||
bluemap = final.callPackage ./packages/bluemap.nix { };
|
||||
})
|
||||
inputs.nix-gitea-themes.overlays.default
|
||||
inputs.pvv-nettsiden.overlays.default
|
||||
];
|
||||
modules = [
|
||||
inputs.nix-gitea-themes.nixosModules.default
|
||||
inputs.pvv-nettsiden.nixosModules.default
|
||||
];
|
||||
};
|
||||
bob = stableNixosConfig "bob" {
|
||||
modules = [
|
||||
disko.nixosModules.disko
|
||||
{ disko.devices.disk.disk1.device = "/dev/vda"; }
|
||||
];
|
||||
};
|
||||
ildkule = stableNixosConfig "ildkule" { };
|
||||
#ildkule-unstable = unstableNixosConfig "ildkule" { };
|
||||
shark = stableNixosConfig "shark" { };
|
||||
wenche = stableNixosConfig "wenche" { };
|
||||
|
||||
kommode = stableNixosConfig "kommode" {
|
||||
overlays = [
|
||||
inputs.nix-gitea-themes.overlays.default
|
||||
];
|
||||
modules = [
|
||||
inputs.nix-gitea-themes.nixosModules.default
|
||||
];
|
||||
};
|
||||
|
||||
ustetind = stableNixosConfig "ustetind" {
|
||||
modules = [
|
||||
"${nixpkgs}/nixos/modules/virtualisation/lxc-container.nix"
|
||||
];
|
||||
};
|
||||
|
||||
brzeczyszczykiewicz = stableNixosConfig "brzeczyszczykiewicz" {
|
||||
modules = [
|
||||
inputs.grzegorz-clients.nixosModules.grzegorz-webui
|
||||
inputs.gergle.nixosModules.default
|
||||
inputs.greg-ng.nixosModules.default
|
||||
];
|
||||
overlays = [
|
||||
inputs.greg-ng.overlays.default
|
||||
inputs.gergle.overlays.default
|
||||
];
|
||||
};
|
||||
georg = stableNixosConfig "georg" {
|
||||
modules = [
|
||||
inputs.grzegorz-clients.nixosModules.grzegorz-webui
|
||||
inputs.gergle.nixosModules.default
|
||||
inputs.greg-ng.nixosModules.default
|
||||
];
|
||||
overlays = [
|
||||
inputs.greg-ng.overlays.default
|
||||
inputs.gergle.overlays.default
|
||||
];
|
||||
};
|
||||
kvernberg = stableNixosConfig "kvernberg" {
|
||||
modules = [
|
||||
disko.nixosModules.disko
|
||||
{ disko.devices.disk.disk1.device = "/dev/sda"; }
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
//
|
||||
(let
|
||||
machineNames = map (i: "lupine-${toString i}") (lib.range 1 5);
|
||||
stableLupineNixosConfig = name: extraArgs:
|
||||
nixosConfig nixpkgs name ./hosts/lupine/configuration.nix extraArgs;
|
||||
in lib.genAttrs machineNames (name: stableLupineNixosConfig name {
|
||||
modules = [{ networking.hostName = name; }];
|
||||
specialArgs.lupineName = name;
|
||||
}));
|
||||
|
||||
nixosModules = {
|
||||
snakeoil-certs = ./modules/snakeoil-certs.nix;
|
||||
snappymail = ./modules/snappymail.nix;
|
||||
robots-txt = ./modules/robots-txt.nix;
|
||||
gickup = ./modules/gickup;
|
||||
matrix-ooye = ./modules/matrix-ooye.nix;
|
||||
};
|
||||
|
||||
devShells = forAllSystems (system: {
|
||||
default = nixpkgs.legacyPackages.${system}.callPackage ./shell.nix { };
|
||||
default = nixpkgs-unstable.legacyPackages.${system}.callPackage ./shell.nix { };
|
||||
cuda = let
|
||||
cuda-pkgs = import nixpkgs-unstable {
|
||||
inherit system;
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
cudaSupport = true;
|
||||
};
|
||||
};
|
||||
in cuda-pkgs.callPackage ./shells/cuda.nix { };
|
||||
});
|
||||
|
||||
packages = {
|
||||
@@ -155,19 +219,20 @@
|
||||
in rec {
|
||||
default = important-machines;
|
||||
important-machines = pkgs.linkFarm "important-machines"
|
||||
(nixlib.getAttrs importantMachines self.packages.x86_64-linux);
|
||||
(lib.getAttrs importantMachines self.packages.x86_64-linux);
|
||||
all-machines = pkgs.linkFarm "all-machines"
|
||||
(nixlib.getAttrs allMachines self.packages.x86_64-linux);
|
||||
(lib.getAttrs allMachines self.packages.x86_64-linux);
|
||||
|
||||
simplesamlphp = pkgs.callPackage ./packages/simplesamlphp { };
|
||||
|
||||
out-of-your-element = pkgs.callPackage ./packages/out-of-your-element.nix { };
|
||||
} //
|
||||
(nixlib.pipe null [
|
||||
(lib.pipe null [
|
||||
(_: pkgs.callPackage ./packages/mediawiki-extensions { })
|
||||
(nixlib.flip builtins.removeAttrs ["override" "overrideDerivation"])
|
||||
(nixlib.mapAttrs' (name: nixlib.nameValuePair "mediawiki-${name}"))
|
||||
(lib.flip builtins.removeAttrs ["override" "overrideDerivation"])
|
||||
(lib.mapAttrs' (name: lib.nameValuePair "mediawiki-${name}"))
|
||||
])
|
||||
// nixlib.genAttrs allMachines
|
||||
// lib.genAttrs allMachines
|
||||
(machine: self.nixosConfigurations.${machine}.config.system.build.toplevel);
|
||||
};
|
||||
};
|
||||
|
||||
26
hosts/bakke/configuration.nix
Normal file
26
hosts/bakke/configuration.nix
Normal file
@@ -0,0 +1,26 @@
|
||||
{ config, pkgs, values, ... }:
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
../../base
|
||||
../../misc/metrics-exporters.nix
|
||||
./filesystems.nix
|
||||
];
|
||||
|
||||
sops.defaultSopsFile = ../../secrets/bakke/bakke.yaml;
|
||||
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
|
||||
sops.age.generateKey = true;
|
||||
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
networking.hostName = "bakke";
|
||||
networking.hostId = "99609ffc";
|
||||
systemd.network.networks."30-enp2s0" = values.defaultNetworkConfig // {
|
||||
matchConfig.Name = "enp2s0";
|
||||
address = with values.hosts.bakke; [ (ipv4 + "/25") (ipv6 + "/64") ];
|
||||
};
|
||||
|
||||
system.stateVersion = "24.05";
|
||||
}
|
||||
83
hosts/bakke/disks.nix
Normal file
83
hosts/bakke/disks.nix
Normal file
@@ -0,0 +1,83 @@
|
||||
{
|
||||
# https://github.com/nix-community/disko/blob/master/example/boot-raid1.nix
|
||||
# Note: Disko was used to create the initial md raid, but is no longer in active use on this host.
|
||||
disko.devices = {
|
||||
disk = {
|
||||
one = {
|
||||
type = "disk";
|
||||
device = "/dev/disk/by-id/ata-WDC_WD40EFRX-68WT0N0_WD-WCC4E2EER6N6";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
size = "500M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "mdraid";
|
||||
name = "boot";
|
||||
};
|
||||
};
|
||||
mdadm = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "mdraid";
|
||||
name = "raid1";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
two = {
|
||||
type = "disk";
|
||||
device = "/dev/disk/by-id/ata-WDC_WD40EFRX-68WT0N0_WD-WCC4E7LPLU71";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
size = "500M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "mdraid";
|
||||
name = "boot";
|
||||
};
|
||||
};
|
||||
mdadm = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "mdraid";
|
||||
name = "raid1";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
mdadm = {
|
||||
boot = {
|
||||
type = "mdadm";
|
||||
level = 1;
|
||||
metadata = "1.0";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
};
|
||||
};
|
||||
raid1 = {
|
||||
type = "mdadm";
|
||||
level = 1;
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions.primary = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
26
hosts/bakke/filesystems.nix
Normal file
26
hosts/bakke/filesystems.nix
Normal file
@@ -0,0 +1,26 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
# Boot drives:
|
||||
boot.swraid.enable = true;
|
||||
|
||||
# ZFS Data pool:
|
||||
environment.systemPackages = with pkgs; [ zfs ];
|
||||
boot = {
|
||||
zfs = {
|
||||
extraPools = [ "tank" ];
|
||||
requestEncryptionCredentials = false;
|
||||
};
|
||||
supportedFilesystems = [ "zfs" ];
|
||||
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
|
||||
};
|
||||
services.zfs.autoScrub = {
|
||||
enable = true;
|
||||
interval = "Wed *-*-8..14 00:00:00";
|
||||
};
|
||||
|
||||
# NFS Exports:
|
||||
#TODO
|
||||
|
||||
# NFS Import mounts:
|
||||
#TODO
|
||||
}
|
||||
52
hosts/bakke/hardware-configuration.nix
Normal file
52
hosts/bakke/hardware-configuration.nix
Normal file
@@ -0,0 +1,52 @@
|
||||
# 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 =
|
||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/0f63c3d2-fc12-4ed5-a5a5-141bfd67a571";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=root" ];
|
||||
};
|
||||
|
||||
fileSystems."/home" =
|
||||
{ device = "/dev/disk/by-uuid/0f63c3d2-fc12-4ed5-a5a5-141bfd67a571";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=home" ];
|
||||
};
|
||||
|
||||
fileSystems."/nix" =
|
||||
{ device = "/dev/disk/by-uuid/0f63c3d2-fc12-4ed5-a5a5-141bfd67a571";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=nix" "noatime" ];
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/sdc2";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0022" "dmask=0022" ];
|
||||
};
|
||||
|
||||
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 false;
|
||||
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.enp2s0.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
@@ -1,15 +1,14 @@
|
||||
{ pkgs, values, ... }:
|
||||
{ fp, pkgs, values, ... }:
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
|
||||
../../base
|
||||
../../misc/metrics-exporters.nix
|
||||
(fp /base)
|
||||
(fp /misc/metrics-exporters.nix)
|
||||
|
||||
./services/bluemap/default.nix
|
||||
./services/gitea/default.nix
|
||||
./services/idp-simplesamlphp
|
||||
./services/kerberos
|
||||
./services/kerberos.nix
|
||||
./services/mediawiki
|
||||
./services/nginx.nix
|
||||
./services/phpfpm.nix
|
||||
@@ -19,7 +18,7 @@
|
||||
./services/well-known
|
||||
];
|
||||
|
||||
sops.defaultSopsFile = ../../secrets/bekkalokk/bekkalokk.yaml;
|
||||
sops.defaultSopsFile = fp /secrets/bekkalokk/bekkalokk.yaml;
|
||||
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
|
||||
sops.age.generateKey = true;
|
||||
|
||||
@@ -1,31 +1,38 @@
|
||||
{ config, lib, pkgs, inputs, ... }:
|
||||
let
|
||||
vanillaSurvival = "/var/lib/bluemap/vanilla_survival_world";
|
||||
format = pkgs.formats.hocon { };
|
||||
in {
|
||||
imports = [
|
||||
./module.nix # From danio, pending upstreaming
|
||||
];
|
||||
|
||||
disabledModules = [ "services/web-servers/bluemap.nix" ];
|
||||
disabledModules = [ "services/web-apps/bluemap.nix" ];
|
||||
|
||||
sops.secrets."bluemap/ssh-key" = { };
|
||||
sops.secrets."bluemap/ssh-known-hosts" = { };
|
||||
|
||||
services.bluemap = {
|
||||
enable = true;
|
||||
package = pkgs.callPackage ./package.nix { };
|
||||
|
||||
eula = true;
|
||||
onCalendar = "*-*-* 05:45:00"; # a little over an hour after auto-upgrade
|
||||
|
||||
host = "minecraft.pvv.ntnu.no";
|
||||
|
||||
maps = {
|
||||
maps = let
|
||||
inherit (inputs.minecraft-kartverket.packages.${pkgs.stdenv.hostPlatform.system}) bluemap-export;
|
||||
in {
|
||||
"verden" = {
|
||||
settings = {
|
||||
world = vanillaSurvival;
|
||||
sorting = 0;
|
||||
ambient-light = 0.1;
|
||||
cave-detection-ocean-floor = -5;
|
||||
marker-sets = inputs.minecraft-data.map-markers.vanillaSurvival.verden;
|
||||
marker-sets = {
|
||||
_includes = [ (format.lib.mkInclude "${bluemap-export}/overworld.hocon") ];
|
||||
};
|
||||
};
|
||||
};
|
||||
"underverden" = {
|
||||
@@ -40,7 +47,9 @@ in {
|
||||
cave-detection-ocean-floor = -5;
|
||||
cave-detection-uses-block-light = true;
|
||||
max-y = 90;
|
||||
marker-sets = inputs.minecraft-data.map-markers.vanillaSurvival.underverden;
|
||||
marker-sets = {
|
||||
_includes = [ (format.lib.mkInclude "${bluemap-export}/nether.hocon") ];
|
||||
};
|
||||
};
|
||||
};
|
||||
"enden" = {
|
||||
@@ -53,6 +62,9 @@ in {
|
||||
world-sky-light = 0;
|
||||
remove-caves-below-y = -10000;
|
||||
cave-detection-ocean-floor = -5;
|
||||
marker-sets = {
|
||||
_includes = [ (format.lib.mkInclude "${bluemap-export}/the-end.hocon") ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -26,7 +26,6 @@ let
|
||||
"webapp.conf" = webappConfig;
|
||||
"webserver.conf" = webserverConfig;
|
||||
"packs" = cfg.resourcepacks;
|
||||
"addons" = cfg.resourcepacks; # TODO
|
||||
};
|
||||
|
||||
renderConfigFolder = name: value: pkgs.linkFarm "bluemap-${name}-config" {
|
||||
@@ -38,13 +37,13 @@ let
|
||||
"webapp.conf" = format.generate "webapp.conf" (cfg.webappSettings // { "update-settings-file" = false; });
|
||||
"webserver.conf" = webserverConfig;
|
||||
"packs" = value.resourcepacks;
|
||||
"addons" = cfg.resourcepacks; # TODO
|
||||
};
|
||||
|
||||
inherit (lib) mkOption;
|
||||
in {
|
||||
options.services.bluemap = {
|
||||
enable = lib.mkEnableOption "bluemap";
|
||||
package = lib.mkPackageOption pkgs "bluemap" { };
|
||||
|
||||
eula = mkOption {
|
||||
type = lib.types.bool;
|
||||
@@ -159,7 +158,7 @@ in {
|
||||
type = lib.types.path;
|
||||
default = cfg.resourcepacks;
|
||||
defaultText = lib.literalExpression "config.services.bluemap.resourcepacks";
|
||||
description = "A set of resourcepacks/mods to extract models from loaded in alphabetical order";
|
||||
description = "A set of resourcepacks/mods/bluemap-addons to extract models from loaded in alphabetical order";
|
||||
};
|
||||
settings = mkOption {
|
||||
type = (lib.types.submodule {
|
||||
@@ -310,9 +309,18 @@ in {
|
||||
Group = "nginx";
|
||||
UMask = "026";
|
||||
};
|
||||
script = lib.strings.concatStringsSep "\n" ((lib.attrsets.mapAttrsToList
|
||||
(name: value: "${lib.getExe pkgs.bluemap} -c ${renderConfigFolder name value} -r")
|
||||
cfg.maps) ++ [ "${lib.getExe pkgs.bluemap} -c ${webappConfigFolder} -gs" ]);
|
||||
script = ''
|
||||
# If web folder doesnt exist generate it
|
||||
test -f "${cfg.webRoot}" || ${lib.getExe cfg.package} -c ${webappConfigFolder} -gs
|
||||
|
||||
# Render each minecraft map
|
||||
${lib.strings.concatStringsSep "\n" (lib.attrsets.mapAttrsToList
|
||||
(name: value: "${lib.getExe cfg.package} -c ${renderConfigFolder name value} -r")
|
||||
cfg.maps)}
|
||||
|
||||
# Generate updated webapp
|
||||
${lib.getExe cfg.package} -c ${webappConfigFolder} -gs
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.timers."render-bluemap-maps" = lib.mkIf cfg.enableRender {
|
||||
|
||||
30
hosts/bekkalokk/services/bluemap/package.nix
Normal file
30
hosts/bekkalokk/services/bluemap/package.nix
Normal file
@@ -0,0 +1,30 @@
|
||||
{ lib, stdenvNoCC, fetchurl, makeWrapper, jre }:
|
||||
|
||||
stdenvNoCC.mkDerivation rec {
|
||||
pname = "bluemap";
|
||||
version = "5.7";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/BlueMap-Minecraft/BlueMap/releases/download/v${version}/BlueMap-${version}-cli.jar";
|
||||
hash = "sha256-8udZYJgrr4bi2mjRYrASd8JwUoUVZW1tZpOLRgafAIw=";
|
||||
};
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
makeWrapper ${jre}/bin/java $out/bin/bluemap --add-flags "-jar $src"
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "3D minecraft map renderer";
|
||||
homepage = "https://bluemap.bluecolored.de/";
|
||||
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ dandellion h7x4 ];
|
||||
mainProgram = "bluemap";
|
||||
};
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
{ pkgs, lib, ... }:
|
||||
|
||||
# Based on
|
||||
# - https://web.mit.edu/kerberos/krb5-1.12/doc/admin/conf_files/krb5_conf.html
|
||||
# - https://manpages.debian.org/unstable/heimdal-docs/krb5.conf.5heimdal.en.html
|
||||
|
||||
let
|
||||
inherit (lib) boolToString concatMapStringsSep concatStringsSep filter
|
||||
isAttrs isBool isList mapAttrsToList mdDoc mkOption singleton splitString;
|
||||
inherit (lib.types) attrsOf bool coercedTo either int listOf oneOf path
|
||||
str submodule;
|
||||
in
|
||||
{ }: {
|
||||
type = let
|
||||
section = attrsOf relation;
|
||||
relation = either (attrsOf value) value;
|
||||
value = either (listOf atom) atom;
|
||||
atom = oneOf [int str bool];
|
||||
in submodule {
|
||||
freeformType = attrsOf section;
|
||||
options = {
|
||||
include = mkOption {
|
||||
default = [ ];
|
||||
description = mdDoc ''
|
||||
Files to include in the Kerberos configuration.
|
||||
'';
|
||||
type = coercedTo path singleton (listOf path);
|
||||
};
|
||||
includedir = mkOption {
|
||||
default = [ ];
|
||||
description = mdDoc ''
|
||||
Directories containing files to include in the Kerberos configuration.
|
||||
'';
|
||||
type = coercedTo path singleton (listOf path);
|
||||
};
|
||||
module = mkOption {
|
||||
default = [ ];
|
||||
description = mdDoc ''
|
||||
Modules to obtain Kerberos configuration from.
|
||||
'';
|
||||
type = coercedTo path singleton (listOf path);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
generate = let
|
||||
indent = str: concatMapStringsSep "\n" (line: " " + line) (splitString "\n" str);
|
||||
|
||||
formatToplevel = args @ {
|
||||
include ? [ ],
|
||||
includedir ? [ ],
|
||||
module ? [ ],
|
||||
...
|
||||
}: let
|
||||
sections = removeAttrs args [ "include" "includedir" "module" ];
|
||||
in concatStringsSep "\n" (filter (x: x != "") [
|
||||
(concatStringsSep "\n" (mapAttrsToList formatSection sections))
|
||||
(concatMapStringsSep "\n" (m: "module ${m}") module)
|
||||
(concatMapStringsSep "\n" (i: "include ${i}") include)
|
||||
(concatMapStringsSep "\n" (i: "includedir ${i}") includedir)
|
||||
]);
|
||||
|
||||
formatSection = name: section: ''
|
||||
[${name}]
|
||||
${indent (concatStringsSep "\n" (mapAttrsToList formatRelation section))}
|
||||
'';
|
||||
|
||||
formatRelation = name: relation:
|
||||
if isAttrs relation
|
||||
then ''
|
||||
${name} = {
|
||||
${indent (concatStringsSep "\n" (mapAttrsToList formatValue relation))}
|
||||
}''
|
||||
else formatValue name relation;
|
||||
|
||||
formatValue = name: value:
|
||||
if isList value
|
||||
then concatMapStringsSep "\n" (formatAtom name) value
|
||||
else formatAtom name value;
|
||||
|
||||
formatAtom = name: atom: let
|
||||
v = if isBool atom then boolToString atom else toString atom;
|
||||
in "${name} = ${v}";
|
||||
in
|
||||
name: value: pkgs.writeText name ''
|
||||
${formatToplevel value}
|
||||
'';
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
inherit (lib) mdDoc mkIf mkOption mkPackageOption mkRemovedOptionModule;
|
||||
inherit (lib.types) bool;
|
||||
|
||||
mkRemovedOptionModule' = name: reason: mkRemovedOptionModule ["krb5" name] reason;
|
||||
mkRemovedOptionModuleCfg = name: mkRemovedOptionModule' name ''
|
||||
The option `krb5.${name}' has been removed. Use
|
||||
`security.krb5.settings.${name}' for structured configuration.
|
||||
'';
|
||||
|
||||
cfg = config.security.krb5;
|
||||
format = import ./krb5-conf-format.nix { inherit pkgs lib; } { };
|
||||
in {
|
||||
imports = [
|
||||
(mkRemovedOptionModuleCfg "libdefaults")
|
||||
(mkRemovedOptionModuleCfg "realms")
|
||||
(mkRemovedOptionModuleCfg "domain_realm")
|
||||
(mkRemovedOptionModuleCfg "capaths")
|
||||
(mkRemovedOptionModuleCfg "appdefaults")
|
||||
(mkRemovedOptionModuleCfg "plugins")
|
||||
(mkRemovedOptionModuleCfg "config")
|
||||
(mkRemovedOptionModuleCfg "extraConfig")
|
||||
(mkRemovedOptionModule' "kerberos" ''
|
||||
The option `krb5.kerberos' has been moved to `security.krb5.package'.
|
||||
'')
|
||||
];
|
||||
|
||||
options = {
|
||||
security.krb5 = {
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
description = mdDoc "Enable and configure Kerberos utilities";
|
||||
type = bool;
|
||||
};
|
||||
|
||||
package = mkPackageOption pkgs "krb5" {
|
||||
example = "heimdal";
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
default = { };
|
||||
type = format.type;
|
||||
description = mdDoc ''
|
||||
Structured contents of the {file}`krb5.conf` file. See
|
||||
{manpage}`krb5.conf(5)` for details about configuration.
|
||||
'';
|
||||
example = {
|
||||
include = [ "/run/secrets/secret-krb5.conf" ];
|
||||
includedir = [ "/run/secrets/secret-krb5.conf.d" ];
|
||||
|
||||
libdefaults = {
|
||||
default_realm = "ATHENA.MIT.EDU";
|
||||
};
|
||||
|
||||
realms = {
|
||||
"ATHENA.MIT.EDU" = {
|
||||
admin_server = "athena.mit.edu";
|
||||
kdc = [
|
||||
"athena01.mit.edu"
|
||||
"athena02.mit.edu"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
domain_realm = {
|
||||
"mit.edu" = "ATHENA.MIT.EDU";
|
||||
};
|
||||
|
||||
logging = {
|
||||
kdc = "SYSLOG:NOTICE";
|
||||
admin_server = "SYSLOG:NOTICE";
|
||||
default = "SYSLOG:NOTICE";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment = {
|
||||
systemPackages = [ cfg.package ];
|
||||
etc."krb5.conf".source = format.generate "krb5.conf" cfg.settings;
|
||||
};
|
||||
};
|
||||
|
||||
meta.maintainers = builtins.attrValues {
|
||||
inherit (lib.maintainers) dblsaiko h7x4;
|
||||
};
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
{ pkgs, lib, config, values, pkgs-unstable, ... }: let
|
||||
{ pkgs, lib, fp, config, values, pkgs-unstable, ... }: let
|
||||
cfg = config.services.mediawiki;
|
||||
|
||||
# "mediawiki"
|
||||
@@ -61,7 +61,6 @@ in {
|
||||
user = "mediawiki";
|
||||
passwordFile = config.sops.secrets."mediawiki/postgres_password".path;
|
||||
createLocally = false;
|
||||
# TODO: create a normal database and copy over old data when the service is production ready
|
||||
name = "mediawiki";
|
||||
};
|
||||
|
||||
@@ -210,16 +209,16 @@ in {
|
||||
'';
|
||||
};
|
||||
|
||||
"= /PNG/PVV-logo.svg".alias = ../../../../assets/logo_blue_regular.svg;
|
||||
"= /PNG/PVV-logo.png".alias = ../../../../assets/logo_blue_regular.png;
|
||||
"= /PNG/PVV-logo.svg".alias = fp /assets/logo_blue_regular.svg;
|
||||
"= /PNG/PVV-logo.png".alias = fp /assets/logo_blue_regular.png;
|
||||
"= /favicon.ico".alias = pkgs.runCommandLocal "mediawiki-favicon.ico" {
|
||||
buildInputs = with pkgs; [ imagemagick ];
|
||||
} ''
|
||||
convert \
|
||||
magick \
|
||||
${fp /assets/logo_blue_regular.png} \
|
||||
-resize x64 \
|
||||
-gravity center \
|
||||
-crop 64x64+0+0 \
|
||||
${../../../../assets/logo_blue_regular.png} \
|
||||
-flatten \
|
||||
-colors 256 \
|
||||
-background transparent \
|
||||
|
||||
@@ -83,7 +83,6 @@ in {
|
||||
ProtectKernelLogs = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectKernelTunables = true;
|
||||
ProtectProc = "invisible";
|
||||
RestrictAddressFamilies = [
|
||||
"AF_INET"
|
||||
"AF_INET6"
|
||||
@@ -98,7 +97,6 @@ in {
|
||||
"@system-service"
|
||||
"~@privileged"
|
||||
];
|
||||
UMask = "0007";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ in
|
||||
custom_from
|
||||
]);
|
||||
|
||||
dicts = with pkgs.aspellDicts; [ en en-science en-computers nb nn fr de it ];
|
||||
dicts = with pkgs.aspellDicts; [ en en-computers nb nn fr de it ];
|
||||
maxAttachmentSize = 20;
|
||||
hostName = "roundcubeplaceholder.example.com";
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, fp, pkgs, ... }:
|
||||
let
|
||||
cfg = config.services.snappymail;
|
||||
in {
|
||||
imports = [ ../../../../modules/snappymail.nix ];
|
||||
imports = [ (fp /modules/snappymail.nix) ];
|
||||
|
||||
services.snappymail = {
|
||||
enable = true;
|
||||
|
||||
@@ -18,11 +18,16 @@ in {
|
||||
restartUnits = [ "phpfpm-pvv-nettsiden.service" ];
|
||||
});
|
||||
|
||||
security.acme.certs."www.pvv.ntnu.no" = {
|
||||
extraDomainNames = [
|
||||
"pvv.ntnu.no"
|
||||
"www.pvv.org"
|
||||
"pvv.org"
|
||||
];
|
||||
};
|
||||
|
||||
services.idp.sp-remote-metadata = [
|
||||
"https://www.pvv.ntnu.no/simplesaml/"
|
||||
"https://pvv.ntnu.no/simplesaml/"
|
||||
"https://www.pvv.org/simplesaml/"
|
||||
"https://pvv.org/simplesaml/"
|
||||
];
|
||||
|
||||
services.pvv-nettsiden = {
|
||||
@@ -67,7 +72,9 @@ in {
|
||||
ADMIN_NAME = "PVV Drift";
|
||||
ADMIN_EMAIL = "drift@pvv.ntnu.no";
|
||||
ADMIN_PASSWORD = includeFromSops "simplesamlphp/admin_password";
|
||||
TRUSTED_DOMAINS = [ cfg.domainName ];
|
||||
TRUSTED_DOMAINS = [
|
||||
"www.pvv.ntnu.no"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -78,13 +85,28 @@ in {
|
||||
"catch_workers_output" = true;
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts.${cfg.domainName} = {
|
||||
serverAliases = [
|
||||
"pvv.ntnu.no"
|
||||
"www.pvv.org"
|
||||
"pvv.org"
|
||||
];
|
||||
services.nginx.virtualHosts."pvv.ntnu.no" = {
|
||||
globalRedirect = cfg.domainName;
|
||||
redirectCode = 307;
|
||||
forceSSL = true;
|
||||
useACMEHost = "www.pvv.ntnu.no";
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."www.pvv.org" = {
|
||||
globalRedirect = cfg.domainName;
|
||||
redirectCode = 307;
|
||||
forceSSL = true;
|
||||
useACMEHost = "www.pvv.ntnu.no";
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."pvv.org" = {
|
||||
globalRedirect = cfg.domainName;
|
||||
redirectCode = 307;
|
||||
forceSSL = true;
|
||||
useACMEHost = "www.pvv.ntnu.no";
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts.${cfg.domainName} = {
|
||||
locations = {
|
||||
# Proxy home directories
|
||||
"^~ /~" = {
|
||||
|
||||
@@ -53,7 +53,7 @@ in {
|
||||
|
||||
echo "Creating thumbnail for $fname"
|
||||
mkdir -p $(dirname ".thumbnails/$fname")
|
||||
convert -define jpeg:size=200x200 "$fname" -thumbnail 300 -auto-orient ".thumbnails/$fname.png" ||:
|
||||
magick -define jpeg:size=200x200 "$fname" -thumbnail 300 -auto-orient ".thumbnails/$fname.png" ||:
|
||||
touch -m -d "$(date -R -r "$fname")" ".thumbnails/$fname.png"
|
||||
done <<< "$images"
|
||||
'';
|
||||
|
||||
@@ -1,32 +1,35 @@
|
||||
{ pkgs, values, ... }:
|
||||
{ fp, pkgs, values, ... }:
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
|
||||
../../base
|
||||
../../misc/metrics-exporters.nix
|
||||
(fp /base)
|
||||
(fp /misc/metrics-exporters.nix)
|
||||
./services/nginx
|
||||
|
||||
./services/calendar-bot.nix
|
||||
#./services/git-mirrors
|
||||
./services/minecraft-heatmap.nix
|
||||
./services/mysql.nix
|
||||
./services/postgres.nix
|
||||
./services/mysql.nix
|
||||
./services/calendar-bot.nix
|
||||
|
||||
./services/matrix
|
||||
];
|
||||
|
||||
sops.defaultSopsFile = ../../secrets/bicep/bicep.yaml;
|
||||
sops.defaultSopsFile = fp /secrets/bicep/bicep.yaml;
|
||||
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
|
||||
sops.age.generateKey = true;
|
||||
|
||||
boot.loader.grub.enable = true;
|
||||
boot.loader.grub.device = "/dev/disk/by-id/scsi-3600508b1001cb1a8751c137b30610682";
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
networking.hostName = "bicep";
|
||||
|
||||
systemd.network.networks."30-enp6s0f0" = values.defaultNetworkConfig // {
|
||||
matchConfig.Name = "enp6s0f0";
|
||||
#systemd.network.networks."30-enp6s0f0" = values.defaultNetworkConfig // {
|
||||
systemd.network.networks."30-ens18" = values.defaultNetworkConfig // {
|
||||
#matchConfig.Name = "enp6s0f0";
|
||||
matchConfig.Name = "ens18";
|
||||
address = with values.hosts.bicep; [ (ipv4 + "/25") (ipv6 + "/64") ]
|
||||
++ (with values.services.turn; [ (ipv4 + "/25") (ipv6 + "/64") ]);
|
||||
};
|
||||
@@ -37,6 +40,13 @@
|
||||
# There are no smart devices
|
||||
services.smartd.enable = false;
|
||||
|
||||
# we are a vm now
|
||||
services.qemuGuest.enable = true;
|
||||
|
||||
# Enable the OpenSSH daemon.
|
||||
services.openssh.enable = true;
|
||||
services.sshguard.enable = true;
|
||||
|
||||
# Do not change, even during upgrades.
|
||||
# See https://search.nixos.org/options?show=system.stateVersion
|
||||
system.stateVersion = "22.11";
|
||||
|
||||
@@ -5,22 +5,29 @@
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
[ (modulesPath + "/profiles/qemu-guest.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "uhci_hcd" "ehci_pci" "hpsa" "ohci_pci" "usbhid" "sd_mod" ];
|
||||
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "ahci" "sd_mod" "sr_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/31a67903-dc00-448a-a24a-36e820318fe5";
|
||||
{ device = "/dev/disk/by-uuid/20e06202-7a09-47cc-8ef6-5e7afe19453a";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
# temp data disk, only 128gb not enough until we can add another disk to the system.
|
||||
fileSystems."/data" =
|
||||
{ device = "/dev/disk/by-uuid/79e93eed-ad95-45c9-b115-4ef92afcc8c0";
|
||||
fsType = "f2fs";
|
||||
{ device = "/dev/disk/by-uuid/c81af266-0781-4084-b8eb-c2587cbcf1ba";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/198B-E363";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0022" "dmask=0022" ];
|
||||
};
|
||||
|
||||
swapDevices = [ ];
|
||||
@@ -30,11 +37,7 @@
|
||||
# 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.enp6s0f0.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.enp6s0f1.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.enp6s0f2.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.enp6s0f3.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.ens18.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{ config, fp, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.services.pvv-calendar-bot;
|
||||
in {
|
||||
sops.secrets = {
|
||||
"calendar-bot/matrix_token" = {
|
||||
sopsFile = ../../../secrets/bicep/bicep.yaml;
|
||||
sopsFile = fp /secrets/bicep/bicep.yaml;
|
||||
key = "calendar-bot/matrix_token";
|
||||
owner = cfg.user;
|
||||
group = cfg.group;
|
||||
};
|
||||
"calendar-bot/mysql_password" = {
|
||||
sopsFile = ../../../secrets/bicep/bicep.yaml;
|
||||
sopsFile = fp /secrets/bicep/bicep.yaml;
|
||||
key = "calendar-bot/mysql_password";
|
||||
owner = cfg.user;
|
||||
group = cfg.group;
|
||||
|
||||
100
hosts/bicep/services/git-mirrors/default.nix
Normal file
100
hosts/bicep/services/git-mirrors/default.nix
Normal file
@@ -0,0 +1,100 @@
|
||||
{ config, pkgs, lib, fp, ... }:
|
||||
let
|
||||
cfg = config.services.gickup;
|
||||
in
|
||||
{
|
||||
sops.secrets."gickup/github-token" = {
|
||||
owner = "gickup";
|
||||
};
|
||||
|
||||
services.gickup = {
|
||||
enable = true;
|
||||
|
||||
dataDir = "/data/gickup";
|
||||
|
||||
destinationSettings = {
|
||||
structured = true;
|
||||
zip = false;
|
||||
keep = 10;
|
||||
bare = true;
|
||||
lfs = false;
|
||||
};
|
||||
|
||||
instances = let
|
||||
defaultGithubConfig = {
|
||||
settings.token_file = config.sops.secrets."gickup/github-token".path;
|
||||
};
|
||||
defaultGitlabConfig = {
|
||||
# settings.token_file = ...
|
||||
};
|
||||
in {
|
||||
"github:Git-Mediawiki/Git-Mediawiki" = defaultGithubConfig;
|
||||
"github:NixOS/nixpkgs" = defaultGithubConfig;
|
||||
"github:go-gitea/gitea" = defaultGithubConfig;
|
||||
"github:heimdal/heimdal" = defaultGithubConfig;
|
||||
"github:saltstack/salt" = defaultGithubConfig;
|
||||
"github:typst/typst" = defaultGithubConfig;
|
||||
"github:unmojang/FjordLauncher" = defaultGithubConfig;
|
||||
"github:unmojang/drasl" = defaultGithubConfig;
|
||||
"github:yushijinhun/authlib-injector" = defaultGithubConfig;
|
||||
|
||||
"gitlab:mx-puppet/discord/better-discord.js" = defaultGitlabConfig;
|
||||
"gitlab:mx-puppet/discord/discord-markdown" = defaultGitlabConfig;
|
||||
"gitlab:mx-puppet/discord/matrix-discord-parser" = defaultGitlabConfig;
|
||||
"gitlab:mx-puppet/discord/mx-puppet-discord" = defaultGitlabConfig;
|
||||
"gitlab:mx-puppet/mx-puppet-bridge" = defaultGitlabConfig;
|
||||
|
||||
"any:glibc" = {
|
||||
settings.url = "https://sourceware.org/git/glibc.git";
|
||||
};
|
||||
|
||||
"any:out-of-your-element" = {
|
||||
settings.url = "https://gitdab.com/cadence/out-of-your-element.git";
|
||||
};
|
||||
|
||||
"any:out-of-your-element-module" = {
|
||||
settings.url = "https://cgit.rory.gay/nix/OOYE-module.git";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.cgit = let
|
||||
domain = "mirrors.pvv.ntnu.no";
|
||||
in {
|
||||
${domain} = {
|
||||
enable = true;
|
||||
package = pkgs.callPackage (fp /packages/cgit.nix) { };
|
||||
group = "gickup";
|
||||
scanPath = "${cfg.dataDir}/linktree";
|
||||
settings = {
|
||||
enable-commit-graph = true;
|
||||
enable-follow-links = true;
|
||||
enable-http-clone = true;
|
||||
enable-remote-branches = true;
|
||||
clone-url = "https://${domain}/$CGIT_REPO_URL";
|
||||
remove-suffix = true;
|
||||
root-title = "PVVSPPP";
|
||||
root-desc = "PVV Speiler Praktisk og Prominent Programvare";
|
||||
snapshots = "all";
|
||||
logo = "/PVV-logo.png";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."mirrors.pvv.ntnu.no" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
|
||||
locations."= /PVV-logo.png".alias = let
|
||||
small-pvv-logo = pkgs.runCommandLocal "pvv-logo-96x96" {
|
||||
nativeBuildInputs = [ pkgs.imagemagick ];
|
||||
} ''
|
||||
magick '${fp /assets/logo_blue_regular.svg}' -resize 96x96 PNG:"$out"
|
||||
'';
|
||||
in toString small-pvv-logo;
|
||||
};
|
||||
|
||||
systemd.services."fcgiwrap-cgit-mirrors.pvv.ntnu.no" = {
|
||||
serviceConfig.BindReadOnlyPaths = [ cfg.dataDir ];
|
||||
};
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
{ config, lib, pkgs, secrets, values, ... }:
|
||||
{ config, lib, fp, pkgs, secrets, values, ... }:
|
||||
|
||||
{
|
||||
sops.secrets."matrix/synapse/turnconfig" = {
|
||||
sopsFile = ../../../../secrets/bicep/matrix.yaml;
|
||||
sopsFile = fp /secrets/bicep/matrix.yaml;
|
||||
key = "synapse/turnconfig";
|
||||
owner = config.users.users.matrix-synapse.name;
|
||||
group = config.users.users.matrix-synapse.group;
|
||||
};
|
||||
sops.secrets."matrix/coturn/static-auth-secret" = {
|
||||
sopsFile = ../../../../secrets/bicep/matrix.yaml;
|
||||
sopsFile = fp /secrets/bicep/matrix.yaml;
|
||||
key = "coturn/static-auth-secret";
|
||||
owner = config.users.users.turnserver.name;
|
||||
group = config.users.users.turnserver.group;
|
||||
@@ -42,12 +42,15 @@
|
||||
|
||||
security.acme.certs.${config.services.coturn.realm} = {
|
||||
email = "drift@pvv.ntnu.no";
|
||||
listenHTTP = "129.241.210.213:80";
|
||||
listenHTTP = "${values.services.turn.ipv4}:80";
|
||||
reloadServices = [ "coturn.service" ];
|
||||
};
|
||||
|
||||
users.users.turnserver.extraGroups = [ "acme" ];
|
||||
|
||||
# It needs this to be allowed to access the files with the acme group
|
||||
systemd.services.coturn.serviceConfig.PrivateUsers = lib.mkForce false;
|
||||
|
||||
systemd.services."acme-${config.services.coturn.realm}".serviceConfig = {
|
||||
AmbientCapabilities = [ "CAP_NET_BIND_SERVICE" ];
|
||||
};
|
||||
@@ -66,7 +69,7 @@
|
||||
|
||||
listening-ips = [
|
||||
values.services.turn.ipv4
|
||||
# values.services.turn.ipv6
|
||||
values.services.turn.ipv6
|
||||
];
|
||||
|
||||
tls-listening-port = 443;
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
./coturn.nix
|
||||
./mjolnir.nix
|
||||
|
||||
./discord.nix
|
||||
# ./discord.nix
|
||||
./out-of-your-element.nix
|
||||
./hookshot
|
||||
];
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ config, lib, ... }:
|
||||
{ config, lib, fp, ... }:
|
||||
|
||||
let
|
||||
cfg = config.services.mx-puppet-discord;
|
||||
@@ -7,11 +7,11 @@ in
|
||||
users.groups.keys-matrix-registrations = { };
|
||||
|
||||
sops.secrets."matrix/discord/as_token" = {
|
||||
sopsFile = ../../../../secrets/bicep/matrix.yaml;
|
||||
sopsFile = fp /secrets/bicep/matrix.yaml;
|
||||
key = "discord/as_token";
|
||||
};
|
||||
sops.secrets."matrix/discord/hs_token" = {
|
||||
sopsFile = ../../../../secrets/bicep/matrix.yaml;
|
||||
sopsFile = fp /secrets/bicep/matrix.yaml;
|
||||
key = "discord/hs_token";
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ in
|
||||
};
|
||||
|
||||
|
||||
services.mx-puppet-discord.enable = true;
|
||||
services.mx-puppet-discord.enable = false;
|
||||
services.mx-puppet-discord.settings = {
|
||||
bridge = {
|
||||
bindAddress = "localhost";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ config, lib, unstablePkgs, inputs, ... }:
|
||||
{ config, lib, fp, unstablePkgs, inputs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.services.matrix-hookshot;
|
||||
@@ -6,16 +6,12 @@ let
|
||||
webhookListenPort = 8435;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./module.nix
|
||||
];
|
||||
|
||||
sops.secrets."matrix/hookshot/as_token" = {
|
||||
sopsFile = ../../../../../secrets/bicep/matrix.yaml;
|
||||
sopsFile = fp /secrets/bicep/matrix.yaml;
|
||||
key = "hookshot/as_token";
|
||||
};
|
||||
sops.secrets."matrix/hookshot/hs_token" = {
|
||||
sopsFile = ../../../../../secrets/bicep/matrix.yaml;
|
||||
sopsFile = fp /secrets/bicep/matrix.yaml;
|
||||
key = "hookshot/hs_token";
|
||||
};
|
||||
|
||||
@@ -81,7 +77,7 @@ in
|
||||
outbound = true;
|
||||
urlPrefix = "https://hookshot.pvv.ntnu.no/webhook/";
|
||||
userIdPrefix = "_webhooks_";
|
||||
allowJsTransformationFunctions = false;
|
||||
allowJsTransformationFunctions = true;
|
||||
waitForComplete = false;
|
||||
};
|
||||
feeds = {
|
||||
@@ -98,6 +94,11 @@ in
|
||||
}
|
||||
];
|
||||
|
||||
widgets = {
|
||||
roomSetupWidget.addOnInvite = false;
|
||||
publicUrl = "https://hookshot.pvv.ntnu.no/widgetapi/v1/static";
|
||||
};
|
||||
|
||||
permissions = [
|
||||
# Users of the PVV Server
|
||||
{ actor = "pvv.ntnu.no";
|
||||
@@ -132,6 +133,7 @@ in
|
||||
|
||||
services.nginx.virtualHosts."hookshot.pvv.ntnu.no" = {
|
||||
enableACME = true;
|
||||
addSSL = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://${webhookListenAddress}:${toString webhookListenPort}";
|
||||
};
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.matrix-hookshot;
|
||||
settingsFormat = pkgs.formats.yaml { };
|
||||
configFile = settingsFormat.generate "matrix-hookshot-config.yml" cfg.settings;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
services.matrix-hookshot = {
|
||||
enable = lib.mkEnableOption "matrix-hookshot, a bridge between Matrix and project management services";
|
||||
|
||||
package = lib.mkPackageOption pkgs "matrix-hookshot" { };
|
||||
|
||||
registrationFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
description = ''
|
||||
Appservice registration file.
|
||||
As it contains secret tokens, you may not want to add this to the publicly readable Nix store.
|
||||
'';
|
||||
example = lib.literalExpression ''
|
||||
pkgs.writeText "matrix-hookshot-registration" \'\'
|
||||
id: matrix-hookshot
|
||||
as_token: aaaaaaaaaa
|
||||
hs_token: aaaaaaaaaa
|
||||
namespaces:
|
||||
rooms: []
|
||||
users:
|
||||
- regex: "@_webhooks_.*:foobar"
|
||||
exclusive: true
|
||||
|
||||
sender_localpart: hookshot
|
||||
url: "http://localhost:9993"
|
||||
rate_limited: false
|
||||
\'\'
|
||||
'';
|
||||
};
|
||||
|
||||
settings = lib.mkOption {
|
||||
description = ''
|
||||
{file}`config.yml` configuration as a Nix attribute set.
|
||||
|
||||
For details please see the [documentation](https://matrix-org.github.io/matrix-hookshot/latest/setup/sample-configuration.html).
|
||||
'';
|
||||
example = {
|
||||
bridge = {
|
||||
domain = "example.com";
|
||||
url = "http://localhost:8008";
|
||||
mediaUrl = "https://example.com";
|
||||
port = 9993;
|
||||
bindAddress = "127.0.0.1";
|
||||
};
|
||||
listeners = [
|
||||
{
|
||||
port = 9000;
|
||||
bindAddress = "0.0.0.0";
|
||||
resources = [ "webhooks" ];
|
||||
}
|
||||
{
|
||||
port = 9001;
|
||||
bindAddress = "localhost";
|
||||
resources = [
|
||||
"metrics"
|
||||
"provisioning"
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
default = { };
|
||||
type = lib.types.submodule {
|
||||
freeformType = settingsFormat.type;
|
||||
options = {
|
||||
passFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "/var/lib/matrix-hookshot/passkey.pem";
|
||||
description = ''
|
||||
A passkey used to encrypt tokens stored inside the bridge.
|
||||
File will be generated if not found.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
serviceDependencies = lib.mkOption {
|
||||
type = with lib.types; listOf str;
|
||||
default = lib.optional config.services.matrix-synapse.enable config.services.matrix-synapse.serviceUnit;
|
||||
defaultText = lib.literalExpression ''
|
||||
lib.optional config.services.matrix-synapse.enable config.services.matrix-synapse.serviceUnit
|
||||
'';
|
||||
description = ''
|
||||
List of Systemd services to require and wait for when starting the application service,
|
||||
such as the Matrix homeserver if it's running on the same host.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.services.matrix-hookshot = {
|
||||
description = "a bridge between Matrix and multiple project management services";
|
||||
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "network-online.target" ] ++ cfg.serviceDependencies;
|
||||
after = [ "network-online.target" ] ++ cfg.serviceDependencies;
|
||||
|
||||
preStart = ''
|
||||
if [ ! -f '${cfg.settings.passFile}' ]; then
|
||||
mkdir -p $(dirname '${cfg.settings.passFile}')
|
||||
${pkgs.openssl}/bin/openssl genpkey -out '${cfg.settings.passFile}' -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:4096
|
||||
fi
|
||||
'';
|
||||
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
Restart = "always";
|
||||
ExecStart = "${cfg.package}/bin/matrix-hookshot ${configFile} ${cfg.registrationFile}";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
meta.maintainers = with lib.maintainers; [ flandweber ];
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
{ config, lib, ... }:
|
||||
{ config, lib, fp, ... }:
|
||||
|
||||
{
|
||||
sops.secrets."matrix/mjolnir/access_token" = {
|
||||
sopsFile = ../../../../secrets/bicep/matrix.yaml;
|
||||
sopsFile = fp /secrets/bicep/matrix.yaml;
|
||||
key = "mjolnir/access_token";
|
||||
owner = config.users.users.mjolnir.name;
|
||||
group = config.users.users.mjolnir.group;
|
||||
|
||||
66
hosts/bicep/services/matrix/out-of-your-element.nix
Normal file
66
hosts/bicep/services/matrix/out-of-your-element.nix
Normal file
@@ -0,0 +1,66 @@
|
||||
{ config, pkgs, fp, ... }:
|
||||
let
|
||||
cfg = config.services.matrix-ooye;
|
||||
in
|
||||
{
|
||||
users.groups.keys-matrix-registrations = { };
|
||||
|
||||
sops.secrets = {
|
||||
"matrix/ooye/as_token" = {
|
||||
sopsFile = fp /secrets/bicep/matrix.yaml;
|
||||
key = "ooye/as_token";
|
||||
};
|
||||
"matrix/ooye/hs_token" = {
|
||||
sopsFile = fp /secrets/bicep/matrix.yaml;
|
||||
key = "ooye/hs_token";
|
||||
};
|
||||
"matrix/ooye/discord_token" = {
|
||||
sopsFile = fp /secrets/bicep/matrix.yaml;
|
||||
key = "ooye/discord_token";
|
||||
};
|
||||
"matrix/ooye/discord_client_secret" = {
|
||||
sopsFile = fp /secrets/bicep/matrix.yaml;
|
||||
key = "ooye/discord_client_secret";
|
||||
};
|
||||
};
|
||||
|
||||
services.matrix-ooye = {
|
||||
enable = true;
|
||||
homeserver = "https://matrix.pvv.ntnu.no";
|
||||
homeserverName = "pvv.ntnu.no";
|
||||
discordTokenPath = config.sops.secrets."matrix/ooye/discord_token".path;
|
||||
discordClientSecretPath = config.sops.secrets."matrix/ooye/discord_client_secret".path;
|
||||
bridgeOrigin = "https://ooye.pvv.ntnu.no";
|
||||
|
||||
enableSynapseIntegration = false;
|
||||
};
|
||||
|
||||
systemd.services."matrix-synapse" = {
|
||||
after = [
|
||||
"matrix-ooye-pre-start.service"
|
||||
"network-online.target"
|
||||
];
|
||||
requires = [ "matrix-ooye-pre-start.service" ];
|
||||
serviceConfig = {
|
||||
LoadCredential = [
|
||||
"matrix-ooye-registration:/var/lib/matrix-ooye/registration.yaml"
|
||||
];
|
||||
ExecStartPre = [
|
||||
"+${pkgs.coreutils}/bin/cp /run/credentials/matrix-synapse.service/matrix-ooye-registration ${config.services.matrix-synapse-next.dataDir}/ooye-registration.yaml"
|
||||
"+${pkgs.coreutils}/bin/chown matrix-synapse:keys-matrix-registrations ${config.services.matrix-synapse-next.dataDir}/ooye-registration.yaml"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
services.matrix-synapse-next.settings = {
|
||||
app_service_config_files = [
|
||||
"${config.services.matrix-synapse-next.dataDir}/ooye-registration.yaml"
|
||||
];
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."ooye.pvv.ntnu.no" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."/".proxyPass = "http://localhost:${cfg.socket}";
|
||||
};
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
{ lib, buildPythonPackage, fetchFromGitHub }:
|
||||
{ lib, buildPythonPackage, fetchFromGitHub, setuptools }:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "matrix-synapse-smtp-auth";
|
||||
@@ -6,6 +6,9 @@ buildPythonPackage rec {
|
||||
|
||||
src = ./.;
|
||||
|
||||
pyproject = true;
|
||||
build-system = [ setuptools ];
|
||||
|
||||
doCheck = false;
|
||||
|
||||
meta = with lib; {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ config, lib, pkgs, values, inputs, ... }:
|
||||
{ config, lib, fp, pkgs, values, inputs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.services.matrix-synapse-next;
|
||||
@@ -10,13 +10,13 @@ let
|
||||
in {
|
||||
sops.secrets."matrix/synapse/signing_key" = {
|
||||
key = "synapse/signing_key";
|
||||
sopsFile = ../../../../secrets/bicep/matrix.yaml;
|
||||
sopsFile = fp /secrets/bicep/matrix.yaml;
|
||||
owner = config.users.users.matrix-synapse.name;
|
||||
group = config.users.users.matrix-synapse.group;
|
||||
};
|
||||
|
||||
sops.secrets."matrix/synapse/user_registration" = {
|
||||
sopsFile = ../../../../secrets/bicep/matrix.yaml;
|
||||
sopsFile = fp /secrets/bicep/matrix.yaml;
|
||||
key = "synapse/signing_key";
|
||||
owner = config.users.users.matrix-synapse.name;
|
||||
group = config.users.users.matrix-synapse.group;
|
||||
@@ -124,8 +124,8 @@ in {
|
||||
"fec0::/10"
|
||||
|
||||
# NTNU
|
||||
"129.241.0.0/16"
|
||||
"2001:700:300::/44"
|
||||
values.ntnu.ipv4-space
|
||||
values.ntnu.ipv6-space
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
49
hosts/bicep/services/minecraft-heatmap.nix
Normal file
49
hosts/bicep/services/minecraft-heatmap.nix
Normal file
@@ -0,0 +1,49 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.services.minecraft-heatmap;
|
||||
in
|
||||
{
|
||||
sops.secrets."minecraft-heatmap/ssh-key/private" = {
|
||||
mode = "600";
|
||||
};
|
||||
|
||||
sops.secrets."minecraft-heatmap/postgres-passwd" = {
|
||||
mode = "600";
|
||||
};
|
||||
|
||||
services.minecraft-heatmap = {
|
||||
enable = true;
|
||||
database = {
|
||||
host = "postgres.pvv.ntnu.no";
|
||||
port = 5432;
|
||||
name = "minecraft_heatmap";
|
||||
user = "minecraft_heatmap";
|
||||
passwordFile = config.sops.secrets."minecraft-heatmap/postgres-passwd".path;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.minecraft-heatmap-ingest-logs = {
|
||||
serviceConfig.LoadCredential = [
|
||||
"sshkey:${config.sops.secrets."minecraft-heatmap/ssh-key/private".path}"
|
||||
];
|
||||
|
||||
preStart = let
|
||||
knownHostsFile = pkgs.writeText "minecraft-heatmap-known-hosts" ''
|
||||
innovation.pvv.ntnu.no ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE9O/y5uqcLKCodg2Q+XfZPH/AoUIyBlDhigImU+4+Kn
|
||||
innovation.pvv.ntnu.no ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQClR9GvWeVPZHudlnFXhGHUX5sGX9nscsOsotnlQ4uVuGsgvRifsVsuDULlAFXwoV1tYp4vnyXlsVtMddpLI5ANOIDcZ4fgDxpfSQmtHKssNpDcfMhFJbfRVyacipjA4osxTxvLox/yjtVt+URjTHUA1MWzEwc26KfiOvWO5tCBTan7doN/4KOyT05GwBxwzUAwUmoGTacIITck2Y9qp4+xFYqehbXqPdBb15hFyd38OCQhtU1hWV2Yi18+hJ4nyjc/g5pr6mW09ULlFghe/BaTUXrTisYC6bMcJZsTDwsvld9581KPvoNZOTQhZPTEQCZZ1h54fe0ZHuveVB3TIHovZyjoUuaf4uiFOjJVaKRB+Ig+Il6r7tMUn9CyHtus/Nd86E0TFBzoKxM0OFu88oaUlDtZVrUJL5En1lGoimajebb1JPxllFN5hqIT+gVyMY6nRzkcfS7ieny/U4rzXY2rfz98selftgh3LsBywwADv65i+mPw1A/1QdND1R6fV4U=
|
||||
innovation.pvv.ntnu.no ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNjl3HfsDqmALWCL9uhz9k93RAD2565ndBqUh4N/rvI7MCwEJ6iRCdDev0YzB1Fpg24oriyYoxZRP24ifC2sQf8=
|
||||
'';
|
||||
in ''
|
||||
mkdir -p '${cfg.minecraftLogsDir}'
|
||||
"${lib.getExe pkgs.rsync}" \
|
||||
--archive \
|
||||
--verbose \
|
||||
--progress \
|
||||
--no-owner \
|
||||
--no-group \
|
||||
--rsh="${pkgs.openssh}/bin/ssh -o UserKnownHostsFile=\"${knownHostsFile}\" -i \"$CREDENTIALS_DIRECTORY\"/sshkey" \
|
||||
root@innovation.pvv.ntnu.no:/ \
|
||||
'${cfg.minecraftLogsDir}'/
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -48,6 +48,8 @@
|
||||
IPAddressAllow = [
|
||||
values.ipv4-space
|
||||
values.ipv6-space
|
||||
values.hosts.ildkule.ipv4
|
||||
values.hosts.ildkule.ipv6
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
{ config, pkgs, ... }:
|
||||
{ config, pkgs, values, ... }:
|
||||
{
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
package = pkgs.postgresql_15;
|
||||
enableTCPIP = true;
|
||||
|
||||
dataDir = "/data/postgresql";
|
||||
|
||||
authentication = ''
|
||||
host all all 129.241.210.128/25 md5
|
||||
host all all 2001:700:300:1900::/64 md5
|
||||
host all all ${values.ipv4-space} md5
|
||||
host all all ${values.ipv6-space} md5
|
||||
host all all ${values.hosts.ildkule.ipv4}/32 md5
|
||||
host all all ${values.hosts.ildkule.ipv6}/32 md5
|
||||
'';
|
||||
|
||||
# Hilsen https://pgconfigurator.cybertec-postgresql.com/
|
||||
@@ -74,11 +74,40 @@
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.postgresql.serviceConfig = {
|
||||
systemd.tmpfiles.settings."10-postgresql"."/data/postgresql".d = {
|
||||
user = config.systemd.services.postgresql.serviceConfig.User;
|
||||
group = config.systemd.services.postgresql.serviceConfig.Group;
|
||||
mode = "0700";
|
||||
};
|
||||
|
||||
systemd.services.postgresql-setup = {
|
||||
after = [
|
||||
"systemd-tmpfiles-setup.service"
|
||||
"systemd-tmpfiles-resetup.service"
|
||||
];
|
||||
serviceConfig = {
|
||||
LoadCredential = [
|
||||
"cert:/etc/certs/postgres.crt"
|
||||
"key:/etc/certs/postgres.key"
|
||||
];
|
||||
|
||||
BindPaths = [ "/data/postgresql:/var/lib/postgresql" ];
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.postgresql = {
|
||||
after = [
|
||||
"systemd-tmpfiles-setup.service"
|
||||
"systemd-tmpfiles-resetup.service"
|
||||
];
|
||||
serviceConfig = {
|
||||
LoadCredential = [
|
||||
"cert:/etc/certs/postgres.crt"
|
||||
"key:/etc/certs/postgres.key"
|
||||
];
|
||||
|
||||
BindPaths = [ "/data/postgresql:/var/lib/postgresql" ];
|
||||
};
|
||||
};
|
||||
|
||||
environment.snakeoil-certs."/etc/certs/postgres" = {
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
{ config, pkgs, values, ... }:
|
||||
{
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
../../base
|
||||
../../misc/metrics-exporters.nix
|
||||
./disks.nix
|
||||
|
||||
../../misc/builder.nix
|
||||
];
|
||||
|
||||
sops.defaultSopsFile = ../../secrets/bob/bob.yaml;
|
||||
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
|
||||
sops.age.generateKey = true;
|
||||
|
||||
boot.loader.grub = {
|
||||
enable = true;
|
||||
efiSupport = true;
|
||||
efiInstallAsRemovable = true;
|
||||
};
|
||||
|
||||
networking.hostName = "bob"; # Define your hostname.
|
||||
|
||||
systemd.network.networks."30-all" = values.defaultNetworkConfig // {
|
||||
matchConfig.Name = "en*";
|
||||
DHCP = "yes";
|
||||
gateway = [ ];
|
||||
};
|
||||
|
||||
# List packages installed in system profile
|
||||
environment.systemPackages = with pkgs; [
|
||||
];
|
||||
|
||||
# List services that you want to enable:
|
||||
|
||||
# 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?
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
# Example to create a bios compatible gpt partition
|
||||
{ lib, ... }:
|
||||
{
|
||||
disko.devices = {
|
||||
disk.disk1 = {
|
||||
device = lib.mkDefault "/dev/sda";
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
name = "boot";
|
||||
size = "1M";
|
||||
type = "EF02";
|
||||
};
|
||||
esp = {
|
||||
name = "ESP";
|
||||
size = "500M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
};
|
||||
};
|
||||
root = {
|
||||
name = "root";
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
{ config, pkgs, values, ... }:
|
||||
{ config, fp, pkgs, values, ... }:
|
||||
{
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
../../base
|
||||
../../misc/metrics-exporters.nix
|
||||
(fp /base)
|
||||
(fp /misc/metrics-exporters.nix)
|
||||
|
||||
./services/grzegorz.nix
|
||||
];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{ config, ... }:
|
||||
{ config, fp, ... }:
|
||||
{
|
||||
imports = [ ../../../modules/grzegorz.nix ];
|
||||
imports = [ (fp /modules/grzegorz.nix) ];
|
||||
|
||||
services.nginx.virtualHosts."${config.networking.fqdn}" = {
|
||||
serverAliases = [
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{ config, pkgs, values, ... }:
|
||||
{ config, fp, pkgs, values, ... }:
|
||||
{
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
../../base
|
||||
../../misc/metrics-exporters.nix
|
||||
(fp /base)
|
||||
(fp /misc/metrics-exporters.nix)
|
||||
|
||||
../../modules/grzegorz.nix
|
||||
(fp /modules/grzegorz.nix)
|
||||
];
|
||||
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
@@ -25,6 +25,26 @@
|
||||
|
||||
# List services that you want to enable:
|
||||
|
||||
|
||||
|
||||
services.spotifyd = {
|
||||
enable = true;
|
||||
settings.global = {
|
||||
device_name = "georg";
|
||||
use_mpris = false;
|
||||
#dbus_type = "system";
|
||||
#zeroconf_port = 1234;
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
# config.services.spotifyd.settings.zeroconf_port
|
||||
5353 # spotifyd is its own mDNS service wtf
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
{ config, pkgs, lib, values, ... }:
|
||||
{ config, fp, pkgs, lib, values, ... }:
|
||||
{
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
../../base
|
||||
../../misc/metrics-exporters.nix
|
||||
(fp /base)
|
||||
(fp /misc/metrics-exporters.nix)
|
||||
|
||||
./services/monitoring
|
||||
./services/nginx
|
||||
];
|
||||
|
||||
sops.defaultSopsFile = ../../secrets/ildkule/ildkule.yaml;
|
||||
sops.defaultSopsFile = fp /secrets/ildkule/ildkule.yaml;
|
||||
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
|
||||
sops.age.generateKey = true;
|
||||
|
||||
@@ -1539,7 +1539,7 @@
|
||||
]
|
||||
},
|
||||
"timezone": "browser",
|
||||
"title": "Gitea Dashbaord",
|
||||
"title": "Gitea Dashboard",
|
||||
"uid": "nNq1Iw5Gz",
|
||||
"version": 29,
|
||||
"weekStart": ""
|
||||
@@ -56,13 +56,12 @@ in {
|
||||
url = "https://raw.githubusercontent.com/matrix-org/synapse/develop/contrib/grafana/synapse.json";
|
||||
options.path = dashboards/synapse.json;
|
||||
}
|
||||
# TODO: enable once https://github.com/NixOS/nixpkgs/pull/242365 gets merged
|
||||
# {
|
||||
# name = "MySQL";
|
||||
# type = "file";
|
||||
# url = "https://raw.githubusercontent.com/prometheus/mysqld_exporter/main/mysqld-mixin/dashboards/mysql-overview.json";
|
||||
# options.path = dashboards/mysql.json;
|
||||
# }
|
||||
{
|
||||
name = "MySQL";
|
||||
type = "file";
|
||||
url = "https://raw.githubusercontent.com/prometheus/mysqld_exporter/main/mysqld-mixin/dashboards/mysql-overview.json";
|
||||
options.path = dashboards/mysql.json;
|
||||
}
|
||||
{
|
||||
name = "Postgresql";
|
||||
type = "file";
|
||||
@@ -76,10 +75,10 @@ in {
|
||||
options.path = dashboards/go-processes.json;
|
||||
}
|
||||
{
|
||||
name = "Gitea Dashbaord";
|
||||
name = "Gitea Dashboard";
|
||||
type = "file";
|
||||
url = "https://grafana.com/api/dashboards/17802/revisions/3/download";
|
||||
options.path = dashboards/gitea-dashbaord.json;
|
||||
options.path = dashboards/gitea-dashboard.json;
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
stateDir = "/data/monitoring/prometheus";
|
||||
in {
|
||||
imports = [
|
||||
./exim.nix
|
||||
./gitea.nix
|
||||
./matrix-synapse.nix
|
||||
# TODO: enable once https://github.com/NixOS/nixpkgs/pull/242365 gets merged
|
||||
# ./mysqld.nix
|
||||
./postgres.nix
|
||||
./machines.nix
|
||||
./matrix-synapse.nix
|
||||
./mysqld.nix
|
||||
./postgres.nix
|
||||
];
|
||||
|
||||
services.prometheus = {
|
||||
|
||||
14
hosts/ildkule/services/monitoring/prometheus/exim.nix
Normal file
14
hosts/ildkule/services/monitoring/prometheus/exim.nix
Normal file
@@ -0,0 +1,14 @@
|
||||
{ ... }:
|
||||
{
|
||||
services.prometheus = {
|
||||
scrapeConfigs = [
|
||||
{
|
||||
job_name = "exim";
|
||||
scrape_interval = "15s";
|
||||
static_configs = [{
|
||||
targets = [ "microbel.pvv.ntnu.no:9636" ];
|
||||
}];
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -1,54 +1,37 @@
|
||||
{ config, ... }: let
|
||||
cfg = config.services.prometheus;
|
||||
|
||||
mkHostScrapeConfig = name: ports: {
|
||||
labels.hostname = name;
|
||||
targets = map (port: "${name}.pvv.ntnu.no:${toString port}") ports;
|
||||
};
|
||||
|
||||
defaultNodeExporterPort = 9100;
|
||||
defaultSystemdExporterPort = 9101;
|
||||
defaultNixosExporterPort = 9102;
|
||||
in {
|
||||
services.prometheus.scrapeConfigs = [{
|
||||
job_name = "base_info";
|
||||
static_configs = [
|
||||
{ labels.hostname = "ildkule";
|
||||
targets = [
|
||||
"ildkule.pvv.ntnu.no:${toString cfg.exporters.node.port}"
|
||||
"ildkule.pvv.ntnu.no:${toString cfg.exporters.systemd.port}"
|
||||
];
|
||||
}
|
||||
{ labels.hostname = "bekkalokk";
|
||||
targets = [
|
||||
"bekkalokk.pvv.ntnu.no:9100"
|
||||
"bekkalokk.pvv.ntnu.no:9101"
|
||||
];
|
||||
}
|
||||
{ labels.hostname = "bicep";
|
||||
targets = [
|
||||
"bicep.pvv.ntnu.no:9100"
|
||||
"bicep.pvv.ntnu.no:9101"
|
||||
];
|
||||
}
|
||||
{ labels.hostname = "brzeczyszczykiewicz";
|
||||
targets = [
|
||||
"brzeczyszczykiewicz.pvv.ntnu.no:9100"
|
||||
"brzeczyszczykiewicz.pvv.ntnu.no:9101"
|
||||
];
|
||||
}
|
||||
{ labels.hostname = "georg";
|
||||
targets = [
|
||||
"georg.pvv.ntnu.no:9100"
|
||||
"georg.pvv.ntnu.no:9101"
|
||||
];
|
||||
}
|
||||
{ labels.hostname = "hildring";
|
||||
targets = [
|
||||
"hildring.pvv.ntnu.no:9100"
|
||||
];
|
||||
}
|
||||
{ labels.hostname = "isvegg";
|
||||
targets = [
|
||||
"isvegg.pvv.ntnu.no:9100"
|
||||
];
|
||||
}
|
||||
{ labels.hostname = "microbel";
|
||||
targets = [
|
||||
"microbel.pvv.ntnu.no:9100"
|
||||
];
|
||||
}
|
||||
(mkHostScrapeConfig "ildkule" [ cfg.exporters.node.port cfg.exporters.systemd.port defaultNixosExporterPort ])
|
||||
|
||||
(mkHostScrapeConfig "bekkalokk" [ defaultNodeExporterPort defaultSystemdExporterPort defaultNixosExporterPort ])
|
||||
(mkHostScrapeConfig "bicep" [ defaultNodeExporterPort defaultSystemdExporterPort defaultNixosExporterPort ])
|
||||
(mkHostScrapeConfig "brzeczyszczykiewicz" [ defaultNodeExporterPort defaultSystemdExporterPort defaultNixosExporterPort ])
|
||||
(mkHostScrapeConfig "georg" [ defaultNodeExporterPort defaultSystemdExporterPort defaultNixosExporterPort ])
|
||||
(mkHostScrapeConfig "kommode" [ defaultNodeExporterPort defaultSystemdExporterPort defaultNixosExporterPort ])
|
||||
(mkHostScrapeConfig "ustetind" [ defaultNodeExporterPort defaultSystemdExporterPort defaultNixosExporterPort ])
|
||||
(mkHostScrapeConfig "wenche" [ defaultNodeExporterPort defaultSystemdExporterPort defaultNixosExporterPort ])
|
||||
|
||||
(mkHostScrapeConfig "lupine-1" [ defaultNodeExporterPort defaultSystemdExporterPort defaultNixosExporterPort ])
|
||||
# (mkHostScrapeConfig "lupine-2" [ defaultNodeExporterPort defaultSystemdExporterPort ])
|
||||
(mkHostScrapeConfig "lupine-3" [ defaultNodeExporterPort defaultSystemdExporterPort defaultNixosExporterPort ])
|
||||
(mkHostScrapeConfig "lupine-4" [ defaultNodeExporterPort defaultSystemdExporterPort defaultNixosExporterPort ])
|
||||
(mkHostScrapeConfig "lupine-5" [ defaultNodeExporterPort defaultSystemdExporterPort defaultNixosExporterPort ])
|
||||
|
||||
(mkHostScrapeConfig "hildring" [ defaultNodeExporterPort ])
|
||||
(mkHostScrapeConfig "isvegg" [ defaultNodeExporterPort ])
|
||||
(mkHostScrapeConfig "microbel" [ defaultNodeExporterPort ])
|
||||
];
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -1,7 +1,22 @@
|
||||
{ config, ... }: let
|
||||
cfg = config.services.prometheus;
|
||||
in {
|
||||
sops.secrets."config/mysqld_exporter" = { };
|
||||
sops = {
|
||||
secrets."config/mysqld_exporter_password" = { };
|
||||
|
||||
templates."mysqld_exporter.conf" = {
|
||||
restartUnits = [ "prometheus-mysqld-exporter.service" ];
|
||||
content = let
|
||||
inherit (config.sops) placeholder;
|
||||
in ''
|
||||
[client]
|
||||
host = mysql.pvv.ntnu.no
|
||||
port = 3306
|
||||
user = prometheus_mysqld_exporter
|
||||
password = ${placeholder."config/mysqld_exporter_password"}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
services.prometheus = {
|
||||
scrapeConfigs = [{
|
||||
@@ -19,7 +34,7 @@ in {
|
||||
|
||||
exporters.mysqld = {
|
||||
enable = true;
|
||||
configFilePath = config.sops.secrets."config/mysqld_exporter".path;
|
||||
configFile = config.sops.templates."mysqld_exporter.conf".path;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
34
hosts/kommode/configuration.nix
Normal file
34
hosts/kommode/configuration.nix
Normal file
@@ -0,0 +1,34 @@
|
||||
{ pkgs, values, fp, ... }:
|
||||
{
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
(fp /base)
|
||||
(fp /misc/metrics-exporters.nix)
|
||||
|
||||
./services/gitea
|
||||
./services/nginx.nix
|
||||
];
|
||||
|
||||
sops.defaultSopsFile = fp /secrets/kommode/kommode.yaml;
|
||||
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
|
||||
sops.age.generateKey = true;
|
||||
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
networking.hostName = "kommode"; # Define your hostname.
|
||||
|
||||
systemd.network.networks."30-ens18" = values.defaultNetworkConfig // {
|
||||
matchConfig.Name = "ens18";
|
||||
address = with values.hosts.kommode; [ (ipv4 + "/25") (ipv6 + "/64") ];
|
||||
};
|
||||
|
||||
services.btrfs.autoScrub.enable = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [];
|
||||
|
||||
system.stateVersion = "24.11";
|
||||
}
|
||||
|
||||
@@ -13,7 +13,20 @@
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
swapDevices = [ ];
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/d421538f-a260-44ae-8e03-47cac369dcc1";
|
||||
fsType = "btrfs";
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/86CD-4C23";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0077" "dmask=0077" ];
|
||||
};
|
||||
|
||||
swapDevices =
|
||||
[ { device = "/dev/disk/by-uuid/4cfbb41e-801f-40dd-8c58-0a0c1a6025f6"; }
|
||||
];
|
||||
|
||||
# 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
|
||||
63
hosts/kommode/services/gitea/customization/default.nix
Normal file
63
hosts/kommode/services/gitea/customization/default.nix
Normal file
@@ -0,0 +1,63 @@
|
||||
{ config, pkgs, lib, fp, ... }:
|
||||
let
|
||||
cfg = config.services.gitea;
|
||||
in
|
||||
{
|
||||
services.gitea-themes = {
|
||||
monokai = pkgs.gitea-theme-monokai;
|
||||
earl-grey = pkgs.gitea-theme-earl-grey;
|
||||
pitch-black = pkgs.gitea-theme-pitch-black;
|
||||
catppuccin = pkgs.gitea-theme-catppuccin;
|
||||
};
|
||||
|
||||
systemd.services.gitea-customization = lib.mkIf cfg.enable {
|
||||
description = "Install extra customization in gitea's CUSTOM_DIR";
|
||||
wantedBy = [ "gitea.service" ];
|
||||
requiredBy = [ "gitea.service" ];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
};
|
||||
|
||||
script = let
|
||||
logo-svg = fp /assets/logo_blue_regular.svg;
|
||||
logo-png = fp /assets/logo_blue_regular.png;
|
||||
|
||||
extraLinks = pkgs.writeText "gitea-extra-links.tmpl" ''
|
||||
<a class="item" href="https://git.pvv.ntnu.no/Drift/-/projects/4">Tokyo Drift Issues</a>
|
||||
'';
|
||||
|
||||
extraLinksFooter = pkgs.writeText "gitea-extra-links-footer.tmpl" ''
|
||||
<a class="item" href="https://www.pvv.ntnu.no/">PVV</a>
|
||||
<a class="item" href="https://wiki.pvv.ntnu.no/">Wiki</a>
|
||||
<a class="item" href="https://wiki.pvv.ntnu.no/wiki/Tjenester/Kodelager">PVV Gitea Howto</a>
|
||||
'';
|
||||
|
||||
project-labels = (pkgs.formats.yaml { }).generate "gitea-project-labels.yaml" {
|
||||
labels = lib.importJSON ./labels/projects.json;
|
||||
};
|
||||
|
||||
customTemplates = pkgs.runCommandLocal "gitea-templates" {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
coreutils
|
||||
gnused
|
||||
];
|
||||
} ''
|
||||
# Bigger icons
|
||||
install -Dm444 "${cfg.package.src}/templates/repo/icon.tmpl" "$out/repo/icon.tmpl"
|
||||
sed -i -e 's/24/60/g' "$out/repo/icon.tmpl"
|
||||
'';
|
||||
in ''
|
||||
install -Dm444 ${logo-svg} ${cfg.customDir}/public/assets/img/logo.svg
|
||||
install -Dm444 ${logo-png} ${cfg.customDir}/public/assets/img/logo.png
|
||||
install -Dm444 ${./loading.apng} ${cfg.customDir}/public/assets/img/loading.png
|
||||
install -Dm444 ${extraLinks} ${cfg.customDir}/templates/custom/extra_links.tmpl
|
||||
install -Dm444 ${extraLinksFooter} ${cfg.customDir}/templates/custom/extra_links_footer.tmpl
|
||||
install -Dm444 ${project-labels} ${cfg.customDir}/options/label/project-labels.yaml
|
||||
|
||||
"${lib.getExe pkgs.rsync}" -a "${customTemplates}/" ${cfg.customDir}/templates/
|
||||
'';
|
||||
};
|
||||
}
|
||||
116
hosts/kommode/services/gitea/customization/labels/projects.json
Normal file
116
hosts/kommode/services/gitea/customization/labels/projects.json
Normal file
@@ -0,0 +1,116 @@
|
||||
[
|
||||
{
|
||||
"name": "art",
|
||||
"exclusive": false,
|
||||
"color": "#006b75",
|
||||
"description": "Requires some creativity"
|
||||
},
|
||||
{
|
||||
"name": "big",
|
||||
"exclusive": false,
|
||||
"color": "#754bc4",
|
||||
"description": "This is gonna take a while"
|
||||
},
|
||||
{
|
||||
"name": "blocked",
|
||||
"exclusive": false,
|
||||
"color": "#850021",
|
||||
"description": "This issue/PR depends on one or more other issues/PRs"
|
||||
},
|
||||
{
|
||||
"name": "bug",
|
||||
"exclusive": false,
|
||||
"color": "#f05048",
|
||||
"description": "Something brokey"
|
||||
},
|
||||
{
|
||||
"name": "ci-cd",
|
||||
"exclusive": false,
|
||||
"color": "#d1ff78",
|
||||
"description": "Continuous integrals and continuous derivation"
|
||||
},
|
||||
{
|
||||
"name": "crash report",
|
||||
"exclusive": false,
|
||||
"color": "#ed1111",
|
||||
"description": "Report an oopsie"
|
||||
},
|
||||
{
|
||||
"name": "disputed",
|
||||
"exclusive": false,
|
||||
"color": "#5319e7",
|
||||
"description": "Kranglefanter"
|
||||
},
|
||||
{
|
||||
"name": "documentation",
|
||||
"exclusive": false,
|
||||
"color": "#fbca04",
|
||||
"description": "Documentation changes required"
|
||||
},
|
||||
{
|
||||
"name": "duplicate",
|
||||
"exclusive": false,
|
||||
"color": "#cccccc",
|
||||
"description": "This issue or pull request already exists"
|
||||
},
|
||||
{
|
||||
"name": "feature request",
|
||||
"exclusive": false,
|
||||
"color": "#0052cc",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "good first issue",
|
||||
"exclusive": false,
|
||||
"color": "#009800",
|
||||
"description": "Get your hands dirty with a new project here"
|
||||
},
|
||||
{
|
||||
"name": "me gusta",
|
||||
"exclusive": false,
|
||||
"color": "#30ff36",
|
||||
"description": "( ͡° ͜ʖ ͡°)"
|
||||
},
|
||||
{
|
||||
"name": "packaging",
|
||||
"exclusive": false,
|
||||
"color": "#bf642b",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "question",
|
||||
"exclusive": false,
|
||||
"color": "#cc317c",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "security",
|
||||
"exclusive": false,
|
||||
"color": "#ed1111",
|
||||
"description": "Skommel"
|
||||
},
|
||||
{
|
||||
"name": "techdebt spring cleaning",
|
||||
"exclusive": false,
|
||||
"color": "#8c6217",
|
||||
"description": "The code is smelly 👃"
|
||||
},
|
||||
{
|
||||
"name": "testing",
|
||||
"exclusive": false,
|
||||
"color": "#52b373",
|
||||
"description": "Poke it and see if it explodes"
|
||||
},
|
||||
{
|
||||
"name": "ui/ux",
|
||||
"exclusive": false,
|
||||
"color": "#f28852",
|
||||
"description": "User complaints about ergonomics and economics and whatever"
|
||||
},
|
||||
{
|
||||
"name": "wontfix",
|
||||
"exclusive": false,
|
||||
"color": "#ffffff",
|
||||
"description": "Nei, vil ikke"
|
||||
}
|
||||
]
|
||||
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
@@ -1,30 +1,35 @@
|
||||
{ config, values, pkgs, lib, ... }:
|
||||
{ config, values, lib, pkgs, unstablePkgs, ... }:
|
||||
let
|
||||
cfg = config.services.gitea;
|
||||
domain = "git.pvv.ntnu.no";
|
||||
sshPort = 2222;
|
||||
in {
|
||||
imports = [
|
||||
./ci.nix
|
||||
./customization
|
||||
./gpg.nix
|
||||
./import-users
|
||||
./web-secret-provider
|
||||
];
|
||||
|
||||
sops.secrets = {
|
||||
"gitea/database" = {
|
||||
owner = "gitea";
|
||||
group = "gitea";
|
||||
};
|
||||
"gitea/email-password" = {
|
||||
sops.secrets = let
|
||||
defaultConfig = {
|
||||
owner = "gitea";
|
||||
group = "gitea";
|
||||
};
|
||||
in {
|
||||
"gitea/database" = defaultConfig;
|
||||
"gitea/email-password" = defaultConfig;
|
||||
"gitea/lfs-jwt-secret" = defaultConfig;
|
||||
"gitea/oauth2-jwt-secret" = defaultConfig;
|
||||
"gitea/secret-key" = defaultConfig;
|
||||
};
|
||||
|
||||
services.gitea = {
|
||||
enable = true;
|
||||
appName = "PVV Git";
|
||||
|
||||
package = unstablePkgs.gitea;
|
||||
|
||||
database = {
|
||||
type = "postgres";
|
||||
host = "postgres.pvv.ntnu.no";
|
||||
@@ -42,9 +47,19 @@ in {
|
||||
ROOT_URL = "https://${domain}/";
|
||||
PROTOCOL = "http+unix";
|
||||
SSH_PORT = sshPort;
|
||||
LANDING_PAGE = "explore";
|
||||
START_SSH_SERVER = true;
|
||||
START_LFS_SERVER = true;
|
||||
LANDING_PAGE = "explore";
|
||||
LFS_JWT_SECRET = lib.mkForce "";
|
||||
LFS_JWT_SECRET_URI = "file:${config.sops.secrets."gitea/lfs-jwt-secret".path}";
|
||||
};
|
||||
oauth2 = {
|
||||
JWT_SECRET = lib.mkForce "";
|
||||
JWT_SECRET_URI = "file:${config.sops.secrets."gitea/oauth2-jwt-secret".path}";
|
||||
};
|
||||
"git.timeout" = {
|
||||
MIGRATE = 3600;
|
||||
MIRROR = 1800;
|
||||
};
|
||||
mailer = {
|
||||
ENABLED = true;
|
||||
@@ -68,6 +83,10 @@ in {
|
||||
};
|
||||
admin.DEFAULT_EMAIL_NOTIFICATIONS = "onmention";
|
||||
session.COOKIE_SECURE = true;
|
||||
security = {
|
||||
SECRET_KEY = lib.mkForce "";
|
||||
SECRET_KEY_URI = "file:${config.sops.secrets."gitea/secret-key".path}";
|
||||
};
|
||||
database.LOG_SQL = false;
|
||||
repository = {
|
||||
PREFERRED_LICENSES = lib.concatStringsSep "," [
|
||||
@@ -102,6 +121,10 @@ in {
|
||||
picture = {
|
||||
DISABLE_GRAVATAR = true;
|
||||
ENABLE_FEDERATED_AVATAR = false;
|
||||
|
||||
AVATAR_MAX_FILE_SIZE = 1024 * 1024 * 5;
|
||||
# NOTE: go any bigger than this, and gitea will freeze your gif >:(
|
||||
AVATAR_MAX_ORIGIN_SIZE = 1024 * 1024 * 2;
|
||||
};
|
||||
actions.ENABLED = true;
|
||||
ui = {
|
||||
@@ -130,10 +153,23 @@ in {
|
||||
};
|
||||
"ui.meta".DESCRIPTION = "Bokstavelig talt programvareverkstedet";
|
||||
};
|
||||
|
||||
dump = {
|
||||
enable = true;
|
||||
interval = "weekly";
|
||||
type = "tar.gz";
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
systemd.services.gitea.serviceConfig.CPUSchedulingPolicy = "batch";
|
||||
|
||||
systemd.services.gitea.serviceConfig.CacheDirectory = "gitea/repo-archive";
|
||||
systemd.services.gitea.serviceConfig.BindPaths = [
|
||||
"%C/gitea/repo-archive:${cfg.stateDir}/data/repo-archive"
|
||||
];
|
||||
|
||||
services.nginx.virtualHosts."${domain}" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
@@ -149,6 +185,7 @@ in {
|
||||
proxyPass = "http://unix:${cfg.settings.server.HTTP_ADDR}";
|
||||
extraConfig = ''
|
||||
allow ${values.hosts.ildkule.ipv4}/32;
|
||||
allow ${values.hosts.ildkule.ipv6}/128;
|
||||
deny all;
|
||||
'';
|
||||
};
|
||||
@@ -157,34 +194,30 @@ in {
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ sshPort ];
|
||||
|
||||
# Extra customization
|
||||
systemd.services.gitea-dump = {
|
||||
serviceConfig.ExecStart = let
|
||||
args = lib.cli.toGNUCommandLineShell { } {
|
||||
type = cfg.dump.type;
|
||||
|
||||
services.gitea-themes.monokai = pkgs.gitea-theme-monokai;
|
||||
# This should be declarative on nixos, no need to backup.
|
||||
skip-custom-dir = true;
|
||||
|
||||
systemd.services.install-gitea-customization = {
|
||||
description = "Install extra customization in gitea's CUSTOM_DIR";
|
||||
wantedBy = [ "gitea.service" ];
|
||||
requiredBy = [ "gitea.service" ];
|
||||
# This can be regenerated, no need to backup
|
||||
skip-index = true;
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
# Logs are stored in the systemd journal
|
||||
skip-log = true;
|
||||
};
|
||||
in lib.mkForce "${lib.getExe cfg.package} ${args}";
|
||||
|
||||
script = let
|
||||
logo-svg = ../../../../assets/logo_blue_regular.svg;
|
||||
logo-png = ../../../../assets/logo_blue_regular.png;
|
||||
extraLinks = pkgs.writeText "gitea-extra-links.tmpl" ''
|
||||
<a class="item" href="https://www.pvv.ntnu.no/">PVV</a>
|
||||
<a class="item" href="https://wiki.pvv.ntnu.no/">Wiki</a>
|
||||
<a class="item" href="https://git.pvv.ntnu.no/Drift/-/projects/4">Tokyo Drift Issues</a>
|
||||
'';
|
||||
# Only keep n backup files at a time
|
||||
postStop = let
|
||||
cu = prog: "'${lib.getExe' pkgs.coreutils prog}'";
|
||||
backupCount = 3;
|
||||
in ''
|
||||
install -Dm444 ${logo-svg} ${cfg.customDir}/public/assets/img/logo.svg
|
||||
install -Dm444 ${logo-png} ${cfg.customDir}/public/assets/img/logo.png
|
||||
install -Dm444 ${./loading.apng} ${cfg.customDir}/public/assets/img/loading.png
|
||||
install -Dm444 ${extraLinks} ${cfg.customDir}/templates/custom/extra_links.tmpl
|
||||
for file in $(${cu "ls"} -t1 '${cfg.dump.backupDir}' | ${cu "sort"} --reverse | ${cu "tail"} -n+${toString (backupCount + 1)}); do
|
||||
${cu "rm"} "$file"
|
||||
done
|
||||
'';
|
||||
};
|
||||
}
|
||||
38
hosts/kommode/services/gitea/gpg.nix
Normal file
38
hosts/kommode/services/gitea/gpg.nix
Normal file
@@ -0,0 +1,38 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
cfg = config.services.gitea;
|
||||
GNUPGHOME = "${config.users.users.gitea.home}/gnupg";
|
||||
in
|
||||
{
|
||||
sops.secrets."gitea/gpg-signing-key" = {
|
||||
owner = cfg.user;
|
||||
inherit (cfg) group;
|
||||
};
|
||||
|
||||
systemd.services.gitea.environment = { inherit GNUPGHOME; };
|
||||
|
||||
systemd.tmpfiles.settings."20-gitea-gnugpg".${GNUPGHOME}.d = {
|
||||
inherit (cfg) user group;
|
||||
mode = "700";
|
||||
};
|
||||
|
||||
systemd.services.gitea-ensure-gnupg-homedir = {
|
||||
description = "Import gpg key for gitea";
|
||||
environment = { inherit GNUPGHOME; };
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = cfg.user;
|
||||
PrivateNetwork = true;
|
||||
};
|
||||
script = ''
|
||||
${lib.getExe pkgs.gnupg} --import ${config.sops.secrets."gitea/gpg-signing-key".path}
|
||||
'';
|
||||
};
|
||||
|
||||
services.gitea.settings."repository.signing" = {
|
||||
SIGNING_KEY = "0549C43374D2253C";
|
||||
SIGNING_NAME = "PVV Git";
|
||||
SIGNING_EMAIL = "gitea@git.pvv.ntnu.no";
|
||||
INITIAL_COMMIT = "always";
|
||||
};
|
||||
}
|
||||
@@ -11,7 +11,8 @@ in
|
||||
|
||||
systemd.services.gitea-import-users = lib.mkIf cfg.enable {
|
||||
enable = true;
|
||||
preStart=''${pkgs.rsync}/bin/rsync -e "${pkgs.openssh}/bin/ssh -o UserKnownHostsFile=$CREDENTIALS_DIRECTORY/ssh-known-hosts -i $CREDENTIALS_DIRECTORY/sshkey" -a pvv@smtp.pvv.ntnu.no:/etc/passwd /tmp/passwd-import'';
|
||||
preStart=''${pkgs.rsync}/bin/rsync -e "${pkgs.openssh}/bin/ssh -o UserKnownHostsFile=$CREDENTIALS_DIRECTORY/ssh-known-hosts -i $CREDENTIALS_DIRECTORY/sshkey" -a pvv@smtp.pvv.ntnu.no:/etc/passwd /run/gitea-import-users/passwd'';
|
||||
environment.PASSWD_FILE_PATH = "/run/gitea-import-users/passwd";
|
||||
serviceConfig = {
|
||||
ExecStart = pkgs.writers.writePython3 "gitea-import-users" {
|
||||
flakeIgnore = [
|
||||
@@ -25,6 +26,7 @@ in
|
||||
];
|
||||
DynamicUser="yes";
|
||||
EnvironmentFile=config.sops.secrets."gitea/import-user-env".path;
|
||||
RuntimeDirectory = "gitea-import-users";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -17,6 +17,10 @@ GITEA_API_URL = os.getenv('GITEA_API_URL')
|
||||
if GITEA_API_URL is None:
|
||||
GITEA_API_URL = 'https://git.pvv.ntnu.no/api/v1'
|
||||
|
||||
PASSWD_FILE_PATH = os.getenv('PASSWD_FILE_PATH')
|
||||
if PASSWD_FILE_PATH is None:
|
||||
PASSWD_FILE_PATH = '/tmp/passwd-import'
|
||||
|
||||
|
||||
def gitea_list_all_users() -> dict[str, dict[str, any]] | None:
|
||||
r = requests.get(
|
||||
@@ -177,6 +181,7 @@ def ensure_gitea_user_is_part_of_team(
|
||||
# List of teams that all users should be part of by default
|
||||
COMMON_USER_TEAMS = [
|
||||
("Projects", "Members"),
|
||||
("Grzegorz", "Members"),
|
||||
("Kurs", "Members"),
|
||||
]
|
||||
|
||||
@@ -186,7 +191,8 @@ def main():
|
||||
if existing_users is None:
|
||||
exit(1)
|
||||
|
||||
for username, name in passwd_file_parser("/tmp/passwd-import"):
|
||||
print(f"Reading passwd entries from {PASSWD_FILE_PATH}")
|
||||
for username, name in passwd_file_parser(PASSWD_FILE_PATH):
|
||||
print(f"Processing {username}")
|
||||
add_or_patch_gitea_user(username, name, existing_users)
|
||||
for org, team_name in COMMON_USER_TEAMS:
|
||||
@@ -3,6 +3,7 @@ let
|
||||
organizations = [
|
||||
"Drift"
|
||||
"Projects"
|
||||
"Grzegorz"
|
||||
"Kurs"
|
||||
];
|
||||
|
||||
@@ -27,6 +28,7 @@ in
|
||||
users.users."gitea-web" = {
|
||||
group = "gitea-web";
|
||||
isSystemUser = true;
|
||||
shell = pkgs.bash;
|
||||
};
|
||||
|
||||
sops.secrets."gitea/web-secret-provider/token" = {
|
||||
@@ -58,6 +60,7 @@ in
|
||||
key-dir = "/var/lib/gitea-web/keys/%i";
|
||||
authorized-keys-path = "/var/lib/gitea-web/authorized_keys.d/%i";
|
||||
rrsync-script = pkgs.writeShellScript "rrsync-chown" ''
|
||||
mkdir -p "$1"
|
||||
${lib.getExe pkgs.rrsync} -wo "$1"
|
||||
${pkgs.coreutils}/bin/chown -R gitea-web:gitea-web "$1"
|
||||
'';
|
||||
@@ -34,7 +34,21 @@ def get_org_repo_list(args: argparse.Namespace, token: str):
|
||||
f"{args.api_url}/orgs/{args.org}/repos",
|
||||
headers = { 'Authorization': 'token ' + token },
|
||||
)
|
||||
return [repo["name"] for repo in result.json()]
|
||||
|
||||
results = [repo["name"] for repo in result.json()]
|
||||
target = int(result.headers['X-Total-Count'])
|
||||
|
||||
i = 2
|
||||
while len(results) < target:
|
||||
result = requests.get(
|
||||
f"{args.api_url}/orgs/{args.org}/repos",
|
||||
params = { 'page': i },
|
||||
headers = { 'Authorization': 'token ' + token },
|
||||
)
|
||||
results += [repo["name"] for repo in result.json()]
|
||||
i += 1
|
||||
|
||||
return results
|
||||
|
||||
|
||||
def generate_ssh_key(args: argparse.Namespace, repository: str):
|
||||
4
hosts/kommode/services/nginx.nix
Normal file
4
hosts/kommode/services/nginx.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{ ... }:
|
||||
{
|
||||
services.nginx.enable = true;
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
{ config, pkgs, values, ... }:
|
||||
{
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
../../base
|
||||
../../misc/metrics-exporters.nix
|
||||
|
||||
./disks.nix
|
||||
];
|
||||
|
||||
sops.defaultSopsFile = ../../secrets/kvernberg/kvernberg.yaml;
|
||||
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
|
||||
sops.age.generateKey = true;
|
||||
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
networking.hostName = "kvernberg"; # Define your hostname.
|
||||
|
||||
systemd.network.networks."30-all" = values.defaultNetworkConfig // {
|
||||
matchConfig.Name = "en*";
|
||||
address = with values.hosts.kvernberg; [ (ipv4 + "/25") (ipv6 + "/64") ];
|
||||
};
|
||||
|
||||
# List packages installed in system profile
|
||||
environment.systemPackages = with pkgs; [
|
||||
|
||||
];
|
||||
|
||||
# No devices with SMART
|
||||
services.smartd.enable = false;
|
||||
|
||||
# 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 = "24.05"; # Did you read the comment?
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
# Example to create a bios compatible gpt partition
|
||||
{ lib, ... }:
|
||||
{
|
||||
disko.devices = {
|
||||
disk.disk1 = {
|
||||
device = lib.mkDefault "/dev/sda";
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
name = "boot";
|
||||
size = "1M";
|
||||
type = "EF02";
|
||||
};
|
||||
esp = {
|
||||
name = "ESP";
|
||||
size = "500M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
};
|
||||
};
|
||||
root = {
|
||||
name = "root";
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
options,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [ (import ./common.nix "bank") ];
|
||||
|
||||
options.services.libeufin.bank = {
|
||||
initialAccounts = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.attrs;
|
||||
description = ''
|
||||
Accounts to enable before the bank service starts.
|
||||
|
||||
This is mainly needed for the nexus currency conversion
|
||||
since the exchange's bank account is expected to be already
|
||||
registered.
|
||||
|
||||
Don't forget to change the account passwords afterwards.
|
||||
'';
|
||||
default = [ ];
|
||||
};
|
||||
|
||||
settings = lib.mkOption {
|
||||
description = ''
|
||||
Configuration options for the libeufin bank system config file.
|
||||
|
||||
For a list of all possible options, please see the man page [`libeufin-bank.conf(5)`](https://docs.taler.net/manpages/libeufin-bank.conf.5.html)
|
||||
'';
|
||||
type = lib.types.submodule {
|
||||
inherit (options.services.libeufin.settings.type.nestedTypes) freeformType;
|
||||
options = {
|
||||
libeufin-bank = {
|
||||
CURRENCY = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
The currency under which the libeufin-bank should operate.
|
||||
|
||||
This defaults to the GNU taler module's currency for convenience
|
||||
but if you run libeufin-bank separately from taler, you must set
|
||||
this yourself.
|
||||
'';
|
||||
};
|
||||
PORT = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 8082;
|
||||
description = ''
|
||||
The port on which libeufin-bank should listen.
|
||||
'';
|
||||
};
|
||||
SUGGESTED_WITHDRAWAL_EXCHANGE = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "https://exchange.demo.taler.net/";
|
||||
description = ''
|
||||
Exchange that is suggested to wallets when withdrawing.
|
||||
|
||||
Note that, in order for withdrawals to work, your libeufin-bank
|
||||
must be able to communicate with and send money etc. to the bank
|
||||
at which the exchange used for withdrawals has its bank account.
|
||||
|
||||
If you also have your own bank and taler exchange network, you
|
||||
probably want to set one of your exchange's url here instead of
|
||||
the demo exchange.
|
||||
|
||||
This setting must always be set in order for the Android app to
|
||||
not crash during the withdrawal process but the exchange to be
|
||||
used can always be changed in the app.
|
||||
'';
|
||||
};
|
||||
};
|
||||
libeufin-bankdb-postgres = {
|
||||
CONFIG = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
The database connection string for the libeufin-bank database.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
services.libeufin.bank.settings.libeufin-bank.CURRENCY = lib.mkIf (
|
||||
config.services.taler.enable && (config.services.taler.settings.taler ? CURRENCY)
|
||||
) config.services.taler.settings.taler.CURRENCY;
|
||||
|
||||
services.libeufin.bank.settings.libeufin-bankdb-postgres.CONFIG = lib.mkIf config.services.libeufin.bank.createLocalDatabase "postgresql:///libeufin-bank";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
# TODO: create a common module generator for Taler and Libeufin?
|
||||
libeufinComponent:
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
options.services.libeufin.${libeufinComponent} = {
|
||||
enable = lib.mkEnableOption "libeufin core banking system and web interface";
|
||||
package = lib.mkPackageOption pkgs "libeufin" { };
|
||||
debug = lib.mkEnableOption "debug logging";
|
||||
createLocalDatabase = lib.mkEnableOption "automatic creation of a local postgres database";
|
||||
openFirewall = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Whether to open ports in the firewall";
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
cfgMain = config.services.libeufin;
|
||||
cfg = cfgMain.${libeufinComponent};
|
||||
|
||||
serviceName = "libeufin-${libeufinComponent}";
|
||||
|
||||
isNexus = libeufinComponent == "nexus";
|
||||
|
||||
# get database name from config
|
||||
# TODO: should this always be the same db? In which case, should this be an option directly under `services.libeufin`?
|
||||
dbName =
|
||||
lib.removePrefix "postgresql:///"
|
||||
cfg.settings."libeufin-${libeufinComponent}db-postgres".CONFIG;
|
||||
|
||||
bankPort = cfg.settings."${if isNexus then "nexus-httpd" else "libeufin-bank"}".PORT;
|
||||
in
|
||||
lib.mkIf cfg.enable {
|
||||
services.libeufin.settings = cfg.settings;
|
||||
|
||||
# TODO add system-libeufin.slice?
|
||||
systemd.services = {
|
||||
# Main service
|
||||
"${serviceName}" = {
|
||||
serviceConfig = {
|
||||
DynamicUser = true;
|
||||
ExecStart =
|
||||
let
|
||||
args = lib.cli.toGNUCommandLineShell { } {
|
||||
c = cfgMain.configFile;
|
||||
L = if cfg.debug then "debug" else null;
|
||||
};
|
||||
in
|
||||
"${lib.getExe' cfg.package "libeufin-${libeufinComponent}"} serve ${args}";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "10s";
|
||||
};
|
||||
requires = [ "libeufin-dbinit.service" ];
|
||||
after = [ "libeufin-dbinit.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
|
||||
# Database Initialisation
|
||||
libeufin-dbinit =
|
||||
let
|
||||
dbScript = pkgs.writers.writeText "libeufin-db-permissions.sql" ''
|
||||
GRANT SELECT,INSERT,UPDATE,DELETE ON ALL TABLES IN SCHEMA libeufin_bank TO "${serviceName}";
|
||||
GRANT SELECT,INSERT,UPDATE,DELETE ON ALL TABLES IN SCHEMA libeufin_nexus TO "${serviceName}";
|
||||
GRANT USAGE ON SCHEMA libeufin_bank TO "${serviceName}";
|
||||
GRANT USAGE ON SCHEMA libeufin_nexus TO "${serviceName}";
|
||||
'';
|
||||
|
||||
# Accounts to be created after the bank database initialization.
|
||||
#
|
||||
# For example, if the bank's currency conversion is enabled, it's
|
||||
# required that the exchange account is registered before the
|
||||
# service starts.
|
||||
initialAccountRegistration = lib.concatMapStringsSep "\n" (
|
||||
account:
|
||||
let
|
||||
args = lib.cli.toGNUCommandLineShell { } {
|
||||
c = cfgMain.configFile;
|
||||
inherit (account) username password name;
|
||||
payto_uri = "payto://x-taler-bank/bank:${toString bankPort}/${account.username}?receiver-name=${account.name}";
|
||||
exchange = lib.toLower account.username == "exchange";
|
||||
};
|
||||
in
|
||||
"${lib.getExe' cfg.package "libeufin-bank"} create-account ${args}"
|
||||
) cfg.initialAccounts;
|
||||
|
||||
args = lib.cli.toGNUCommandLineShell { } {
|
||||
c = cfgMain.configFile;
|
||||
L = if cfg.debug then "debug" else null;
|
||||
};
|
||||
in
|
||||
{
|
||||
path = [ config.services.postgresql.package ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
DynamicUser = true;
|
||||
StateDirectory = "libeufin-dbinit";
|
||||
StateDirectoryMode = "0750";
|
||||
User = dbName;
|
||||
};
|
||||
script = lib.optionalString cfg.enable ''
|
||||
${lib.getExe' cfg.package "libeufin-${libeufinComponent}"} dbinit ${args}
|
||||
'';
|
||||
# Grant DB permissions after schemas have been created
|
||||
postStart =
|
||||
''
|
||||
psql -U "${dbName}" -f "${dbScript}"
|
||||
''
|
||||
+ lib.optionalString ((!isNexus) && (cfg.initialAccounts != [ ])) ''
|
||||
# only register initial accounts once
|
||||
if [ ! -e /var/lib/libeufin-dbinit/init ]; then
|
||||
${initialAccountRegistration}
|
||||
touch /var/lib/libeufin-dbinit/init
|
||||
echo "Bank initialisation complete"
|
||||
fi
|
||||
'';
|
||||
requires = lib.optionals cfg.createLocalDatabase [ "postgresql.service" ];
|
||||
after = [ "network.target" ] ++ lib.optionals cfg.createLocalDatabase [ "postgresql.service" ];
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall = lib.mkIf cfg.openFirewall {
|
||||
allowedTCPPorts = [
|
||||
bankPort
|
||||
];
|
||||
};
|
||||
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
services.postgresql = lib.mkIf cfg.createLocalDatabase {
|
||||
enable = true;
|
||||
ensureDatabases = [ dbName ];
|
||||
ensureUsers = [
|
||||
{ name = serviceName; }
|
||||
{
|
||||
name = dbName;
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertion =
|
||||
cfg.createLocalDatabase || (cfg.settings."libeufin-${libeufinComponent}db-postgres" ? CONFIG);
|
||||
message = "Libeufin ${libeufinComponent} database is not configured.";
|
||||
}
|
||||
];
|
||||
|
||||
};
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.services.libeufin;
|
||||
settingsFormat = pkgs.formats.ini { };
|
||||
in
|
||||
|
||||
{
|
||||
options.services.libeufin = {
|
||||
configFile = lib.mkOption {
|
||||
internal = true;
|
||||
default = settingsFormat.generate "generated-libeufin.conf" cfg.settings;
|
||||
};
|
||||
settings = lib.mkOption {
|
||||
description = "Global configuration options for the libeufin bank system config file.";
|
||||
type = lib.types.submodule { freeformType = settingsFormat.type; };
|
||||
default = { };
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (cfg.bank.enable || cfg.nexus.enable) {
|
||||
environment.etc."libeufin/libeufin.conf".source = cfg.configFile;
|
||||
};
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
options,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [ (import ./common.nix "nexus") ];
|
||||
|
||||
options.services.libeufin.nexus.settings = lib.mkOption {
|
||||
description = ''
|
||||
Configuration options for the libeufin nexus config file.
|
||||
For a list of all possible options, please see the man page [`libeufin-nexus.conf(5)`](https://docs.taler.net/manpages/libeufin-nexus.conf.5.html)
|
||||
'';
|
||||
type = lib.types.submodule {
|
||||
inherit (options.services.libeufin.settings.type.nestedTypes) freeformType;
|
||||
options = {
|
||||
nexus-ebics = {
|
||||
# Mandatory configuration values
|
||||
# https://docs.taler.net/libeufin/nexus-manual.html#setting-up-the-ebics-subscriber
|
||||
# https://docs.taler.net/libeufin/setup-ebics-at-postfinance.html
|
||||
CURRENCY = lib.mkOption {
|
||||
description = "Name of the fiat currency.";
|
||||
type = lib.types.nonEmptyStr;
|
||||
example = "CHF";
|
||||
};
|
||||
HOST_BASE_URL = lib.mkOption {
|
||||
description = "URL of the EBICS server.";
|
||||
type = lib.types.nonEmptyStr;
|
||||
example = "https://ebics.postfinance.ch/ebics/ebics.aspx";
|
||||
};
|
||||
BANK_DIALECT = lib.mkOption {
|
||||
description = ''
|
||||
Name of the following combination: EBICS version and ISO20022
|
||||
recommendations that Nexus would honor in the communication with the
|
||||
bank.
|
||||
Currently only the "postfinance" or "gls" value is supported.
|
||||
'';
|
||||
type = lib.types.enum [
|
||||
"postfinance"
|
||||
"gls"
|
||||
];
|
||||
example = "postfinance";
|
||||
};
|
||||
HOST_ID = lib.mkOption {
|
||||
description = "Name of the EBICS host.";
|
||||
type = lib.types.nonEmptyStr;
|
||||
example = "PFEBICS";
|
||||
};
|
||||
USER_ID = lib.mkOption {
|
||||
description = ''
|
||||
User ID of the EBICS subscriber.
|
||||
This value must be assigned by the bank after having activated a new EBICS subscriber.
|
||||
'';
|
||||
type = lib.types.nonEmptyStr;
|
||||
example = "PFC00563";
|
||||
};
|
||||
PARTNER_ID = lib.mkOption {
|
||||
description = ''
|
||||
Partner ID of the EBICS subscriber.
|
||||
This value must be assigned by the bank after having activated a new EBICS subscriber.
|
||||
'';
|
||||
type = lib.types.nonEmptyStr;
|
||||
example = "PFC00563";
|
||||
};
|
||||
IBAN = lib.mkOption {
|
||||
description = "IBAN of the bank account that is associated with the EBICS subscriber.";
|
||||
type = lib.types.nonEmptyStr;
|
||||
example = "CH7789144474425692816";
|
||||
};
|
||||
BIC = lib.mkOption {
|
||||
description = "BIC of the bank account that is associated with the EBICS subscriber.";
|
||||
type = lib.types.nonEmptyStr;
|
||||
example = "POFICHBEXXX";
|
||||
};
|
||||
NAME = lib.mkOption {
|
||||
description = "Legal entity that is associated with the EBICS subscriber.";
|
||||
type = lib.types.nonEmptyStr;
|
||||
example = "John Smith S.A.";
|
||||
};
|
||||
BANK_PUBLIC_KEYS_FILE = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "/var/lib/libeufin-nexus/bank-ebics-keys.json";
|
||||
description = ''
|
||||
Filesystem location where Nexus should store the bank public keys.
|
||||
'';
|
||||
};
|
||||
CLIENT_PRIVATE_KEYS_FILE = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "/var/lib/libeufin-nexus/client-ebics-keys.json";
|
||||
description = ''
|
||||
Filesystem location where Nexus should store the subscriber private keys.
|
||||
'';
|
||||
};
|
||||
};
|
||||
nexus-httpd = {
|
||||
PORT = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 8084;
|
||||
description = ''
|
||||
The port on which libeufin-bank should listen.
|
||||
'';
|
||||
};
|
||||
};
|
||||
libeufin-nexusdb-postgres = {
|
||||
CONFIG = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
The database connection string for the libeufin-nexus database.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
cfgMain = config.services.libeufin;
|
||||
cfg = config.services.libeufin.nexus;
|
||||
in
|
||||
lib.mkIf cfg.enable {
|
||||
services.libeufin.nexus.settings.libeufin-nexusdb-postgres.CONFIG = lib.mkIf (
|
||||
cfgMain.bank.enable && cfgMain.bank.createLocalDatabase
|
||||
) "postgresql:///libeufin-bank";
|
||||
};
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
imports = [
|
||||
./libeufin/bank.nix
|
||||
./libeufin/module.nix
|
||||
./libeufin/nexus.nix
|
||||
./taler/exchange.nix
|
||||
./taler/merchant.nix
|
||||
./taler/module.nix
|
||||
];
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
# TODO: create a common module generator for Taler and Libeufin?
|
||||
{
|
||||
talerComponent ? "",
|
||||
servicesDB ? [ ],
|
||||
servicesNoDB ? [ ],
|
||||
...
|
||||
}:
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = cfgTaler.${talerComponent};
|
||||
cfgTaler = config.services.taler;
|
||||
settingsFormat = pkgs.formats.ini { };
|
||||
|
||||
services = servicesDB ++ servicesNoDB;
|
||||
|
||||
dbName = "taler-${talerComponent}-httpd";
|
||||
groupName = "taler-${talerComponent}-services";
|
||||
|
||||
inherit (cfgTaler) runtimeDir;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
services.taler.${talerComponent} = {
|
||||
enable = lib.mkEnableOption "the GNU Taler ${talerComponent}";
|
||||
package = lib.mkPackageOption pkgs "taler-${talerComponent}" { };
|
||||
# TODO: make option accept multiple debugging levels?
|
||||
debug = lib.mkEnableOption "debug logging";
|
||||
openFirewall = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Whether to open ports in the firewall";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.taler.enable = cfg.enable;
|
||||
|
||||
systemd.services = lib.mergeAttrsList [
|
||||
# Main services
|
||||
(lib.genAttrs (map (n: "taler-${talerComponent}-${n}") services) (name: {
|
||||
serviceConfig = {
|
||||
DynamicUser = true;
|
||||
User = name;
|
||||
Group = groupName;
|
||||
ExecStart = toString [
|
||||
(lib.getExe' cfg.package name)
|
||||
"-c /etc/taler/taler.conf"
|
||||
(lib.optionalString cfg.debug " -L debug")
|
||||
];
|
||||
RuntimeDirectory = name;
|
||||
StateDirectory = name;
|
||||
CacheDirectory = name;
|
||||
ReadWritePaths = [ runtimeDir ];
|
||||
Restart = "always";
|
||||
RestartSec = "10s";
|
||||
};
|
||||
requires = [ "taler-${talerComponent}-dbinit.service" ];
|
||||
after = [ "taler-${talerComponent}-dbinit.service" ];
|
||||
wantedBy = [ "multi-user.target" ]; # TODO slice?
|
||||
}))
|
||||
# Database Initialisation
|
||||
{
|
||||
"taler-${talerComponent}-dbinit" = {
|
||||
path = [ config.services.postgresql.package ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
DynamicUser = true;
|
||||
User = dbName;
|
||||
Restart = "on-failure";
|
||||
RestartSec = "5s";
|
||||
};
|
||||
requires = [ "postgresql.service" ];
|
||||
after = [ "postgresql.service" ];
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
users.groups.${groupName} = { };
|
||||
systemd.tmpfiles.settings = {
|
||||
"10-taler-${talerComponent}" = {
|
||||
"${runtimeDir}" = {
|
||||
d = {
|
||||
group = groupName;
|
||||
user = "nobody";
|
||||
mode = "070";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall = lib.mkIf cfg.openFirewall {
|
||||
allowedTCPPorts = [ cfg.settings."${talerComponent}".PORT ];
|
||||
};
|
||||
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
services.taler.includes = [ "/etc/taler/conf.d/${talerComponent}.conf" ];
|
||||
environment.etc."taler/conf.d/${talerComponent}.conf".source = settingsFormat.generate "generated-taler.conf" cfg.settings;
|
||||
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
ensureDatabases = [ dbName ];
|
||||
ensureUsers = map (service: { name = "taler-${talerComponent}-${service}"; }) servicesDB ++ [
|
||||
{
|
||||
name = dbName;
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
options,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = cfgTaler.exchange;
|
||||
cfgTaler = config.services.taler;
|
||||
|
||||
talerComponent = "exchange";
|
||||
|
||||
# https://docs.taler.net/taler-exchange-manual.html#services-users-groups-and-file-system-hierarchy
|
||||
servicesDB = [
|
||||
"httpd"
|
||||
"aggregator"
|
||||
"closer"
|
||||
"wirewatch"
|
||||
];
|
||||
|
||||
servicesNoDB = [
|
||||
"secmod-cs"
|
||||
"secmod-eddsa"
|
||||
"secmod-rsa"
|
||||
];
|
||||
in
|
||||
|
||||
{
|
||||
imports = [
|
||||
(import ./common.nix { inherit talerComponent servicesDB servicesNoDB; })
|
||||
];
|
||||
|
||||
options.services.taler.exchange = {
|
||||
settings = lib.mkOption {
|
||||
description = ''
|
||||
Configuration options for the taler exchange config file.
|
||||
For a list of all possible options, please see the man page [`taler.conf(5)`](https://docs.taler.net/manpages/taler.conf.5.html#exchange-options)
|
||||
'';
|
||||
type = lib.types.submodule {
|
||||
inherit (options.services.taler.settings.type.nestedTypes) freeformType;
|
||||
options = {
|
||||
# TODO: do we want this to be a sub-attribute or only define the exchange set of options here
|
||||
exchange = {
|
||||
AML_THRESHOLD = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "${cfgTaler.settings.taler.CURRENCY}:1000000";
|
||||
defaultText = "1000000 in {option}`CURRENCY`";
|
||||
description = "Monthly transaction volume until an account is considered suspicious and flagged for AML review.";
|
||||
};
|
||||
DB = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
internal = true;
|
||||
default = "postgres";
|
||||
};
|
||||
MASTER_PUBLIC_KEY = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = throw ''
|
||||
You must provide `MASTER_PUBLIC_KEY` with the public part of your master key.
|
||||
This will be used by the auditor service to get information about the exchange.
|
||||
For more information, see https://docs.taler.net/taler-auditor-manual.html#initial-configuration
|
||||
To generate this key, you must run `taler-exchange-offline setup`. It will print the public key.
|
||||
'';
|
||||
defaultText = "None, you must set this yourself.";
|
||||
description = "Used by the exchange to verify information signed by the offline system.";
|
||||
};
|
||||
PORT = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 8081;
|
||||
description = "Port on which the HTTP server listens.";
|
||||
};
|
||||
};
|
||||
exchangedb-postgres = {
|
||||
CONFIG = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
internal = true;
|
||||
default = "postgres:///taler-exchange-httpd";
|
||||
description = "Database connection URI.";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
};
|
||||
denominationConfig = lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
defaultText = "None, you must set this yourself.";
|
||||
example = ''
|
||||
[COIN-KUDOS-n1-t1718140083]
|
||||
VALUE = KUDOS:0.1
|
||||
DURATION_WITHDRAW = 7 days
|
||||
DURATION_SPEND = 2 years
|
||||
DURATION_LEGAL = 6 years
|
||||
FEE_WITHDRAW = KUDOS:0
|
||||
FEE_DEPOSIT = KUDOS:0.1
|
||||
FEE_REFRESH = KUDOS:0
|
||||
FEE_REFUND = KUDOS:0
|
||||
RSA_KEYSIZE = 2048
|
||||
CIPHER = RSA
|
||||
'';
|
||||
description = ''
|
||||
This option configures the cash denomination for the coins that the exchange offers.
|
||||
For more information, consult the [upstream docs](https://docs.taler.net/taler-exchange-manual.html#coins-denomination-keys).
|
||||
You can either write these manually or you can use the `taler-harness deployment gen-coin-config`
|
||||
command to generate it.
|
||||
Warning: Do not modify existing denominations after deployment.
|
||||
Please see the upstream docs for how to safely do that.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.taler.includes = [
|
||||
(pkgs.writers.writeText "exchange-denominations.conf" cfg.denominationConfig)
|
||||
];
|
||||
|
||||
systemd.services.taler-exchange-wirewatch = {
|
||||
requires = [ "taler-exchange-httpd.service" ];
|
||||
after = [ "taler-exchange-httpd.service" ];
|
||||
};
|
||||
|
||||
# Taken from https://docs.taler.net/taler-exchange-manual.html#exchange-database-setup
|
||||
# TODO: Why does aggregator need DELETE?
|
||||
systemd.services."taler-${talerComponent}-dbinit".script =
|
||||
let
|
||||
deletePerm = name: lib.optionalString (name == "aggregator") ",DELETE";
|
||||
dbScript = pkgs.writers.writeText "taler-exchange-db-permissions.sql" (
|
||||
lib.pipe servicesDB [
|
||||
(map (name: ''
|
||||
GRANT SELECT,INSERT,UPDATE${deletePerm name} ON ALL TABLES IN SCHEMA exchange TO "taler-exchange-${name}";
|
||||
GRANT USAGE ON SCHEMA exchange TO "taler-exchange-${name}";
|
||||
''))
|
||||
lib.concatStrings
|
||||
]
|
||||
);
|
||||
in
|
||||
''
|
||||
${lib.getExe' cfg.package "taler-exchange-dbinit"}
|
||||
psql -U taler-exchange-httpd -f ${dbScript}
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
options,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = cfgTaler.merchant;
|
||||
cfgTaler = config.services.taler;
|
||||
|
||||
talerComponent = "merchant";
|
||||
|
||||
# https://docs.taler.net/taler-merchant-manual.html#launching-the-backend
|
||||
servicesDB = [
|
||||
"httpd"
|
||||
"webhook"
|
||||
"wirewatch"
|
||||
"depositcheck"
|
||||
"exchange"
|
||||
];
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(import ./common.nix { inherit talerComponent servicesDB; })
|
||||
];
|
||||
|
||||
options.services.taler.merchant = {
|
||||
settings = lib.mkOption {
|
||||
description = ''
|
||||
Configuration options for the taler merchant config file.
|
||||
For a list of all possible options, please see the man page [`taler.conf(5)`](https://docs.taler.net/manpages/taler.conf.5.html#merchant-options)
|
||||
'';
|
||||
type = lib.types.submodule {
|
||||
inherit (options.services.taler.settings.type.nestedTypes) freeformType;
|
||||
options = {
|
||||
# TODO: do we want this to be a sub-attribute or only define the merchant set of options here
|
||||
merchant = {
|
||||
DB = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
internal = true;
|
||||
default = "postgres";
|
||||
description = "Plugin to use for the database.";
|
||||
};
|
||||
PORT = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 8083;
|
||||
description = "Port on which the HTTP server listens.";
|
||||
};
|
||||
SERVE = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "tcp";
|
||||
description = ''
|
||||
Whether the HTTP server should listen on a UNIX domain socket ("unix") or on a TCP socket ("tcp").
|
||||
'';
|
||||
};
|
||||
LEGAL_PRESERVATION = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
internal = true;
|
||||
default = "10 years";
|
||||
description = "How long to keep data in the database for tax audits after the transaction has completed.";
|
||||
};
|
||||
};
|
||||
merchantdb-postgres = {
|
||||
CONFIG = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
internal = true;
|
||||
default = "postgres:///taler-${talerComponent}-httpd";
|
||||
description = "Database connection URI.";
|
||||
};
|
||||
SQL_DIR = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
internal = true;
|
||||
default = "${cfg.package}/share/taler/sql/merchant/";
|
||||
description = "The location for the SQL files to setup the database tables.";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.services.taler-merchant-depositcheck = {
|
||||
# taler-merchant-depositcheck needs its executable is in the PATH
|
||||
# NOTE: couldn't use `lib.getExe` to only get that single executable
|
||||
path = [ cfg.package ];
|
||||
};
|
||||
|
||||
systemd.services."taler-${talerComponent}-dbinit".script =
|
||||
let
|
||||
# NOTE: not documented, but is necessary
|
||||
dbScript = pkgs.writers.writeText "taler-merchant-db-permissions.sql" (
|
||||
lib.concatStrings (
|
||||
map (name: ''
|
||||
GRANT SELECT,INSERT,UPDATE,DELETE ON ALL TABLES IN SCHEMA merchant TO "taler-merchant-${name}";
|
||||
GRANT USAGE ON SCHEMA merchant TO "taler-merchant-${name}";
|
||||
'') servicesDB
|
||||
)
|
||||
);
|
||||
in
|
||||
''
|
||||
${lib.getExe' cfg.package "taler-merchant-dbinit"}
|
||||
psql -U taler-${talerComponent}-httpd -f ${dbScript}
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.services.taler;
|
||||
settingsFormat = pkgs.formats.ini { };
|
||||
in
|
||||
|
||||
{
|
||||
# TODO turn this into a generic taler-like service thingy?
|
||||
options.services.taler = {
|
||||
enable = lib.mkEnableOption "the GNU Taler system" // lib.mkOption { internal = true; };
|
||||
includes = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.path;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Files to include into the config file using Taler's `@inline@` directive.
|
||||
This allows including arbitrary INI files, including imperatively managed ones.
|
||||
'';
|
||||
};
|
||||
settings = lib.mkOption {
|
||||
description = ''
|
||||
Global configuration options for the taler config file.
|
||||
For a list of all possible options, please see the man page [`taler.conf(5)`](https://docs.taler.net/manpages/taler.conf.5.html)
|
||||
'';
|
||||
type = lib.types.submodule {
|
||||
freeformType = settingsFormat.type;
|
||||
options = {
|
||||
taler = {
|
||||
CURRENCY = lib.mkOption {
|
||||
type = lib.types.nonEmptyStr;
|
||||
description = ''
|
||||
The currency which taler services will operate with. This cannot be changed later.
|
||||
'';
|
||||
};
|
||||
CURRENCY_ROUND_UNIT = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "${cfg.settings.taler.CURRENCY}:0.01";
|
||||
defaultText = lib.literalExpression ''
|
||||
"''${config.services.taler.settings.taler.CURRENCY}:0.01"
|
||||
'';
|
||||
description = ''
|
||||
Smallest amount in this currency that can be transferred using the underlying RTGS.
|
||||
You should probably not touch this.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
};
|
||||
runtimeDir = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "/run/taler-system-runtime/";
|
||||
description = ''
|
||||
Runtime directory shared between the taler services.
|
||||
Crypto helpers put their sockets here for instance and the httpd
|
||||
connects to them.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.taler.settings.PATHS = {
|
||||
TALER_DATA_HOME = "\${STATE_DIRECTORY}/";
|
||||
TALER_CACHE_HOME = "\${CACHE_DIRECTORY}/";
|
||||
TALER_RUNTIME_DIR = cfg.runtimeDir;
|
||||
};
|
||||
|
||||
environment.etc."taler/taler.conf".source =
|
||||
let
|
||||
includes = pkgs.writers.writeText "includes.conf" (
|
||||
lib.concatStringsSep "\n" (map (include: "@inline@ ${include}") cfg.includes)
|
||||
);
|
||||
generatedConfig = settingsFormat.generate "generated-taler.conf" cfg.settings;
|
||||
in
|
||||
pkgs.runCommand "taler.conf" { } ''
|
||||
cat ${includes} > $out
|
||||
echo >> $out
|
||||
echo >> $out
|
||||
cat ${generatedConfig} >> $out
|
||||
'';
|
||||
|
||||
};
|
||||
}
|
||||
35
hosts/lupine/configuration.nix
Normal file
35
hosts/lupine/configuration.nix
Normal file
@@ -0,0 +1,35 @@
|
||||
{ fp, values, lupineName, ... }:
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration/${lupineName}.nix
|
||||
|
||||
(fp /base)
|
||||
(fp /misc/metrics-exporters.nix)
|
||||
|
||||
./services/gitea-runner.nix
|
||||
];
|
||||
|
||||
sops.defaultSopsFile = fp /secrets/lupine/lupine.yaml;
|
||||
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
|
||||
sops.age.generateKey = true;
|
||||
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
systemd.network.networks."30-enp0s31f6" = values.defaultNetworkConfig // {
|
||||
matchConfig.Name = "enp0s31f6";
|
||||
address = with values.hosts.${lupineName}; [ (ipv4 + "/25") (ipv6 + "/64") ];
|
||||
networkConfig.LLDP = false;
|
||||
};
|
||||
systemd.network.wait-online = {
|
||||
anyInterface = true;
|
||||
};
|
||||
|
||||
# There are no smart devices
|
||||
services.smartd.enable = false;
|
||||
|
||||
# Do not change, even during upgrades.
|
||||
# See https://search.nixos.org/options?show=system.stateVersion
|
||||
system.stateVersion = "25.05";
|
||||
}
|
||||
40
hosts/lupine/hardware-configuration/lupine-1.nix
Normal file
40
hosts/lupine/hardware-configuration/lupine-1.nix
Normal file
@@ -0,0 +1,40 @@
|
||||
# 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 =
|
||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/a949e2e8-d973-4925-83e4-bcd815e65af7";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/81D6-38D3";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0077" "dmask=0077" ];
|
||||
};
|
||||
|
||||
swapDevices =
|
||||
[ { device = "/dev/disk/by-uuid/82c2d7fa-7cd0-4398-8cf6-c892bc56264b"; }
|
||||
];
|
||||
|
||||
# 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.enp0s31f6.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
40
hosts/lupine/hardware-configuration/lupine-2.nix
Normal file
40
hosts/lupine/hardware-configuration/lupine-2.nix
Normal file
@@ -0,0 +1,40 @@
|
||||
# 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 =
|
||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/aa81d439-800b-403d-ac10-9d2aac3619d0";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/4A34-6AE5";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0077" "dmask=0077" ];
|
||||
};
|
||||
|
||||
swapDevices =
|
||||
[ { device = "/dev/disk/by-uuid/efb7cd0c-c1ae-4a86-8bc2-8e7fd0066650"; }
|
||||
];
|
||||
|
||||
# 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.enp0s31f6.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
40
hosts/lupine/hardware-configuration/lupine-3.nix
Normal file
40
hosts/lupine/hardware-configuration/lupine-3.nix
Normal file
@@ -0,0 +1,40 @@
|
||||
# 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 =
|
||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/39ba059b-3205-4701-a832-e72c0122cb88";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/63FA-297B";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0077" "dmask=0077" ];
|
||||
};
|
||||
|
||||
swapDevices =
|
||||
[ { device = "/dev/disk/by-uuid/9c72eb54-ea8c-4b09-808a-8be9b9a33869"; }
|
||||
];
|
||||
|
||||
# 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.enp0s31f6.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
@@ -5,20 +5,30 @@
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/profiles/qemu-guest.nix")
|
||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_blk" ];
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/c7bbb293-a0a3-4995-8892-0ec63e8c67dd";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
swapDevices =
|
||||
[ { device = "/dev/disk/by-uuid/a86ffda8-8ecb-42a1-bf9f-926072e90ca5"; }
|
||||
];
|
||||
|
||||
# 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;
|
||||
# networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
40
hosts/lupine/hardware-configuration/lupine-5.nix
Normal file
40
hosts/lupine/hardware-configuration/lupine-5.nix
Normal file
@@ -0,0 +1,40 @@
|
||||
# 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 =
|
||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/5f8418ad-8ec1-4f9e-939e-f3a4c36ef343";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/F372-37DF";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0077" "dmask=0077" ];
|
||||
};
|
||||
|
||||
swapDevices =
|
||||
[ { device = "/dev/disk/by-uuid/27bf292d-bbb3-48c4-a86e-456e0f1f648f"; }
|
||||
];
|
||||
|
||||
# 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.enp0s31f6.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
71
hosts/lupine/services/gitea-runner.nix
Normal file
71
hosts/lupine/services/gitea-runner.nix
Normal file
@@ -0,0 +1,71 @@
|
||||
{ config, lupineName, ... }:
|
||||
{
|
||||
# This is unfortunately state, and has to be generated one at a time :(
|
||||
# To do that, comment out all except one of the runners, fill in its token
|
||||
# inside the sops file, rebuild the system, and only after this runner has
|
||||
# successfully registered will gitea give you the next token.
|
||||
# - oysteikt Sep 2023
|
||||
sops = {
|
||||
secrets."gitea/runners/token" = {
|
||||
key = "gitea/runners/${lupineName}";
|
||||
};
|
||||
|
||||
templates."gitea-runner-envfile" = {
|
||||
restartUnits = [
|
||||
"gitea-runner-${lupineName}.service"
|
||||
];
|
||||
content = ''
|
||||
TOKEN="${config.sops.placeholder."gitea/runners/token"}"
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
services.gitea-actions-runner.instances = {
|
||||
${lupineName} = {
|
||||
enable = true;
|
||||
name = "git-runner-${lupineName}";
|
||||
url = "https://git.pvv.ntnu.no";
|
||||
# NOTE: gitea actions runners need node inside their docker images,
|
||||
# so we are a bit limited here.
|
||||
labels = [
|
||||
"debian-latest:docker://node:current-trixie"
|
||||
"debian-trixie:docker://node:current-trixie"
|
||||
"debian-bookworm:docker://node:current-bookworm"
|
||||
"debian-bullseye:docker://node:current-bullseye"
|
||||
|
||||
"debian-latest-slim:docker://node:current-trixie-slim"
|
||||
"debian-trixie-slim:docker://node:current-trixie-slim"
|
||||
"debian-bookworm-slim:docker://node:current-bookworm-slim"
|
||||
"debian-bullseye-slim:docker://node:current-bullseye-slim"
|
||||
|
||||
"alpine-latest:docker://node:current-alpine"
|
||||
"alpine-3.22:docker://node:current-alpine3.22"
|
||||
"alpine-3.21:docker://node:current-alpine3.21"
|
||||
|
||||
# See https://gitea.com/gitea/runner-images
|
||||
"ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest"
|
||||
"ubuntu-24.04:docker://docker.gitea.com/runner-images:ubuntu-24.04"
|
||||
"ubuntu-noble:docker://docker.gitea.com/runner-images:ubuntu-24.04"
|
||||
"ubuntu-22.04:docker://docker.gitea.com/runner-images:ubuntu-22.04"
|
||||
"ubuntu-jammy:docker://docker.gitea.com/runner-images:ubuntu-22.04"
|
||||
|
||||
"ubuntu-latest-slim:docker://docker.gitea.com/runner-images:ubuntu-latest-slim"
|
||||
"ubuntu-24.04-slim:docker://docker.gitea.com/runner-images:ubuntu-24.04-slim"
|
||||
"ubuntu-noble-slim:docker://docker.gitea.com/runner-images:ubuntu-24.04-slim"
|
||||
"ubuntu-22.04-slim:docker://docker.gitea.com/runner-images:ubuntu-22.04-slim"
|
||||
"ubuntu-jammy-slim:docker://docker.gitea.com/runner-images:ubuntu-22.04-slim"
|
||||
];
|
||||
tokenFile = config.sops.templates."gitea-runner-envfile".path;
|
||||
};
|
||||
};
|
||||
|
||||
virtualisation.podman = {
|
||||
enable = true;
|
||||
defaultNetwork.settings.dns_enabled = true;
|
||||
autoPrune.enable = true;
|
||||
};
|
||||
|
||||
networking.dhcpcd.IPv6rs = false;
|
||||
|
||||
networking.firewall.interfaces."podman+".allowedUDPPorts = [53 5353];
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
{ config, pkgs, values, ... }:
|
||||
{ config, fp, pkgs, values, ... }:
|
||||
{
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
../../base
|
||||
../../misc/metrics-exporters.nix
|
||||
(fp /base)
|
||||
(fp /misc/metrics-exporters.nix)
|
||||
];
|
||||
|
||||
sops.defaultSopsFile = ../../secrets/shark/shark.yaml;
|
||||
sops.defaultSopsFile = fp /secrets/shark/shark.yaml;
|
||||
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
|
||||
sops.age.generateKey = true;
|
||||
|
||||
44
hosts/ustetind/configuration.nix
Normal file
44
hosts/ustetind/configuration.nix
Normal file
@@ -0,0 +1,44 @@
|
||||
{ config, fp, pkgs, lib, values, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
(fp /base)
|
||||
(fp /misc/metrics-exporters.nix)
|
||||
|
||||
./services/gitea-runners.nix
|
||||
];
|
||||
|
||||
sops.defaultSopsFile = fp /secrets/ustetind/ustetind.yaml;
|
||||
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
|
||||
sops.age.generateKey = true;
|
||||
|
||||
networking.hostName = "ustetind";
|
||||
|
||||
networking.useHostResolvConf = lib.mkForce false;
|
||||
|
||||
systemd.network.networks = {
|
||||
"30-lxc-eth" = values.defaultNetworkConfig // {
|
||||
matchConfig = {
|
||||
Type = "ether";
|
||||
Kind = "veth";
|
||||
Name = [
|
||||
"eth*"
|
||||
];
|
||||
};
|
||||
address = with values.hosts.ustetind; [ (ipv4 + "/25") (ipv6 + "/64") ];
|
||||
};
|
||||
"40-podman-veth" = values.defaultNetworkConfig // {
|
||||
matchConfig = {
|
||||
Type = "ether";
|
||||
Kind = "veth";
|
||||
Name = [
|
||||
"veth*"
|
||||
];
|
||||
};
|
||||
DHCP = "yes";
|
||||
};
|
||||
};
|
||||
|
||||
system.stateVersion = "24.11";
|
||||
}
|
||||
@@ -15,8 +15,8 @@ let
|
||||
enable = true;
|
||||
name = "git-runner-${name}"; url = "https://git.pvv.ntnu.no";
|
||||
labels = [
|
||||
"debian-latest:docker://node:18-bullseye"
|
||||
"ubuntu-latest:docker://node:18-bullseye"
|
||||
"debian-latest:docker://node:current-bookworm"
|
||||
"ubuntu-latest:docker://node:current-bookworm"
|
||||
];
|
||||
tokenFile = config.sops.secrets."gitea/runners/${name}".path;
|
||||
};
|
||||
@@ -27,5 +27,15 @@ lib.mkMerge [
|
||||
(mkRunner "alpha")
|
||||
(mkRunner "beta")
|
||||
(mkRunner "epsilon")
|
||||
{ virtualisation.podman.enable = true; }
|
||||
{
|
||||
virtualisation.podman = {
|
||||
enable = true;
|
||||
defaultNetwork.settings.dns_enabled = true;
|
||||
autoPrune.enable = true;
|
||||
};
|
||||
|
||||
networking.dhcpcd.IPv6rs = false;
|
||||
|
||||
networking.firewall.interfaces."podman+".allowedUDPPorts = [53 5353];
|
||||
}
|
||||
]
|
||||
39
hosts/wenche/configuration.nix
Normal file
39
hosts/wenche/configuration.nix
Normal file
@@ -0,0 +1,39 @@
|
||||
{ config, fp, pkgs, values, lib, ... }:
|
||||
{
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
(fp /base)
|
||||
(fp /misc/metrics-exporters.nix)
|
||||
|
||||
(fp /misc/builder.nix)
|
||||
];
|
||||
|
||||
sops.defaultSopsFile = fp /secrets/wenche/wenche.yaml;
|
||||
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
|
||||
sops.age.generateKey = true;
|
||||
|
||||
boot.loader.grub.device = "/dev/sda";
|
||||
|
||||
networking.hostName = "wenche"; # Define your hostname.
|
||||
|
||||
systemd.network.networks."30-ens18" = values.defaultNetworkConfig // {
|
||||
matchConfig.Name = "ens18";
|
||||
address = with values.hosts.wenche; [ (ipv4 + "/25") (ipv6 + "/64") ];
|
||||
};
|
||||
|
||||
hardware.graphics.enable = true;
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
hardware.nvidia = {
|
||||
modesetting.enable = true;
|
||||
open = false;
|
||||
package = config.boot.kernelPackages.nvidiaPackages.production;
|
||||
};
|
||||
|
||||
# List packages installed in system profile
|
||||
environment.systemPackages = with pkgs; [
|
||||
];
|
||||
|
||||
system.stateVersion = "24.11"; # Did you read the comment?
|
||||
}
|
||||
27
hosts/wenche/hardware-configuration.nix
Normal file
27
hosts/wenche/hardware-configuration.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/profiles/qemu-guest.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "nvidia" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/4e8ecdd2-d453-4fff-b952-f06da00f3b85";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
swapDevices = [ {
|
||||
device = "/var/lib/swapfile";
|
||||
size = 16*1024;
|
||||
} ];
|
||||
|
||||
networking.useDHCP = lib.mkDefault false;
|
||||
# networking.interfaces.ens18.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user