add legacy utility scripts
This commit is contained in:
parent
fdd2030235
commit
fcb17cc9d1
2 changed files with 0 additions and 51 deletions
14
utils/deploy
14
utils/deploy
|
@ -1,14 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
if [ -z "$1" ]
|
|
||||||
then
|
|
||||||
echo "usage: deploy <hostname>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
git push
|
|
||||||
|
|
||||||
gen-config $1 | ssh "$1".dadada.li 'sudo bash -c "cat - > /etc/nixos/configuration.nix && (nixos-rebuild test && nixos-rebuild switch) || (nixos-rebuild switch --rollback && exit 1)"'
|
|
|
@ -1,37 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
function hash {
|
|
||||||
archive="$(mktemp /tmp/nix-config.XXX.tar.gz)"
|
|
||||||
git archive "$1" | gzip > "$archive"
|
|
||||||
nix-prefetch-url --unpack --type sha256 "file:$archive" 2>/dev/null
|
|
||||||
rm "$archive"
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ -z "$1" ]
|
|
||||||
then
|
|
||||||
echo "usage: deploy <hostname>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
host="${1}"
|
|
||||||
rev="$(git rev-parse HEAD)"
|
|
||||||
sha256=$(hash "$rev")
|
|
||||||
|
|
||||||
cat <<EOF
|
|
||||||
{ config, pkgs, ... }:
|
|
||||||
let
|
|
||||||
host = "$host";
|
|
||||||
rev = "$rev";
|
|
||||||
sha256 = "$sha256";
|
|
||||||
dadada = import (builtins.fetchTarball {
|
|
||||||
url = "https://github.com/dadada/nix-config/archive/\${rev}.tar.gz";
|
|
||||||
sha256 = sha256;
|
|
||||||
}) { inherit pkgs; };
|
|
||||||
in
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
./hardware-configuration.nix
|
|
||||||
dadada.hosts."\${host}"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
EOF
|
|
Loading…
Add table
Add a link
Reference in a new issue