From d39e2b94d8f7c3634e72fcb78a76ecb24263bd4b Mon Sep 17 00:00:00 2001 From: clerie Date: Sun, 2 Oct 2022 16:49:43 +0200 Subject: [PATCH] flake: migrate deploy to flake --- deploy.sh | 32 ------------------------------- flake.lock | 27 ++++++++++++++++++++++++++ flake.nix | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 32 deletions(-) delete mode 100755 deploy.sh create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/deploy.sh b/deploy.sh deleted file mode 100755 index 08cf4df..0000000 --- a/deploy.sh +++ /dev/null @@ -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} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..66ac1d5 --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..595ceaf --- /dev/null +++ b/flake.nix @@ -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 = { ... }: {}; + }; + }; +}