Compare commits

..

2 commits

Author SHA1 Message Date
b23046ea5d Add ornithologist LXC 2025-08-29 11:21:38 +08:00
ecbddad7a7 Clean up helpers.nix 2025-08-27 15:41:59 +08:00
5 changed files with 105 additions and 91 deletions

View file

@ -103,5 +103,10 @@
(mkHost "nextcloud" {
suite = "server/lxc";
})
# Container for managing server flock.
(mkHost "ornithologist" {
suite = "server/lxc";
})
];
}

View file

@ -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";

View file

@ -39,6 +39,9 @@ with lib; {
];
};
# Allow emulating aarch64 to build for Raspberry Pi.
boot.binfmt.emulatedSystems = ["aarch64-linux"];
# Share Music dir.
services.samba = {
enable = true;

View file

@ -0,0 +1,7 @@
{pkgs, ...}: {
# Allow emulating aarch64 to build for Raspberry Pi.
boot.binfmt.emulatedSystems = ["aarch64-linux"];
# Install some packages.
environment.systemPackages = with pkgs; [deploy-rs];
}

View file

@ -26,9 +26,6 @@ with lib; {
"udev.log_priority=3"
"rd.systemd.show_status=auto"
];
# Allow emulating aarch64 to build for Raspberry Pi.
binfmt.emulatedSystems = ["aarch64-linux"];
};
# Enable smart card support (for YubiKey).