mirror of
https://github.com/kmein/niveum
synced 2026-03-20 03:51:07 +01:00
feat: add niveum-scripts
This commit is contained in:
@@ -157,23 +157,6 @@ in
|
|||||||
|
|
||||||
environment.systemPackages = [ pkgs.pavucontrol pkgs.pamixer ];
|
environment.systemPackages = [ pkgs.pavucontrol pkgs.pamixer ];
|
||||||
}
|
}
|
||||||
{
|
|
||||||
environment.systemPackages =
|
|
||||||
let niveumPath = "${config.users.users.me.home}/prog/git/niveum";
|
|
||||||
in [
|
|
||||||
(pkgs.writers.writeDashBin "niveum-deploy" ''
|
|
||||||
[ $# -eq 1 ] || echo >&2 "Usage: niveum-deploy SYSTEM"
|
|
||||||
|
|
||||||
eval $(${pkgs.nix}/bin/nix-build --no-out-link "${niveumPath}/deploy.nix" -A "$1")
|
|
||||||
'')
|
|
||||||
(pkgs.writers.writeDashBin "niveum-update" ''
|
|
||||||
${pkgs.nix-prefetch-git}/bin/nix-prefetch-git \
|
|
||||||
--url https://github.com/NixOS/nixpkgs-channels \
|
|
||||||
--rev refs/heads/nixos-${config.system.stateVersion} \
|
|
||||||
> "${niveumPath}/nixpkgs.json"
|
|
||||||
'')
|
|
||||||
];
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
environment.interactiveShellInit = "export PATH=$PATH:$HOME/.cargo/bin";
|
environment.interactiveShellInit = "export PATH=$PATH:$HOME/.cargo/bin";
|
||||||
environment.shellAliases =
|
environment.shellAliases =
|
||||||
|
|||||||
6
niveum-deploy
Executable file
6
niveum-deploy
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
niveum_dir="$HOME/prog/git/niveum"
|
||||||
|
|
||||||
|
[ $# -eq 1 ] || echo >&2 "Usage: niveum-deploy SYSTEM"
|
||||||
|
|
||||||
|
eval "$(nix-build --no-out-link "$niveum_dir/deploy.nix" -A "$1")"
|
||||||
20
niveum-status
Executable file
20
niveum-status
Executable file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
version_file=/etc/niveum/version
|
||||||
|
niveum_dir="$HOME/prog/git/niveum"
|
||||||
|
|
||||||
|
machine_status () {
|
||||||
|
hostname="$1"
|
||||||
|
|
||||||
|
if commit_id="$(ssh "$hostname" cat $version_file 2>/dev/null)"; then
|
||||||
|
machine_status="$(git -C "$niveum_dir" log -1 --oneline "$commit_id")"
|
||||||
|
else
|
||||||
|
machine_status=offline
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "\033[1m%11s\033[0m %s\n" "$hostname" "$machine_status"
|
||||||
|
}
|
||||||
|
|
||||||
|
for system in "$niveum_dir"/systems/*; do
|
||||||
|
hostname="$(basename "$system")"
|
||||||
|
machine_status "$hostname"
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user