feat: added deploy-rs

main
Ricard Illa 2023-08-04 17:45:37 +02:00
parent 8e90c64dbe
commit de13ab6b0e
Signed by: rilla
GPG Key ID: 525307BD467E4205
3 changed files with 131 additions and 9 deletions

View File

@ -34,7 +34,7 @@
sudo.enable = false;
};
environment.systemPackages = with pkgs; [ git vim wget just ripgrep ];
environment.systemPackages = with pkgs; [ git vim wget just ripgrep deploy-rs ];
services.openssh = {
enable = true;

View File

@ -1,5 +1,41 @@
{
"nodes": {
"deploy-rs": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": "nixpkgs",
"utils": "utils"
},
"locked": {
"lastModified": 1686747123,
"narHash": "sha256-XUQK9kwHpTeilHoad7L4LjMCCyY13Oq383CoFADecRE=",
"owner": "serokell",
"repo": "deploy-rs",
"rev": "724463b5a94daa810abfc64a4f87faef4e00f984",
"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"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@ -54,17 +90,18 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1690548937,
"narHash": "sha256-x3ZOPGLvtC0/+iFAg9Kvqm/8hTAIkGjc634SqtgaXTA=",
"lastModified": 1671417167,
"narHash": "sha256-JkHam6WQOwZN1t2C2sbp1TqMv3TVRjzrdoejqfefwrM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2a9d660ff0f7ffde9d73be328ee6e6f10ef66b28",
"rev": "bb31220cca6d044baa6dc2715b07497a2a7c4bc7",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
@ -82,14 +119,45 @@
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1690548937,
"narHash": "sha256-x3ZOPGLvtC0/+iFAg9Kvqm/8hTAIkGjc634SqtgaXTA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2a9d660ff0f7ffde9d73be328ee6e6f10ef66b28",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"root": {
"inputs": {
"deploy-rs": "deploy-rs",
"home-manager": "home-manager",
"impermanence": "impermanence",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs",
"nixpkgs": "nixpkgs_2",
"nixpkgs-stable": "nixpkgs-stable"
}
},
"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",

View File

@ -8,6 +8,7 @@
inputs.nixpkgs.follows = "nixpkgs";
};
impermanence.url = "github:nix-community/impermanence";
deploy-rs.url = "github:serokell/deploy-rs";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
};
@ -18,7 +19,26 @@
, nixos-hardware
, home-manager
, impermanence
}@inputs: {
, deploy-rs
}@inputs:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
deployPkgs = import nixpkgs {
inherit system;
overlays = [
deploy-rs.overlay
(self: super: {
deploy-rs = {
inherit (pkgs) deploy-rs;
lib = deploy-rs.lib;
};
})
];
};
in
{
nixosConfigurations = {
trantor = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
@ -60,5 +80,39 @@
];
};
};
deploy.nodes = {
capibara = {
hostname = "capibara";
profiles = {
system = {
sshUser = "rilla";
user = "root";
sudo = "doas -u";
path = deployPkgs.deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.capibara;
autoRollback = true;
remoteBuild = false;
};
};
};
lb = {
hostname = "lb";
profiles = {
system = {
sshUser = "rilla";
user = "root";
sudo = "doas -u";
path = deployPkgs.deploy-rs.lib.aarch64-linux.activate.nixos self.nixosConfigurations.lb;
autoRollback = true;
# remoteBuild = false;
remoteBuild = true;
};
};
};
};
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deployPkgs.deploy-rs.lib;
};
}