Local changes

This commit is contained in:
root 2021-01-15 13:07:13 -06:00
parent a5836387e9
commit a6f61dca18
6 changed files with 9 additions and 116 deletions

View File

@ -141,7 +141,7 @@ in rec {
];
imports = [
../local.nix
./mail.nix
];
environment = {

View File

@ -1,38 +0,0 @@
{ lib, config, pkgs, ... }:
with lib; {
imports = [
./fudo/acme-for-hostname.nix
./fudo/authentication.nix
./fudo/backplane
./fudo/chat.nix
./fudo/client/dns.nix
./fudo/common.nix
./fudo/dns.nix
./fudo/garbage-collector.nix
./fudo/git.nix
./fudo/grafana.nix
./fudo/ipfs.nix
./fudo/kdc.nix
./fudo/ldap.nix
./fudo/local-network.nix
./fudo/mail.nix
./fudo/mail-container.nix
./fudo/minecraft-server.nix
./fudo/netinfo-email.nix
./fudo/node-exporter.nix
./fudo/password.nix
./fudo/postgres.nix
./fudo/prometheus.nix
./fudo/secure-dns-proxy.nix
./fudo/slynk.nix
./fudo/system.nix
./fudo/vpn.nix
./fudo/webmail.nix
./informis/cl-gemini.nix
../fudo/profiles
../fudo/sites
];
}

View File

@ -1,75 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
let
catLines = builtins.concatStringsSep "\n";
userOpts = { config, ... }: {
options = {
passwd = mkOption {
type = types.str;
description = ''
The password of a given user.
'';
};
databases = mkOption {
type = types.attrsOf types.lines;
default = {};
description = ''
A list of databases to which this user should have access.
'';
};
};
};
grantDatabaseAccess = username: database: ''
GRANT CONNECT ON DATABASE ${database} TO USER ${username};
GRANT SELECT,INSERT,UPDATE,DELETE ON ALL TABLES IN SCHEMA ${database} TO USER ${username};
'';
createUserSql = username: userOpts: ''
CREATE ROLE ${username} ENCRYPTED PASSWORD ${userOpts.passwd};
${catLines (map (grantDatabaseAccess username) userOpts.databases)}
'';
createDatabaseSql = database: dbOpts: ''
CREATE DATABASE ${database};
USE ${database};
'';
dataPath = /srv + ("/" + config.networking.hostName);
in {
options = {
fudo.postgresql = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Whether to enable the PostgreSQL server for Fudo services.
'';
};
databases = mkOption {
type = types.attrsOf types.lines;
default = {};
description = ''
A map of database_name => database_defn.
'';
};
users = mkOption {
type = with types; attrsOf (submodule userOpts);
default = {};
description = ''
A map of user_name => { user_attributes }.
'';
};
};
};
}

View File

@ -8,7 +8,7 @@ in {
imports = [
./hardware-configuration.nix
./packages/local.nix
./config/local.nix
./config
<home-manager/nixos>
];

View File

@ -578,6 +578,12 @@ in {
};
};
fudo.ipfs = {
enable = true;
users = [ "niten" "reaper" ];
api-address = "/ip4/${host_ipv4}/tcp/5001";
};
###
# Minecraft
###

View File

@ -17,7 +17,7 @@ in {
rm = "rm --one-file-system --preserve-root";
};
extraInit = ''
initExtra = ''
case $TERM in
screen|xterm*|rxvt*)
shopt -s checkwinsize