summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flake.lock48
-rw-r--r--flake.nix12
-rw-r--r--hosts/atlas/default.nix8
-rw-r--r--hosts/default.nix6
-rw-r--r--hosts/p-body/default.nix8
-rw-r--r--justfile2
-rw-r--r--parts/default.nix1
-rw-r--r--parts/deploy.nix49
-rw-r--r--parts/dev.nix20
9 files changed, 97 insertions, 57 deletions
diff --git a/flake.lock b/flake.lock
index ff0876a..af50e6d 100644
--- a/flake.lock
+++ b/flake.lock
@@ -95,6 +95,32 @@
"type": "github"
}
},
+ "deploy-rs": {
+ "inputs": {
+ "flake-compat": [
+ "flake-compat"
+ ],
+ "nixpkgs": [
+ "nixpkgs"
+ ],
+ "utils": [
+ "flake-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": {
@@ -302,26 +328,6 @@
"type": "github"
}
},
- "nixinate": {
- "inputs": {
- "nixpkgs": [
- "nixpkgs"
- ]
- },
- "locked": {
- "lastModified": 1688141737,
- "narHash": "sha256-qHrNMYWukOKmKVf6wXOGKj1xxUnOGjvTRbt/PLLXuBE=",
- "owner": "MatthewCroughan",
- "repo": "nixinate",
- "rev": "7902ae845e6cc5bd450e510cdf5e009a6e4a44d9",
- "type": "github"
- },
- "original": {
- "owner": "MatthewCroughan",
- "repo": "nixinate",
- "type": "github"
- }
- },
"nixos-hardware": {
"locked": {
"lastModified": 1691730710,
@@ -517,6 +523,7 @@
"root": {
"inputs": {
"darwin": "darwin",
+ "deploy-rs": "deploy-rs",
"flake-compat": "flake-compat",
"flake-parts": "flake-parts",
"flake-utils": "flake-utils",
@@ -525,7 +532,6 @@
"home-manager": "home-manager",
"lanzaboote": "lanzaboote",
"nix-index-database": "nix-index-database",
- "nixinate": "nixinate",
"nixos-hardware": "nixos-hardware",
"nixos-wsl": "nixos-wsl",
"nixpkgs": "nixpkgs_2",
diff --git a/flake.nix b/flake.nix
index a5cb141..79a7867 100644
--- a/flake.nix
+++ b/flake.nix
@@ -24,6 +24,13 @@
inputs.nixpkgs.follows = "nixpkgs";
};
+ deploy-rs = {
+ url = "github:serokell/deploy-rs";
+ inputs.nixpkgs.follows = "nixpkgs";
+ inputs.utils.follows = "flake-utils";
+ inputs.flake-compat.follows = "flake-compat";
+ };
+
# this is just to avoid having multiple versions in flake.lock
flake-compat = {
url = "github:edolstra/flake-compat";
@@ -63,11 +70,6 @@
inputs.pre-commit-hooks-nix.follows = "pre-commit-hooks";
};
- nixinate = {
- url = "github:MatthewCroughan/nixinate";
- inputs.nixpkgs.follows = "nixpkgs";
- };
-
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
diff --git a/hosts/atlas/default.nix b/hosts/atlas/default.nix
index 1a9691d..212d44a 100644
--- a/hosts/atlas/default.nix
+++ b/hosts/atlas/default.nix
@@ -9,14 +9,6 @@
./nginx.nix
];
- _module.args.nixinate = {
- host = "atlas";
- sshUser = "root";
- buildOn = "remote";
- substituteOnTarget = true;
- hermetic = false;
- };
-
boot = {
binfmt.emulatedSystems = ["x86_64-linux" "i686-linux"];
loader.systemd-boot.enable = true;
diff --git a/hosts/default.nix b/hosts/default.nix
index a3340b5..f1ff518 100644
--- a/hosts/default.nix
+++ b/hosts/default.nix
@@ -48,13 +48,9 @@
nixosModules.getchoo = import ../modules/nixos;
darwinModules.getchoo = import ../modules/darwin;
- packages.x86_64-linux.turret = withSystem "x86_64-linux" ({pkgs, ...}:
+ openwrt.turret = withSystem "x86_64-linux" ({pkgs, ...}:
pkgs.callPackage ./turret {
inherit (inputs) openwrt-imagebuilder;
});
};
-
- perSystem = {system, ...}: {
- apps = (inputs.nixinate.nixinate.${system} self).nixinate;
- };
}
diff --git a/hosts/p-body/default.nix b/hosts/p-body/default.nix
index c1d4dca..16341e7 100644
--- a/hosts/p-body/default.nix
+++ b/hosts/p-body/default.nix
@@ -14,14 +14,6 @@
./victoriametrics.nix
];
- _module.args.nixinate = {
- host = "p-body";
- sshUser = "root";
- buildOn = "remote";
- substituteOnTarget = true;
- hermetic = false;
- };
-
getchoo.server.secrets.enable = true;
networking = {
diff --git a/justfile b/justfile
index b4d42dc..c01fb76 100644
--- a/justfile
+++ b/justfile
@@ -23,7 +23,7 @@ check:
nix flake check
deploy HOST:
- nix run .#{{ HOST }}
+ deploy .#{{ HOST }}
deploy-all: (deploy "atlas") (deploy "p-body")
diff --git a/parts/default.nix b/parts/default.nix
index fa5cf95..dc01879 100644
--- a/parts/default.nix
+++ b/parts/default.nix
@@ -1,5 +1,6 @@
{inputs, ...}: {
imports = [
+ ./deploy.nix
./dev.nix
./overlays
];
diff --git a/parts/deploy.nix b/parts/deploy.nix
new file mode 100644
index 0000000..bebf25c
--- /dev/null
+++ b/parts/deploy.nix
@@ -0,0 +1,49 @@
+{
+ self,
+ inputs,
+ lib,
+ withSystem,
+ ...
+}: let
+ systems = ["atlas" "p-body"];
+
+ deployedSystems =
+ lib.filterAttrs
+ (n: _: builtins.elem n systems)
+ self.nixosConfigurations;
+
+ deployPkgs = import inputs.nixpkgs rec {
+ system = "x86_64-linux";
+ overlays = [
+ inputs.deploy-rs.overlay
+ (_: prev: {
+ deploy-rs = {
+ inherit (withSystem system (p: p.pkgs)) deploy-rs;
+ inherit (prev.deploy-rs) lib;
+ };
+ })
+ ];
+ };
+
+ mkNodes = hosts: let
+ inherit (builtins) attrNames listToAttrs map;
+ vals =
+ map (name: let
+ system = self.nixosConfigurations.${name};
+ in {
+ inherit name;
+ value = {
+ sshUser = "root";
+ hostname = system.config.networking.hostName;
+ profiles.system.path = deployPkgs.deploy-rs.lib.activate.nixos system;
+ };
+ })
+ (attrNames hosts);
+ in
+ listToAttrs vals;
+in {
+ flake.deploy = {
+ remoteBuild = true;
+ nodes = mkNodes deployedSystems;
+ };
+}
diff --git a/parts/dev.nix b/parts/dev.nix
index c190008..c0b5490 100644
--- a/parts/dev.nix
+++ b/parts/dev.nix
@@ -25,15 +25,17 @@
devShells = {
default = pkgs.mkShell {
inherit (self.checks.${system}.pre-commit-check) shellHook;
- packages = with pkgs; [
- actionlint
- alejandra
- deadnix
- just
- inputs.ragenix.packages.${system}.ragenix
- statix
- stylua
- ];
+ packages = with pkgs;
+ [
+ actionlint
+ alejandra
+ deadnix
+ just
+ inputs.ragenix.packages.${system}.ragenix
+ statix
+ stylua
+ ]
+ ++ lib.optional (system == "x86_64-linux") deploy-rs;
};
};