mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-04-19 00:19:11 +00:00
chore: reformat codebase
This commit is contained in:
parent
9d99235d94
commit
1bdda28ffe
@ -231,41 +231,45 @@ in
|
||||
# We're using wg-quick here as this host is using network managers that can
|
||||
# differ between workflows (i.e., GNOME and KDE Plasma using NetworkManager,
|
||||
# others might be using systemd-networkd).
|
||||
networking.wg-quick.interfaces.wireguard0 = let
|
||||
domains = [
|
||||
"~plover.foodogsquared.one"
|
||||
"~0.27.172.in-addr.arpa"
|
||||
];
|
||||
in {
|
||||
privateKeyFile = config.sops.secrets."ni/wireguard/private-key".path;
|
||||
listenPort = wireguardPort;
|
||||
dns = with interfaces.internal; [ IPv4.adress IPv6.address ];
|
||||
postUp = let
|
||||
resolvectl = "${lib.getBin pkgs.systemd}/bin/resolvectl";
|
||||
in ''
|
||||
${resolvectl} domain %i ${lib.concatStringsSep " " domains}
|
||||
'';
|
||||
networking.wg-quick.interfaces.wireguard0 =
|
||||
let
|
||||
domains = [
|
||||
"~plover.foodogsquared.one"
|
||||
"~0.27.172.in-addr.arpa"
|
||||
];
|
||||
in
|
||||
{
|
||||
privateKeyFile = config.sops.secrets."ni/wireguard/private-key".path;
|
||||
listenPort = wireguardPort;
|
||||
dns = with interfaces.internal; [ IPv4.adress IPv6.address ];
|
||||
postUp =
|
||||
let
|
||||
resolvectl = "${lib.getBin pkgs.systemd}/bin/resolvectl";
|
||||
in
|
||||
''
|
||||
${resolvectl} domain %i ${lib.concatStringsSep " " domains}
|
||||
'';
|
||||
|
||||
address = with wireguardPeers.desktop; [
|
||||
"${IPv4}/32"
|
||||
"${IPv6}/128"
|
||||
];
|
||||
address = with wireguardPeers.desktop; [
|
||||
"${IPv4}/32"
|
||||
"${IPv6}/128"
|
||||
];
|
||||
|
||||
peers = [
|
||||
# The "server" peer.
|
||||
{
|
||||
publicKey = lib.removeSuffix "\n" (lib.readFile ../plover/files/wireguard/wireguard-public-key-plover);
|
||||
presharedKeyFile = config.sops.secrets."ni/wireguard/preshared-keys/plover".path;
|
||||
allowedIPs = wireguardAllowedIPs;
|
||||
endpoint = "${interfaces.main'.IPv4.address}:${toString wireguardPort}";
|
||||
}
|
||||
peers = [
|
||||
# The "server" peer.
|
||||
{
|
||||
publicKey = lib.removeSuffix "\n" (lib.readFile ../plover/files/wireguard/wireguard-public-key-plover);
|
||||
presharedKeyFile = config.sops.secrets."ni/wireguard/preshared-keys/plover".path;
|
||||
allowedIPs = wireguardAllowedIPs;
|
||||
endpoint = "${interfaces.main'.IPv4.address}:${toString wireguardPort}";
|
||||
}
|
||||
|
||||
# The "phone" peer.
|
||||
{
|
||||
publicKey = lib.removeSuffix "\n" (lib.readFile ../plover/files/wireguard/wireguard-public-key-phone);
|
||||
presharedKeyFile = config.sops.secrets."ni/wireguard/preshared-keys/phone".path;
|
||||
allowedIPs = wireguardAllowedIPs;
|
||||
}
|
||||
];
|
||||
};
|
||||
# The "phone" peer.
|
||||
{
|
||||
publicKey = lib.removeSuffix "\n" (lib.readFile ../plover/files/wireguard/wireguard-public-key-phone);
|
||||
presharedKeyFile = config.sops.secrets."ni/wireguard/preshared-keys/phone".path;
|
||||
allowedIPs = wireguardAllowedIPs;
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
@ -165,13 +165,14 @@ in
|
||||
${replaceSecretBin} '#mailboxSecurityKey#' '${secretsPath "dns/${domain}/mailbox-security-key"}' '${domainZoneFile'}'
|
||||
${replaceSecretBin} '#mailboxSecurityKeyRecord#' '${secretsPath "dns/${domain}/mailbox-security-key-record"}' '${domainZoneFile'}'
|
||||
'';
|
||||
serviceConfig.LoadCredential = let
|
||||
certDirectory = certs."${dnsDomainName}".directory;
|
||||
in
|
||||
[
|
||||
"cert.pem:${certDirectory}/cert.pem"
|
||||
"key.pem:${certDirectory}/key.pem"
|
||||
"fullchain.pem:${certDirectory}/fullchain.pem"
|
||||
];
|
||||
serviceConfig.LoadCredential =
|
||||
let
|
||||
certDirectory = certs."${dnsDomainName}".directory;
|
||||
in
|
||||
[
|
||||
"cert.pem:${certDirectory}/cert.pem"
|
||||
"key.pem:${certDirectory}/key.pem"
|
||||
"fullchain.pem:${certDirectory}/fullchain.pem"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
@ -137,25 +137,26 @@ in
|
||||
|
||||
# Gitea service module will have to set up certain things first which is
|
||||
# why we have to go first.
|
||||
preStart = let
|
||||
giteaBin = "${lib.getBin config.services.gitea.package}/bin/gitea";
|
||||
giteaAdminUsername = lib.escapeShellArg "foodogsquared";
|
||||
preStart =
|
||||
let
|
||||
giteaBin = "${lib.getBin config.services.gitea.package}/bin/gitea";
|
||||
giteaAdminUsername = lib.escapeShellArg "foodogsquared";
|
||||
in
|
||||
lib.mkMerge [
|
||||
(lib.mkBefore ''
|
||||
# Setting up the appropriate schema for PostgreSQL secure schema usage.
|
||||
psql -tAc "SELECT 1 FROM information_schema.schemata WHERE schema_name='${giteaDatabaseUser}';" \
|
||||
grep -q 1 || psql -tAc "CREATE SCHEMA IF NOT EXISTS AUTHORIZATION ${giteaDatabaseUser};"
|
||||
'')
|
||||
lib.mkMerge [
|
||||
(lib.mkBefore ''
|
||||
# Setting up the appropriate schema for PostgreSQL secure schema usage.
|
||||
psql -tAc "SELECT 1 FROM information_schema.schemata WHERE schema_name='${giteaDatabaseUser}';" \
|
||||
grep -q 1 || psql -tAc "CREATE SCHEMA IF NOT EXISTS AUTHORIZATION ${giteaDatabaseUser};"
|
||||
'')
|
||||
|
||||
(lib.mkAfter ''
|
||||
# Setting up the administrator account automated.
|
||||
${giteaBin} admin user list --admin | grep -q ${giteaAdminUsername} \
|
||||
|| ${giteaBin} admin user create \
|
||||
--username ${giteaAdminUsername} --email foodogsquared@${config.networking.domain} \
|
||||
--random-password --random-password-length 76 --admin
|
||||
'')
|
||||
];
|
||||
(lib.mkAfter ''
|
||||
# Setting up the administrator account automated.
|
||||
${giteaBin} admin user list --admin | grep -q ${giteaAdminUsername} \
|
||||
|| ${giteaBin} admin user create \
|
||||
--username ${giteaAdminUsername} --email foodogsquared@${config.networking.domain} \
|
||||
--random-password --random-password-length 76 --admin
|
||||
'')
|
||||
];
|
||||
};
|
||||
|
||||
# Attaching it altogether with the reverse proxy of choice.
|
||||
|
@ -62,8 +62,9 @@ in
|
||||
|
||||
# Modifying it a little bit for per-user schema.
|
||||
systemd.services.keycloak = {
|
||||
preStart = let
|
||||
psqlBin = "${lib.getBin config.services.postgresql.package}/bin/psql";
|
||||
preStart =
|
||||
let
|
||||
psqlBin = "${lib.getBin config.services.postgresql.package}/bin/psql";
|
||||
in
|
||||
lib.mkAfter ''
|
||||
# Setting up the appropriate schema for PostgreSQL secure schema usage.
|
||||
@ -88,7 +89,7 @@ in
|
||||
(lib.lists.map
|
||||
(appPath: lib.nameValuePair appPath { proxyPass = keycloakPath appPath; })
|
||||
[ "/js/" "/realms/" "/resources/" "/robots.txt" ])
|
||||
// { "/".return = "444"; };
|
||||
// { "/".return = "444"; };
|
||||
};
|
||||
|
||||
"${authInternalDomain}" = {
|
||||
|
@ -61,7 +61,7 @@ let
|
||||
note of the commands used for each type as documented from
|
||||
`config.home.mutableFile.<name>.type`.
|
||||
'';
|
||||
default = [];
|
||||
default = [ ];
|
||||
example = [ "--depth" "1" ];
|
||||
};
|
||||
};
|
||||
@ -136,7 +136,8 @@ in
|
||||
script = pkgs.writeShellScript "fetch-mutable-files" ''
|
||||
${lib.concatStringsSep "\n" mutableFilesCmds}
|
||||
'';
|
||||
in builtins.toString script;
|
||||
in
|
||||
builtins.toString script;
|
||||
};
|
||||
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
|
@ -6,17 +6,19 @@
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
};
|
||||
|
||||
outputs = { nixpkgs, home-manager, ... }: let
|
||||
system = "x85_64-linux";
|
||||
in {
|
||||
nixosConfigurations.desktop = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [ ./hosts/desktop ];
|
||||
};
|
||||
outputs = { nixpkgs, home-manager, ... }:
|
||||
let
|
||||
system = "x85_64-linux";
|
||||
in
|
||||
{
|
||||
nixosConfigurations.desktop = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [ ./hosts/desktop ];
|
||||
};
|
||||
|
||||
homeConfigurations.foodogsquared = home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
modules = [ ./users/foodogsquared ];
|
||||
homeConfigurations.foodogsquared = home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
modules = [ ./users/foodogsquared ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -354,12 +354,14 @@ in
|
||||
};
|
||||
|
||||
systemd.user.services.fetch-mutable-files = {
|
||||
Service.ExecStartPost = let
|
||||
script = pkgs.writeShellScript "post-fetch-mutable-files" ''
|
||||
# Automate installation of Doom Emacs.
|
||||
${config.xdg.configHome}/emacs/bin/doom install --no-config --no-fonts --install --force
|
||||
${config.xdg.configHome}/emacs/bin/doom sync
|
||||
'';
|
||||
in builtins.toString script;
|
||||
Service.ExecStartPost =
|
||||
let
|
||||
script = pkgs.writeShellScript "post-fetch-mutable-files" ''
|
||||
# Automate installation of Doom Emacs.
|
||||
${config.xdg.configHome}/emacs/bin/doom install --no-config --no-fonts --install --force
|
||||
${config.xdg.configHome}/emacs/bin/doom sync
|
||||
'';
|
||||
in
|
||||
builtins.toString script;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user