Files
nixos-config/modules/apps.nix
2026-03-05 16:05:51 +00:00

36 lines
931 B
Nix

{inputs, ...}: {
perSystem = {
pkgs,
system,
...
}: let
descriptions = {
apply = "Build and apply configuration";
build = "Build configuration";
build-switch = "Build and switch configuration";
rollback = "Rollback to previous generation";
update = "Update flake inputs and regenerate flake.nix";
};
mkApp = name: {
type = "app";
program = "${(pkgs.writeShellScriptBin name ''
PATH=${pkgs.git}/bin:$PATH
echo "Running ${name} for ${system}"
exec ${inputs.self}/apps/${system}/${name} "$@"
'')}/bin/${name}";
meta.description = descriptions.${name};
};
appNames = ["apply" "build" "build-switch" "rollback" "update"];
in {
apps =
pkgs.lib.genAttrs appNames mkApp
// {
deploy = {
type = "app";
program = "${inputs.deploy-rs.packages.${system}.deploy-rs}/bin/deploy";
meta.description = "Deploy to NixOS hosts via deploy-rs";
};
};
};
}