From c72e3e2e815b241bdea7ae61241d1250f98c0463 Mon Sep 17 00:00:00 2001 From: josiah Date: Sun, 19 Feb 2023 11:30:38 -0600 Subject: [PATCH] Experimenting with deploy-rs, DO NOT USE. Deploy-rs ultimately did not work for us. It seems to break when trying to push the flake to remote machines. Leaving here for historical purposes. --- nixos-configs/deploy-rs/flake.lock | 95 ++++++++++++++++++++++++++++++ nixos-configs/deploy-rs/flake.nix | 31 +++++++--- 2 files changed, 119 insertions(+), 7 deletions(-) create mode 100644 nixos-configs/deploy-rs/flake.lock diff --git a/nixos-configs/deploy-rs/flake.lock b/nixos-configs/deploy-rs/flake.lock new file mode 100644 index 0000000..79a5b80 --- /dev/null +++ b/nixos-configs/deploy-rs/flake.lock @@ -0,0 +1,95 @@ +{ + "nodes": { + "deploy-rs": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": "nixpkgs", + "utils": "utils" + }, + "locked": { + "lastModified": 1674127017, + "narHash": "sha256-QO1xF7stu5ZMDLbHN30LFolMAwY6TVlzYvQoUs1RD68=", + "owner": "serokell", + "repo": "deploy-rs", + "rev": "8c9ea9605eed20528bf60fae35a2b613b901fd77", + "type": "github" + }, + "original": { + "owner": "serokell", + "repo": "deploy-rs", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1668681692, + "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1671417167, + "narHash": "sha256-JkHam6WQOwZN1t2C2sbp1TqMv3TVRjzrdoejqfefwrM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "bb31220cca6d044baa6dc2715b07497a2a7c4bc7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1672580127, + "narHash": "sha256-3lW3xZslREhJogoOkjeZtlBtvFMyxHku7I/9IVehhT8=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "0874168639713f547c05947c76124f78441ea46c", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-22.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "deploy-rs": "deploy-rs", + "nixpkgs": "nixpkgs_2" + } + }, + "utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/nixos-configs/deploy-rs/flake.nix b/nixos-configs/deploy-rs/flake.nix index 6ed952a..3a93164 100644 --- a/nixos-configs/deploy-rs/flake.nix +++ b/nixos-configs/deploy-rs/flake.nix @@ -1,23 +1,40 @@ { description = "Test deployment for my server cluster"; - # For accessing `deploy-rs`'s utility Nix functions - inputs.deploy-rs.url = "github:serokell/deploy-rs"; + inputs = { + nixpkgs.url = + "github:nixos/nixpkgs/nixos-22.05"; # change this to your desired NixOS version + # For accessing `deploy-rs`'s utility Nix functions + deploy-rs.url = "github:serokell/deploy-rs"; + }; outputs = { self, nixpkgs, deploy-rs }: { - nixosConfigurations.seraph = nixpkgs.lib.nixosSystem { + nixosConfigurations.exgod = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; - modules = [ ../hosts/seraph/configuration.nix ]; + modules = [ ../hosts/exgod/configuration.nix ]; }; - deploy.nodes.seraph.profiles.system = { + deploy.nodes.exgod = { + hostname = "exgod"; user = "alice"; sshUser = "alice"; + magicRollback = false; remoteBuild = false; - path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.some-random-system; + path = deploy-rs.lib.x86_64-linux.activate.nixos + self.nixosConfigurations.exgod; + + # This forces ssh to connect over IPv4. + sshOpts = [ "-4" ]; + + profiles.system = { + path = deploy-rs.lib.x86_64-linux.activate.nixos + self.nixosConfigurations.exgod; + }; }; # This is highly advised, and will prevent many possible mistakes - checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; + checks = + builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) + deploy-rs.lib; }; }