chore(ci): formatting

This commit is contained in:
arcnmx 2024-02-23 10:54:40 -08:00
parent ef5306904c
commit 6e882b5342
11 changed files with 30 additions and 44 deletions

View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -eu set -eu
exec nf-alejandra "${NF_NIX_WHITELIST_FILES[@]}" "$@" exec nf-alejandra "${NF_NIX_WHITELIST_DIRS[@]}" "${NF_NIX_WHITELIST_FILES[@]}" "$@"

View file

@ -1,27 +1,17 @@
{ {
nix = { nix = {
whitelist = [ whitelist = [
"systems/default.nix"
"systems/ct/default.nix"
"systems/ct/nixos.nix"
"systems/hakurei/default.nix"
"systems/kuwubernetes/default.nix"
"systems/kuwubernetes/nixos.nix"
"systems/mediabox/default.nix"
"systems/mediabox/nixos.nix"
"systems/reimu/default.nix"
"systems/tei/default.nix"
"systems/tei/nixos.nix"
"systems/tei/cloudflared.nix"
"systems/tewi/default.nix"
"systems/tewi/nixos.nix"
"overlays/default.nix" "overlays/default.nix"
"ci/fmt.nix"
"devShells.nix" "devShells.nix"
"shell.nix" "shell.nix"
"lib.nix" "lib.nix"
"outputs.nix" "outputs.nix"
"tree.nix" "tree.nix"
]; ];
whitelistDirs = [
"systems"
];
blacklistDirs = [ blacklistDirs = [
"overlays" "overlays"
"ci" "ci"

View file

@ -10,9 +10,16 @@
subdir ? null, subdir ? null,
exe ? null, exe ? null,
}: let }: let
subcommand = if exe == null then "run" else "shell"; subcommand =
exeArg = if exe == null then "--" else "-c ${exe}"; if exe == null
in pkgs.writeShellScriptBin name '' then "run"
else "shell";
exeArg =
if exe == null
then "--"
else "-c ${exe}";
in
pkgs.writeShellScriptBin name ''
${optionalString (subdir != null) ''cd "$NF_CONFIG_ROOT${subdir}"''} ${optionalString (subdir != null) ''cd "$NF_CONFIG_ROOT${subdir}"''}
exec nix ${subcommand} ''${FLAKE_OPTS-} "$NF_CONFIG_ROOT#${attr}" ${exeArg} "$@" exec nix ${subcommand} ''${FLAKE_OPTS-} "$NF_CONFIG_ROOT#${attr}" ${exeArg} "$@"
''; '';

View file

@ -29,9 +29,9 @@
nibble0 + (fixedWidthString 1 "0" (toHexStringLower nibble1)); nibble0 + (fixedWidthString 1 "0" (toHexStringLower nibble1));
in "${part0 (part 0)}${part 1}:${part 2}ff:fe${part 3}:${part 4}${part 5}"; in "${part0 (part 0)}${part 1}:${part 2}ff:fe${part 3}:${part 4}${part 5}";
userIs = group: user: builtins.elem group (user.extraGroups ++ [ user.group ]); userIs = group: user: builtins.elem group (user.extraGroups ++ [user.group]);
mkWinPath = replaceStrings [ "/" ] [ "\\" ]; mkWinPath = replaceStrings ["/"] ["\\"];
in { in {
inherit tree nixlib inputs; inherit tree nixlib inputs;
std = inputs.self.lib.Std.Std.compat; std = inputs.self.lib.Std.Std.compat;
@ -40,5 +40,5 @@ in {
inherit mkWinPath userIs eui64 toHexStringLower hexCharToInt; inherit mkWinPath userIs eui64 toHexStringLower hexCharToInt;
inherit (inputs.arcexprs.lib) unmerged; inherit (inputs.arcexprs.lib) unmerged;
}; };
generate = import ./generate.nix { inherit inputs tree; }; generate = import ./generate.nix {inherit inputs tree;};
} }

View file

@ -16,6 +16,7 @@
''; '';
exportsFmtNix = '' exportsFmtNix = ''
NF_NIX_BLACKLIST_DIRS=(${string.concatMapSep " " string.escapeShellArg fmt.nix.blacklistDirs}) NF_NIX_BLACKLIST_DIRS=(${string.concatMapSep " " string.escapeShellArg fmt.nix.blacklistDirs})
NF_NIX_WHITELIST_DIRS=(${string.concatMapSep " " string.escapeShellArg fmt.nix.whitelistDirs})
NF_NIX_WHITELIST_FILES=(${string.concatMapSep " " string.escapeShellArg fmt.nix.whitelist}) NF_NIX_WHITELIST_FILES=(${string.concatMapSep " " string.escapeShellArg fmt.nix.whitelist})
''; '';
output = { output = {
@ -110,6 +111,7 @@
nf-alejandra = pkgs.writeShellScriptBin "nf-alejandra" '' nf-alejandra = pkgs.writeShellScriptBin "nf-alejandra" ''
${exports} ${exports}
${exportsFmtNix} ${exportsFmtNix}
export PATH="${makeBinPath [ packages.alejandra ]}:$PATH"
source ${../ci/alejandra.sh} source ${../ci/alejandra.sh}
''; '';
nf-lint-tf = pkgs.writeShellScriptBin "nf-lint-tf" '' nf-lint-tf = pkgs.writeShellScriptBin "nf-lint-tf" ''

View file

@ -1,7 +1,4 @@
{ {meta, ...}: {
meta,
...
}: {
imports = let imports = let
inherit (meta) nixos; inherit (meta) nixos;
in [ in [
@ -28,11 +25,11 @@
enable = true; enable = true;
rejectLocaladdrs = true; rejectLocaladdrs = true;
serviceSettings = rec { serviceSettings = rec {
wants = [ "localaddrs.service" ]; wants = ["localaddrs.service"];
after = wants; after = wants;
}; };
}; };
interfaces.eth1 = { }; interfaces.eth1 = {};
}; };
systemd.network.networks.eth0 = { systemd.network.networks.eth0 = {
name = "eth0"; name = "eth0";

View file

@ -1,7 +1,4 @@
{ {meta, ...}: {
meta,
...
}: {
imports = with meta; [ imports = with meta; [
nixos.reisen-ct nixos.reisen-ct
]; ];

View file

@ -32,15 +32,15 @@ in {
}; };
services.openssh = { services.openssh = {
ports = mkAfter [ sshPort ]; ports = mkAfter [sshPort];
}; };
# required for kbd or password authentication # required for kbd or password authentication
security.pam.services.sshd.unixAuth = mkForce true; security.pam.services.sshd.unixAuth = mkForce true;
networking.firewall.allowedTCPPorts = [ sshPort ]; networking.firewall.allowedTCPPorts = [sshPort];
sops.secrets = { sops.secrets = {
tf-proxmox-passwd = { }; tf-proxmox-passwd = {};
tf-proxmox-identity = { tf-proxmox-identity = {
owner = username; owner = username;
}; };

View file

@ -1,7 +1,4 @@
{ {meta, ...}: {
meta,
...
}: {
imports = let imports = let
inherit (meta) nixos; inherit (meta) nixos;
in [ in [

View file

@ -62,8 +62,7 @@ in {
"music/raw" "music/raw"
]; ];
}; };
in in [libraryDir];
[libraryDir];
}; };
hardware.opengl = { hardware.opengl = {

View file

@ -1,7 +1,4 @@
{ {meta, ...}: {
meta,
...
}: {
imports = let imports = let
inherit (meta) nixos; inherit (meta) nixos;
in [ in [