nix-actions/lib/default.nix

37 lines
644 B
Nix
Raw Normal View History

# SPDX-FileCopyrightText: 2024 Tom Hubrecht <tom.hubrecht@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{ lib }:
let
inherit (lib) escapeShellArgs optionals;
in
rec {
expr = repr: "\${{ ${repr} }}";
secret = name: expr "secrets.${name}";
nix-shell =
{
script,
extraArgs ? [ ],
packages ? [ ],
shell ? null,
}:
escapeShellArgs (
[ "nix-shell" ]
++ extraArgs
++ (optionals (packages != [ ]) ([ "-p" ] ++ packages))
++ (optionals (shell != null) [
"-A"
shell
])
++ [
"--run"
script
]
);
steps = import ./steps.nix;
}