Add nice server roles (not ready yet)

This commit is contained in:
Ivan Bushchik 2023-09-06 11:20:33 +03:00
parent 12c3e83dbe
commit 7879fc2feb
No known key found for this signature in database
GPG key ID: 2F16FBF3262E090C
6 changed files with 48 additions and 19 deletions

View file

@ -64,6 +64,9 @@ curl https://iva.bz/nix | sh
## TODO ## TODO
- Setup services (which I host) - Setup services (which I host)
- [x] ivabus.dev
- [ ] iva.bz
- [ ] ивабус.рф
- Setup "secret" roles (I need them) - Setup "secret" roles (I need them)
- Setup router - Setup router

View file

@ -27,6 +27,10 @@ in {
torrent.enable = true; torrent.enable = true;
virtualisation.enable = false; virtualisation.enable = false;
yggdrasil-client.enable = true; yggdrasil-client.enable = true;
server = {
ivabus-dev.enable = true;
};
}; };
networking.useDHCP = true; networking.useDHCP = true;
@ -40,23 +44,5 @@ in {
(retroarch.override { cores = with libretro; [ np2kai ];}) (retroarch.override { cores = with libretro; [ np2kai ];})
]; ];
services.nginx = {
enable = true;
# Use recommended settings
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
virtualHosts."ivabus.dev" = {
# i don't want to call package like this
root = pkgs.callPackage ../../pkgs/ivabus-dev.nix {};
extraConfig = ''
error_page 404 /404.html;
'';
};
};
system.stateVersion = "23.05"; system.stateVersion = "23.05";
} }

View file

@ -1,6 +1,6 @@
{ pkgs ? import <nixpkgs> {}, bundlerEnv, ... }: { pkgs ? import <nixpkgs> {}, bundlerEnv, ... }:
let let
version = "025b56be08da939ad016dcacfb833b8652d2848e"; version = "130812885aee9f2e0a5f6a4b534a3b6b68431554";
repo = builtins.fetchGit { repo = builtins.fetchGit {
url = "https://github.com/ivabus/website"; url = "https://github.com/ivabus/website";
rev = version; rev = version;

View file

@ -10,5 +10,8 @@
./torrent.nix ./torrent.nix
./virtualisation.nix ./virtualisation.nix
./yggdrasil-client.nix ./yggdrasil-client.nix
./server/nginx.nix
./server/ivabus-dev.nix
]; ];
} }

View file

@ -0,0 +1,20 @@
{ config, lib, pkgs, ... }:
let
cfg = config.my.roles.server.ivabus-dev;
in
{
options.my.roles.server.ivabus-dev.enable = lib.mkEnableOption "Serve ivabus.dev";
config = lib.mkIf (cfg.enable) {
my.roles.server.nginx.enable = true;
services.nginx = {
virtualHosts."ivabus.dev" = {
# i don't want to call package like this
root = pkgs.callPackage ../../pkgs/ivabus-dev.nix {};
extraConfig = ''
error_page 404 /404.html;
'';
};
};
};
}

17
roles/server/nginx.nix Normal file
View file

@ -0,0 +1,17 @@
{ config, lib, pkgs, ... }:
let
cfg = config.my.roles.server.nginx;
in
{
# Don't call from machine setup, services will enable it automatically
options.my.roles.server.nginx.enable = lib.mkEnableOption "Initial nginx setup";
config = lib.mkIf (cfg.enable) {
services.nginx = {
enable = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
};
};
}