mirror of
https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git
synced 2026-02-20 17:07:51 +01:00
Compare commits
10 Commits
f85907ffc8
...
loginpage
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
407e95d696 | ||
|
|
689d6582ae | ||
|
|
ccdaeaf4a3 | ||
|
|
72fdca4998 | ||
|
|
9ccdeb6ac9 | ||
|
|
8072121b3c | ||
|
|
95f6463171 | ||
|
|
39d3773a10 | ||
|
|
0e963f8cf0 | ||
|
|
ba6c1c8205 |
@@ -556,6 +556,7 @@ $config = [
|
|||||||
'module.enable' => [
|
'module.enable' => [
|
||||||
'admin' => true,
|
'admin' => true,
|
||||||
'authpwauth' => true,
|
'authpwauth' => true,
|
||||||
|
'themepvv' => true,
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
@@ -858,7 +859,7 @@ $config = [
|
|||||||
/*
|
/*
|
||||||
* Which theme directory should be used?
|
* Which theme directory should be used?
|
||||||
*/
|
*/
|
||||||
'theme.use' => 'default',
|
'theme.use' => 'themepvv:pvv',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set this option to the text you would like to appear at the header of each page. Set to false if you don't want
|
* Set this option to the text you would like to appear at the header of each page. Set to false if you don't want
|
||||||
|
|||||||
@@ -1,8 +1,24 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
|
themePvv = pkgs.fetchFromGitea {
|
||||||
|
domain = "git.pvv.ntnu.no";
|
||||||
|
owner = "Drift";
|
||||||
|
repo = "ssp-theme";
|
||||||
|
rev = "bda4314030be5f81aeaf2fb1927aee582f1194d9";
|
||||||
|
hash = "sha256-naNRyPL6PAsZKW2w1Vt9wrHT9inCL/yAFnvpy4glv+c=";
|
||||||
|
};
|
||||||
|
|
||||||
pwAuthScript = pkgs.writeShellApplication {
|
pwAuthScript = pkgs.writeShellApplication {
|
||||||
name = "pwauth";
|
name = "pwauth";
|
||||||
runtimeInputs = with pkgs; [ coreutils heimdal ];
|
runtimeInputs = with pkgs; [
|
||||||
|
coreutils
|
||||||
|
heimdal
|
||||||
|
];
|
||||||
text = ''
|
text = ''
|
||||||
read -r user1
|
read -r user1
|
||||||
user2="$(echo -n "$user1" | tr -c -d '0123456789abcdefghijklmnopqrstuvwxyz')"
|
user2="$(echo -n "$user1" | tr -c -d '0123456789abcdefghijklmnopqrstuvwxyz')"
|
||||||
@@ -33,7 +49,7 @@ let
|
|||||||
|
|
||||||
"metadata/saml20-sp-remote.php" = pkgs.writeText "saml20-sp-remote.php" ''
|
"metadata/saml20-sp-remote.php" = pkgs.writeText "saml20-sp-remote.php" ''
|
||||||
<?php
|
<?php
|
||||||
${ lib.pipe config.services.idp.sp-remote-metadata [
|
${lib.pipe config.services.idp.sp-remote-metadata [
|
||||||
(map (url: ''
|
(map (url: ''
|
||||||
$metadata['${url}'] = [
|
$metadata['${url}'] = [
|
||||||
'SingleLogoutService' => [
|
'SingleLogoutService' => [
|
||||||
@@ -85,18 +101,27 @@ let
|
|||||||
|
|
||||||
substituteInPlace "$out" \
|
substituteInPlace "$out" \
|
||||||
--replace-warn '$SAML_COOKIE_SECURE' 'true' \
|
--replace-warn '$SAML_COOKIE_SECURE' 'true' \
|
||||||
--replace-warn '$SAML_COOKIE_SALT' 'file_get_contents("${config.sops.secrets."idp/cookie_salt".path}")' \
|
--replace-warn '$SAML_COOKIE_SALT' 'file_get_contents("${
|
||||||
|
config.sops.secrets."idp/cookie_salt".path
|
||||||
|
}")' \
|
||||||
--replace-warn '$SAML_ADMIN_NAME' '"Drift"' \
|
--replace-warn '$SAML_ADMIN_NAME' '"Drift"' \
|
||||||
--replace-warn '$SAML_ADMIN_EMAIL' '"drift@pvv.ntnu.no"' \
|
--replace-warn '$SAML_ADMIN_EMAIL' '"drift@pvv.ntnu.no"' \
|
||||||
--replace-warn '$SAML_ADMIN_PASSWORD' 'file_get_contents("${config.sops.secrets."idp/admin_password".path}")' \
|
--replace-warn '$SAML_ADMIN_PASSWORD' 'file_get_contents("${
|
||||||
|
config.sops.secrets."idp/admin_password".path
|
||||||
|
}")' \
|
||||||
--replace-warn '$SAML_TRUSTED_DOMAINS' 'array( "idp.pvv.ntnu.no" )' \
|
--replace-warn '$SAML_TRUSTED_DOMAINS' 'array( "idp.pvv.ntnu.no" )' \
|
||||||
--replace-warn '$SAML_DATABASE_DSN' '"pgsql:host=postgres.pvv.ntnu.no;port=5432;dbname=idp"' \
|
--replace-warn '$SAML_DATABASE_DSN' '"pgsql:host=postgres.pvv.ntnu.no;port=5432;dbname=idp"' \
|
||||||
--replace-warn '$SAML_DATABASE_USERNAME' '"idp"' \
|
--replace-warn '$SAML_DATABASE_USERNAME' '"idp"' \
|
||||||
--replace-warn '$SAML_DATABASE_PASSWORD' 'file_get_contents("${config.sops.secrets."idp/postgres_password".path}")' \
|
--replace-warn '$SAML_DATABASE_PASSWORD' 'file_get_contents("${
|
||||||
|
config.sops.secrets."idp/postgres_password".path
|
||||||
|
}")' \
|
||||||
--replace-warn '$CACHE_DIRECTORY' '/var/cache/idp'
|
--replace-warn '$CACHE_DIRECTORY' '/var/cache/idp'
|
||||||
'';
|
'';
|
||||||
|
|
||||||
"modules/authpwauth/src/Auth/Source/PwAuth.php" = ./authpwauth.php;
|
"modules/authpwauth/src/Auth/Source/PwAuth.php" = ./authpwauth.php;
|
||||||
|
|
||||||
|
# PVV theme module (themepvv).
|
||||||
|
"modules/themepvv" = themePvv;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
@@ -158,10 +183,12 @@ in
|
|||||||
services.phpfpm.pools.idp = {
|
services.phpfpm.pools.idp = {
|
||||||
user = "idp";
|
user = "idp";
|
||||||
group = "idp";
|
group = "idp";
|
||||||
settings = let
|
settings =
|
||||||
|
let
|
||||||
listenUser = config.services.nginx.user;
|
listenUser = config.services.nginx.user;
|
||||||
listenGroup = config.services.nginx.group;
|
listenGroup = config.services.nginx.group;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
"pm" = "dynamic";
|
"pm" = "dynamic";
|
||||||
"pm.max_children" = 32;
|
"pm.max_children" = 32;
|
||||||
"pm.max_requests" = 500;
|
"pm.max_requests" = 500;
|
||||||
|
|||||||
@@ -10,8 +10,6 @@
|
|||||||
(fp /base)
|
(fp /base)
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.loader.systemd-boot.enable = false;
|
|
||||||
|
|
||||||
systemd.network.enable = lib.mkForce false;
|
systemd.network.enable = lib.mkForce false;
|
||||||
networking =
|
networking =
|
||||||
let
|
let
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
{ config, pkgs, lib, fp, ... }: {
|
{ config, pkgs, lib, fp, values, ... }: {
|
||||||
imports = [
|
imports = [
|
||||||
# ./hardware-configuration.nix
|
# ./hardware-configuration.nix
|
||||||
|
|
||||||
(fp /base)
|
(fp /base)
|
||||||
];
|
];
|
||||||
|
|
||||||
|
sops.defaultSopsFile = fp /secrets/skrott/skrott.yaml;
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
consoleLogLevel = 0;
|
consoleLogLevel = 0;
|
||||||
enableContainers = false;
|
enableContainers = false;
|
||||||
@@ -36,7 +38,11 @@
|
|||||||
interfaces.eth0 = {
|
interfaces.eth0 = {
|
||||||
useDHCP = false;
|
useDHCP = false;
|
||||||
ipv4.addresses = [{
|
ipv4.addresses = [{
|
||||||
address = "129.241.210.235";
|
address = values.hosts.skrott.ipv4;
|
||||||
|
prefixLength = 25;
|
||||||
|
}];
|
||||||
|
ipv6.addresses = [{
|
||||||
|
address = values.hosts.skrott.ipv6;
|
||||||
prefixLength = 25;
|
prefixLength = 25;
|
||||||
}];
|
}];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
(fp /base)
|
(fp /base)
|
||||||
|
|
||||||
./services/nfs-mounts.nix
|
./services/nfs-mounts.nix
|
||||||
|
./services/userweb.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.network.networks."30-ens18" = values.defaultNetworkConfig // {
|
systemd.network.networks."30-ens18" = values.defaultNetworkConfig // {
|
||||||
@@ -13,6 +14,8 @@
|
|||||||
address = with values.hosts.temmie; [ (ipv4 + "/25") (ipv6 + "/64") ];
|
address = with values.hosts.temmie; [ (ipv4 + "/25") (ipv6 + "/64") ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.nginx.enable = false;
|
||||||
|
|
||||||
services.qemuGuest.enable = true;
|
services.qemuGuest.enable = true;
|
||||||
|
|
||||||
# Don't change (even during upgrades) unless you know what you are doing.
|
# Don't change (even during upgrades) unless you know what you are doing.
|
||||||
|
|||||||
@@ -1,14 +1,19 @@
|
|||||||
{ lib, ... }:
|
{ lib, values, ... }:
|
||||||
let
|
let
|
||||||
# See microbel:/etc/exports
|
# See microbel:/etc/exports
|
||||||
letters = [ "a" "b" "c" "d" "h" "i" "j" "k" "l" "m" "z" ];
|
letters = [ "a" "b" "c" "d" "h" "i" "j" "k" "l" "m" "z" ];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
systemd.targets."pvv-homedirs" = {
|
||||||
|
description = "PVV Homedir Partitions";
|
||||||
|
};
|
||||||
|
|
||||||
systemd.mounts = map (l: {
|
systemd.mounts = map (l: {
|
||||||
description = "PVV Homedirs Partition ${l}";
|
description = "PVV Homedir Partition ${l}";
|
||||||
|
|
||||||
before = [ "remote-fs.target" ];
|
before = [ "remote-fs.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
requiredBy = [ "pvv-homedirs.target" ];
|
||||||
|
|
||||||
type = "nfs";
|
type = "nfs";
|
||||||
what = "homepvv${l}.pvv.ntnu.no:/export/home/pvv/${l}";
|
what = "homepvv${l}.pvv.ntnu.no:/export/home/pvv/${l}";
|
||||||
@@ -16,10 +21,27 @@ in
|
|||||||
|
|
||||||
options = lib.concatStringsSep "," [
|
options = lib.concatStringsSep "," [
|
||||||
"nfsvers=3"
|
"nfsvers=3"
|
||||||
|
|
||||||
|
# NOTE: this is a bit unfortunate. The address above seems to resolve to IPv6 sometimes,
|
||||||
|
# and it doesn't seem possible to specify proto=tcp,tcp6, meaning we have to tell
|
||||||
|
# NFS which exact address to use here, despite it being specified in the `what` attr :\
|
||||||
"proto=tcp"
|
"proto=tcp"
|
||||||
"auto"
|
"addr=${values.hosts.microbel.ipv4}"
|
||||||
|
"mountproto=tcp"
|
||||||
|
"mounthost=${values.hosts.microbel.ipv4}"
|
||||||
|
"port=2049"
|
||||||
|
|
||||||
|
# NOTE: this is yet more unfortunate. When enabling locking, it will sometimes complain about connection failed.
|
||||||
|
# dmesg(1) reveals that it has something to do with registering the lockdv1 RPC service (errno: 111), not
|
||||||
|
# quite sure how to fix it. Living life on dangerous mode for now.
|
||||||
|
"nolock"
|
||||||
|
|
||||||
|
# Don't wait on every read/write
|
||||||
"async"
|
"async"
|
||||||
|
|
||||||
|
# Always keep mounted
|
||||||
|
"noauto"
|
||||||
|
|
||||||
# We don't want to update access time constantly
|
# We don't want to update access time constantly
|
||||||
"noatime"
|
"noatime"
|
||||||
|
|
||||||
@@ -35,17 +57,4 @@ in
|
|||||||
# "noexec"
|
# "noexec"
|
||||||
];
|
];
|
||||||
}) letters;
|
}) letters;
|
||||||
|
|
||||||
systemd.automounts = map (l: {
|
|
||||||
description = "PVV Homedirs Partition ${l}";
|
|
||||||
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
|
||||||
|
|
||||||
where = "/run/pvv-home-mounts/${l}";
|
|
||||||
|
|
||||||
automountConfig = {
|
|
||||||
# Unmount if not accessed in 5 mins
|
|
||||||
TimeoutIdleSec = "5min";
|
|
||||||
};
|
|
||||||
}) letters;
|
|
||||||
}
|
}
|
||||||
|
|||||||
29
hosts/temmie/services/userweb.nix
Normal file
29
hosts/temmie/services/userweb.nix
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
services.httpd = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# extraModules = [];
|
||||||
|
|
||||||
|
# virtualHosts."userweb.pvv.ntnu.no" = {
|
||||||
|
virtualHosts."temmie.pvv.ntnu.no" = {
|
||||||
|
|
||||||
|
forceSSL = true;
|
||||||
|
enableACME = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.httpd = {
|
||||||
|
after = [ "pvv-homedirs.target" ];
|
||||||
|
requires = [ "pvv-homedirs.target" ];
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
ProtectHome = "tmpfs";
|
||||||
|
BindPaths = let
|
||||||
|
letters = [ "a" "b" "c" "d" "h" "i" "j" "k" "l" "m" "z" ];
|
||||||
|
in map (l: "/run/pvv-home-mounts/${l}:/home/pvv/${l}") letters;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# TODO: create phpfpm pools with php environments that contain packages similar to those present on tom
|
||||||
|
}
|
||||||
@@ -53,7 +53,7 @@ in {
|
|||||||
nodes.ntnu-pvv-router = mkRouter "NTNU PVV Gateway" {
|
nodes.ntnu-pvv-router = mkRouter "NTNU PVV Gateway" {
|
||||||
interfaceGroups = [ ["wan1"] ["eth1"] ];
|
interfaceGroups = [ ["wan1"] ["eth1"] ];
|
||||||
connections.eth1 = mkConnection "knutsen" "em1";
|
connections.eth1 = mkConnection "knutsen" "em1";
|
||||||
interfaces.eth1.network = "pvv";
|
interfaces.eth1.network = "ntnu";
|
||||||
};
|
};
|
||||||
|
|
||||||
nodes.knutsen = mkRouter "knutsen" {
|
nodes.knutsen = mkRouter "knutsen" {
|
||||||
@@ -82,6 +82,8 @@ in {
|
|||||||
(mkConnection "buskerud" "eth1")
|
(mkConnection "buskerud" "eth1")
|
||||||
# (mkConnection "knutsen" "eth1")
|
# (mkConnection "knutsen" "eth1")
|
||||||
(mkConnection "powerpuff-cluster" "eth1")
|
(mkConnection "powerpuff-cluster" "eth1")
|
||||||
|
(mkConnection "powerpuff-cluster" "eth2")
|
||||||
|
(mkConnection "powerpuff-cluster" "eth3")
|
||||||
(mkConnection "lupine-1" "enp0s31f6")
|
(mkConnection "lupine-1" "enp0s31f6")
|
||||||
(mkConnection "lupine-2" "enp0s31f6")
|
(mkConnection "lupine-2" "enp0s31f6")
|
||||||
(mkConnection "lupine-3" "enp0s31f6")
|
(mkConnection "lupine-3" "enp0s31f6")
|
||||||
@@ -139,7 +141,7 @@ in {
|
|||||||
|
|
||||||
hardware.info = "Dell PowerEdge R730 x 3";
|
hardware.info = "Dell PowerEdge R730 x 3";
|
||||||
|
|
||||||
interfaceGroups = [ [ "eth1" ] ];
|
interfaceGroups = [ [ "eth1" "eth2" "eth3" ] ];
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
proxmox = {
|
proxmox = {
|
||||||
@@ -167,6 +169,13 @@ in {
|
|||||||
interfaces.ens18.network = "pvv";
|
interfaces.ens18.network = "pvv";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nodes.temmie = {
|
||||||
|
guestType = "proxmox";
|
||||||
|
parent = config.nodes.powerpuff-cluster.id;
|
||||||
|
|
||||||
|
interfaces.ens18.network = "pvv";
|
||||||
|
};
|
||||||
|
|
||||||
nodes.ustetind = {
|
nodes.ustetind = {
|
||||||
guestType = "proxmox LXC";
|
guestType = "proxmox LXC";
|
||||||
parent = config.nodes.powerpuff-cluster.id;
|
parent = config.nodes.powerpuff-cluster.id;
|
||||||
@@ -219,7 +228,7 @@ in {
|
|||||||
(mkConnection "demiurgen" "eno1")
|
(mkConnection "demiurgen" "eno1")
|
||||||
(mkConnection "sanctuary" "ethernet_0")
|
(mkConnection "sanctuary" "ethernet_0")
|
||||||
(mkConnection "torskas" "eth0")
|
(mkConnection "torskas" "eth0")
|
||||||
(mkConnection "skrott" "eth0")
|
(mkConnection "skrot" "eth0")
|
||||||
(mkConnection "homeassistant" "eth0")
|
(mkConnection "homeassistant" "eth0")
|
||||||
(mkConnection "orchid" "eth0")
|
(mkConnection "orchid" "eth0")
|
||||||
(mkConnection "principal" "em0")
|
(mkConnection "principal" "em0")
|
||||||
@@ -249,6 +258,12 @@ in {
|
|||||||
|
|
||||||
interfaces.ens4.network = "ntnu";
|
interfaces.ens4.network = "ntnu";
|
||||||
};
|
};
|
||||||
|
nodes.gluttony = {
|
||||||
|
guestType = "openstack";
|
||||||
|
parent = config.nodes.stackit.id;
|
||||||
|
|
||||||
|
interfaces.ens3.network = "ntnu";
|
||||||
|
};
|
||||||
nodes.wenche = {
|
nodes.wenche = {
|
||||||
guestType = "openstack";
|
guestType = "openstack";
|
||||||
parent = config.nodes.stackit.id;
|
parent = config.nodes.stackit.id;
|
||||||
|
|||||||
@@ -290,21 +290,6 @@ in {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nodes.skrott = mkDevice "skrott" {
|
|
||||||
# TODO: the interface name is likely wrong
|
|
||||||
interfaceGroups = [ [ "eth0" ] ];
|
|
||||||
interfaces.eth0 = {
|
|
||||||
# mac = "";
|
|
||||||
addresses = [
|
|
||||||
"129.241.210.235"
|
|
||||||
];
|
|
||||||
gateways = [
|
|
||||||
values.hosts.gateway
|
|
||||||
values.hosts.gateway6
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
nodes.torskas = mkDevice "torskas" {
|
nodes.torskas = mkDevice "torskas" {
|
||||||
deviceIcon = "${pkgs.super-tiny-icons}/share/icons/SuperTinyIcons/svg/arch_linux.svg";
|
deviceIcon = "${pkgs.super-tiny-icons}/share/icons/SuperTinyIcons/svg/arch_linux.svg";
|
||||||
|
|
||||||
|
|||||||
@@ -69,10 +69,18 @@ in rec {
|
|||||||
ipv4 = pvv-ipv4 223;
|
ipv4 = pvv-ipv4 223;
|
||||||
ipv6 = pvv-ipv6 223;
|
ipv6 = pvv-ipv6 223;
|
||||||
};
|
};
|
||||||
|
microbel = {
|
||||||
|
ipv4 = pvv-ipv4 179;
|
||||||
|
ipv6 = pvv-ipv6 "1:2";
|
||||||
|
};
|
||||||
ustetind = {
|
ustetind = {
|
||||||
ipv4 = pvv-ipv4 234;
|
ipv4 = pvv-ipv4 234;
|
||||||
ipv6 = pvv-ipv6 234;
|
ipv6 = pvv-ipv6 234;
|
||||||
};
|
};
|
||||||
|
skrott = {
|
||||||
|
ipv4 = pvv-ipv4 235;
|
||||||
|
ipv6 = pvv-ipv6 235;
|
||||||
|
};
|
||||||
temmie = {
|
temmie = {
|
||||||
ipv4 = pvv-ipv4 167;
|
ipv4 = pvv-ipv4 167;
|
||||||
ipv6 = pvv-ipv6 167;
|
ipv6 = pvv-ipv6 167;
|
||||||
|
|||||||
Reference in New Issue
Block a user