16
0
Fork 0
This repository has been archived on 2023-12-19. You can view files and clone it, but cannot push or open issues or pull requests.
brzeczyszczykiewicz-flake/flake.nix

127 lines
4.5 KiB
Nix
Raw Normal View History

2023-08-26 23:22:13 +02:00
{
description = "bokhylle";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.grzegorz.url = "github:Programvareverkstedet/grzegorz";
inputs.grzegorz.inputs.nixpkgs.follows = "nixpkgs";
inputs.grzegorz-clients.url = "github:Programvareverkstedet/grzegorz-clients";
inputs.grzegorz-clients.inputs.nixpkgs.follows = "nixpkgs";
outputs = {
self,
nixpkgs,
grzegorz,
grzegorz-clients,
...
}@inputs:
{
inherit inputs;
nixosConfigurations.brzeczyszczykiewicz = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
grzegorz.nixosModules.grzegorz-kiosk
grzegorz-clients.nixosModules.grzegorz-webui
./hardware-configuration.nix
2023-08-27 01:01:20 +02:00
({ config, pkgs, ... }: {
2023-08-26 23:22:13 +02:00
system.stateVersion = "23.05";
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
boot.loader.grub.useOSProber = true;
2023-08-27 01:01:20 +02:00
services.resolved.enable = true;
2023-08-26 23:22:13 +02:00
networking.hostName = "brzeczyszczykiewicz";
networking.domain = "pvv.ntnu.no";
networking.search = [ "pvv.ntnu.no" ];
2023-08-27 01:01:20 +02:00
networking = {
interfaces = {
eno1.ipv4.addresses = [{
address = "129.241.210.205";
prefixLength = 25;
}];
eno1.ipv6.addresses = [{
address = "2001:700:300:1900::1:50";
prefixLength = 64;
}];
};
defaultGateway.address = "129.241.210.129";
defaultGateway.interface = "eno1";
defaultGateway6.address = "2001:700:300:1900::1";
defaultGateway6.interface = "eno1";
};
environment.systemPackages = with pkgs; [ git ];
2023-08-26 23:22:13 +02:00
services.openssh.enable = true;
services.openssh.settings.PermitRootLogin = "yes";
services.xserver.layout = "no";
services.xserver.xkbVariant = "";
console.keyMap = "no";
services.pipewire.enable = true;
services.pipewire.alsa.enable = true;
services.pipewire.alsa.support32Bit = true;
services.pipewire.pulse.enable = true;
users.users.pvv = {
isNormalUser = true;
description = "pvv";
extraGroups = [ "networkmanager" "wheel" ];
#packages = [ ];
};
services.grzegorz.enable = true;
2023-08-27 01:01:20 +02:00
services.grzegorz.listenAddr = "localhost";
2023-08-26 23:22:13 +02:00
services.grzegorz.listenPort = 31337;
services.grzegorz-webui.enable = true;
2023-08-27 01:01:20 +02:00
services.grzegorz-webui.listenAddr = "localhost";
services.grzegorz-webui.listenPort = 42069;
services.grzegorz-webui.listenWebsocketPort = 42042;
services.grzegorz-webui.hostName = "brzeczyszczykiewicz.pvv.ntnu.no";
services.grzegorz-webui.apiBase = "http://localhost:${builtins.toString config.services.grzegorz.listenPort}/api";
2023-08-26 23:22:13 +02:00
#services.grzegorz-webui.apiBase = "https://brzeczyszczykiewicz.pvv.ntnu.no/api";
security.acme.acceptTerms = true;
security.acme.defaults.email = "pederbs@pvv.ntnu.no";
services.nginx.enable = true;
networking.firewall.allowedTCPPorts = [ 80 443 ];
services.nginx.virtualHosts."brzeczyszczykiewicz.pvv.ntnu.no" = {
2023-08-27 01:01:20 +02:00
forceSSL = true;
enableACME = true;
2023-08-26 23:22:13 +02:00
serverAliases = [
"brzeczyszczykiewicz.pvv.org"
"bokhylle.pvv.ntnu.no"
"bokhylle.pvv.org"
];
extraConfig = ''
allow 129.241.210.128/25;
allow 2001:700:300:1900::/64;
deny all;
'';
locations."/" = {
proxyPass = "http://localhost:${builtins.toString config.services.grzegorz-webui.listenPort}";
2023-08-27 01:01:20 +02:00
};
# https://github.com/rawpython/remi/issues/216
locations."/websocket" = {
proxyPass = "http://localhost:${builtins.toString config.services.grzegorz-webui.listenWebsocketPort}";
2023-08-26 23:22:13 +02:00
proxyWebsockets = true;
};
2023-08-27 01:01:20 +02:00
locations."/api" = {
proxyPass = "http://localhost:${builtins.toString config.services.grzegorz.listenPort}";
};
locations."/docs" = {
proxyPass = "http://localhost:${builtins.toString config.services.grzegorz.listenPort}";
};
2023-08-26 23:22:13 +02:00
};
})
];
};
};
}