Modified directory creation process

This commit is contained in:
Illia Chub 2020-12-21 15:18:22 +02:00
parent b2ccc9be90
commit 2c25fbdf10

View file

@ -9,6 +9,13 @@ makeConf() {
[[ -e /etc/nixos/configuration.nix ]] && return 0
# NB <<"EOF" quotes / $ ` in heredocs, <<EOF does not
mkdir -p /etc/nixos
mkdir -p /etc/nixos/mailserver/system
mkdir -p /etc/nixos/letsencrypt
mkdir /etc/nixos/backup
mkdir /etc/nixos/passmgr/
mkdir /etc/nixos/nginx
mkdir /etc/nixos/git
# Prevent grep for sending error code 1 (and halting execution) when no lines are selected : https://www.unix.com/man-page/posix/1P/grep
local IFS=$'\n'
for trypath in /root/.ssh/authorized_keys $HOME/.ssh/authorized_keys; do
@ -56,9 +63,7 @@ EOF
}
EOF
mkdir -p /etc/nixos/mailserver/system
mkdir /etc/nixos/mailserver/
cat > /etc/nixos/mailserver/system/mailserver.nix << EOF
cat > /etc/nixos/mailserver/system/mailserver.nix << EOF
{ config, pkgs, lib, ... }:
{
imports = [
@ -133,8 +138,7 @@ EOF
}
EOF
mkdir -p /etc/nixos/letsencrypt
cat > /etc/nixos/letsencrypt/acme.nix << EOF
cat > /etc/nixos/letsencrypt/acme.nix << EOF
{ pkgs, ... }:
{
users.groups.acmerecievers = {
@ -167,8 +171,7 @@ EOF
}
EOF
mkdir -p /etc/nixos/letsencrypt
cat > /etc/nixos/letsencrypt/certbot.nix << EOF
cat > /etc/nixos/letsencrypt/certbot.nix << EOF
{ pkgs, ... }:
{
systemd = {
@ -190,8 +193,7 @@ EOF
}
EOF
mkdir /etc/nixos/backup
cat > /etc/nixos/backup/restic.nix << EOF
cat > /etc/nixos/backup/restic.nix << EOF
{ pkgs, ... }:
{
services.restic.backups = {
@ -225,8 +227,7 @@ AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
}
EOF
mkdir /etc/nixos/passmgr/
cat > /etc/nixos/passmgr/bitwarden.nix << EOF
cat > /etc/nixos/passmgr/bitwarden.nix << EOF
{ pkgs, ... }:
{
services.bitwarden_rs = {
@ -243,8 +244,7 @@ EOF
}
EOF
mkdir /etc/nixos/nginx
cat > /etc/nixos/nginx/nginx.nix << EOF
cat > /etc/nixos/nginx/nginx.nix << EOF
{ pkgs, ... }:
{
services.nginx = {
@ -358,8 +358,7 @@ cat > /etc/nixos/backup/nextcloud.nix << EOF
}
EOF
mkdir /etc/nixos/git
cat > /etc/nixos/git/gitea.nix << EOF
cat > /etc/nixos/git/gitea.nix << EOF
{ pkgs, ... }:
{
services = {