1
0

flake: migrate deploy to flake

This commit is contained in:
clerie 2022-10-02 16:49:43 +02:00
parent e9414209f5
commit d39e2b94d8
3 changed files with 83 additions and 32 deletions

View File

@ -1,32 +0,0 @@
#!/usr/bin/env bash
DEPLOY_HOST=$1
DEPLOY_ADDRESS=$2
DEPLOY_PORT=$3
if [ -z $DEPLOY_HOST ]; then
exit 1
fi
cmd=" \
nixos-rebuild switch \
-I "nixos-config=hosts/${DEPLOY_HOST}/configuration.nix" --show-trace\
"
if [ -z $DEPLOY_ADDRESS ] || [ $DEPLOY_ADDRESS = "-" ]; then
DEPLOY_ADDRESS="clerie@${DEPLOY_HOST}.net.clerie.de"
fi
if [ $DEPLOY_ADDRESS != "localhost" ]; then
cmd="${cmd} \
--target-host ${DEPLOY_ADDRESS} \
--build-host localhost \
--use-remote-sudo \
"
fi
if [ -n "$DEPLOY_PORT" ]; then
cmd="NIX_SSHOPTS=\"-p $DEPLOY_PORT\" ${cmd}"
fi
eval ${cmd}

27
flake.lock Normal file
View File

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1664538465,
"narHash": "sha256-EnlC7dDKX7X1wlnXkB1gmn9rBZQ0J9+biVTZHw//8us=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "10ecda252ce1b3b1d6403caeadbcc8f30d5ab796",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

56
flake.nix Normal file
View File

@ -0,0 +1,56 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { nixpkgs, ... }: {
colmena = {
meta = {
nixpkgs = import nixpkgs {};
};
defaults = { name, ... }: {
imports = [
(./. + "/hosts/${name}/configuration.nix")
];
deployment = {
targetHost = "${name}.net.clerie.de";
targetUser = null;
};
};
# Hosts
backup-4 = { ... }: {};
carbon = { ... }: {};
clerie-backup = { ... }: {};
dn42-il-gw1 = { ... }: {};
dn42-il-gw5 = { ... }: {};
dn42-il-gw6 = { ... }: {};
dn42-ildix-clerie = { ... }: {};
gatekeeper = { ... }: {};
minecraft-2 = { ... }: {};
monitoring-3 = { ... }: {};
nonat = { ... }: {};
osmium = { ... }: {};
palladium = { ... }: {};
porter = { ... }: {};
storage-2 = { ... }: {};
web-2 = { ... }: {};
};
};
}