Archived
1
0

chore: format files

This commit is contained in:
Gustavo "Guz" L. de Mello
2024-06-16 20:08:29 -03:00
parent 25af484bb9
commit c8247a3208
18 changed files with 265 additions and 247 deletions

View File

@@ -1,41 +1,40 @@
{ config
, lib
, ...
}:
let
cfg = config.services.adguardhome;
in
{
imports = [ ];
config,
lib,
...
}: let
cfg = config.services.adguardhome;
in {
imports = [];
options.services.adguardhome = with lib;
with lib.types; {
dns.filters = mkOption {
type = attrsOf (submodule ({ lib, ... }: {
options = {
name = mkOption {
type = nullOr str;
default = null;
};
url = mkOption {
type = str;
};
enabled = mkOption {
type = bool;
default = true;
};
with lib.types; {
dns.filters = mkOption {
type = attrsOf (submodule ({lib, ...}: {
options = {
name = mkOption {
type = nullOr str;
default = null;
};
}));
default = { };
};
dns.rewrites = mkOption {
type = attrsOf str;
default = { };
};
url = mkOption {
type = str;
};
enabled = mkOption {
type = bool;
default = true;
};
};
}));
default = {};
};
dns.rewrites = mkOption {
type = attrsOf str;
default = {};
};
};
config = with lib;
mkIf cfg.enable {
networking.firewall.allowedTCPPorts = [ 53 ];
networking.firewall.allowedUDPPorts = [ 53 51820 ];
networking.firewall.allowedTCPPorts = [53];
networking.firewall.allowedUDPPorts = [53 51820];
services.adguardhome = {
settings = {

View File

@@ -1,4 +1,4 @@
{ ... }: {
{...}: {
imports = [
./adguardhome.nix
./forgejo

View File

@@ -1,12 +1,12 @@
{ config
, lib
, pkgs
, utils
, ...
}:
let
{
config,
lib,
pkgs,
utils,
...
}: let
cfg = config.services.forgejo;
yamlFormat = pkgs.formats.yaml { };
yamlFormat = pkgs.formats.yaml {};
users = builtins.attrValues (builtins.mapAttrs
(username: info: {
name =
@@ -19,67 +19,67 @@ let
})
cfg.users);
initList = l: lib.strings.concatStringsSep "," l;
in
{
imports = [ ];
in {
imports = [];
options.services.forgejo = with lib;
with lib.types; {
handleUndeclaredUsers = mkOption {
type = bool;
default = false;
};
users = mkOption {
type = attrsOf (submodule ({ config
, lib
, ...
}:
with lib;
with lib.types; {
options = {
name = mkOption {
type = nullOr (either str path);
default = null;
};
password = mkOption {
type = either str path;
};
email = mkOption {
type = either str path;
};
admin = mkOption {
type = bool;
default = false;
};
with lib.types; {
handleUndeclaredUsers = mkOption {
type = bool;
default = false;
};
users = mkOption {
type = attrsOf (submodule ({
config,
lib,
...
}:
with lib;
with lib.types; {
options = {
name = mkOption {
type = nullOr (either str path);
default = null;
};
}));
default = { };
password = mkOption {
type = either str path;
};
email = mkOption {
type = either str path;
};
admin = mkOption {
type = bool;
default = false;
};
};
}));
default = {};
};
actions = {
enable = mkOption {
type = bool;
default = cfg.enable;
};
actions = {
enable = mkOption {
type = bool;
default = cfg.enable;
};
token = mkOption {
type = str;
};
url = mkOption {
type = str;
default = "http://localhost:${toString cfg.settings.server.HTTP_PORT}";
};
labels = mkOption {
type = listOf str;
default = [
/*
token = mkOption {
type = str;
};
url = mkOption {
type = str;
default = "http://localhost:${toString cfg.settings.server.HTTP_PORT}";
};
labels = mkOption {
type = listOf str;
default = [
/*
Remember to install git on these images so actions/checkout can work,
without it, the actions tries to use the /api/v3/repos/{user}/{repo}/tarball/{ref}
api endpoint, which Gitea/Forgejo doesn't has.
*/
"ubuntu-latest:docker://gitea/runner-images:ubuntu-latest-slim"
"ubuntu-latest-full:docker://gitea/runner-images:ubuntu-latest"
];
};
*/
"ubuntu-latest:docker://gitea/runner-images:ubuntu-latest-slim"
"ubuntu-latest-full:docker://gitea/runner-images:ubuntu-latest"
];
};
};
};
config = with lib;
mkIf cfg.enable {
networking.firewall.allowedTCPPorts = mkIf cfg.settings.actions.ENABLED [
@@ -94,9 +94,9 @@ in
useDefaultShell = true;
group = cfg.group;
isSystemUser = true;
extraGroups = [ "wheel" "networkmanager" ];
extraGroups = ["wheel" "networkmanager"];
};
users.groups."${cfg.group}" = { };
users.groups."${cfg.group}" = {};
services.forgejo = {
user = mkDefault "git";
@@ -193,8 +193,8 @@ in
'')
users)}
'';
wantedBy = [ "multi-user.target" ];
after = [ "forgejo.service" ];
wantedBy = ["multi-user.target"];
after = ["forgejo.service"];
serviceConfig = {
Type = "oneshot";
User = cfg.user;

View File

@@ -1,50 +1,49 @@
{ config
, lib
, ...
}:
let
cfg = config.profiles.locale;
in
{
imports = [ ];
config,
lib,
...
}: let
cfg = config.profiles.locale;
in {
imports = [];
options.profiles.locale = with lib;
with lib.types; {
enable = mkEnableOption "";
locale = mkOption {
type = str;
default = "en_US.UTF-8";
};
extraLocales = mkOption {
type = attrsOf str;
default = rec {
LC_ADDRESS = "pt_BR.UTF-8";
LC_IDENTIFICATION = LC_ADDRESS;
LC_MEASUREMENT = LC_ADDRESS;
LC_MONETARY = LC_ADDRESS;
LC_NAME = LC_ADDRESS;
LC_NUMERIC = LC_ADDRESS;
LC_PAPER = LC_ADDRESS;
LC_TELEPHONE = LC_ADDRESS;
LC_TIME = LC_ADDRESS;
};
};
keymap.layout = mkOption {
type = str;
default = "br";
};
keymap.variant = mkOption {
type = str;
default = "";
};
keymap.console = mkOption {
type = str;
default = "br-abnt2";
};
timeZone = mkOption {
type = str;
default = "America/Sao_Paulo";
with lib.types; {
enable = mkEnableOption "";
locale = mkOption {
type = str;
default = "en_US.UTF-8";
};
extraLocales = mkOption {
type = attrsOf str;
default = rec {
LC_ADDRESS = "pt_BR.UTF-8";
LC_IDENTIFICATION = LC_ADDRESS;
LC_MEASUREMENT = LC_ADDRESS;
LC_MONETARY = LC_ADDRESS;
LC_NAME = LC_ADDRESS;
LC_NUMERIC = LC_ADDRESS;
LC_PAPER = LC_ADDRESS;
LC_TELEPHONE = LC_ADDRESS;
LC_TIME = LC_ADDRESS;
};
};
keymap.layout = mkOption {
type = str;
default = "br";
};
keymap.variant = mkOption {
type = str;
default = "";
};
keymap.console = mkOption {
type = str;
default = "br-abnt2";
};
timeZone = mkOption {
type = str;
default = "America/Sao_Paulo";
};
};
config = {
i18n = {
defaultLocale = cfg.locale;

View File

@@ -1,9 +1,9 @@
{ config
, lib
, pkgs
, ...
}:
let
{
config,
lib,
pkgs,
...
}: let
cfg = config.programs.nh;
wrapper = pkgs.writeShellScriptBin "nh" ''
function alejandra() { ${pkgs.alejandra}/bin/alejandra "$@"; }
@@ -16,9 +16,8 @@ let
${builtins.readFile ./wrapper.sh}
'';
in
{
options.programs.nh = with lib; with lib.types; { };
in {
options.programs.nh = with lib; with lib.types; {};
config = with lib;
mkIf cfg.enable {
programs.nh.package = wrapper;

View File

@@ -1,33 +1,32 @@
{ config
, lib
, ...
}:
let
cfg = config.services.tailscale;
in
{
imports = [ ];
config,
lib,
...
}: let
cfg = config.services.tailscale;
in {
imports = [];
options.services.tailscale = with lib;
with lib.types; {
exitNode = mkOption {
type = bool;
default = false;
};
tailnetName = mkOption {
type = str;
};
tailnetUrl = mkOption {
type = str;
default = "${config.services.tailscale.tailnetName}.ts.net";
};
deviceUrl = mkOption {
type = str;
default = "${config.networking.hostName}.${config.services.tailscale.tailnetUrl}";
};
deviceIp = mkOption {
type = str;
};
with lib.types; {
exitNode = mkOption {
type = bool;
default = false;
};
tailnetName = mkOption {
type = str;
};
tailnetUrl = mkOption {
type = str;
default = "${config.services.tailscale.tailnetName}.ts.net";
};
deviceUrl = mkOption {
type = str;
default = "${config.networking.hostName}.${config.services.tailscale.tailnetUrl}";
};
deviceIp = mkOption {
type = str;
};
};
config = with lib;
mkIf cfg.enable {
services.tailscale = {
@@ -52,7 +51,7 @@ in
systemd.services."tailscaled" = mkIf config.services.caddy.enable (mkDefault {
serviceConfig = {
Environment = [ "TS_PERMIT_CERT_UID=caddy" ];
Environment = ["TS_PERMIT_CERT_UID=caddy"];
};
});