update to NixOS 21.11

This commit is contained in:
Michele Guerini Rocco 2021-12-21 00:31:10 +01:00
parent f3210b5d91
commit b954fafb18
Signed by: rnhmjoj
GPG Key ID: BFBAF4C975F76450
5 changed files with 40 additions and 26 deletions

View File

@ -44,7 +44,7 @@
5349 # turn server 5349 # turn server
3551 # apcups 3551 # apcups
18080 # monero p2p 18080 # monero p2p
20000 # syncthing transfert 22000 # syncthing transfer
64738 # mumble server 64738 # mumble server
]; ];
firewall.allowedUDPPorts = [ firewall.allowedUDPPorts = [
@ -113,6 +113,7 @@
# SSH operation handier, example: # SSH operation handier, example:
# git clone git@maxwell:user/repo # git clone git@maxwell:user/repo
git = { git = {
group = "git";
description = "Git server user"; description = "Git server user";
home = "/var/lib/gitea"; home = "/var/lib/gitea";
isSystemUser = true; isSystemUser = true;
@ -120,6 +121,8 @@
}; };
}; };
users.groups.git = { };
# Generate Diffie-Hellman parameters # Generate Diffie-Hellman parameters
# for TLS applications, like nginx. # for TLS applications, like nginx.
security.dhparams = { security.dhparams = {
@ -217,16 +220,13 @@
password = "$JOIN_PASSWORD"; password = "$JOIN_PASSWORD";
users = 10; users = 10;
environmentFile = config.secrets.environments.murmur; environmentFile = config.secrets.environments.murmur;
extraConfig = with config.var; '' sslCert = "/var/lib/acme/${config.var.hostname}/fullchain.pem";
sslCert=/var/lib/acme/${hostname}/fullchain.pem sslKey = "/var/lib/acme/${config.var.hostname}/key.pem";
sslKey=/var/lib/acme/${hostname}/key.pem
'';
}; };
### Syncthing node ### Syncthing node
services.syncthing = { services.syncthing = {
enable = true; enable = true;
openDefaultPorts = true;
}; };
### Monero node with local RPC ### Monero node with local RPC

View File

@ -27,17 +27,28 @@ in {
''; '';
}; };
group = mkOption {
type = types.str;
default = "asjon";
description = ''
Asjon will be run under this group (user will be created if it doesn't exist.
This can be your user name).
'';
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
users.extraUsers.${cfg.user} = { users.users.${cfg.user} = {
group = cfg.group;
home = cfg.dataDir; home = cfg.dataDir;
isSystemUser = true; isSystemUser = true;
createHome = true; createHome = true;
description = "asjon user"; description = "asjon user";
shell = "${pkgs.bash}/bin/bash"; shell = "${pkgs.bash}/bin/bash";
}; };
users.groups.${cfg.group} = { };
systemd.services.asjon = { systemd.services.asjon = {
description = "asjon: our chat bot"; description = "asjon: our chat bot";

View File

@ -44,6 +44,15 @@ in {
''; '';
}; };
group = mkOption {
type = types.str;
default = "breve";
description = ''
Breve will run under this group (user will be created if it doesn't exist.
This can be your user name).
'';
};
hostname = mkOption { hostname = mkOption {
type = types.str; type = types.str;
default = config.networking.hostName; default = config.networking.hostName;
@ -98,11 +107,14 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
users.extraUsers."${cfg.user}" = { users.users.${cfg.user} = {
isSystemUser = true; isSystemUser = true;
group = cfg.group;
description = "Breve daemon user"; description = "Breve daemon user";
}; };
users.groups.${cfg.group} = {};
networking.firewall = mkIf cfg.openPorts { networking.firewall = mkIf cfg.openPorts {
allowedTCPPorts = [ cfg.port ] allowedTCPPorts = [ cfg.port ]
++ optional (cfg.port == 443) 80; ++ optional (cfg.port == 443) 80;
@ -116,6 +128,7 @@ in {
environment.XDG_CONFIG_HOME = "${dataDir}/conf"; environment.XDG_CONFIG_HOME = "${dataDir}/conf";
serviceConfig = { serviceConfig = {
User = cfg.user; User = cfg.user;
Group = cfg.group;
ExecStart = "${pkgs.haskellPackages.breve}/bin/breve"; ExecStart = "${pkgs.haskellPackages.breve}/bin/breve";
Restart = "on-failure"; Restart = "on-failure";
StateDirectory = "breve"; StateDirectory = "breve";

View File

@ -3,8 +3,8 @@
{ {
imports = [ imports = [
(builtins.fetchTarball { (builtins.fetchTarball {
url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/nixos-21.05/nixos-mailserver-nixos-21.05.tar.gz"; url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/nixos-21.11/nixos-mailserver-nixos-21.11.tar.gz";
sha256 = "1fwhb7a5v9c98nzhf3dyqf3a5ianqh7k50zizj8v5nmj3blxw4pi"; sha256 = "1i56llz037x416bw698v8j6arvv622qc0vsycd20lx3yx8n77n44";
}) })
]; ];

View File

@ -1,9 +1,5 @@
{ pkgs, lib, ... }: { pkgs, lib, ... }:
let
secrets = toString ./secrets;
in
{ {
imports = [ imports = [
<nixpkgs/nixos/modules/virtualisation/qemu-vm.nix> <nixpkgs/nixos/modules/virtualisation/qemu-vm.nix>
@ -11,22 +7,16 @@ in
]; ];
# VM hardware setup # VM hardware setup
virtualisation.memorySize = "4000"; # MB virtualisation.memorySize = 4000; # MB
virtualisation.graphics = false; virtualisation.graphics = false;
virtualisation.cores = 4; virtualisation.cores = 4;
virtualisation.msize = 1 * 1024 * 1024; virtualisation.msize = 1 * 1024 * 1024;
virtualisation.qemu.options = # Ensure secrets are accessible by the
[ # Ensure secrets are accessible by the # activation scripts at runtime.
# activation scripts at runtime. virtualisation.sharedDirectories.secrets =
"-virtfs local,path=${secrets},security_model=none,mount_tag=secrets" { source = toString ./secrets;
]; target = toString ./secrets;
virtualisation.fileSystems."${secrets}" =
{ device = "secrets";
fsType = "9p";
options = [ "trans=virtio" "version=9p2000.L" ];
neededForBoot = true;
}; };
# These don't work in a virtual machine # These don't work in a virtual machine