From d9f0ada04f87074d1e101ef7dbd9b33bdf287f2c Mon Sep 17 00:00:00 2001 From: winston Date: Mon, 16 Sep 2024 17:04:33 +0200 Subject: [PATCH] feat: add deploy-rs --- flake.lock | 25 +++++++++++++++++++++++++ flake.nix | 45 ++++++++++++++++++++++++++++++++------------- 2 files changed, 57 insertions(+), 13 deletions(-) diff --git a/flake.lock b/flake.lock index 30881b4..bc6f9e6 100644 --- a/flake.lock +++ b/flake.lock @@ -73,6 +73,30 @@ "type": "github" } }, + "deploy-rs": { + "inputs": { + "flake-compat": [], + "nixpkgs": [ + "nixpkgs" + ], + "utils": [ + "flake-utils" + ] + }, + "locked": { + "lastModified": 1718194053, + "narHash": "sha256-FaGrf7qwZ99ehPJCAwgvNY5sLCqQ3GDiE/6uLhxxwSY=", + "owner": "serokell", + "repo": "deploy-rs", + "rev": "3867348fa92bc892eba5d9ddb2d7a97b9e127a8a", + "type": "github" + }, + "original": { + "owner": "serokell", + "repo": "deploy-rs", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -235,6 +259,7 @@ "inputs": { "agenix": "agenix", "attic": "attic", + "deploy-rs": "deploy-rs", "flake-parts": "flake-parts_2", "flake-utils": "flake-utils", "home-manager": "home-manager", diff --git a/flake.nix b/flake.nix index fbe5f19..cbdcc92 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,7 @@ flake-parts, nixpkgs, nixpkgs-unstable, + self, ... } @ inputs: let overlays = [ @@ -34,6 +35,17 @@ ]; specialArgs = {inherit inputs;}; }; + + checks = builtins.mapAttrs (_: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib; + + deploy.nodes.main-node = { + hostname = "winston.sh"; + profiles.system = { + user = "winston"; + remoteBuild = true; + path = inputs.deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.main-node; + }; + }; }; perSystem = { @@ -48,6 +60,20 @@ inherit overlays system; }; + devShells.default = pkgs.mkShell { + inherit (config.pre-commit.devShell) shellHook; + buildInputs = [ + inputs'.agenix.packages.agenix + pkgs.age-plugin-yubikey + pkgs.unstable.deploy-rs + pkgs.unstable.nh + pkgs.unstable.nixd + self'.formatter + ]; + }; + + formatter = pkgs.alejandra; + pre-commit = { check.enable = true; settings.excludes = ["_sources/"]; @@ -60,19 +86,6 @@ shellcheck.enable = true; }; }; - - devShells.default = pkgs.mkShell { - inherit (config.pre-commit.devShell) shellHook; - buildInputs = [ - inputs'.agenix.packages.agenix - pkgs.age-plugin-yubikey - pkgs.unstable.nh - pkgs.unstable.nil - self'.formatter - ]; - }; - - formatter = pkgs.alejandra; }; imports = [inputs.pre-commit-hooks.flakeModule]; @@ -106,6 +119,12 @@ inputs.flake-compat.follows = ""; inputs.flake-utils.follows = "flake-utils"; }; + deploy-rs = { + url = "github:serokell/deploy-rs"; + inputs.flake-compat.follows = ""; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.utils.follows = "flake-utils"; + }; pre-commit-hooks = { url = "github:cachix/pre-commit-hooks.nix"; inputs.flake-compat.follows = "";