Compare commits

..

26 Commits

Author SHA1 Message Date
Adrian G L
18e795abdc feat: add initialdeploy hashed password to root 2026-05-20 15:31:30 +02:00
Adrian G L
30ec70fa5f fix: ildkule grub duplicated devices, format nix files 2026-05-19 16:26:36 +02:00
Adrian G L
1024b428ac feat: ildkule disco config 2026-05-19 12:16:39 +02:00
Adrian G L
1e6b692fbf fix: updated ildkule config and ips to match trd1 new setup 2026-05-19 11:37:05 +02:00
Vegard Bieker Matthey
beac6e91dd flake.lock: bump pvv-nettsiden 2026-05-17 16:58:04 +02:00
h7x4
0fd41c214a flake.{nix,lock}: bump deps 2026-05-13 01:19:35 +09:00
h7x4
5c1ee958ea flake.{nix,lock}: bump roowho2 2026-05-12 00:25:55 +09:00
h7x4
d8e97715c9 flake.lock: bump pvv-nettsiden 2026-05-12 00:24:56 +09:00
h7x4
33297b0436 treewide: lib.cli.toGNUCommandLineShell -> lib.cli.toCommandLineShellGNU 2026-05-11 23:09:50 +09:00
h7x4
be33c95c83 bekkalokk/website: more logging, specify timeouts, ban spooky funcs, fake sendmail 2026-05-11 21:14:08 +09:00
h7x4
2abf36a9af packages/simplesamlphp: 2.4.3 -> 2.5.0 2026-05-11 16:12:15 +09:00
h7x4
a60be532ce packages/mediawiki-extensions: bump all 2026-05-11 16:11:10 +09:00
h7x4
9c142fd56f kommode/gitea: remove deprecated config options 2026-05-11 16:00:51 +09:00
Øystein Tveit
b98e8679e6 temmie/userweb: set same phpOptions for env and apache 2026-05-11 14:54:56 +09:00
h7x4
ea092ec0b3 temmie/userweb: pass userdir user to sendmail through custom envvar 2026-05-11 14:26:47 +09:00
h7x4
5e50b617fb temmie/userweb: switch from postfix to nullmailer 2026-05-11 13:52:58 +09:00
h7x4
258c5a7b25 temmie/userweb: set up sendmail wrapper 2026-05-11 12:26:39 +09:00
h7x4
b9eda3dc56 temmie/userweb: reduce package list 2026-05-11 10:17:09 +09:00
Vegard Bieker Matthey
2fcaf5893f fix deprecation warning for mediawiki update script 2026-05-09 20:40:14 +02:00
h7x4
b009da31af temmie/userweb: deny a bunch of spooky directories by default
It should still be possible for the user to re-enable these with
`.htaccess`
2026-05-10 03:33:43 +09:00
h7x4
e9a267e2a3 temmie/userweb: ignore collisions in fhs env 2026-05-10 03:02:27 +09:00
h7x4
338c2f2531 temmie/userweb: adjust perl and php env
This adds and removes a few packages to make the environments closer to
how they are on tom
2026-05-10 03:02:26 +09:00
8db3034baf Run shellcheck 2026-05-08 09:31:35 +02:00
h7x4
f64f9c944e topology: hook skrot up to the switch at the office 2026-05-08 16:27:01 +09:00
h7x4
baeb1e5e60 base/hardening: move hardening options from base/default 2026-05-08 16:23:17 +09:00
h7x4
86ca8dcdc3 base/hardening: ban a bunch more unimportant kernel modules 2026-05-08 16:23:17 +09:00
25 changed files with 655 additions and 460 deletions

View File

@@ -13,6 +13,7 @@
./mitigations.nix ./mitigations.nix
./flake-input-exporter.nix ./flake-input-exporter.nix
./hardening.nix
./networking.nix ./networking.nix
./nix.nix ./nix.nix
./programs.nix ./programs.nix
@@ -70,8 +71,6 @@
fi fi
''; '';
# security.lockKernelModules = true;
security.protectKernelImage = true;
security.sudo.execWheelOnly = true; security.sudo.execWheelOnly = true;
security.sudo.extraConfig = '' security.sudo.extraConfig = ''
Defaults lecture = never Defaults lecture = never
@@ -85,6 +84,8 @@
# users.mutableUsers = lib.mkDefault false; # users.mutableUsers = lib.mkDefault false;
users.users.root.initialHashedPassword = "$y$j9T$ahP6GAdttD17OMBo7Yqeh.$Ad7qBcFvTL7HrJ9uTtrQzksN3220Nj9t/CrP6DwgK34"; # generated using mkpasswd, see huttiheita root on vaultwarden
users.groups."drift".name = "drift"; users.groups."drift".name = "drift";
# Trusted users on the nix builder machines # Trusted users on the nix builder machines

64
base/hardening.nix Normal file
View File

@@ -0,0 +1,64 @@
{ ... }:
{
boot.blacklistedKernelModules = [
# Obscure network protocols
"appletalk"
"atm"
"ax25"
"batman-adv"
"can"
"netrom"
"psnap"
"rds"
"rose"
"sctp"
"tipc"
# Filesystems we don't use
"adfs"
"affs"
"befs"
"bfs"
"cifs"
"cramfs"
"efs"
"exofs"
"orangefs"
"freevxfs"
"gfs2"
"hfs"
"hfsplus"
"hpfs"
"jffs2"
"jfs"
"minix"
"nilfs2"
"ntfs"
"omfs"
"qnx4"
"qnx6"
"sysv"
"ubifs"
"ufs"
# Legacy hardware
"pcspkr"
"floppy"
"parport"
"ppdev"
# Other stuff we don't use
"firewire-core"
"firewire-ohci"
"ksmbd"
"ib_core"
"l2tp_eth"
"l2tp_netlink"
"l2tp_ppp"
"nfc"
"soundwire"
];
# security.lockKernelModules = true;
security.protectKernelImage = true;
}

View File

@@ -8,6 +8,5 @@
# Let's not spam LetsEncrypt in `nixos-rebuild build-vm` mode: # Let's not spam LetsEncrypt in `nixos-rebuild build-vm` mode:
virtualisation.vmVariant = { virtualisation.vmVariant = {
security.acme.defaults.server = "https://127.0.0.1"; security.acme.defaults.server = "https://127.0.0.1";
users.users.root.initialPassword = "root";
}; };
} }

40
flake.lock generated
View File

@@ -232,11 +232,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1777808420, "lastModified": 1778407980,
"narHash": "sha256-hh9XBz0K1ypZ+neezgIPCSsnWFKEq8VfV/1aUSPu3OA=", "narHash": "sha256-r980BhsReZQe6FkmyNZkwCZpvzARo5jZgTl8HxjAssY=",
"owner": "oddlama", "owner": "oddlama",
"repo": "nix-topology", "repo": "nix-topology",
"rev": "28e9dc901ff38a8fa2d24bccd5f89511d6d8324e", "rev": "ca0a602f650306d00d6f3e3c76d0f4c48a5c5adc",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -248,11 +248,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1778125667, "lastModified": 1778544512,
"narHash": "sha256-swcxqlW+XrZFBqjcV3AV8AR64/eI234AZRFKs6q4DFo=", "narHash": "sha256-VIsPgfIpZ/01XUO6WN+o1NZbP5iKPKPHdHPWqfm4XIg=",
"rev": "75636a69ad3115ff64d4cb3090e66c8275dda9c2", "rev": "c417517f9d525181ee5619c683419d308ee29fe8",
"type": "tarball", "type": "tarball",
"url": "https://releases.nixos.org/nixos/25.11-small/nixos-25.11.10534.75636a69ad31/nixexprs.tar.xz" "url": "https://releases.nixos.org/nixos/25.11-small/nixos-25.11.10745.c417517f9d52/nixexprs.tar.xz"
}, },
"original": { "original": {
"type": "tarball", "type": "tarball",
@@ -276,11 +276,11 @@
}, },
"nixpkgs-unstable": { "nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1778157832, "lastModified": 1778586796,
"narHash": "sha256-lSl05j1UzI5MioSJWUa7oUp5a88zzv3sXMwWC4d1N70=", "narHash": "sha256-XmDljcG4x8slQDlsWOc77pCA1YVuYn8JGumkYlhfTxI=",
"rev": "ec299c6a33eee9baf5b4d72881ca2f15c06b4f01", "rev": "b25e938b89759b5f9466fc53c4a970244f84dc39",
"type": "tarball", "type": "tarball",
"url": "https://releases.nixos.org/nixos/unstable-small/nixos-26.05pre993859.ec299c6a33ee/nixexprs.tar.xz" "url": "https://releases.nixos.org/nixos/unstable-small/nixos-26.05pre996582.b25e938b8975/nixexprs.tar.xz"
}, },
"original": { "original": {
"type": "tarball", "type": "tarball",
@@ -315,11 +315,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1769009806, "lastModified": 1778960428,
"narHash": "sha256-52xTtAOc9B+MBRMRZ8HI6ybNsRLMlHHLh+qwAbaJjRY=", "narHash": "sha256-YAs3LbFGlBLJW3xHeoQfTq2GBBXTvuSKl2WXDtloczU=",
"ref": "main", "ref": "main",
"rev": "aa8adfc6a4d5b6222752e2d15d4a6d3b3b85252e", "rev": "927748790b1f7159adfe32a3ad9ec01d22e9c5a2",
"revCount": 575, "revCount": 583,
"type": "git", "type": "git",
"url": "https://git.pvv.ntnu.no/Projects/nettsiden.git" "url": "https://git.pvv.ntnu.no/Projects/nettsiden.git"
}, },
@@ -380,17 +380,17 @@
"rust-overlay": "rust-overlay_3" "rust-overlay": "rust-overlay_3"
}, },
"locked": { "locked": {
"lastModified": 1777418851, "lastModified": 1778600367,
"narHash": "sha256-M6LntO3jkxwgcKkaa9de1Vqu+LsV12Yz8Bv3/9/k018=", "narHash": "sha256-YB0b2xUf4D8792D5Ay//7C3AjHyv+9yoy8K1mTe+wvE=",
"ref": "main", "ref": "main",
"rev": "16b2bc5c2759e20ecb952374509f1e1f9d6c06e7", "rev": "8e5f2849ff7c9616100fe928261512a7ad647939",
"revCount": 83, "revCount": 91,
"type": "git", "type": "git",
"url": "https://git.pvv.ntnu.no/Projects/roowho2.git" "url": "https://git.pvv.ntnu.no/Projects/roowho2.git"
}, },
"original": { "original": {
"ref": "main", "ref": "main",
"rev": "16b2bc5c2759e20ecb952374509f1e1f9d6c06e7", "rev": "8e5f2849ff7c9616100fe928261512a7ad647939",
"type": "git", "type": "git",
"url": "https://git.pvv.ntnu.no/Projects/roowho2.git" "url": "https://git.pvv.ntnu.no/Projects/roowho2.git"
} }

484
flake.nix
View File

@@ -32,7 +32,7 @@
minecraft-heatmap.url = "git+https://git.pvv.ntnu.no/Projects/minecraft-heatmap.git?ref=main"; minecraft-heatmap.url = "git+https://git.pvv.ntnu.no/Projects/minecraft-heatmap.git?ref=main";
minecraft-heatmap.inputs.nixpkgs.follows = "nixpkgs"; minecraft-heatmap.inputs.nixpkgs.follows = "nixpkgs";
roowho2.url = "git+https://git.pvv.ntnu.no/Projects/roowho2.git?ref=main&rev=16b2bc5c2759e20ecb952374509f1e1f9d6c06e7"; roowho2.url = "git+https://git.pvv.ntnu.no/Projects/roowho2.git?ref=main&rev=8e5f2849ff7c9616100fe928261512a7ad647939";
roowho2.inputs.nixpkgs.follows = "nixpkgs"; roowho2.inputs.nixpkgs.follows = "nixpkgs";
greg-ng.url = "git+https://git.pvv.ntnu.no/Grzegorz/greg-ng.git?ref=main"; greg-ng.url = "git+https://git.pvv.ntnu.no/Grzegorz/greg-ng.git?ref=main";
@@ -49,8 +49,14 @@
qotd.inputs.nixpkgs.follows = "nixpkgs"; qotd.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = { self, nixpkgs, nixpkgs-unstable, sops-nix, disko, ... }@inputs: outputs = {
let self,
nixpkgs,
nixpkgs-unstable,
sops-nix,
disko,
...
} @ inputs: let
inherit (nixpkgs) lib; inherit (nixpkgs) lib;
systems = [ systems = [
"x86_64-linux" "x86_64-linux"
@@ -71,178 +77,196 @@
in { in {
inputs = lib.mapAttrs (_: src: src.outPath) inputs; inputs = lib.mapAttrs (_: src: src.outPath) inputs;
pkgs = forAllSystems (system: import nixpkgs { pkgs = forAllSystems (system:
inherit system; import nixpkgs {
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) inherit system;
[ config.allowUnfreePredicate = pkg:
"nvidia-x11" builtins.elem (lib.getName pkg)
"nvidia-settings" [
]; "nvidia-x11"
}); "nvidia-settings"
];
});
nixosConfigurations = let nixosConfigurations = let
nixosConfig = nixosConfig = nixpkgs: name: configurationPath: extraArgs @ {
nixpkgs: localSystem ? "x86_64-linux", # buildPlatform
name: crossSystem ? "x86_64-linux", # hostPlatform
configurationPath: specialArgs ? {},
extraArgs@{ modules ? [],
localSystem ? "x86_64-linux", # buildPlatform overlays ? [],
crossSystem ? "x86_64-linux", # hostPlatform enableDefaults ? true,
specialArgs ? { }, ...
modules ? [ ], }: let
overlays ? [ ], commonPkgsConfig =
enableDefaults ? true, {
... config.allowUnfreePredicate = pkg:
}: builtins.elem (lib.getName pkg)
let
commonPkgsConfig = {
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg)
[ [
"nvidia-x11" "nvidia-x11"
"nvidia-settings" "nvidia-settings"
]; ];
overlays = (lib.optionals enableDefaults [ overlays =
# Global overlays go here (lib.optionals enableDefaults [
inputs.roowho2.overlays.default # Global overlays go here
]) ++ overlays; inputs.roowho2.overlays.default
} // (if localSystem != crossSystem then { ])
inherit localSystem crossSystem; ++ overlays;
} else { }
system = crossSystem; // (
}); if localSystem != crossSystem
pkgs = import nixpkgs commonPkgsConfig; then {
unstablePkgs = import nixpkgs-unstable commonPkgsConfig; inherit localSystem crossSystem;
in
lib.nixosSystem (lib.recursiveUpdate
{
system = crossSystem;
inherit pkgs;
specialArgs = {
inherit inputs unstablePkgs;
values = import ./values.nix;
fp = path: ./${path};
} // specialArgs;
modules = [
{
networking.hostName = lib.mkDefault name;
} }
configurationPath else {
] ++ (lib.optionals enableDefaults [ system = crossSystem;
sops-nix.nixosModules.sops }
inputs.roowho2.nixosModules.default );
self.nixosModules.rsync-pull-targets pkgs = import nixpkgs commonPkgsConfig;
]) ++ modules; unstablePkgs = import nixpkgs-unstable commonPkgsConfig;
} in
(builtins.removeAttrs extraArgs [ lib.nixosSystem (
"localSystem" lib.recursiveUpdate
"crossSystem" {
"modules" system = crossSystem;
"overlays"
"specialArgs" inherit pkgs;
"enableDefaults"
]) specialArgs =
); {
inherit inputs unstablePkgs;
values = import ./values.nix;
fp = path: ./${path};
}
// specialArgs;
modules =
[
{
networking.hostName = lib.mkDefault name;
}
configurationPath
]
++ (lib.optionals enableDefaults [
sops-nix.nixosModules.sops
inputs.roowho2.nixosModules.default
self.nixosModules.rsync-pull-targets
])
++ modules;
}
(builtins.removeAttrs extraArgs [
"localSystem"
"crossSystem"
"modules"
"overlays"
"specialArgs"
"enableDefaults"
])
);
stableNixosConfig = name: extraArgs: stableNixosConfig = name: extraArgs:
nixosConfig nixpkgs name ./hosts/${name}/configuration.nix extraArgs; nixosConfig nixpkgs name ./hosts/${name}/configuration.nix extraArgs;
in { in
bicep = stableNixosConfig "bicep" { {
modules = [ bicep = stableNixosConfig "bicep" {
inputs.matrix-next.nixosModules.default modules = [
inputs.pvv-calendar-bot.nixosModules.default inputs.matrix-next.nixosModules.default
inputs.minecraft-heatmap.nixosModules.default inputs.pvv-calendar-bot.nixosModules.default
self.nixosModules.gickup inputs.minecraft-heatmap.nixosModules.default
self.nixosModules.matrix-ooye self.nixosModules.gickup
]; self.nixosModules.matrix-ooye
overlays = [ ];
inputs.pvv-calendar-bot.overlays.default overlays = [
inputs.minecraft-heatmap.overlays.default inputs.pvv-calendar-bot.overlays.default
(final: prev: { inputs.minecraft-heatmap.overlays.default
inherit (self.packages.${prev.stdenv.hostPlatform.system}) out-of-your-element; (final: prev: {
}) inherit (self.packages.${prev.stdenv.hostPlatform.system}) out-of-your-element;
]; })
}; ];
bekkalokk = stableNixosConfig "bekkalokk" { };
overlays = [ bekkalokk = stableNixosConfig "bekkalokk" {
(final: prev: { overlays = [
mediawiki-extensions = final.callPackage ./packages/mediawiki-extensions { }; (final: prev: {
simplesamlphp = final.callPackage ./packages/simplesamlphp { }; mediawiki-extensions = final.callPackage ./packages/mediawiki-extensions {};
bluemap = final.callPackage ./packages/bluemap.nix { }; simplesamlphp = final.callPackage ./packages/simplesamlphp {};
}) bluemap = final.callPackage ./packages/bluemap.nix {};
inputs.pvv-nettsiden.overlays.default })
inputs.qotd.overlays.default inputs.pvv-nettsiden.overlays.default
]; inputs.qotd.overlays.default
modules = [ ];
inputs.pvv-nettsiden.nixosModules.default modules = [
self.nixosModules.bluemap inputs.pvv-nettsiden.nixosModules.default
inputs.qotd.nixosModules.default self.nixosModules.bluemap
]; inputs.qotd.nixosModules.default
}; ];
ildkule = stableNixosConfig "ildkule" { }; };
#ildkule-unstable = unstableNixosConfig "ildkule" { }; ildkule = stableNixosConfig "ildkule" {
skrot = stableNixosConfig "skrot" { modules = [
modules = [ inputs.disko.nixosModules.disko
inputs.disko.nixosModules.disko ];
inputs.dibbler.nixosModules.default };
]; #ildkule-unstable = unstableNixosConfig "ildkule" { };
overlays = [inputs.dibbler.overlays.default]; skrot = stableNixosConfig "skrot" {
}; modules = [
shark = stableNixosConfig "shark" { }; inputs.disko.nixosModules.disko
wenche = stableNixosConfig "wenche" { }; inputs.dibbler.nixosModules.default
temmie = stableNixosConfig "temmie" { }; ];
gluttony = stableNixosConfig "gluttony" { }; overlays = [inputs.dibbler.overlays.default];
};
shark = stableNixosConfig "shark" {};
wenche = stableNixosConfig "wenche" {};
temmie = stableNixosConfig "temmie" {};
gluttony = stableNixosConfig "gluttony" {};
kommode = stableNixosConfig "kommode" { kommode = stableNixosConfig "kommode" {
overlays = [ overlays = [
inputs.nix-gitea-themes.overlays.default inputs.nix-gitea-themes.overlays.default
]; ];
modules = [ modules = [
inputs.nix-gitea-themes.nixosModules.default inputs.nix-gitea-themes.nixosModules.default
inputs.disko.nixosModules.disko inputs.disko.nixosModules.disko
]; ];
}; };
ustetind = stableNixosConfig "ustetind" { ustetind = stableNixosConfig "ustetind" {
modules = [ modules = [
"${nixpkgs}/nixos/modules/virtualisation/lxc-container.nix" "${nixpkgs}/nixos/modules/virtualisation/lxc-container.nix"
]; ];
}; };
brzeczyszczykiewicz = stableNixosConfig "brzeczyszczykiewicz" { brzeczyszczykiewicz = stableNixosConfig "brzeczyszczykiewicz" {
modules = [ modules = [
inputs.grzegorz-clients.nixosModules.grzegorz-webui inputs.grzegorz-clients.nixosModules.grzegorz-webui
inputs.gergle.nixosModules.default inputs.gergle.nixosModules.default
inputs.greg-ng.nixosModules.default inputs.greg-ng.nixosModules.default
]; ];
overlays = [ overlays = [
inputs.greg-ng.overlays.default inputs.greg-ng.overlays.default
inputs.gergle.overlays.default inputs.gergle.overlays.default
]; ];
}; };
georg = stableNixosConfig "georg" { georg = stableNixosConfig "georg" {
modules = [ modules = [
inputs.grzegorz-clients.nixosModules.grzegorz-webui inputs.grzegorz-clients.nixosModules.grzegorz-webui
inputs.gergle.nixosModules.default inputs.gergle.nixosModules.default
inputs.greg-ng.nixosModules.default inputs.greg-ng.nixosModules.default
]; ];
overlays = [ overlays = [
inputs.greg-ng.overlays.default inputs.greg-ng.overlays.default
inputs.gergle.overlays.default inputs.gergle.overlays.default
]; ];
}; };
} }
// // (let
(let machineNames = map (i: "lupine-${toString i}") (lib.range 1 5);
machineNames = map (i: "lupine-${toString i}") (lib.range 1 5); stableLupineNixosConfig = name: extraArgs:
stableLupineNixosConfig = name: extraArgs:
nixosConfig nixpkgs name ./hosts/lupine/configuration.nix extraArgs; nixosConfig nixpkgs name ./hosts/lupine/configuration.nix extraArgs;
in lib.genAttrs machineNames (name: stableLupineNixosConfig name { in
modules = [{ networking.hostName = name; }]; lib.genAttrs machineNames (name:
specialArgs.lupineName = name; stableLupineNixosConfig name {
})); modules = [{networking.hostName = name;}];
specialArgs.lupineName = name;
}));
nixosModules = { nixosModules = {
bluemap = ./modules/bluemap.nix; bluemap = ./modules/bluemap.nix;
@@ -264,7 +288,8 @@
}) })
]; ];
}; };
in pkgs.callPackage ./shell.nix { }; in
pkgs.callPackage ./shell.nix {};
cuda = let cuda = let
cuda-pkgs = import nixpkgs-unstable { cuda-pkgs = import nixpkgs-unstable {
inherit system; inherit system;
@@ -273,81 +298,88 @@
cudaSupport = true; cudaSupport = true;
}; };
}; };
in cuda-pkgs.callPackage ./shells/cuda.nix { }; in
cuda-pkgs.callPackage ./shells/cuda.nix {};
}); });
packages = { packages = {
"x86_64-linux" = let "x86_64-linux" = let
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
in rec { in
default = important-machines; rec {
important-machines = pkgs.linkFarm "important-machines" default = important-machines;
(lib.getAttrs importantMachines self.packages.${system}); important-machines =
all-machines = pkgs.linkFarm "all-machines" pkgs.linkFarm "important-machines"
(lib.getAttrs allMachines self.packages.${system}); (lib.getAttrs importantMachines self.packages.${system});
all-machines =
pkgs.linkFarm "all-machines"
(lib.getAttrs allMachines self.packages.${system});
simplesamlphp = pkgs.callPackage ./packages/simplesamlphp { }; simplesamlphp = pkgs.callPackage ./packages/simplesamlphp {};
bluemap = pkgs.callPackage ./packages/bluemap.nix { }; bluemap = pkgs.callPackage ./packages/bluemap.nix {};
out-of-your-element = pkgs.callPackage ./packages/ooye/package.nix { }; out-of-your-element = pkgs.callPackage ./packages/ooye/package.nix {};
} }
// //
# Mediawiki extensions # Mediawiki extensions
(lib.pipe null [ (lib.pipe null [
(_: pkgs.callPackage ./packages/mediawiki-extensions { }) (_: pkgs.callPackage ./packages/mediawiki-extensions {})
(lib.flip builtins.removeAttrs ["override" "overrideDerivation"]) (lib.flip builtins.removeAttrs ["override" "overrideDerivation"])
(lib.mapAttrs' (name: lib.nameValuePair "mediawiki-${name}")) (lib.mapAttrs' (name: lib.nameValuePair "mediawiki-${name}"))
]) ])
// //
# Machines # Machines
lib.genAttrs allMachines lib.genAttrs allMachines
(machine: self.nixosConfigurations.${machine}.config.system.build.toplevel) (machine: self.nixosConfigurations.${machine}.config.system.build.toplevel)
// //
# Nix-topology # Nix-topology
(let (let
topology' = import inputs.nix-topology { topology' = import inputs.nix-topology {
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
overlays = [ overlays = [
inputs.nix-topology.overlays.default inputs.nix-topology.overlays.default
(final: prev: { (final: prev: {
inherit (nixpkgs-unstable.legacyPackages.${system}) super-tiny-icons; inherit (nixpkgs-unstable.legacyPackages.${system}) super-tiny-icons;
}) })
];
};
specialArgs = {
values = import ./values.nix;
};
modules = [
./topology
{
nixosConfigurations = lib.mapAttrs (_name: nixosCfg:
nixosCfg.extendModules {
modules = [
inputs.nix-topology.nixosModules.default
./topology/service-extractors/greg-ng.nix
./topology/service-extractors/postgresql.nix
./topology/service-extractors/mysql.nix
./topology/service-extractors/gitea-runners.nix
];
})
self.nixosConfigurations;
}
]; ];
}; };
in {
specialArgs = { topology = topology'.config.output;
values = import ./values.nix; topology-png =
}; pkgs.runCommand "pvv-config-topology-png" {
nativeBuildInputs = [pkgs.writableTmpDirAsHomeHook];
modules = [ } ''
./topology mkdir -p "$out"
{ for file in '${topology'.config.output}'/*.svg; do
nixosConfigurations = lib.mapAttrs (_name: nixosCfg: nixosCfg.extendModules { ${lib.getExe pkgs.imagemagick} -density 300 -background none "$file" "$out"/"$(basename "''${file%.svg}.png")"
modules = [ done
inputs.nix-topology.nixosModules.default '';
./topology/service-extractors/greg-ng.nix });
./topology/service-extractors/postgresql.nix
./topology/service-extractors/mysql.nix
./topology/service-extractors/gitea-runners.nix
];
}) self.nixosConfigurations;
}
];
};
in {
topology = topology'.config.output;
topology-png = pkgs.runCommand "pvv-config-topology-png" {
nativeBuildInputs = [ pkgs.writableTmpDirAsHomeHook ];
} ''
mkdir -p "$out"
for file in '${topology'.config.output}'/*.svg; do
${lib.getExe pkgs.imagemagick} -density 300 -background none "$file" "$out"/"$(basename "''${file%.svg}.png")"
done
'';
});
}; };
}; };
} }

View File

@@ -80,9 +80,40 @@ in {
}; };
services.phpfpm.pools."pvv-nettsiden".settings = { services.phpfpm.pools."pvv-nettsiden".settings = {
# "php_admin_value[error_log]" = "stderr"; "php_admin_value[error_log]" = "syslog";
"php_admin_flag[log_errors]" = true; "php_admin_flag[log_errors]" = true;
"catch_workers_output" = true; "catch_workers_output" = true;
"php_admin_value[max_execution_time]" = "30";
"request_terminate_timeout" = "60s";
"php_admin_value[sendmail_path]" = let
fakeSendmail = pkgs.writeShellApplication {
name = "fake-sendmail";
text = ''
TIMESTAMP="$(date +%Y-%m-%d-%H-%M-%S-%N)"
(
echo "SENDMAIL ARGS:"
echo "$@"
echo "SENDMAIL STDIN:"
cat -
) > "/var/lib/pvv-nettsiden/emails/$TIMESTAMP.mail"
'';
};
in lib.getExe fakeSendmail;
"php_admin_value[disable_functions]" = lib.concatStringsSep "," [
"curl_exec"
"curl_multi_exec"
"exec"
"parse_ini_file"
"passthru"
"popen"
"proc_open"
"shell_exec"
"show_source"
"system"
];
}; };
services.nginx.virtualHosts."pvv.ntnu.no" = { services.nginx.virtualHosts."pvv.ntnu.no" = {

View File

@@ -40,15 +40,15 @@ in {
path = with pkgs; [ imagemagick gnutar gzip ]; path = with pkgs; [ imagemagick gnutar gzip ];
script = '' script = ''
tar ${lib.cli.toGNUCommandLineShell {} { tar ${lib.cli.toCommandLineShellGNU { } {
extract = true; extract = true;
file = "${transferDir}/gallery.tar.gz"; file = "${transferDir}/gallery.tar.gz";
directory = "."; directory = ".";
}} }}
# Delete files and directories that exists in the gallery that don't exist in the tarball # Delete files and directories that exists in the gallery that don't exist in the tarball
filesToRemove=$(uniq -u <(sort <(find . -not -path "./.thumbnails*") <(tar -tf ${transferDir}/gallery.tar.gz | sed 's|/$||'))) filesToRemove=$(uniq -u <(sort <(find . -not -path './.thumbnails*') <(tar -tf '${transferDir}/gallery.tar.gz' | sed 's|/$||')))
while IFS= read fname; do while IFS= read -r fname; do
rm -f "$fname" ||: rm -f "$fname" ||:
rm -f ".thumbnails/$fname.png" ||: rm -f ".thumbnails/$fname.png" ||:
done <<< "$filesToRemove" done <<< "$filesToRemove"
@@ -56,9 +56,9 @@ in {
find . -type d -empty -delete find . -type d -empty -delete
mkdir -p .thumbnails mkdir -p .thumbnails
images=$(find . -type f -not -path "./.thumbnails*") images=$(find . -type f -not -path './.thumbnails*')
while IFS= read fname; do while IFS= read -r fname; do
# Skip this file if an up-to-date thumbnail already exists # Skip this file if an up-to-date thumbnail already exists
if [ -f ".thumbnails/$fname.png" ] && \ if [ -f ".thumbnails/$fname.png" ] && \
[ "$(date -R -r "$fname")" == "$(date -R -r ".thumbnails/$fname.png")" ] [ "$(date -R -r "$fname")" == "$(date -R -r ".thumbnails/$fname.png")" ]
@@ -67,7 +67,7 @@ in {
fi fi
echo "Creating thumbnail for $fname" echo "Creating thumbnail for $fname"
mkdir -p $(dirname ".thumbnails/$fname") mkdir -p "$(dirname ".thumbnails/$fname")"
magick -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" touch -m -d "$(date -R -r "$fname")" ".thumbnails/$fname.png"
done <<< "$images" done <<< "$images"

View File

@@ -57,7 +57,7 @@ in
rm "$STATE_DIRECTORY/mysql-dump-latest.sql.zst" ||: rm "$STATE_DIRECTORY/mysql-dump-latest.sql.zst" ||:
ln -T "$OUT_FILE" "$STATE_DIRECTORY/mysql-dump-latest.sql.zst" ln -T "$OUT_FILE" "$STATE_DIRECTORY/mysql-dump-latest.sql.zst"
while [ "$(find "$STATE_DIRECTORY" -type f -printf '.' | wc -c)" -gt ${toString (rotations + 1)} ]; do while [ "$(find "$STATE_DIRECTORY" -type f -printf '.' | wc -c)" -gt '${toString (rotations + 1)}' ]; do
rm "$(find "$STATE_DIRECTORY" -type f -printf '%T+ %p\n' | sort | head -n 1 | cut -d' ' -f2)" rm "$(find "$STATE_DIRECTORY" -type f -printf '%T+ %p\n' | sort | head -n 1 | cut -d' ' -f2)"
done done
''; '';

View File

@@ -58,7 +58,7 @@ in
rm "$STATE_DIRECTORY/postgresql-dump-latest.sql.zst" ||: rm "$STATE_DIRECTORY/postgresql-dump-latest.sql.zst" ||:
ln -T "$OUT_FILE" "$STATE_DIRECTORY/postgresql-dump-latest.sql.zst" ln -T "$OUT_FILE" "$STATE_DIRECTORY/postgresql-dump-latest.sql.zst"
while [ "$(find "$STATE_DIRECTORY" -type f -printf '.' | wc -c)" -gt ${toString (rotations + 1)} ]; do while [ "$(find "$STATE_DIRECTORY" -type f -printf '.' | wc -c)" -gt '${toString (rotations + 1)}' ]; do
rm "$(find "$STATE_DIRECTORY" -type f -printf '%T+ %p\n' | sort | head -n 1 | cut -d' ' -f2)" rm "$(find "$STATE_DIRECTORY" -type f -printf '%T+ %p\n' | sort | head -n 1 | cut -d' ' -f2)"
done done
''; '';

View File

@@ -1,17 +1,23 @@
{ config, fp, pkgs, lib, values, ... }:
{ {
config,
fp,
pkgs,
lib,
values,
...
}: {
imports = [ imports = [
# Include the results of the hardware scan. ./hardware-configuration.nix
./hardware-configuration.nix ./disks.nix
(fp /base) (fp /base)
./services/monitoring ./services/monitoring
./services/nginx ./services/nginx
./services/journald-remote.nix ./services/journald-remote.nix
]; ];
boot.loader.systemd-boot.enable = false; boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/vda"; boot.loader.systemd-boot.enable = lib.mkForce false;
boot.tmp.cleanOnBoot = true; boot.tmp.cleanOnBoot = true;
zramSwap.enable = true; zramSwap.enable = true;
@@ -27,13 +33,22 @@
nameservers = values.defaultNetworkConfig.dns; nameservers = values.defaultNetworkConfig.dns;
defaultGateway.address = hostConf.ipv4_internal_gw; defaultGateway.address = hostConf.ipv4_internal_gw;
interfaces."ens4" = { interfaces."ens3" = {
ipv4.addresses = [ ipv4.addresses = [
{ address = hostConf.ipv4; prefixLength = 32; } {
{ address = hostConf.ipv4_internal; prefixLength = 24; } address = hostConf.ipv4;
prefixLength = 32;
}
{
address = hostConf.ipv4_internal;
prefixLength = 24;
}
]; ];
ipv6.addresses = [ ipv6.addresses = [
{ address = hostConf.ipv6; prefixLength = 64; } {
address = hostConf.ipv6;
prefixLength = 64;
}
]; ];
}; };
}; };

27
hosts/ildkule/disks.nix Normal file
View File

@@ -0,0 +1,27 @@
{
disko.devices = {
disk = {
sda = {
device = "/dev/sda";
type = "disk";
content = {
type = "gpt";
partitions = {
bios = {
size = "1M";
type = "EF02";
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
};
};
}

View File

@@ -1,16 +1,24 @@
{ modulesPath, lib, ... }: # Do not modify this file! It was generated by nixos-generate-config
{ # and may be overwritten by future invocations. Please make changes
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; # to /etc/nixos/configuration.nix instead.
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "xen_blkfront" "vmw_pvscsi" ]; { config, lib, pkgs, modulesPath, ... }:
boot.initrd.kernelModules = [ "nvme" ];
fileSystems."/" = {
device = "/dev/disk/by-uuid/e35eb4ce-aac3-4f91-8383-6e7cd8bbf942";
fsType = "ext4";
};
fileSystems."/data" = {
device = "/dev/disk/by-uuid/0a4c1234-02d3-4b53-aeca-d95c4c8d534b";
fsType = "ext4";
};
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
# 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.useDHCP = lib.mkDefault true;
# networking.interfaces.ens3.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
} }

View File

@@ -99,23 +99,23 @@ in
]; ];
} '' } ''
# Bigger icons # Bigger icons
install -Dm444 "${cfg.package.src}/templates/repo/icon.tmpl" "$out/repo/icon.tmpl" install -Dm444 '${cfg.package.src}/templates/repo/icon.tmpl' "$out/repo/icon.tmpl"
sed -i -e 's/24/60/g' "$out/repo/icon.tmpl" sed -i -e 's/24/60/g' "$out/repo/icon.tmpl"
''; '';
in '' in ''
install -Dm444 ${logo-svg} ${cfg.customDir}/public/assets/img/logo.svg install -Dm444 '${logo-svg}' '${cfg.customDir}/public/assets/img/logo.svg'
install -Dm444 ${logo-png} ${cfg.customDir}/public/assets/img/logo.png install -Dm444 '${logo-png}' '${cfg.customDir}/public/assets/img/logo.png'
install -Dm444 ${./loading.apng} ${cfg.customDir}/public/assets/img/loading.png install -Dm444 '${./loading.apng}' '${cfg.customDir}/public/assets/img/loading.png'
install -Dm444 ${extraLinks} ${cfg.customDir}/templates/custom/extra_links.tmpl install -Dm444 '${extraLinks}' '${cfg.customDir}/templates/custom/extra_links.tmpl'
install -Dm444 ${extraLinksFooter} ${cfg.customDir}/templates/custom/extra_links_footer.tmpl install -Dm444 '${extraLinksFooter}' '${cfg.customDir}/templates/custom/extra_links_footer.tmpl'
install -Dm444 ${project-labels} ${cfg.customDir}/options/label/project-labels.yaml install -Dm444 '${project-labels}' '${cfg.customDir}/options/label/project-labels.yaml'
install -Dm644 ${./emotes/bruh.png} ${cfg.customDir}/public/assets/img/emoji/bruh.png install -Dm644 '${./emotes/bruh.png}' '${cfg.customDir}/public/assets/img/emoji/bruh.png'
install -Dm644 ${./emotes/huh.gif} ${cfg.customDir}/public/assets/img/emoji/huh.png install -Dm644 '${./emotes/huh.gif}' '${cfg.customDir}/public/assets/img/emoji/huh.png'
install -Dm644 ${./emotes/grr.png} ${cfg.customDir}/public/assets/img/emoji/grr.png install -Dm644 '${./emotes/grr.png}' '${cfg.customDir}/public/assets/img/emoji/grr.png'
install -Dm644 ${./emotes/okiedokie.jpg} ${cfg.customDir}/public/assets/img/emoji/okiedokie.png install -Dm644 '${./emotes/okiedokie.jpg}' '${cfg.customDir}/public/assets/img/emoji/okiedokie.png'
"${lib.getExe pkgs.rsync}" -a "${customTemplates}/" ${cfg.customDir}/templates/ '${lib.getExe pkgs.rsync}' -a '${customTemplates}/' '${cfg.customDir}/templates/'
''; '';
}; };
} }

View File

@@ -134,9 +134,6 @@ in {
ALLOW_FORK_INTO_SAME_OWNER = true; ALLOW_FORK_INTO_SAME_OWNER = true;
}; };
picture = { picture = {
DISABLE_GRAVATAR = true;
ENABLE_FEDERATED_AVATAR = false;
AVATAR_MAX_FILE_SIZE = 1024 * 1024 * 5; AVATAR_MAX_FILE_SIZE = 1024 * 1024 * 5;
# NOTE: go any bigger than this, and gitea will freeze your gif >:( # NOTE: go any bigger than this, and gitea will freeze your gif >:(
AVATAR_MAX_ORIGIN_SIZE = 1024 * 1024 * 2; AVATAR_MAX_ORIGIN_SIZE = 1024 * 1024 * 2;
@@ -217,7 +214,7 @@ in {
systemd.services.gitea-dump = { systemd.services.gitea-dump = {
serviceConfig.ExecStart = let serviceConfig.ExecStart = let
args = lib.cli.toGNUCommandLineShell { } { args = lib.cli.toCommandLineShellGNU { } {
type = cfg.dump.type; type = cfg.dump.type;
# This should be declarative on nixos, no need to backup. # This should be declarative on nixos, no need to backup.

View File

@@ -53,7 +53,7 @@ in
Slice = "system-giteaweb.slice"; Slice = "system-giteaweb.slice";
Type = "oneshot"; Type = "oneshot";
ExecStart = let ExecStart = let
args = lib.cli.toGNUCommandLineShell { } { args = lib.cli.toCommandLineShellGNU { } {
org = "%i"; org = "%i";
token-path = "%d/token"; token-path = "%d/token";
api-url = "${giteaCfg.settings.server.ROOT_URL}api/v1"; api-url = "${giteaCfg.settings.server.ROOT_URL}api/v1";

View File

@@ -6,7 +6,7 @@
(fp /base) (fp /base)
./services/nfs-mounts.nix ./services/nfs-mounts.nix
./services/userweb.nix ./services/userweb
]; ];
systemd.network.networks."30-ens18" = values.defaultNetworkConfig // { systemd.network.networks."30-ens18" = values.defaultNetworkConfig // {

View File

@@ -4,19 +4,39 @@ let
homeLetters = [ "a" "b" "c" "d" "h" "i" "j" "k" "l" "m" "z" ]; homeLetters = [ "a" "b" "c" "d" "h" "i" "j" "k" "l" "m" "z" ];
phpOptions = lib.concatStringsSep "\n" (lib.mapAttrsToList (k: v: "${k} = ${v}"){
display_errors = "Off";
display_startup_errors = "Off";
post_max_size = "40M";
upload_max_filesize = "40M";
});
# https://nixos.org/manual/nixpkgs/stable/#ssec-php-user-guide-installing-with-extensions # https://nixos.org/manual/nixpkgs/stable/#ssec-php-user-guide-installing-with-extensions
phpEnv = pkgs.php.buildEnv { phpEnv = pkgs.php.buildEnv {
extensions = { all, ... }: with all; [ extensions = { all, ... }: with all; [
bz2
curl
decimal
gd
imagick imagick
opcache mysqli
protobuf mysqlnd
pgsql
posix
protobuf sqlite3
uuid
xml
xsl
zlib
zstd
pdo
pdo_mysql
pdo_pgsql
pdo_sqlite
]; ];
extraConfig = '' extraConfig = phpOptions;
display_errors=0
post_max_size = 40M
upload_max_filesize = 40M
'';
}; };
perlEnv = pkgs.perl.withPackages (ps: with ps; [ perlEnv = pkgs.perl.withPackages (ps: with ps; [
@@ -25,38 +45,15 @@ let
pkgs.irssi pkgs.irssi
pkgs.nix.libs.nix-perl-bindings pkgs.nix.libs.nix-perl-bindings
AlgorithmDiff
AnyEvent
AnyEventI3
ArchiveZip
CGI CGI
CPAN
CPANPLUS
DBDPg DBDPg
DBDSQLite DBDSQLite
DBDmysql
DBI DBI
EmailAddress
EmailSimple
Env
Git Git
HTMLMason
HTMLParser
HTMLTagset
HTTPDAV
HTTPDaemon
ImageMagick ImageMagick
JSON JSON
LWP TemplateToolkit
MozillaCA
PathTiny
Switch
SysSyslog
TestPostgreSQL
TextPDF
TieFile
Tk
URI
XMLLibXML
]); ]);
# https://nixos.org/manual/nixpkgs/stable/#python.buildenv-function # https://nixos.org/manual/nixpkgs/stable/#python.buildenv-function
@@ -70,102 +67,88 @@ let
ignoreCollisions = true; ignoreCollisions = true;
}; };
sendmailWrapper = pkgs.writeShellApplication {
name = "sendmail";
runtimeInputs = [ ];
text = ''
args=("$@")
if [[ -z "$USERDIR_USER" ]] && [[ "$USERDIR_USER" != "pvv" ]]; then
# Prepend -fusername to the argument list, so bounces go to the user
args=("-f$USERDIR_USER" "''${args[@]}")
fi
exec '${lib.getExe pkgs.system-sendmail}' "''${args[@]}"
'';
};
# https://nixos.org/manual/nixpkgs/stable/#sec-building-environment # https://nixos.org/manual/nixpkgs/stable/#sec-building-environment
fhsEnv = pkgs.buildEnv { fhsEnv = pkgs.buildEnv {
name = "userweb-env"; name = "userweb-env";
ignoreCollisions = true;
paths = with pkgs; [ paths = with pkgs; [
bash bash
sendmailWrapper
perlEnv perlEnv
pythonEnv pythonEnv
phpEnv phpEnv
] ]
++ (with phpEnv.packages; [ ++ (with phpEnv.packages; [
# composer # composer
]) ])
++ [ ++ [
# Useful packages for homepages
exiftool
gnuplot
ikiwiki-full
imagemagick
jhead
ruby
sbcl
sourceHighlight
# Missing packages from tom
# blosxom
# pyblosxom
# mediawiki (TODO: do people host their own mediawikis in userweb?)
# nanoblogger
# Version control
cvs
rcs
git
# Compression/Archival
bzip2
gnutar
gzip
lz4
unzip
xz
zip
zstd
# Other tools you might expect to find on a normal system
acl acl
aspell
autoconf
autotrash
bazel
bintools
bison
bsd-finger
catdoc
ccache
clang
cmake
coreutils-full coreutils-full
curl curl
devcontainer
diffutils diffutils
emacs
# exiftags
exiftool
ffmpeg
file file
findutils findutils
gawk gawk
gcc
glibc
gnugrep gnugrep
gnumake gnumake
gnupg gnupg
gnuplot
gnused gnused
gnutar
gzip
html-tidy
imagemagick
inetutils
iproute2
jhead
less less
libgcc man
lndir
mailutils
man # TODO: does this one want a mandb instance?
meson
more
mpc
mpi
mplayer
ninja
nix
openssh
openssl
patchelf
pkg-config
ppp
procmail
procps
qemu
rc
rhash
rsync
ruby # TODO: does this one want systemwide packages?
salt
sccache
sourceHighlight
spamassassin
strace
subversion
system-sendmail
systemdMinimal
texliveMedium
tmux
unzip
util-linux util-linux
valgrind
vim vim
wget wget
which which
wine
xdg-utils xdg-utils
zip
zstd
]; ];
extraOutputsToInstall = [ extraOutputsToInstall = [
@@ -175,6 +158,10 @@ let
}; };
in in
{ {
imports = [
./mail.nix
];
services.httpd = { services.httpd = {
enable = true; enable = true;
adminAddr = "drift@pvv.ntnu.no"; adminAddr = "drift@pvv.ntnu.no";
@@ -189,6 +176,7 @@ in
enablePHP = true; enablePHP = true;
phpPackage = phpEnv; phpPackage = phpEnv;
inherit phpOptions;
enablePerl = true; enablePerl = true;
@@ -225,12 +213,32 @@ in
UserDir disabled root UserDir disabled root
AddHandler cgi-script .cgi AddHandler cgi-script .cgi
DirectoryIndex index.html index.html.var index.php index.php3 index.cgi index.phtml index.shtml meg.html DirectoryIndex index.html index.html.var index.php index.php3 index.cgi index.phtml index.shtml meg.html
SetEnvIf Request_URI "^/~([^/]+)" USERDIR_USER=$1
<Directory "/home/pvv/?/*/web-docs"> <Directory "/home/pvv/?/*/web-docs">
Options MultiViews Indexes SymLinksIfOwnerMatch ExecCGI IncludesNoExec Options MultiViews Indexes SymLinksIfOwnerMatch ExecCGI IncludesNoExec
AllowOverride All AllowOverride All
Require all granted Require all granted
</Directory> </Directory>
<DirectoryMatch "^/home/pvv/.*/web-docs/(${lib.concatStringsSep "|" [
"\\.git"
"\\.hg"
"\\.svn"
"\\.ssh"
"\\.env"
"\\.envrc"
"\\.bzr"
"\\.venv"
"CVS"
"RCS"
".*\\.swp"
".*\\.bak"
".*~"
]})(/|$)">
AllowOverride All
Require all denied
</DirectoryMatch>
''; '';
}; };
}; };

View File

@@ -0,0 +1,12 @@
{ config, lib, ... }:
{
services.postfix.enable = lib.mkForce false;
services.nullmailer = {
enable = true;
config = {
me = config.networking.fqdn;
remotes = "mail.pvv.ntnu.no smtp --port=25";
};
};
}

View File

@@ -77,29 +77,29 @@ in
id id
echo "Before if statement" echo "Before if statement"
stat ''${REGISTRATION_FILE} stat "''${REGISTRATION_FILE}"
if [[ ! -f ''${REGISTRATION_FILE} ]]; then if [[ ! -f "''${REGISTRATION_FILE}" ]]; then
echo "No registration file found at '$REGISTRATION_FILE'" echo "No registration file found at '$REGISTRATION_FILE'"
cp --no-preserve=mode,ownership ${baseConfig} ''${REGISTRATION_FILE} cp --no-preserve=mode,ownership "${baseConfig}" "''${REGISTRATION_FILE}"
fi fi
echo "After if statement" echo "After if statement"
stat ''${REGISTRATION_FILE} stat "''${REGISTRATION_FILE}"
AS_TOKEN=$(${lib.getExe pkgs.jq} -r .as_token ''${REGISTRATION_FILE}) AS_TOKEN="$('${lib.getExe pkgs.jq}' -r .as_token "''${REGISTRATION_FILE}")"
HS_TOKEN=$(${lib.getExe pkgs.jq} -r .hs_token ''${REGISTRATION_FILE}) HS_TOKEN="$('${lib.getExe pkgs.jq}' -r .hs_token "''${REGISTRATION_FILE}")"
DISCORD_TOKEN=$(cat /run/credentials/matrix-ooye-pre-start.service/discord_token) DISCORD_TOKEN="$(cat /run/credentials/matrix-ooye-pre-start.service/discord_token)"
DISCORD_CLIENT_SECRET=$(cat /run/credentials/matrix-ooye-pre-start.service/discord_client_secret) DISCORD_CLIENT_SECRET="$(cat /run/credentials/matrix-ooye-pre-start.service/discord_client_secret)"
# Check if we have all required tokens # Check if we have all required tokens
if [[ -z "$AS_TOKEN" || "$AS_TOKEN" == "null" ]]; then if [[ -z "$AS_TOKEN" || "$AS_TOKEN" == "null" ]]; then
AS_TOKEN=$(${lib.getExe pkgs.openssl} rand -hex 64) AS_TOKEN="$('${lib.getExe pkgs.openssl}' rand -hex 64)"
echo "Generated new AS token: ''${AS_TOKEN}" echo "Generated new AS token: ''${AS_TOKEN}"
fi fi
if [[ -z "$HS_TOKEN" || "$HS_TOKEN" == "null" ]]; then if [[ -z "$HS_TOKEN" || "$HS_TOKEN" == "null" ]]; then
HS_TOKEN=$(${lib.getExe pkgs.openssl} rand -hex 64) HS_TOKEN="$('${lib.getExe pkgs.openssl}' rand -hex 64)"
echo "Generated new HS token: ''${HS_TOKEN}" echo "Generated new HS token: ''${HS_TOKEN}"
fi fi
@@ -115,13 +115,13 @@ in
exit 1 exit 1
fi fi
shred -u ''${REGISTRATION_FILE} shred -u "''${REGISTRATION_FILE}"
cp --no-preserve=mode,ownership ${baseConfig} ''${REGISTRATION_FILE} cp --no-preserve=mode,ownership "${baseConfig}" "''${REGISTRATION_FILE}"
${lib.getExe pkgs.jq} '.as_token = "'$AS_TOKEN'" | .hs_token = "'$HS_TOKEN'" | .ooye.discord_token = "'$DISCORD_TOKEN'" | .ooye.discord_client_secret = "'$DISCORD_CLIENT_SECRET'"' ''${REGISTRATION_FILE} > ''${REGISTRATION_FILE}.tmp '${lib.getExe pkgs.jq}' '.as_token = "'$AS_TOKEN'" | .hs_token = "'$HS_TOKEN'" | .ooye.discord_token = "'$DISCORD_TOKEN'" | .ooye.discord_client_secret = "'$DISCORD_CLIENT_SECRET'"' "''${REGISTRATION_FILE}" > "''${REGISTRATION_FILE}.tmp"
shred -u ''${REGISTRATION_FILE} shred -u "''${REGISTRATION_FILE}"
mv ''${REGISTRATION_FILE}.tmp ''${REGISTRATION_FILE} mv "''${REGISTRATION_FILE}.tmp" "''${REGISTRATION_FILE}"
''; '';
in in

View File

@@ -51,24 +51,24 @@ in
script = let script = let
openssl = lib.getExe pkgs.openssl; openssl = lib.getExe pkgs.openssl;
in lib.concatMapStringsSep "\n" ({ name, value }: '' in lib.concatMapStringsSep "\n" ({ name, value }: ''
mkdir -p $(dirname "${value.certificate}") $(dirname "${value.certificateKey}") mkdir -p "$(dirname '${value.certificate}')" "$(dirname '${value.certificateKey}')"
if ! ${openssl} x509 -checkend 86400 -noout -in ${value.certificate} if ! ${openssl} x509 -checkend 86400 -noout -in '${value.certificate}'
then then
echo "Regenerating '${value.certificate}'" echo "Regenerating '${value.certificate}'"
${openssl} req \ ${openssl} req \
-newkey rsa:4096 \ -newkey rsa:4096 \
-new -x509 \ -new -x509 \
-days "${toString value.daysValid}" \ -days '${toString value.daysValid}' \
-nodes \ -nodes \
-subj "${value.subject}" \ -subj '${value.subject}' \
-out "${value.certificate}" \ -out '${value.certificate}' \
-keyout "${value.certificateKey}" \ -keyout '${value.certificateKey}' \
${lib.escapeShellArgs value.extraOpenSSLArgs} ${lib.escapeShellArgs value.extraOpenSSLArgs}
fi fi
chown "${value.owner}:${value.group}" "${value.certificate}" chown '${value.owner}:${value.group}' '${value.certificate}'
chown "${value.owner}:${value.group}" "${value.certificateKey}" chown '${value.owner}:${value.group}' '${value.certificateKey}'
chmod "${value.mode}" "${value.certificate}" chmod '${value.mode}' '${value.certificate}'
chmod "${value.mode}" "${value.certificateKey}" chmod '${value.mode}' '${value.certificateKey}'
echo "\n-----------------\n" echo "\n-----------------\n"
'') (lib.attrsToList cfg); '') (lib.attrsToList cfg);

View File

@@ -33,63 +33,63 @@ in
lib.mergeAttrsList [ lib.mergeAttrsList [
(mw-ext { (mw-ext {
name = "CodeEditor"; name = "CodeEditor";
commit = "83e1d0c13f34746f0d7049e38b00e9ab0a47c23f"; commit = "2db9c9cef35d88a0696b926e8e4ea2d479d0d73a";
hash = "sha256-qH9fSQZGA+z6tBSh1DaTKLcujqA6K/vQmZML9w5X8mU="; hash = "sha256-f0tWJl/4hml+RCp7OoIpQ4WSGKE3/z8DTYOAOHbLA9A=";
}) })
(mw-ext { (mw-ext {
name = "CodeMirror"; name = "CodeMirror";
commit = "af2b08b9ad2b89a64b2626cf80b026c5b45e9922"; commit = "b16e614c3c4ba68c346b8dd7393ab005ab127441";
hash = "sha256-CxXPwCKUlF9Tg4JhwLaKQyvt43owq75jCugVtb3VX+I="; hash = "sha256-J/TJPo5Oxgpy6UQINivLKl8jzJp4k/mKv6br3kcCSMQ=";
}) })
(mw-ext { (mw-ext {
name = "DeleteBatch"; name = "DeleteBatch";
commit = "3d6f2fd0e3efdae1087dd0cc8b1f96fe0edf734f"; commit = "1b947c0f80249cf052b58138f830b379edf080bc";
hash = "sha256-iD9EjDIW7AGpZan74SIRcr54dV8W7xMKIDjatjdVkKs="; hash = "sha256-629RCz+38m2pfyJe/CrYutRoDyN1HzD0KzDdC2wwqlI=";
}) })
(mw-ext { (mw-ext {
name = "PluggableAuth"; name = "PluggableAuth";
commit = "85e96acd1ac0ebcdaa29c20eae721767a938f426"; commit = "56893b8ee9ecd03eaee256e08c38bc82657ee0a1";
hash = "sha256-bMVhrg8FsfWhXF605Cj5TgI0A6Jy/MIQ5aaUcLQQ0Ss="; hash = "sha256-gvoJey7YLMk+toutQTdWxpaedNDr59E+3xXWmXWCGl0=";
}) })
(mw-ext { (mw-ext {
name = "Popups"; name = "Popups";
commit = "410e2343c32a7b18dcdc2bbd995b0bfdf3bf5f37"; commit = "6732d8d195bd8312779d8514e92bad372ef63096";
hash = "sha256-u2AlR75x54rCpiK9Mz00D9odJCn8fmi6DRU4QKmKqSc="; hash = "sha256-XZzhA9UjAOUMcoGYYwiqRg2uInZ927JOZ9/IrZtarJU=";
}) })
(mw-ext { (mw-ext {
name = "Scribunto"; name = "Scribunto";
commit = "904f323f343dba5ff6a6cdd143c4a8ef5b7d2c55"; commit = "fc9658623bd37fad352e326ce81b2a08ef55f04d";
hash = "sha256-ZOVYhjMMyWbqwZOBb39hMIRmzzCPEnz2y8Q2jgyeERw="; hash = "sha256-P9WQk8O9qP+vXsBS9A5eXX+bRhnfqHetbkXwU3+c1Vk=";
}) })
(mw-ext { (mw-ext {
name = "SimpleSAMLphp"; name = "SimpleSAMLphp";
kebab-name = "simple-saml-php"; kebab-name = "simple-saml-php";
commit = "a2f77374713473d594e368de24539aebcc1a800a"; commit = "4c615a9203860bb908f2476a5467573e3287d224";
hash = "sha256-5+t3VQFKcrIffDNPJ4RWBIWS6K1gTOcEleYWmM6xWms="; hash = "sha256-zNKvzInhdW3B101Hcghk/8m0Y+Qk/7XN7n0i/x/5hSE=";
}) })
(mw-ext { (mw-ext {
name = "TemplateData"; name = "TemplateData";
commit = "76a6a04bd13a606923847ba68750b5d98372cacd"; commit = "6884b10e603dce82ee39632f839ee5ccd8a6fbe3";
hash = "sha256-X2+U5PMqzkSljw2ypIvJUSaPDaonTkQx89OgKzf5scw="; hash = "sha256-jcLe3r5fPIrQlp89N+PdIUSC7bkdd7pTmiYppSpdKVQ=";
}) })
(mw-ext { (mw-ext {
name = "TemplateStyles"; name = "TemplateStyles";
commit = "7de60a8da6576d7930f293d19ef83529abf52704"; commit = "f0401a6b82528c8fd5a0375f1e55e72d1211f2ab";
hash = "sha256-iPmFDoO5V4964CVyd1mBSQcNlW34odbvpm2CfDBlPBU="; hash = "sha256-tEcCNBz/i9OaE3mNrqw0J2K336BAf6it30TLhQkbtKs=";
}) })
(mw-ext { (mw-ext {
name = "UserMerge"; name = "UserMerge";
commit = "71eb53ff4289ac4efaa31685ab8b6483c165a584"; commit = "6c138ffc65991766fd58ff4739fcb7febf097146";
hash = "sha256-OfKSEPgctfr659oh5jf99T0Rzqn+60JhNaZq+2gfubk="; hash = "sha256-366Nb0ilmXixWgk5NgCuoxj82Mf0iRu1bC/L/eofAxU=";
}) })
(mw-ext { (mw-ext {
name = "VisualEditor"; name = "VisualEditor";
commit = "a6a63f53605c4d596c3df1dcc2583ffd3eb8d929"; commit = "9cfcca3195bf88225844f136da90ab7a1f6dd0b9";
hash = "sha256-4d8picO66uzKoxh1TdyvKLHebc6ZL7N2DdXLV2vgBL4="; hash = "sha256-jHw3RnUB3bQa1OvmzhEBqadZlFPWH62iGl5BLXi3nZ4=";
}) })
(mw-ext { (mw-ext {
name = "WikiEditor"; name = "WikiEditor";
commit = "0a5719bb95326123dd0fee1f88658358321ed7be"; commit = "fe5329ba7a8c71ac8236cd0e940a64de2645b780";
hash = "sha256-eQMyjhdm1E6TkktIHad1NMeMo8QNoO8z4A05FYOMCwQ="; hash = "sha256-no6kH7esqKiZv34btidzy2zLd75SBVb8EaYVhfRPQSI=";
}) })
] ]

View File

@@ -83,7 +83,7 @@ def get_newest_commit(project_name: str, tracking_branch: str) -> str:
content = requests.get(f"{BASE_WEB_URL}/{project_name}/+log/refs/heads/{tracking_branch}/").text content = requests.get(f"{BASE_WEB_URL}/{project_name}/+log/refs/heads/{tracking_branch}/").text
soup = bs4.BeautifulSoup(content, features="html.parser") soup = bs4.BeautifulSoup(content, features="html.parser")
try: try:
a = soup.find('li').findChild('a') a = soup.find('li').find('a')
commit_sha = a['href'].split('/')[-1] commit_sha = a['href'].split('/')[-1]
except AttributeError: except AttributeError:
print(f"ERROR: Could not parse page for {project_name}:") print(f"ERROR: Could not parse page for {project_name}:")

View File

@@ -8,18 +8,18 @@
php.buildComposerProject rec { php.buildComposerProject rec {
pname = "simplesamlphp"; pname = "simplesamlphp";
version = "2.4.3"; version = "2.5.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "simplesamlphp"; owner = "simplesamlphp";
repo = "simplesamlphp"; repo = "simplesamlphp";
tag = "v${version}"; tag = "v${version}";
hash = "sha256-vv4gzcnPfMapd8gER2Vsng1SBloHKWrJJltnw2HUnX4="; hash = "sha256-Md07vWhB/5MDUH+SPQEs8PYiUrkEgAyqQl+LO+ap0Sw=";
}; };
composerStrictValidation = false; composerStrictValidation = false;
vendorHash = "sha256-vu3Iz6fRk3Gnh9Psn46jgRYKkmqGte+5xHBRmvdgKG4="; vendorHash = "sha256-GrEoGJXEyI1Ib+06GIuo5eRwxQ0UMKeX5RswShu2CHM=";
# TODO: metadata could be fetched automagically with these: # TODO: metadata could be fetched automagically with these:
# - https://simplesamlphp.org/docs/contrib_modules/metarefresh/simplesamlphp-automated_metadata.html # - https://simplesamlphp.org/docs/contrib_modules/metarefresh/simplesamlphp-automated_metadata.html

View File

@@ -228,6 +228,7 @@ in {
(mkConnection "demiurgen" "eno1") (mkConnection "demiurgen" "eno1")
(mkConnection "sanctuary" "ethernet_0") (mkConnection "sanctuary" "ethernet_0")
(mkConnection "torskas" "eth0") (mkConnection "torskas" "eth0")
(mkConnection "skrot" "enp2s0")
(mkConnection "homeassistant" "eth0") (mkConnection "homeassistant" "eth0")
(mkConnection "orchid" "eth0") (mkConnection "orchid" "eth0")
(mkConnection "principal" "em0") (mkConnection "principal" "em0")

View File

@@ -37,10 +37,10 @@ in rec {
ipv6 = pvv-ipv6 168; ipv6 = pvv-ipv6 168;
}; };
ildkule = { ildkule = {
ipv4 = "129.241.153.213"; ipv4 = "129.241.100.145";
ipv4_internal = "192.168.12.209"; ipv4_internal = "192.168.1.17";
ipv4_internal_gw = "192.168.12.1"; ipv4_internal_gw = "192.168.1.1";
ipv6 = "2001:700:300:6026:f816:3eff:fe58:f1e8"; ipv6 = "2001:700:305:8a0f:f816:3eff:fef5:e400";
}; };
bicep = { bicep = {
ipv4 = pvv-ipv4 209; ipv4 = pvv-ipv4 209;
@@ -118,9 +118,9 @@ in rec {
}; };
defaultNetworkConfig = { defaultNetworkConfig = {
dns = [ "129.241.0.200" "129.241.0.201" "2001:700:300:1900::200" "2001:700:300:1900::201" ]; dns = ["129.241.0.200" "129.241.0.201" "2001:700:300:1900::200" "2001:700:300:1900::201"];
domains = [ "pvv.ntnu.no" "pvv.org" ]; domains = ["pvv.ntnu.no" "pvv.org"];
gateway = [ hosts.gateway hosts.gateway6 ]; gateway = [hosts.gateway hosts.gateway6];
networkConfig.IPv6AcceptRA = "no"; networkConfig.IPv6AcceptRA = "no";
DHCP = "no"; DHCP = "no";