init
This commit is contained in:
parent
6a95af0656
commit
6447202f7f
11 changed files with 235 additions and 0 deletions
67
flake.nix
Normal file
67
flake.nix
Normal file
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
description = "LaSuite Federez Deployment";
|
||||
|
||||
inputs = {
|
||||
# General sources
|
||||
deploy-rs.url = "github:serokell/deploy-rs";
|
||||
agenix.url = "github:ryantm/agenix";
|
||||
nixpkgs-25-05.url = "github:NixOS/nixpkgs/nixos-25.05";
|
||||
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs-25-05, nixpkgs-unstable, deploy-rs, agenix }: let
|
||||
system = "x86_64-linux";
|
||||
|
||||
# Unmodified nixpkgs
|
||||
pkgs-25-05 = import nixpkgs-25-05 { inherit system; };
|
||||
pkgs-unstable = import nixpkgs-unstable { inherit system; };
|
||||
|
||||
# nixpkgs with deploy-rs overlay but force the nixpkgs package
|
||||
deployPkgs-25-05 = import nixpkgs-25-05 {
|
||||
inherit system;
|
||||
overlays = [
|
||||
deploy-rs.overlay.default
|
||||
(self: super: { deploy-rs = { inherit (pkgs-25-05) deploy-rs; lib = super.deploy-rs.lib; }; })
|
||||
];
|
||||
};
|
||||
deployPkgs-unstable = import nixpkgs-unstable {
|
||||
inherit system;
|
||||
overlays = [
|
||||
deploy-rs.overlay.default
|
||||
(self: super: { deploy-rs = { inherit (pkgs-unstable) deploy-rs; lib = super.deploy-rs.lib; }; })
|
||||
];
|
||||
};
|
||||
|
||||
nodes = import ./shared/nodes.nix;
|
||||
|
||||
defaultModules = [
|
||||
./shared/users.nix
|
||||
./shared/commons.nix
|
||||
];
|
||||
|
||||
in {
|
||||
deploy = {
|
||||
user = "root";
|
||||
autoRollback = true;
|
||||
magicRollback = true;
|
||||
remoteBuild = true;
|
||||
nodes = builtins.mapAttrs (name: config: {
|
||||
"${name}" = {
|
||||
hostname = builtins.head (builtins.split "/" config.ip4);
|
||||
profilesOrder = [ "system" ];
|
||||
profiles = {
|
||||
system = {
|
||||
path = "deployPkgs-${config.ver}".deploy-rs.lib.activate.nixos "nixpkgs-${config.ver}".lib.nixosSystem {
|
||||
system = config.system;
|
||||
modules = config.modules ++ defaultModules;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}) nodes;
|
||||
};
|
||||
|
||||
# This is highly advised, and will prevent many possible mistakes
|
||||
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue