From bec4007725c6eba9228158c2eef00004fddeba62 Mon Sep 17 00:00:00 2001 From: Artem Sheremet Date: Tue, 9 Jun 2026 09:27:30 +0000 Subject: [PATCH] Add deploy-rs config --- flake.lock | 144 ++++++++++++++++++++++++++++++++++++++++++++--------- flake.nix | 71 ++++++++++++++++++++++---- 2 files changed, 183 insertions(+), 32 deletions(-) diff --git a/flake.lock b/flake.lock index c3da934..3c6a4ab 100644 --- a/flake.lock +++ b/flake.lock @@ -37,18 +37,38 @@ "type": "github" } }, - "flake-compat": { - "flake": false, + "deploy-rs": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": "nixpkgs", + "utils": "utils" + }, "locked": { - "lastModified": 1767039857, - "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", - "owner": "NixOS", - "repo": "flake-compat", - "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", + "lastModified": 1770019181, + "narHash": "sha256-hwsYgDnby50JNVpTRYlF3UR/Rrpt01OrxVuryF40CFY=", + "owner": "serokell", + "repo": "deploy-rs", + "rev": "77c906c0ba56aabdbc72041bf9111b565cdd6171", "type": "github" }, "original": { - "owner": "NixOS", + "owner": "serokell", + "repo": "deploy-rs", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1733328505, + "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "type": "github" + }, + "original": { + "owner": "edolstra", "repo": "flake-compat", "type": "github" } @@ -69,9 +89,25 @@ "type": "github" } }, + "flake-compat_3": { + "flake": false, + "locked": { + "lastModified": 1767039857, + "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", + "owner": "NixOS", + "repo": "flake-compat", + "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "inputs": { - "systems": "systems_3" + "systems": "systems_4" }, "locked": { "lastModified": 1681202837, @@ -93,7 +129,7 @@ "nixpkgs": [ "nixpkgs" ], - "systems": "systems" + "systems": "systems_2" }, "locked": { "lastModified": 1779558945, @@ -111,7 +147,7 @@ }, "git-hooks": { "inputs": { - "flake-compat": "flake-compat", + "flake-compat": "flake-compat_2", "gitignore": "gitignore", "nixpkgs": [ "fw_nix", @@ -134,7 +170,7 @@ }, "git-hooks_2": { "inputs": { - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat_3", "gitignore": "gitignore_2", "nixpkgs": [ "nixpkgs" @@ -252,16 +288,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1779508470, - "narHash": "sha256-Ap9KJX+5xHIn3bPIpfNgT6MEXdAECECwo4/rmlQD74M=", - "owner": "nixos", + "lastModified": 1743014863, + "narHash": "sha256-jAIUqsiN2r3hCuHji80U7NNEafpIMBXiwKlSrjWMlpg=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "29916453413845e54a65b8a1cf996842300cd299", + "rev": "bd3bac8bfb542dbde7ffffb6987a1a1f9d41699f", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-unstable", + "owner": "NixOS", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } @@ -282,17 +318,48 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1779508470, + "narHash": "sha256-Ap9KJX+5xHIn3bPIpfNgT6MEXdAECECwo4/rmlQD74M=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "29916453413845e54a65b8a1cf996842300cd299", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1682134069, + "narHash": "sha256-TnI/ZXSmRxQDt2sjRYK/8j8iha4B4zP2cnQCZZ3vp7k=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "fd901ef4bf93499374c5af385b2943f5801c0833", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, "root": { "inputs": { "darwin": "darwin", + "deploy-rs": "deploy-rs", "fw_nix": "fw_nix", "git-hooks": "git-hooks_2", "home-manager": "home-manager", "jail-nix": "jail-nix", "nix-homebrew": "nix-homebrew", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nixpkgs-master": "nixpkgs-master", - "systems": "systems_2", + "systems": "systems_3", "vscode-server": "vscode-server" } }, @@ -341,12 +408,43 @@ "type": "github" } }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "vscode-server": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": [ - "nixpkgs" - ] + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1770124655, diff --git a/flake.nix b/flake.nix index 3a808b3..b343b77 100644 --- a/flake.nix +++ b/flake.nix @@ -27,6 +27,7 @@ inputs.nixpkgs.follows = "nixpkgs"; }; jail-nix.url = "sourcehut:~alexdavid/jail.nix"; + deploy-rs.url = "github:serokell/deploy-rs"; }; outputs = @@ -38,6 +39,7 @@ home-manager, vscode-server, darwin, + deploy-rs, ... }@inputs: let @@ -59,14 +61,65 @@ }; in { - checks = eachSystem (system: { - pre-commit-check = inputs.git-hooks.lib.${system}.run ( - { - src = ./.; - } - // inputs.fw_nix.lib.pre-commit - ); - }); + checks = eachSystem ( + system: + { + pre-commit-check = inputs.git-hooks.lib.${system}.run ( + { + src = ./.; + excludes = [ "legacy/" ]; + } + // inputs.fw_nix.lib.pre-commit + ); + } + // deploy-rs.lib.${system}.deployChecks { + nodes = builtins.intersectAttrs ( + if system == "x86_64-linux" then + { deimos = 1; } + else if system == "x86_64-darwin" then + { mars = 1; } + else + { } + ) self.deploy.nodes; + } + ); + + deploy = { + nodes = { + deimos = { + hostname = "deimos"; + profiles = { + system = { + sshUser = homeManagerUser; + user = "root"; + path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.deimos; + }; + home = { + user = homeManagerUser; + path = + deploy-rs.lib.x86_64-linux.activate.home-manager + self.homeConfigurations."${homeManagerUser}@deimos"; + }; + }; + }; + mars = { + hostname = "mars"; + profiles = { + system = { + sshUser = homeManagerUser; + user = "root"; + path = deploy-rs.lib.x86_64-darwin.activate.darwin self.darwinConfigurations.mars; + }; + home = { + user = homeManagerUser; + path = + deploy-rs.lib.x86_64-darwin.activate.home-manager + self.homeConfigurations."${homeManagerUser}@mars"; + }; + }; + }; + }; + }; homeModules = { mac-portable = import ./modules/home/mac-portable.nix; @@ -159,7 +212,7 @@ in { default = pkgs.mkShell { - packages = enabledPackages; + packages = enabledPackages ++ [ pkgs.deploy-rs ]; inherit shellHook; }; }