mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 17:49:07 +01:00
scripts: Refactor following tests' example
This commit is contained in:
parent
a3bae7baec
commit
0ea72891c8
4 changed files with 15 additions and 21 deletions
|
|
@ -7,19 +7,19 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
mkScript = file: rec {
|
||||||
|
name =
|
||||||
|
file
|
||||||
|
|> lib.unsafeDiscardStringContext
|
||||||
|
|> lib.removePrefix "${self}/scripts/"
|
||||||
|
|> lib.removeSuffix ".nix"
|
||||||
|
|> lib.replaceString "/" "-";
|
||||||
|
value = pkgs.writeShellApplication ({ inherit name; } // import file { inherit self' pkgs lib; });
|
||||||
|
};
|
||||||
|
in
|
||||||
{
|
{
|
||||||
packages =
|
packages =
|
||||||
"${self}/scripts"
|
"${self}/scripts" |> lib.filesystem.listFilesRecursive |> lib.map mkScript |> lib.listToAttrs;
|
||||||
|> lib.filesystem.listFilesRecursive
|
|
||||||
|> lib.map (file: {
|
|
||||||
name =
|
|
||||||
file
|
|
||||||
|> lib.unsafeDiscardStringContext
|
|
||||||
|> lib.removePrefix "${self}/scripts/"
|
|
||||||
|> lib.removeSuffix ".nix"
|
|
||||||
|> lib.replaceString "/" "-";
|
|
||||||
value = import file { inherit self' pkgs lib; };
|
|
||||||
})
|
|
||||||
|> lib.listToAttrs;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
pkgs.writeShellApplication {
|
{
|
||||||
name = "nebula-recert-host";
|
|
||||||
|
|
||||||
runtimeInputs = [
|
runtimeInputs = [
|
||||||
pkgs.nebula
|
pkgs.nebula
|
||||||
pkgs.bitwarden-cli
|
pkgs.bitwarden-cli
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue