scripts: Refactor following tests' example

This commit is contained in:
SebastianStork 2026-02-14 23:54:13 +01:00
parent a3bae7baec
commit 0ea72891c8
Signed by: SebastianStork
SSH key fingerprint: SHA256:iEM011ogNMG1q8+U500adGu/9rpPuZ2KnFtbdLeqTiI
4 changed files with 15 additions and 21 deletions

View file

@ -7,19 +7,19 @@
lib, lib,
... ...
}: }:
{ let
packages = mkScript = file: rec {
"${self}/scripts"
|> lib.filesystem.listFilesRecursive
|> lib.map (file: {
name = name =
file file
|> lib.unsafeDiscardStringContext |> lib.unsafeDiscardStringContext
|> lib.removePrefix "${self}/scripts/" |> lib.removePrefix "${self}/scripts/"
|> lib.removeSuffix ".nix" |> lib.removeSuffix ".nix"
|> lib.replaceString "/" "-"; |> lib.replaceString "/" "-";
value = import file { inherit self' pkgs lib; }; value = pkgs.writeShellApplication ({ inherit name; } // import file { inherit self' pkgs lib; });
}) };
|> lib.listToAttrs; in
{
packages =
"${self}/scripts" |> lib.filesystem.listFilesRecursive |> lib.map mkScript |> lib.listToAttrs;
}; };
} }

View file

@ -1,7 +1,5 @@
{ pkgs, ... }: { pkgs, ... }:
pkgs.writeShellApplication { {
name = "install-anywhere";
runtimeInputs = [ runtimeInputs = [
pkgs.sops pkgs.sops
pkgs.ssh-to-age pkgs.ssh-to-age

View file

@ -1,7 +1,5 @@
{ self', pkgs, ... }: { self', pkgs, ... }:
pkgs.writeShellApplication { {
name = "nebula-recert-all-hosts";
runtimeInputs = [ runtimeInputs = [
pkgs.bitwarden-cli pkgs.bitwarden-cli
pkgs.jq pkgs.jq

View file

@ -1,7 +1,5 @@
{ pkgs, ... }: { pkgs, ... }:
pkgs.writeShellApplication { {
name = "nebula-recert-host";
runtimeInputs = [ runtimeInputs = [
pkgs.nebula pkgs.nebula
pkgs.bitwarden-cli pkgs.bitwarden-cli