parent
d9e2311f3c
commit
80ba7d0bda
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs, selfprivacy-graphql-api, ... }:
|
selfprivacy-graphql-api: { config, lib, pkgs, ... }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
{
|
{
|
||||||
services.selfprivacy-api = {
|
services.selfprivacy-api = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableSwagger = config.services.userdata.api.enableSwagger;
|
enableSwagger = config.selfprivacy.userdata.api.enableSwagger;
|
||||||
b2Bucket = config.services.userdata.backup.bucket;
|
b2Bucket = config.selfprivacy.userdata.backup.bucket;
|
||||||
};
|
};
|
||||||
|
|
||||||
users.users."selfprivacy-api" = {
|
users.users."selfprivacy-api" = {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.services.userdata;
|
cfg = config.selfprivacy.userdata;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
services.restic.backups = {
|
services.restic.backups = {
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
{ userdata, config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./variables-module.nix
|
./variables-module.nix
|
||||||
./variables.nix
|
|
||||||
./files.nix
|
./files.nix
|
||||||
./volumes.nix
|
./volumes.nix
|
||||||
./users.nix
|
./users.nix
|
||||||
./mailserver/system/mailserver.nix
|
|
||||||
./vpn/ocserv.nix
|
./vpn/ocserv.nix
|
||||||
./api/api.nix
|
./api/api.nix
|
||||||
./api/api-module.nix
|
|
||||||
./social/pleroma.nix
|
./social/pleroma.nix
|
||||||
./letsencrypt/acme.nix
|
./letsencrypt/acme.nix
|
||||||
./letsencrypt/resolve.nix
|
./letsencrypt/resolve.nix
|
||||||
|
@ -41,11 +38,11 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services.do-agent.enable = if config.services.userdata.server.provider == "DIGITALOCEAN" then true else false;
|
services.do-agent.enable = if config.selfprivacy.userdata.server.provider == "DIGITALOCEAN" then true else false;
|
||||||
|
|
||||||
boot.cleanTmpDir = true;
|
boot.cleanTmpDir = true;
|
||||||
networking = {
|
networking = {
|
||||||
hostName = config.services.userdata.hostname;
|
hostName = config.selfprivacy.userdata.hostname;
|
||||||
usePredictableInterfaceNames = false;
|
usePredictableInterfaceNames = false;
|
||||||
firewall = {
|
firewall = {
|
||||||
allowedTCPPorts = lib.mkForce [ 22 25 80 143 443 465 587 993 4443 8443 ];
|
allowedTCPPorts = lib.mkForce [ 22 25 80 143 443 465 587 993 4443 8443 ];
|
||||||
|
@ -57,12 +54,12 @@
|
||||||
};
|
};
|
||||||
nameservers = [ "1.1.1.1" "1.0.0.1" ];
|
nameservers = [ "1.1.1.1" "1.0.0.1" ];
|
||||||
};
|
};
|
||||||
time.timeZone = config.services.userdata.timezone;
|
time.timeZone = config.selfprivacy.userdata.timezone;
|
||||||
i18n.defaultLocale = "en_GB.UTF-8";
|
i18n.defaultLocale = "en_GB.UTF-8";
|
||||||
users.users.root.openssh.authorizedKeys.keys = config.services.userdata.ssh.rootKeys;
|
users.users.root.openssh.authorizedKeys.keys = config.selfprivacy.userdata.ssh.rootKeys;
|
||||||
services.openssh = {
|
services.openssh = {
|
||||||
enable = config.services.userdata.ssh.enable;
|
enable = config.selfprivacy.userdata.ssh.enable;
|
||||||
passwordAuthentication = config.services.userdata.ssh.passwordAuthentication;
|
passwordAuthentication = config.selfprivacy.userdata.ssh.passwordAuthentication;
|
||||||
permitRootLogin = "yes";
|
permitRootLogin = "yes";
|
||||||
openFirewall = false;
|
openFirewall = false;
|
||||||
};
|
};
|
||||||
|
@ -75,14 +72,14 @@
|
||||||
jq
|
jq
|
||||||
];
|
];
|
||||||
environment.variables = {
|
environment.variables = {
|
||||||
DOMAIN = config.services.userdata.domain;
|
DOMAIN = config.selfprivacy.userdata.domain;
|
||||||
};
|
};
|
||||||
system.autoUpgrade = {
|
system.autoUpgrade = {
|
||||||
enable = config.services.userdata.autoUpgrade.enable;
|
enable = config.selfprivacy.userdata.autoUpgrade.enable;
|
||||||
allowReboot = config.services.userdata.autoUpgrade.allowReboot;
|
allowReboot = config.selfprivacy.userdata.autoUpgrade.allowReboot;
|
||||||
channel = "https://channel.selfprivacy.org/nixos-selfpricacy";
|
channel = "https://channel.selfprivacy.org/nixos-selfpricacy";
|
||||||
};
|
};
|
||||||
system.stateVersion = config.services.userdata.stateVersion;
|
system.stateVersion = config.selfprivacy.userdata.stateVersion;
|
||||||
nix = {
|
nix = {
|
||||||
optimise.automatic = true;
|
optimise.automatic = true;
|
||||||
gc = {
|
gc = {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.services.userdata;
|
cfg = config.selfprivacy.userdata;
|
||||||
dnsCredentialsTemplates = {
|
dnsCredentialsTemplates = {
|
||||||
DIGITALOCEAN = "DO_AUTH_TOKEN=REPLACEME";
|
DIGITALOCEAN = "DO_AUTH_TOKEN=REPLACEME";
|
||||||
CLOUDFLARE = ''
|
CLOUDFLARE = ''
|
||||||
|
|
84
flake.nix
84
flake.nix
|
@ -9,40 +9,54 @@
|
||||||
selfprivacy-graphql-api.inputs.nixpkgs.follows = "nixpkgs";
|
selfprivacy-graphql-api.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, selfprivacy-graphql-api }:
|
outputs = { self, nixpkgs, selfprivacy-graphql-api }: {
|
||||||
let
|
nixosConfigurations-fun =
|
||||||
system = "x86_64-linux";
|
{ system
|
||||||
in
|
, hardware-configuration
|
||||||
{
|
, userdata
|
||||||
nixosConfigurations-fun =
|
, top-level-flake
|
||||||
{ hardware-configuration
|
, sp-modules
|
||||||
, userdata
|
}:
|
||||||
, top-level-flake
|
let
|
||||||
}: {
|
lib = nixpkgs.legacyPackages.${system}.lib;
|
||||||
just-nixos = nixpkgs.lib.nixosSystem {
|
in
|
||||||
specialArgs = {
|
{
|
||||||
inherit
|
inherit system;
|
||||||
system
|
just-nixos = nixpkgs.lib.nixosSystem {
|
||||||
hardware-configuration
|
specialArgs = { inherit system; };
|
||||||
userdata;
|
modules = [
|
||||||
selfprivacy-graphql-api =
|
hardware-configuration
|
||||||
selfprivacy-graphql-api.packages.${system}.default;
|
./configuration.nix
|
||||||
};
|
(import ./userdata-variables.nix userdata)
|
||||||
modules = [
|
(import ./api/api-module.nix
|
||||||
hardware-configuration
|
selfprivacy-graphql-api.packages.${system}.default)
|
||||||
./configuration.nix
|
{
|
||||||
{
|
# embed top-level flake source folder into the build
|
||||||
# embed top-level flake source folder into the build
|
environment.etc."selfprivacy-config-source".source =
|
||||||
environment.etc."selfprivacy-config-source" =
|
top-level-flake.outPath;
|
||||||
top-level-flake.outPath;
|
# for running "nix search nixpkgs", etc
|
||||||
# for running "nix search nixpkgs", etc
|
nix.registry.nixpkgs.flake = nixpkgs;
|
||||||
nix.registry.nixpkgs.flake = nixpkgs;
|
# embed commit sha1; FIXME dirty builds must be intentionally forbidden
|
||||||
# embed commit sha1; dirty builds are intentionally forbidden
|
system.configurationRevision = self.rev or ("#" + self.lastModifiedDate + "-" + toString self.lastModified);
|
||||||
system.configurationRevision = self.rev;
|
}
|
||||||
}
|
]
|
||||||
];
|
++
|
||||||
inherit system;
|
# add SP modules, but filter available config attributes for each
|
||||||
};
|
map
|
||||||
|
(sp-module: args@{ pkgs, ... }: (sp-module.nixosModules.default
|
||||||
|
(args // {
|
||||||
|
config =
|
||||||
|
# TODO use lib.attrsets.mergeAttrsList from nixpkgs 23.05
|
||||||
|
(builtins.foldl' lib.trivial.mergeAttrs { }
|
||||||
|
(map
|
||||||
|
(p: lib.attrsets.setAttrByPath p
|
||||||
|
(lib.attrsets.getAttrFromPath p args.config))
|
||||||
|
sp-module.configPathsNeeded));
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
# (sp-module: sp-module.nixosModules.default)
|
||||||
|
(lib.attrsets.attrValues sp-modules);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.services.userdata;
|
cfg = config.selfprivacy.userdata;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
fileSystems = lib.mkIf cfg.useBinds {
|
fileSystems = lib.mkIf cfg.useBinds {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.services.userdata;
|
cfg = config.selfprivacy.userdata;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
users.groups.acmerecievers = {
|
users.groups.acmerecievers = {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
let
|
let
|
||||||
domain = config.services.userdata.domain;
|
domain = config.selfprivacy.userdata.domain;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
systemd = {
|
systemd = {
|
||||||
|
|
|
@ -1,89 +0,0 @@
|
||||||
{ config, pkgs, lib, ... }:
|
|
||||||
let
|
|
||||||
cfg = config.services.userdata;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
(builtins.fetchTarball {
|
|
||||||
# Pick a commit from the branch you are interested in
|
|
||||||
url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/6d0d9fb9/nixos-mailserver-6d0d9fb9.tar.gz";
|
|
||||||
|
|
||||||
# And set its hash
|
|
||||||
sha256 = "sha256:0h35al73p15z9v8zb6hi5nq987sfl5wp4rm5c8947nlzlnsjl61x";
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
fileSystems = lib.mkIf cfg.useBinds {
|
|
||||||
"/var/vmail" = {
|
|
||||||
device = "/volumes/${cfg.email.location}/vmail";
|
|
||||||
options = [ "bind" ];
|
|
||||||
};
|
|
||||||
"/var/sieve" = {
|
|
||||||
device = "/volumes/${cfg.email.location}/sieve";
|
|
||||||
options = [ "bind" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
users.users = {
|
|
||||||
virtualMail = {
|
|
||||||
isNormalUser = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
mailserver = {
|
|
||||||
enable = true;
|
|
||||||
fqdn = cfg.domain;
|
|
||||||
domains = [ cfg.domain ];
|
|
||||||
|
|
||||||
# A list of all login accounts. To create the password hashes, use
|
|
||||||
# mkpasswd -m sha-512 "super secret password"
|
|
||||||
loginAccounts = {
|
|
||||||
"${cfg.username}@${cfg.domain}" = {
|
|
||||||
hashedPassword = cfg.hashedMasterPassword;
|
|
||||||
sieveScript = ''
|
|
||||||
require ["fileinto", "mailbox"];
|
|
||||||
if header :contains "Chat-Version" "1.0"
|
|
||||||
{
|
|
||||||
fileinto :create "DeltaChat";
|
|
||||||
stop;
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
} // builtins.listToAttrs (builtins.map
|
|
||||||
(user: {
|
|
||||||
name = "${user.username}@${cfg.domain}";
|
|
||||||
value = {
|
|
||||||
hashedPassword = user.hashedPassword;
|
|
||||||
sieveScript = ''
|
|
||||||
require ["fileinto", "mailbox"];
|
|
||||||
if header :contains "Chat-Version" "1.0"
|
|
||||||
{
|
|
||||||
fileinto :create "DeltaChat";
|
|
||||||
stop;
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
})
|
|
||||||
cfg.users);
|
|
||||||
|
|
||||||
extraVirtualAliases = {
|
|
||||||
"admin@${cfg.domain}" = "${cfg.username}@${cfg.domain}";
|
|
||||||
};
|
|
||||||
|
|
||||||
certificateScheme = 1;
|
|
||||||
certificateFile = "/var/lib/acme/${cfg.domain}/fullchain.pem";
|
|
||||||
keyFile = "/var/lib/acme/${cfg.domain}/key.pem";
|
|
||||||
|
|
||||||
# Enable IMAP and POP3
|
|
||||||
enableImap = true;
|
|
||||||
enableImapSsl = true;
|
|
||||||
enablePop3 = false;
|
|
||||||
enablePop3Ssl = false;
|
|
||||||
dkimSelector = "selector";
|
|
||||||
|
|
||||||
# Enable the ManageSieve protocol
|
|
||||||
enableManageSieve = true;
|
|
||||||
|
|
||||||
virusScanning = false;
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ pkgs, lib, config, ... }:
|
{ pkgs, lib, config, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.services.userdata;
|
cfg = config.selfprivacy.userdata;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
fileSystems = lib.mkIf cfg.useBinds {
|
fileSystems = lib.mkIf cfg.useBinds {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ pkgs, lib, config, ... }:
|
{ pkgs, lib, config, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.services.userdata;
|
cfg = config.selfprivacy.userdata;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
fileSystems = lib.mkIf cfg.useBinds {
|
fileSystems = lib.mkIf cfg.useBinds {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ pkgs, lib, config, ... }:
|
{ pkgs, lib, config, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.services.userdata;
|
cfg = config.selfprivacy.userdata;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
fileSystems = lib.mkIf cfg.useBinds {
|
fileSystems = lib.mkIf cfg.useBinds {
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
[
|
||||||
|
[
|
||||||
|
"services",
|
||||||
|
"redis"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"mailserver"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"selfprivacy",
|
||||||
|
"userdata",
|
||||||
|
"email"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"selfprivacy",
|
||||||
|
"userdata",
|
||||||
|
"domain"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"selfprivacy",
|
||||||
|
"userdata",
|
||||||
|
"username"
|
||||||
|
]
|
||||||
|
]
|
|
@ -0,0 +1,81 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.selfprivacy.userdata;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
fileSystems = lib.mkIf
|
||||||
|
(cfg.simple-nixos-mailserver.enable && cfg.useBinds)
|
||||||
|
{
|
||||||
|
"/var/vmail" = {
|
||||||
|
device = "/volumes/${cfg.email.location}/vmail";
|
||||||
|
options = [ "bind" ];
|
||||||
|
};
|
||||||
|
"/var/sieve" = {
|
||||||
|
device = "/volumes/${cfg.email.location}/sieve";
|
||||||
|
options = [ "bind" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
users.users = lib.mkIf cfg.simple-nixos-mailserver.enable {
|
||||||
|
virtualMail = {
|
||||||
|
isNormalUser = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
selfprivacy.userdata.simple-nixos-mailserver =
|
||||||
|
lib.mkIf cfg.simple-nixos-mailserver.enable {
|
||||||
|
fqdn = cfg.domain;
|
||||||
|
domains = [ cfg.domain ];
|
||||||
|
|
||||||
|
# A list of all login accounts. To create the password hashes, use
|
||||||
|
# mkpasswd -m sha-512 "super secret password"
|
||||||
|
loginAccounts = {
|
||||||
|
"${cfg.username}@${cfg.domain}" = {
|
||||||
|
hashedPassword = cfg.hashedMasterPassword;
|
||||||
|
sieveScript = ''
|
||||||
|
require ["fileinto", "mailbox"];
|
||||||
|
if header :contains "Chat-Version" "1.0"
|
||||||
|
{
|
||||||
|
fileinto :create "DeltaChat";
|
||||||
|
stop;
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
} // builtins.listToAttrs (builtins.map
|
||||||
|
(user: {
|
||||||
|
name = "${user.username}@${cfg.domain}";
|
||||||
|
value = {
|
||||||
|
hashedPassword = user.hashedPassword;
|
||||||
|
sieveScript = ''
|
||||||
|
require ["fileinto", "mailbox"];
|
||||||
|
if header :contains "Chat-Version" "1.0"
|
||||||
|
{
|
||||||
|
fileinto :create "DeltaChat";
|
||||||
|
stop;
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
})
|
||||||
|
cfg.users);
|
||||||
|
|
||||||
|
extraVirtualAliases = {
|
||||||
|
"admin@${cfg.domain}" = "${cfg.username}@${cfg.domain}";
|
||||||
|
};
|
||||||
|
|
||||||
|
certificateScheme = "manual";
|
||||||
|
certificateFile = "/var/lib/acme/${cfg.domain}/fullchain.pem";
|
||||||
|
keyFile = "/var/lib/acme/${cfg.domain}/key.pem";
|
||||||
|
|
||||||
|
# Enable IMAP and POP3
|
||||||
|
enableImap = true;
|
||||||
|
enableImapSsl = true;
|
||||||
|
enablePop3 = false;
|
||||||
|
enablePop3Ssl = false;
|
||||||
|
dkimSelector = "selector";
|
||||||
|
|
||||||
|
# Enable the ManageSieve protocol
|
||||||
|
enableManageSieve = true;
|
||||||
|
|
||||||
|
virusScanning = false;
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,126 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"blobs": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1604995301,
|
||||||
|
"narHash": "sha256-wcLzgLec6SGJA8fx1OEN1yV/Py5b+U5iyYpksUY/yLw=",
|
||||||
|
"owner": "simple-nixos-mailserver",
|
||||||
|
"repo": "blobs",
|
||||||
|
"rev": "2cccdf1ca48316f2cfd1c9a0017e8de5a7156265",
|
||||||
|
"type": "gitlab"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "simple-nixos-mailserver",
|
||||||
|
"repo": "blobs",
|
||||||
|
"type": "gitlab"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1668681692,
|
||||||
|
"narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "009399224d5e398d03b22badca40a37ac85412a1",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1670751203,
|
||||||
|
"narHash": "sha256-XdoH1v3shKDGlrwjgrNX/EN8s3c+kQV7xY6cLCE8vcI=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "64e0bf055f9d25928c31fb12924e59ff8ce71e60",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"id": "nixpkgs",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"type": "indirect"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-22_11": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1669558522,
|
||||||
|
"narHash": "sha256-yqxn+wOiPqe6cxzOo4leeJOp1bXE/fjPEi/3F/bBHv8=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "ce5fe99df1f15a09a91a86be9738d68fadfbad82",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"id": "nixpkgs",
|
||||||
|
"ref": "nixos-22.11",
|
||||||
|
"type": "indirect"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-23_05": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1684782344,
|
||||||
|
"narHash": "sha256-SHN8hPYYSX0thDrMLMWPWYulK3YFgASOrCsIL3AJ78g=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "8966c43feba2c701ed624302b6a935f97bcbdf88",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"id": "nixpkgs",
|
||||||
|
"ref": "nixos-23.05",
|
||||||
|
"type": "indirect"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"simple-nixos-mailserver": "simple-nixos-mailserver"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"simple-nixos-mailserver": {
|
||||||
|
"inputs": {
|
||||||
|
"blobs": "blobs",
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"nixpkgs-22_11": "nixpkgs-22_11",
|
||||||
|
"nixpkgs-23_05": "nixpkgs-23_05",
|
||||||
|
"utils": "utils"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1695910380,
|
||||||
|
"narHash": "sha256-CyzeiXQGm8ceEOSK1dffBCfO7JNp8XhQeNkUiJ5HxgY=",
|
||||||
|
"owner": "simple-nixos-mailserver",
|
||||||
|
"repo": "nixos-mailserver",
|
||||||
|
"rev": "84783b661ecf33927c534b6476beb74ea3308968",
|
||||||
|
"type": "gitlab"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "simple-nixos-mailserver",
|
||||||
|
"repo": "nixos-mailserver",
|
||||||
|
"type": "gitlab"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1605370193,
|
||||||
|
"narHash": "sha256-YyMTf3URDL/otKdKgtoMChu4vfVL3vCMkRqpGifhUn0=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "5021eac20303a61fafe17224c087f5519baed54d",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
description = "PoC SP module for the simple-nixos-mailserver";
|
||||||
|
|
||||||
|
inputs.mailserver.url =
|
||||||
|
gitlab:simple-nixos-mailserver/nixos-mailserver;
|
||||||
|
|
||||||
|
outputs = { self, mailserver }: {
|
||||||
|
# tricks to rename (alias) the original module
|
||||||
|
nixosModules.default = args@{ pkgs, ... }:
|
||||||
|
let
|
||||||
|
module = mailserver.nixosModules.default args;
|
||||||
|
in
|
||||||
|
module // {
|
||||||
|
imports = module.imports ++ [
|
||||||
|
./config.nix
|
||||||
|
({ config, ... }: {
|
||||||
|
mailserver =
|
||||||
|
config.selfprivacy.userdata.simple-nixos-mailserver;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
options = module.options // {
|
||||||
|
selfprivacy.userdata.simple-nixos-mailserver =
|
||||||
|
module.options.mailserver;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
configPathsNeeded =
|
||||||
|
builtins.fromJSON (builtins.readFile ./config-paths-needed.json);
|
||||||
|
|
||||||
|
# TODO generate json docs from module? something like:
|
||||||
|
# nix eval --impure --expr 'let flake = builtins.getFlake (builtins.toPath ./.); pkgs = flake.inputs.mailserver.inputs.nixpkgs.legacyPackages.x86_64-linux; in (pkgs.nixosOptionsDoc { inherit (pkgs.lib.evalModules { modules = [ flake.nixosModules.default ]; }) options; }).optionsJSON'
|
||||||
|
# (doesn't work because of `assertions`)
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"enable"
|
||||||
|
}
|
|
@ -1,9 +1,6 @@
|
||||||
{ lib, userdata, ... }:
|
jsonData: { lib, ... }:
|
||||||
let
|
|
||||||
jsonData = userdata;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
services.userdata = {
|
selfprivacy.userdata = jsonData // {
|
||||||
hostname = lib.attrsets.attrByPath [ "hostname" ] null jsonData;
|
hostname = lib.attrsets.attrByPath [ "hostname" ] null jsonData;
|
||||||
domain = lib.attrsets.attrByPath [ "domain" ] null jsonData;
|
domain = lib.attrsets.attrByPath [ "domain" ] null jsonData;
|
||||||
timezone = lib.attrsets.attrByPath [ "timezone" ] "Europe/Uzhgorod" jsonData;
|
timezone = lib.attrsets.attrByPath [ "timezone" ] "Europe/Uzhgorod" jsonData;
|
||||||
|
@ -61,6 +58,5 @@ in
|
||||||
};
|
};
|
||||||
users = lib.attrsets.attrByPath [ "users" ] [ ] jsonData;
|
users = lib.attrsets.attrByPath [ "users" ] [ ] jsonData;
|
||||||
volumes = lib.attrsets.attrByPath [ "volumes" ] [ ] jsonData;
|
volumes = lib.attrsets.attrByPath [ "volumes" ] [ ] jsonData;
|
||||||
useBinds = lib.attrsets.attrByPath [ "useBinds" ] false jsonData;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
{ pkgs, config, ... }:
|
{ pkgs, config, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.services.userdata;
|
cfg = config.selfprivacy.userdata;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
users.mutableUsers = false;
|
users.mutableUsers = false;
|
||||||
|
|
|
@ -1,16 +1,8 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ lib, ... }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
|
||||||
cfg = config.services.userdata;
|
|
||||||
directionArg =
|
|
||||||
if cfg.direction == ""
|
|
||||||
then ""
|
|
||||||
else "--direction=${cfg.direction}";
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
options.services.userdata = {
|
options.selfprivacy.userdata = {
|
||||||
# General server options
|
# General server options
|
||||||
hostname = mkOption {
|
hostname = mkOption {
|
||||||
description = "The hostname of the server.";
|
description = "The hostname of the server.";
|
||||||
|
@ -221,6 +213,7 @@ in
|
||||||
useBinds = mkOption {
|
useBinds = mkOption {
|
||||||
type = types.nullOr types.bool;
|
type = types.nullOr types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
description = "Whether to bind-mount vmail and sieve folders";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
{ pkgs, config, ... }:
|
{ config, ... }:
|
||||||
let
|
|
||||||
domain = config.services.userdata.domain;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
services.jitsi-meet = {
|
services.jitsi-meet = {
|
||||||
enable = config.services.userdata.jitsi.enable;
|
enable = config.selfprivacy.userdata.jitsi.enable;
|
||||||
hostName = "meet.${domain}";
|
hostName = "meet.${config.selfprivacy.userdata.domain}";
|
||||||
nginx.enable = true;
|
nginx.enable = true;
|
||||||
interfaceConfig = {
|
interfaceConfig = {
|
||||||
SHOW_JITSI_WATERMARK = false;
|
SHOW_JITSI_WATERMARK = false;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{ pkgs, config, ... }:
|
{ config, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.services.userdata;
|
cfg = config.selfprivacy.userdata;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
fileSystems = { } // builtins.listToAttrs (builtins.map
|
fileSystems = builtins.listToAttrs (builtins.map
|
||||||
(volume: {
|
(volume: {
|
||||||
name = "${volume.mountPoint}";
|
name = "${volume.mountPoint}";
|
||||||
value = {
|
value = {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ pkgs, config, ... }:
|
{ config, ... }:
|
||||||
let
|
let
|
||||||
domain = config.services.userdata.domain;
|
domain = config.selfprivacy.userdata.domain;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
users.groups.ocserv = {
|
users.groups.ocserv = {
|
||||||
|
@ -13,7 +13,7 @@ in
|
||||||
group = "ocserv";
|
group = "ocserv";
|
||||||
};
|
};
|
||||||
services.ocserv = {
|
services.ocserv = {
|
||||||
enable = config.services.userdata.ocserv.enable;
|
enable = config.selfprivacy.userdata.ocserv.enable;
|
||||||
config = ''
|
config = ''
|
||||||
socket-file = /var/run/ocserv-socket
|
socket-file = /var/run/ocserv-socket
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ pkgs, config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
let
|
let
|
||||||
domain = config.services.userdata.domain;
|
domain = config.selfprivacy.userdata.domain;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
|
|
Loading…
Reference in New Issue