config: add deploy.nodes to output

Welp, now I'm using NixOS for my servers. One step closer to managing an
entire cluster with this.
This commit is contained in:
Gabriel Arazas 2022-11-13 13:49:54 +08:00
parent 1658f2d4ca
commit ebbd0b5220
2 changed files with 82 additions and 2 deletions

58
flake.lock generated
View File

@ -49,6 +49,28 @@
"type": "github" "type": "github"
} }
}, },
"deploy": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": [
"nixpkgs"
],
"utils": "utils"
},
"locked": {
"lastModified": 1659725433,
"narHash": "sha256-1ZxuK67TL29YLw88vQ18Y2Y6iYg8Jb7I6/HVzmNB6nM=",
"owner": "serokell",
"repo": "deploy-rs",
"rev": "41f15759dd8b638e7b4f299730d94d5aa46ab7eb",
"type": "github"
},
"original": {
"owner": "serokell",
"repo": "deploy-rs",
"type": "github"
}
},
"devshell": { "devshell": {
"inputs": { "inputs": {
"flake-utils": [ "flake-utils": [
@ -188,6 +210,22 @@
} }
}, },
"flake-compat": { "flake-compat": {
"flake": false,
"locked": {
"lastModified": 1648199409,
"narHash": "sha256-JwPKdC2PoVBkG6E+eWw3j6BMR6sL3COpYWfif7RVb8Y=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "64a525ee38886ab9028e6f61790de0832aa3ef03",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_2": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1650374568, "lastModified": 1650374568,
@ -380,7 +418,7 @@
}, },
"neovim-nightly-overlay": { "neovim-nightly-overlay": {
"inputs": { "inputs": {
"flake-compat": "flake-compat", "flake-compat": "flake-compat_2",
"neovim-flake": "neovim-flake", "neovim-flake": "neovim-flake",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
@ -447,7 +485,7 @@
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"utils": "utils" "utils": "utils_2"
}, },
"locked": { "locked": {
"lastModified": 1652641841, "lastModified": 1652641841,
@ -579,6 +617,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"deploy": "deploy",
"devshell": "devshell", "devshell": "devshell",
"dotfiles": "dotfiles", "dotfiles": "dotfiles",
"emacs-overlay": "emacs-overlay", "emacs-overlay": "emacs-overlay",
@ -664,6 +703,21 @@
} }
}, },
"utils": { "utils": {
"locked": {
"lastModified": 1648297722,
"narHash": "sha256-W+qlPsiZd8F3XkzXOzAoR+mpFqzm3ekQkJNa+PIh1BQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "0f8662f1319ad6abf89b3380dd2722369fc51ade",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"utils_2": {
"locked": { "locked": {
"lastModified": 1652372896, "lastModified": 1652372896,
"narHash": "sha256-lURGussfF3mGrFPQT3zgW7+RC0pBhbHzco0C7I+ilow=", "narHash": "sha256-lURGussfF3mGrFPQT3zgW7+RC0pBhbHzco0C7I+ilow=",

View File

@ -71,6 +71,11 @@
# Generating an entire flavored themes with Nix? # Generating an entire flavored themes with Nix?
nix-colors.url = "github:misterio77/nix-colors"; nix-colors.url = "github:misterio77/nix-colors";
# Deploying stuff with Nix. This is becoming a monorepo for everything I
# need and I'm liking it.
deploy.url = "github:serokell/deploy-rs";
deploy.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = inputs@{ self, nixpkgs, ... }: outputs = inputs@{ self, nixpkgs, ... }:
@ -384,5 +389,26 @@
# feel like it does. # feel like it does.
formatter = formatter =
forAllSystems (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt); forAllSystems (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt);
# nixops-lite... in here!?! We got it all, son!
#
# Take note for automatically imported nodes, various options should be
# overridden in the deploy utility considering that most have only
# certain values and likely not work if run with the intended value.
deploy.nodes = (lib'.mapAttrs' (name: value:
lib'.nameValuePair name {
hostname = name;
profiles.system = {
sshUser = "admin";
user = "root";
path = inputs.deploy.lib.${defaultSystem}.activate.nixos value;
};
}) self.nixosConfigurations);
# How to make yourself slightly saner than before. So far the main checks
# are for deploy nodes.
checks = lib'.mapAttrs
(system: deployLib: deployLib.deployChecks self.deploy)
inputs.deploy.lib;
}; };
} }