update to NixOS 21.11

master
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
3551 # apcups
18080 # monero p2p
20000 # syncthing transfert
22000 # syncthing transfer
64738 # mumble server
];
firewall.allowedUDPPorts = [
@ -113,6 +113,7 @@
# SSH operation handier, example:
# git clone git@maxwell:user/repo
git = {
group = "git";
description = "Git server user";
home = "/var/lib/gitea";
isSystemUser = true;
@ -120,6 +121,8 @@
};
};
users.groups.git = { };
# Generate Diffie-Hellman parameters
# for TLS applications, like nginx.
security.dhparams = {
@ -217,16 +220,13 @@
password = "$JOIN_PASSWORD";
users = 10;
environmentFile = config.secrets.environments.murmur;
extraConfig = with config.var; ''
sslCert=/var/lib/acme/${hostname}/fullchain.pem
sslKey=/var/lib/acme/${hostname}/key.pem
'';
sslCert = "/var/lib/acme/${config.var.hostname}/fullchain.pem";
sslKey = "/var/lib/acme/${config.var.hostname}/key.pem";
};
### Syncthing node
services.syncthing = {
enable = true;
openDefaultPorts = true;
};
### 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 {
users.extraUsers.${cfg.user} = {
users.users.${cfg.user} = {
group = cfg.group;
home = cfg.dataDir;
isSystemUser = true;
createHome = true;
description = "asjon user";
shell = "${pkgs.bash}/bin/bash";
};
users.groups.${cfg.group} = { };
systemd.services.asjon = {
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 {
type = types.str;
default = config.networking.hostName;
@ -98,11 +107,14 @@ in {
config = mkIf cfg.enable {
users.extraUsers."${cfg.user}" = {
users.users.${cfg.user} = {
isSystemUser = true;
group = cfg.group;
description = "Breve daemon user";
};
users.groups.${cfg.group} = {};
networking.firewall = mkIf cfg.openPorts {
allowedTCPPorts = [ cfg.port ]
++ optional (cfg.port == 443) 80;
@ -116,6 +128,7 @@ in {
environment.XDG_CONFIG_HOME = "${dataDir}/conf";
serviceConfig = {
User = cfg.user;
Group = cfg.group;
ExecStart = "${pkgs.haskellPackages.breve}/bin/breve";
Restart = "on-failure";
StateDirectory = "breve";

View File

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

View File

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