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

View file

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

View file

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

View file

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