Clean up helpers.nix
This commit is contained in:
parent
7417d91809
commit
ecbddad7a7
1 changed files with 90 additions and 88 deletions
52
helpers.nix
52
helpers.nix
|
@ -12,13 +12,14 @@ with inputs.nixpkgs.lib; {
|
|||
suite ? "",
|
||||
docker ? false,
|
||||
hostModules ? [],
|
||||
}:
|
||||
{
|
||||
nixosConfigurations.${hostname} = nixosSystem rec {
|
||||
}: let
|
||||
# Secrets directory.
|
||||
secrets = builtins.toString inputs.secrets;
|
||||
|
||||
# Architecture.
|
||||
system = platform;
|
||||
|
||||
# nixpkgs config.
|
||||
# Stable nixpkgs with overlay.
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
|
||||
|
@ -38,12 +39,27 @@ with inputs.nixpkgs.lib; {
|
|||
];
|
||||
};
|
||||
|
||||
specialArgs = {
|
||||
# Pass hostname & inputs to config.
|
||||
inherit inputs hostname;
|
||||
# deploy-rs.
|
||||
deployPkgs = import nixpkgs {
|
||||
inherit system;
|
||||
|
||||
# Secrets directory.
|
||||
secrets = builtins.toString inputs.secrets;
|
||||
overlays = [
|
||||
deploy-rs.overlays.default
|
||||
(self: super: {
|
||||
deploy-rs = {
|
||||
inherit (pkgs) deploy-rs;
|
||||
lib = super.deploy-rs.lib;
|
||||
};
|
||||
})
|
||||
];
|
||||
};
|
||||
in {
|
||||
nixosConfigurations.${hostname} = nixosSystem {
|
||||
inherit system pkgs;
|
||||
|
||||
specialArgs = {
|
||||
# Pass variables to config.
|
||||
inherit inputs secrets hostname;
|
||||
};
|
||||
|
||||
modules =
|
||||
|
@ -83,22 +99,8 @@ with inputs.nixpkgs.lib; {
|
|||
++ optionals (docker == true) [./suites/server/docker] # Enable docker if required.
|
||||
++ (filesystem.listFilesRecursive ./modules); # Custom modules.
|
||||
};
|
||||
}
|
||||
// optionalAttrs (strings.hasPrefix "server" suite) {
|
||||
deploy.nodes.${hostname} = let
|
||||
deployPkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [
|
||||
deploy-rs.overlays.default
|
||||
(self: super: {
|
||||
deploy-rs = {
|
||||
inherit (pkgs) deploy-rs;
|
||||
lib = super.deploy-rs.lib;
|
||||
};
|
||||
})
|
||||
];
|
||||
};
|
||||
in {
|
||||
|
||||
deploy.nodes.${hostname} = mkIf (strings.hasPrefix "server" suite) {
|
||||
hostname = "${hostname}.local";
|
||||
profiles.system = {
|
||||
user = "root";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue