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

@ -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 [

View file

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

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 [