mirror of
https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git
synced 2026-05-28 17:21:12 +02:00
Compare commits
11 Commits
setup-open
...
the-heccin
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9bc07d6e9 | ||
|
|
3372712e26 | ||
|
|
7e586e082e | ||
|
|
47a744f68f | ||
|
|
da505d4fe2 | ||
|
|
18ab1ef982 | ||
|
|
5023edeb13 | ||
|
|
0d8c26c548 | ||
|
|
bd244e7797 | ||
|
|
e9220bb31e | ||
|
|
6beb9c62c3 |
62
flake.lock
generated
62
flake.lock
generated
@@ -1,5 +1,27 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"bro": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"rust-overlay": "rust-overlay"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1779629827,
|
||||||
|
"narHash": "sha256-nrlB50/oelB8oFx9DhOoXI5z0VoTZGEA6XxYvkvpqDA=",
|
||||||
|
"ref": "main",
|
||||||
|
"rev": "7d0f35e12e4dec39f981c08fc33515589f41f4a5",
|
||||||
|
"revCount": 3,
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.pvv.ntnu.no/Projects/bro.git"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"ref": "main",
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.pvv.ntnu.no/Projects/bro.git"
|
||||||
|
}
|
||||||
|
},
|
||||||
"crane": {
|
"crane": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1776635034,
|
"lastModified": 1776635034,
|
||||||
@@ -101,7 +123,7 @@
|
|||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs-unstable"
|
"nixpkgs-unstable"
|
||||||
],
|
],
|
||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1777019032,
|
"lastModified": 1777019032,
|
||||||
@@ -165,7 +187,7 @@
|
|||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
"rust-overlay": "rust-overlay_2"
|
"rust-overlay": "rust-overlay_3"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1767906976,
|
"lastModified": 1767906976,
|
||||||
@@ -294,11 +316,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1764869785,
|
"lastModified": 1779774845,
|
||||||
"narHash": "sha256-FGTIpC7gB4lbeL0bfYzn1Ge0PaCpd7VqWBLhJBx0i4A=",
|
"narHash": "sha256-QJU1J4eupwjRrtvWGzRut0GY3woql92RS9O/acWkJkk=",
|
||||||
"ref": "main",
|
"ref": "main",
|
||||||
"rev": "8ce7fb0b1918bdb3d1489a40d73895693955e8b2",
|
"rev": "13667cd216db260ab549e6f1b6281aa230d2f9e0",
|
||||||
"revCount": 23,
|
"revCount": 29,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.pvv.ntnu.no/Projects/calendar-bot.git"
|
"url": "https://git.pvv.ntnu.no/Projects/calendar-bot.git"
|
||||||
},
|
},
|
||||||
@@ -352,6 +374,7 @@
|
|||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"bro": "bro",
|
||||||
"dibbler": "dibbler",
|
"dibbler": "dibbler",
|
||||||
"disko": "disko",
|
"disko": "disko",
|
||||||
"gergle": "gergle",
|
"gergle": "gergle",
|
||||||
@@ -377,7 +400,7 @@
|
|||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
"rust-overlay": "rust-overlay_3"
|
"rust-overlay": "rust-overlay_4"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1778600367,
|
"lastModified": 1778600367,
|
||||||
@@ -396,6 +419,27 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-overlay": {
|
"rust-overlay": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"bro",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1779419951,
|
||||||
|
"narHash": "sha256-dMX0PUslUHPajP6o8FEoRdFv9afq/dec4POR0vVfjK4=",
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"rev": "5b5c521d6cae9ef4aa32f888eb2c0ce595c9be52",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rust-overlay_2": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"greg-ng",
|
"greg-ng",
|
||||||
@@ -416,7 +460,7 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-overlay_2": {
|
"rust-overlay_3": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"minecraft-heatmap",
|
"minecraft-heatmap",
|
||||||
@@ -437,7 +481,7 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-overlay_3": {
|
"rust-overlay_4": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"roowho2",
|
"roowho2",
|
||||||
|
|||||||
26
flake.nix
26
flake.nix
@@ -47,6 +47,9 @@
|
|||||||
|
|
||||||
qotd.url = "git+https://git.pvv.ntnu.no/Projects/qotd.git?ref=main";
|
qotd.url = "git+https://git.pvv.ntnu.no/Projects/qotd.git?ref=main";
|
||||||
qotd.inputs.nixpkgs.follows = "nixpkgs";
|
qotd.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
|
bro.url = "git+https://git.pvv.ntnu.no/Projects/bro.git?ref=main";
|
||||||
|
bro.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs = {
|
||||||
@@ -214,7 +217,14 @@
|
|||||||
};
|
};
|
||||||
shark = stableNixosConfig "shark" {};
|
shark = stableNixosConfig "shark" {};
|
||||||
wenche = stableNixosConfig "wenche" {};
|
wenche = stableNixosConfig "wenche" {};
|
||||||
temmie = stableNixosConfig "temmie" {};
|
temmie = stableNixosConfig "temmie" {
|
||||||
|
overlays = [
|
||||||
|
inputs.bro.overlays.default
|
||||||
|
];
|
||||||
|
modules = [
|
||||||
|
inputs.bro.nixosModules.default
|
||||||
|
];
|
||||||
|
};
|
||||||
gluttony = stableNixosConfig "gluttony" {
|
gluttony = stableNixosConfig "gluttony" {
|
||||||
overlays = [
|
overlays = [
|
||||||
(final: prev: { bluemap = final.callPackage ./packages/bluemap.nix {}; })
|
(final: prev: { bluemap = final.callPackage ./packages/bluemap.nix {}; })
|
||||||
@@ -232,20 +242,6 @@
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
grevling = stableNixosConfig "grevling" {
|
|
||||||
modules = [
|
|
||||||
./hosts/grevling/configuration.nix
|
|
||||||
sops-nix.nixosModules.sops
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
tuba = stableNixosConfig "grevling" {
|
|
||||||
modules = [
|
|
||||||
./hosts/tuba/configuration.nix
|
|
||||||
sops-nix.nixosModules.sops
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
brzeczyszczykiewicz = stableNixosConfig "brzeczyszczykiewicz" {
|
brzeczyszczykiewicz = stableNixosConfig "brzeczyszczykiewicz" {
|
||||||
modules = [
|
modules = [
|
||||||
inputs.grzegorz-clients.nixosModules.grzegorz-webui
|
inputs.grzegorz-clients.nixosModules.grzegorz-webui
|
||||||
|
|||||||
39
hosts/bikkje/hardware-configuration.nix
Normal file
39
hosts/bikkje/hardware-configuration.nix
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# Do 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 and run ⟪nix-env --switch-profile⟫ instead.
|
||||||
|
{ config, lib, pkgs, modulesPath, home-manager, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports =
|
||||||
|
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||||
|
];
|
||||||
|
|
||||||
|
boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "af_alg" "esp4" "esp6" "rds" ];
|
||||||
|
boot.initrd.kernelModules = [ ];
|
||||||
|
boot.kernelModules = [ "kvm-amd" ];
|
||||||
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
|
fileSystems."/" =
|
||||||
|
{ device = "/dev/sdj1";
|
||||||
|
fsType = "bcachefs";
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/boott" =
|
||||||
|
{ device = "/dev/disk/by-uuid/AAAA-AAAA";
|
||||||
|
fsType = "vfat";
|
||||||
|
};
|
||||||
|
|
||||||
|
# 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.em1.useDHCP = lib.mkDefault true;
|
||||||
|
# networking.interfaces.em2.useDHCP = lib.mkDefault true;
|
||||||
|
# networking.interfaces.pflog0.useDHCP = lib.mkDefault true;
|
||||||
|
|
||||||
|
nixpkgs.hostPlatform = lib.mkDefault "i686-freebsd";
|
||||||
|
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
|
hardware.infiniband.enable = true;
|
||||||
|
hardware.flipperzero.enable = lib.mkIf (config.security.isolate.cgRoot == "auto:/run/isolate/tank") true;
|
||||||
|
}
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
{ config, pkgs, values, ... }:
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
# Include the results of the hardware scan.
|
|
||||||
./hardware-configuration.nix
|
|
||||||
../../base.nix
|
|
||||||
../../misc/metrics-exporters.nix
|
|
||||||
|
|
||||||
./services/openvpn
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.loader.systemd-boot.enable = true;
|
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
|
||||||
|
|
||||||
networking.hostName = "grevling";
|
|
||||||
|
|
||||||
# systemd.network.networks."30-eno1" = values.defaultNetworkConfig // {
|
|
||||||
# matchConfig.Name = "eno1";
|
|
||||||
# address = with values.hosts.georg; [ (ipv4 + "/25") (ipv6 + "/64") ];
|
|
||||||
# };
|
|
||||||
|
|
||||||
# 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,40 +0,0 @@
|
|||||||
# 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" "ehci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
|
|
||||||
boot.initrd.kernelModules = [ ];
|
|
||||||
boot.kernelModules = [ "kvm-intel" ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
|
|
||||||
fileSystems."/" =
|
|
||||||
{ device = "/dev/disk/by-uuid/33825f0d-5a63-40fc-83db-bfa1ebb72ba0";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/boot" =
|
|
||||||
{ device = "/dev/disk/by-uuid/145E-7362";
|
|
||||||
fsType = "vfat";
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices =
|
|
||||||
[ { device = "/dev/disk/by-uuid/7ed27e21-3247-44cd-8bcc-5d4a2efebf57"; }
|
|
||||||
];
|
|
||||||
|
|
||||||
# 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.eno1.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.enp2s2.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
|
||||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
{ pkgs, lib, values, ... }:
|
|
||||||
{
|
|
||||||
services.openvpn.servers."ov-tunnel" = {
|
|
||||||
config = let
|
|
||||||
conf = {
|
|
||||||
# TODO: use aliases
|
|
||||||
local = "129.241.210.191";
|
|
||||||
port = 1194;
|
|
||||||
proto = "udp";
|
|
||||||
dev = "tap";
|
|
||||||
|
|
||||||
# TODO: set up
|
|
||||||
ca = "";
|
|
||||||
cert = "";
|
|
||||||
key = "";
|
|
||||||
dh = "";
|
|
||||||
|
|
||||||
# Maintain a record of client <-> virtual IP address
|
|
||||||
# associations in this file. If OpenVPN goes down or
|
|
||||||
# is restarted, reconnecting clients can be assigned
|
|
||||||
# the same virtual IP address from the pool that was
|
|
||||||
# previously assigned.
|
|
||||||
ifconfig-pool-persist = ./ipp.txt;
|
|
||||||
|
|
||||||
server-bridge = builtins.concatStringsSep " " [
|
|
||||||
"129.241.210.129"
|
|
||||||
"255.255.255.128"
|
|
||||||
"129.241.210.253"
|
|
||||||
"129.241.210.254"
|
|
||||||
];
|
|
||||||
|
|
||||||
keepalive = "10 120";
|
|
||||||
cipher = "none";
|
|
||||||
|
|
||||||
user = "nobody";
|
|
||||||
group = "nobody";
|
|
||||||
|
|
||||||
status = "/var/log/openvpn-status.log";
|
|
||||||
|
|
||||||
client-config-dir = pkgs.writeTextDir "tuba" ''
|
|
||||||
# Sett IP-adr. for tap0 til tubas PVV-adr.
|
|
||||||
ifconfig-push ${values.services.tuba-tap} 255.255.255.128
|
|
||||||
# Hvordan skal man faa dette til aa funke, tro?
|
|
||||||
#ifconfig-ipv6-push 2001:700:300:1900::xxx/64
|
|
||||||
|
|
||||||
# La tuba bruke std. PVV-gateway til all trafikk (unntatt
|
|
||||||
# VPN-tunnellen).
|
|
||||||
push "redirect-gateway"
|
|
||||||
'';
|
|
||||||
|
|
||||||
persist-key = true;
|
|
||||||
persist-tun = true;
|
|
||||||
|
|
||||||
verb = 5;
|
|
||||||
|
|
||||||
explicit-exit-notify = 1;
|
|
||||||
};
|
|
||||||
in lib.pipe conf [
|
|
||||||
(lib.filterAttrs (_: value: !(builtins.isNull value || value == false)))
|
|
||||||
(builtins.mapAttrs (_: value:
|
|
||||||
if builtins.isList value then builtins.concatStringsSep " " (map toString value)
|
|
||||||
else if value == true then value
|
|
||||||
else if builtins.any (f: f value) [
|
|
||||||
builtins.isString
|
|
||||||
builtins.isInt
|
|
||||||
builtins.isFloat
|
|
||||||
lib.isPath
|
|
||||||
lib.isDerivation
|
|
||||||
] then toString value
|
|
||||||
else throw "Unknown value in grevling openvpn config, deading now\n${value}"
|
|
||||||
))
|
|
||||||
(lib.mapAttrsToList (name: value: if value == true then name else "${name} ${value}"))
|
|
||||||
(builtins.concatStringsSep "\n")
|
|
||||||
(x: x + "\n\n")
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, values, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.services.uptime-kuma;
|
cfg = config.services.uptime-kuma;
|
||||||
domain = "status.pvv.ntnu.no";
|
domain = "status.pvv.ntnu.no";
|
||||||
@@ -24,4 +24,21 @@ in {
|
|||||||
fsType = "bind";
|
fsType = "bind";
|
||||||
options = [ "bind" ];
|
options = [ "bind" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.rsync-pull-targets = {
|
||||||
|
enable = true;
|
||||||
|
locations.${stateDir} = {
|
||||||
|
user = "root";
|
||||||
|
rrsyncArgs.ro = true;
|
||||||
|
authorizedKeysAttrs = [
|
||||||
|
"restrict"
|
||||||
|
"from=\"principal.pvv.ntnu.no,${values.hosts.principal.ipv6},${values.hosts.principal.ipv4}\""
|
||||||
|
"no-agent-forwarding"
|
||||||
|
"no-port-forwarding"
|
||||||
|
"no-pty"
|
||||||
|
"no-X11-forwarding"
|
||||||
|
];
|
||||||
|
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJXzcDm6cVr4NmWzUSroy33FlielKqaG83wY0RCMC0p/ uptime_kuma rsync backup";
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ in
|
|||||||
SIGNING_NAME = "PVV Git";
|
SIGNING_NAME = "PVV Git";
|
||||||
SIGNING_EMAIL = "gitea@git.pvv.ntnu.no";
|
SIGNING_EMAIL = "gitea@git.pvv.ntnu.no";
|
||||||
INITIAL_COMMIT = "always";
|
INITIAL_COMMIT = "always";
|
||||||
|
MERGES = lib.concatStringsSep "," [ "always" ];
|
||||||
|
CRUD_ACTIONS = lib.concatStringsSep "," [ "always" ];
|
||||||
WIKI = "always";
|
WIKI = "always";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ let
|
|||||||
extraConfig = phpOptions;
|
extraConfig = phpOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
perlEnv = pkgs.perl.withPackages (ps: with ps; [
|
perlEnv = (pkgs.perl.withPackages (ps: with ps; [
|
||||||
pkgs.exiftool
|
pkgs.exiftool
|
||||||
pkgs.ikiwiki
|
pkgs.ikiwiki
|
||||||
pkgs.irssi
|
pkgs.irssi
|
||||||
@@ -54,7 +54,14 @@ let
|
|||||||
ImageMagick
|
ImageMagick
|
||||||
JSON
|
JSON
|
||||||
TemplateToolkit
|
TemplateToolkit
|
||||||
]);
|
])).overrideAttrs (prev: {
|
||||||
|
# NOTE: `pkgs.perl.propagatedBuildInputs` don't actually propagate through the
|
||||||
|
# wrapper derivation created by `withPackages`. This should compensate
|
||||||
|
# for that.
|
||||||
|
postBuild = prev.postBuild + ''
|
||||||
|
cp -r '${pkgs.perl}/nix-support' "$out"/nix-support
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
|
||||||
# https://nixos.org/manual/nixpkgs/stable/#python.buildenv-function
|
# https://nixos.org/manual/nixpkgs/stable/#python.buildenv-function
|
||||||
pythonEnv = pkgs.python3.buildEnv.override {
|
pythonEnv = pkgs.python3.buildEnv.override {
|
||||||
@@ -67,21 +74,6 @@ 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";
|
||||||
@@ -89,7 +81,7 @@ let
|
|||||||
paths = with pkgs; [
|
paths = with pkgs; [
|
||||||
bash
|
bash
|
||||||
|
|
||||||
sendmailWrapper
|
config.services.bro.instances.userweb-sendmail.client.package
|
||||||
|
|
||||||
perlEnv
|
perlEnv
|
||||||
pythonEnv
|
pythonEnv
|
||||||
@@ -184,17 +176,21 @@ in
|
|||||||
extraModules = [
|
extraModules = [
|
||||||
"systemd"
|
"systemd"
|
||||||
"userdir"
|
"userdir"
|
||||||
# TODO: I think the compilation steps of pkgs.apacheHttpdPackages.mod_perl might have some
|
{
|
||||||
# incorrect or restrictive assumptions upstream, either nixpkgs or source
|
name = "perl";
|
||||||
# {
|
path = let
|
||||||
# name = "perl";
|
mod_perl = pkgs.symlinkJoin {
|
||||||
# path = let
|
name = "userweb_modperl_with_custom_perl_env";
|
||||||
# mod_perl = pkgs.apacheHttpdPackages.mod_perl.override {
|
ignoreCollisions = true;
|
||||||
# apacheHttpd = cfg.package.out;
|
paths = [
|
||||||
# perl = perlEnv;
|
(pkgs.apacheHttpdPackages.mod_perl.override {
|
||||||
# };
|
apacheHttpd = cfg.package.out;
|
||||||
# in "${mod_perl}/modules/mod_perl.so";
|
})
|
||||||
# }
|
perlEnv
|
||||||
|
];
|
||||||
|
};
|
||||||
|
in "${mod_perl}/modules/mod_perl.so";
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
@@ -203,11 +199,14 @@ in
|
|||||||
ScriptLog ${cfg.logDir}/cgi.log
|
ScriptLog ${cfg.logDir}/cgi.log
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# virtualHosts."userweb.pvv.ntnu.no" = {
|
|
||||||
virtualHosts."temmie.pvv.ntnu.no" = {
|
virtualHosts."temmie.pvv.ntnu.no" = {
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
|
|
||||||
|
serverAliases = [
|
||||||
|
"www2.pvv.ntnu.no"
|
||||||
|
];
|
||||||
|
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
UserDir ${lib.concatMapStringsSep " " (l: "/home/pvv/${l}/*/web-docs") homeLetters}
|
UserDir ${lib.concatMapStringsSep " " (l: "/home/pvv/${l}/*/web-docs") homeLetters}
|
||||||
UserDir disabled root
|
UserDir disabled root
|
||||||
@@ -258,6 +257,14 @@ in
|
|||||||
# ];
|
# ];
|
||||||
# };
|
# };
|
||||||
|
|
||||||
|
# NOTE: 54 -> 33, this is the UID/GID we used for www-data on tom in the past.
|
||||||
|
# Any files accessed by or created by httpd will do so over NFS with this
|
||||||
|
# UID/GID pair as its credentials.
|
||||||
|
# This overlaps with the hardcoded `disnix` uid in nixpkgs, but we *probably*
|
||||||
|
# won't be using that for the foreseeable future.
|
||||||
|
users.users."wwwrun".uid = lib.mkForce 33;
|
||||||
|
users.groups."wwwrun".gid = lib.mkForce 33;
|
||||||
|
|
||||||
systemd.services.httpd = {
|
systemd.services.httpd = {
|
||||||
after = [ "pvv-homedirs.target" ];
|
after = [ "pvv-homedirs.target" ];
|
||||||
requires = [ "pvv-homedirs.target" ];
|
requires = [ "pvv-homedirs.target" ];
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ config, lib, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
{
|
{
|
||||||
services.postfix.enable = lib.mkForce false;
|
services.postfix.enable = lib.mkForce false;
|
||||||
|
|
||||||
@@ -9,4 +9,111 @@
|
|||||||
remotes = "mail.pvv.ntnu.no smtp --port=25";
|
remotes = "mail.pvv.ntnu.no smtp --port=25";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.bro = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
instances.userweb-sendmail = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
client = {
|
||||||
|
settings.BRO_FILE_FLAGS = [
|
||||||
|
"-C"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
server = {
|
||||||
|
settings = {
|
||||||
|
executable = let
|
||||||
|
sendmailWrapper = pkgs.writeShellApplication {
|
||||||
|
name = "sendmail";
|
||||||
|
runtimeInputs = [ ];
|
||||||
|
bashOptions = [
|
||||||
|
"errexit"
|
||||||
|
"pipefail"
|
||||||
|
];
|
||||||
|
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}' -t -i "''${args[@]}"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in lib.getExe sendmailWrapper;
|
||||||
|
allowed-env = [ "USERDIR_USER" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = [
|
||||||
|
(config.services.bro.instances.userweb-sendmail.client.package.overrideAttrs (prev: {
|
||||||
|
buildCommand = prev.buildCommand + ''
|
||||||
|
mv "$out/bin/sendmail" "$out/bin/bro-sendmail"
|
||||||
|
'';
|
||||||
|
}))
|
||||||
|
];
|
||||||
|
|
||||||
|
users.users.nullmailer-user = {
|
||||||
|
enable = true;
|
||||||
|
isSystemUser = true;
|
||||||
|
group = "nullmailer-user";
|
||||||
|
};
|
||||||
|
|
||||||
|
users.groups.nullmailer-user = { };
|
||||||
|
|
||||||
|
systemd.services.bro-userweb-sendmail = {
|
||||||
|
serviceConfig = {
|
||||||
|
User = "nullmailer-user";
|
||||||
|
Group = "nullmailer-user";
|
||||||
|
|
||||||
|
ReadWritePaths = [
|
||||||
|
"/var/spool/nullmailer"
|
||||||
|
];
|
||||||
|
|
||||||
|
AmbientCapabilities = "";
|
||||||
|
CapabilityBoundingSet = "";
|
||||||
|
NoNewPrivileges = false;
|
||||||
|
ProtectSystem = "strict";
|
||||||
|
ProtectHome = true;
|
||||||
|
PrivateTmp = true;
|
||||||
|
PrivateDevices = true;
|
||||||
|
PrivateUsers = false;
|
||||||
|
ProtectHostname = true;
|
||||||
|
ProtectClock = true;
|
||||||
|
ProtectKernelTunables = true;
|
||||||
|
ProtectKernelModules = true;
|
||||||
|
ProtectKernelLogs = true;
|
||||||
|
ProtectControlGroups = true;
|
||||||
|
RestrictAddressFamilies = [
|
||||||
|
"AF_UNIX"
|
||||||
|
"AF_INET"
|
||||||
|
"AF_INET6"
|
||||||
|
"AF_NETLINK"
|
||||||
|
];
|
||||||
|
LockPersonality = true;
|
||||||
|
MemoryDenyWriteExecute = true;
|
||||||
|
PrivateMounts = true;
|
||||||
|
ProcSubset = "pid";
|
||||||
|
ProtectProc = "invisible";
|
||||||
|
RemoveIPC = true;
|
||||||
|
RestrictNamespaces = true;
|
||||||
|
RestrictRealtime = true;
|
||||||
|
RestrictSUIDSGID = true;
|
||||||
|
SystemCallArchitectures = "native";
|
||||||
|
SystemCallFilter = [
|
||||||
|
"@system-service"
|
||||||
|
"~@resources"
|
||||||
|
];
|
||||||
|
UMask = "0077";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.httpd.serviceConfig = {
|
||||||
|
BindPaths = [ (lib.head config.systemd.sockets.bro-userweb-sendmail.listenStreams) ];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
{ config, pkgs, values, ... }:
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
# Include the results of the hardware scan.
|
|
||||||
./hardware-configuration.nix
|
|
||||||
../../base.nix
|
|
||||||
../../misc/metrics-exporters.nix
|
|
||||||
|
|
||||||
./services/openvpn
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.loader.systemd-boot.enable = true;
|
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
|
||||||
|
|
||||||
networking.hostName = "tuba";
|
|
||||||
|
|
||||||
# systemd.network.networks."30-eno1" = values.defaultNetworkConfig // {
|
|
||||||
# matchConfig.Name = "eno1";
|
|
||||||
# address = with values.hosts.georg; [ (ipv4 + "/25") (ipv6 + "/64") ];
|
|
||||||
# };
|
|
||||||
|
|
||||||
# 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,40 +0,0 @@
|
|||||||
# 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" "ehci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
|
|
||||||
boot.initrd.kernelModules = [ ];
|
|
||||||
boot.kernelModules = [ "kvm-intel" ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
|
|
||||||
fileSystems."/" =
|
|
||||||
{ device = "/dev/disk/by-uuid/33825f0d-5a63-40fc-83db-bfa1ebb72ba0";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/boot" =
|
|
||||||
{ device = "/dev/disk/by-uuid/145E-7362";
|
|
||||||
fsType = "vfat";
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices =
|
|
||||||
[ { device = "/dev/disk/by-uuid/7ed27e21-3247-44cd-8bcc-5d4a2efebf57"; }
|
|
||||||
];
|
|
||||||
|
|
||||||
# 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.eno1.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.enp2s2.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
|
||||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
{ lib, values, ... }:
|
|
||||||
{
|
|
||||||
services.openvpn.servers."ov-tunnel" = {
|
|
||||||
config = let
|
|
||||||
conf = {
|
|
||||||
# TODO: use aliases
|
|
||||||
client = true;
|
|
||||||
dev = "tap";
|
|
||||||
proto = "udp";
|
|
||||||
remote = "129.241.210.191 1194";
|
|
||||||
|
|
||||||
resolv-retry = "infinite";
|
|
||||||
nobind = true;
|
|
||||||
|
|
||||||
# # TODO: set up
|
|
||||||
ca = "";
|
|
||||||
cert = "";
|
|
||||||
key = "";
|
|
||||||
remote-cert-tls = "server";
|
|
||||||
cipher = "none";
|
|
||||||
|
|
||||||
user = "nobody";
|
|
||||||
group = "nobody";
|
|
||||||
|
|
||||||
status = "/var/log/openvpn-status.log";
|
|
||||||
|
|
||||||
persist-key = true;
|
|
||||||
persist-tun = true;
|
|
||||||
|
|
||||||
verb = 5;
|
|
||||||
|
|
||||||
# script-security = 2;
|
|
||||||
# up = "systemctl restart rwhod";
|
|
||||||
};
|
|
||||||
in lib.pipe conf [
|
|
||||||
(lib.filterAttrs (_: value: !(builtins.isNull value || value == false)))
|
|
||||||
(builtins.mapAttrs (_: value:
|
|
||||||
if builtins.isList value then builtins.concatStringsSep " " (map toString value)
|
|
||||||
else if value == true then value
|
|
||||||
else if builtins.any (f: f value) [
|
|
||||||
builtins.isString
|
|
||||||
builtins.isInt
|
|
||||||
builtins.isFloat
|
|
||||||
lib.isPath
|
|
||||||
lib.isDerivation
|
|
||||||
] then toString value
|
|
||||||
else throw "Unknown value in tuba openvpn config, deading now\n${value}"
|
|
||||||
))
|
|
||||||
(lib.mapAttrsToList (name: value: if value == true then name else "${name} ${value}"))
|
|
||||||
(builtins.concatStringsSep "\n")
|
|
||||||
(x: x + "\n\n")
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -171,6 +171,9 @@ in
|
|||||||
requires = [ "matrix-ooye-pre-start.service" ];
|
requires = [ "matrix-ooye-pre-start.service" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
|
startLimitIntervalSec = 5;
|
||||||
|
startLimitBurst = 5;
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = lib.getExe config.services.matrix-ooye.package;
|
ExecStart = lib.getExe config.services.matrix-ooye.package;
|
||||||
WorkingDirectory = "/var/lib/matrix-ooye";
|
WorkingDirectory = "/var/lib/matrix-ooye";
|
||||||
@@ -182,8 +185,6 @@ in
|
|||||||
#PrivateDevices = true;
|
#PrivateDevices = true;
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSec = "5s";
|
RestartSec = "5s";
|
||||||
StartLimitIntervalSec = "5s";
|
|
||||||
StartLimitBurst = "5";
|
|
||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
14
values.nix
14
values.nix
@@ -26,12 +26,6 @@ in rec {
|
|||||||
ipv4 = pvv-ipv4 213;
|
ipv4 = pvv-ipv4 213;
|
||||||
ipv6 = pvv-ipv6 213;
|
ipv6 = pvv-ipv6 213;
|
||||||
};
|
};
|
||||||
grevling-tap = {
|
|
||||||
ipv4 = pvv-ipv4 251;
|
|
||||||
};
|
|
||||||
tuba-tap = {
|
|
||||||
ipv4 = pvv-ipv4 252;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
hosts = {
|
hosts = {
|
||||||
@@ -117,14 +111,6 @@ in rec {
|
|||||||
ipv4 = pvv-ipv4 228;
|
ipv4 = pvv-ipv4 228;
|
||||||
ipv6 = pvv-ipv6 228;
|
ipv6 = pvv-ipv6 228;
|
||||||
};
|
};
|
||||||
grevling = {
|
|
||||||
ipv4 = pvv-ipv4 198;
|
|
||||||
ipv6 = pvv-ipv6 198;
|
|
||||||
};
|
|
||||||
tuba = {
|
|
||||||
ipv4 = pvv-ipv4 199;
|
|
||||||
ipv6 = pvv-ipv6 199;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultNetworkConfig = {
|
defaultNetworkConfig = {
|
||||||
|
|||||||
Reference in New Issue
Block a user