Replace deploy-rs with nh for remote push deployments

This commit is contained in:
SebastianStork 2026-02-03 19:04:48 +01:00
parent 5c61459fe7
commit fee1ddd9a9
Signed by: SebastianStork
SSH key fingerprint: SHA256:tRrGdjYOwgHxpSc/wTOZQZEjxcb15P0tyXRsbAfd+2Q
5 changed files with 6 additions and 100 deletions

View file

@ -1,12 +1,11 @@
_: {
perSystem =
{ inputs', pkgs, ... }:
{ pkgs, ... }:
{
devShells.default = pkgs.mkShellNoCC {
packages = [
pkgs.just
pkgs.nh
inputs'.deploy-rs.packages.default
];
};
};

View file

@ -17,26 +17,8 @@ let
]
++ lib.optional (lib.pathExists "${self}/users/seb/@${hostName}") "${self}/users/seb/@${hostName}";
};
mkDeployNode = hostName: {
hostname = "${hostName}.${
self.nixosConfigurations.${hostName}.config.custom.networking.overlay.domain
}";
user = "root";
interactiveSudo = true;
profiles.system.path =
inputs.deploy-rs.lib.x86_64-linux.activate.nixos
self.nixosConfigurations.${hostName};
};
hostNames = "${self}/hosts" |> self.lib.listDirectoryNames;
in
{
flake = {
nixosConfigurations = hostNames |> self.lib.genAttrs mkHost;
deploy.nodes = hostNames |> self.lib.genAttrs mkDeployNode;
checks = inputs.deploy-rs.lib |> lib.mapAttrs (_: deployLib: deployLib.deployChecks self.deploy);
};
flake.nixosConfigurations =
"${self}/hosts" |> self.lib.listDirectoryNames |> self.lib.genAttrs mkHost;
}

72
flake.lock generated
View file

@ -58,28 +58,6 @@
"url": "https://codeberg.org/kampka/nix-flake-crowdsec.git"
}
},
"deploy-rs": {
"inputs": {
"flake-compat": "flake-compat_2",
"nixpkgs": [
"nixpkgs"
],
"utils": "utils"
},
"locked": {
"lastModified": 1766051518,
"narHash": "sha256-znKOwPXQnt3o7lDb3hdf19oDo0BLP4MfBOYiWkEHoik=",
"owner": "serokell",
"repo": "deploy-rs",
"rev": "d5eff7f948535b9c723d60cd8239f8f11ddc90fa",
"type": "github"
},
"original": {
"owner": "serokell",
"repo": "deploy-rs",
"type": "github"
}
},
"disko": {
"inputs": {
"nixpkgs": [
@ -139,22 +117,6 @@
"type": "github"
}
},
"flake-compat_2": {
"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"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
@ -351,7 +313,6 @@
"betterfox": "betterfox",
"comin": "comin",
"crowdsec": "crowdsec",
"deploy-rs": "deploy-rs",
"disko": "disko",
"firefox-addons": "firefox-addons",
"flake-parts": "flake-parts",
@ -401,21 +362,6 @@
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt": {
"inputs": {
"nixpkgs": [
@ -436,24 +382,6 @@
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems_2"
},
"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-extensions": {
"inputs": {
"nixpkgs": [

View file

@ -30,11 +30,6 @@
inputs.nixpkgs.follows = "nixpkgs";
};
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs.nixpkgs.follows = "nixpkgs";
};
treefmt = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";

View file

@ -40,7 +40,9 @@ reboot:
[group('remote')]
deploy +hosts:
deploy --skip-checks --targets $(echo {{ hosts }} | sed 's/[^ ]*/\.#&/g')
for host in {{ hosts }}; do \
nh os switch . --hostname=$host --target-host=$host; \
done
[group('remote')]
install host destination='root@installer':