diff --git a/flake.lock b/flake.lock index 1beee1c..76149cb 100644 --- a/flake.lock +++ b/flake.lock @@ -47,6 +47,47 @@ "type": "github" } }, + "deploy-rs": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": [ + "nixpkgs" + ], + "utils": [ + "flake-utils" + ] + }, + "locked": { + "lastModified": 1711973905, + "narHash": "sha256-UFKME/N1pbUtn+2Aqnk+agUt8CekbpuqwzljivfIme8=", + "owner": "serokell", + "repo": "deploy-rs", + "rev": "88b3059b020da69cbe16526b8d639bd5e0b51c8b", + "type": "github" + }, + "original": { + "owner": "serokell", + "ref": "master", + "repo": "deploy-rs", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems_2" @@ -137,6 +178,7 @@ "root": { "inputs": { "agenix": "agenix", + "deploy-rs": "deploy-rs", "flake-utils": "flake-utils", "home-manager": "home-manager", "impermanence": "impermanence", diff --git a/flake.nix b/flake.nix index d98c454..6436bc7 100644 --- a/flake.nix +++ b/flake.nix @@ -13,11 +13,15 @@ home-manager.inputs.nixpkgs.follows = "nixpkgs"; impermanence.url = "github:nix-community/impermanence/master"; + + deploy-rs.url = "github:serokell/deploy-rs/master"; + deploy-rs.inputs.nixpkgs.follows = "nixpkgs"; + deploy-rs.inputs.utils.follows = "flake-utils"; }; description = "Hillion Nix flake"; - outputs = { self, nixpkgs, nixpkgs-unstable, flake-utils, agenix, home-manager, impermanence, ... }@inputs: { + outputs = { self, nixpkgs, nixpkgs-unstable, flake-utils, agenix, home-manager, impermanence, deploy-rs, ... }@inputs: { nixosConfigurations = let fqdns = builtins.attrNames (builtins.readDir ./hosts); @@ -55,6 +59,21 @@ }; in nixpkgs.lib.genAttrs fqdns mkHost; + + deploy = { + nodes = builtins.mapAttrs + (name: value: { + hostname = name; + profiles.system = { + user = "root"; + remoteBuild = true; + path = deploy-rs.lib.aarch64-darwin.activate.nixos self.nixosConfigurations.${name}; + }; + }) + self.nixosConfigurations; + }; + + checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; } // flake-utils.lib.eachDefaultSystem (system: { formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt; });