home lab init
This commit is contained in:
commit
7278922625
65 changed files with 27336 additions and 0 deletions
46
nixos/hosts/docker-host.nix
Normal file
46
nixos/hosts/docker-host.nix
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
{ config, pkgs, modulesPath, lib, ... }:
|
||||
|
||||
{
|
||||
# Pull in all the shared settings from configuration.nix
|
||||
imports = [ ../configuration.nix ];
|
||||
|
||||
config = lib.recursiveUpdate config ({
|
||||
# (Here, add anything live‐VM‐specific—e.g. NFS mounts, Docker, Compose service,
|
||||
# static IP, or “import users/plasmagoat.nix” if you prefer.)
|
||||
|
||||
networking.interfaces.enp0s25 = {
|
||||
useDHCP = false;
|
||||
ipv4.addresses = [ { address = "192.168.1.50"; prefixLength = 24; } ];
|
||||
ipv4.gateway = "192.168.1.1";
|
||||
};
|
||||
|
||||
# Docker + Compose bits, for example:
|
||||
fileSystems."/mnt/nas" = {
|
||||
device = "192.168.1.100:/export/docker-volumes";
|
||||
fsType = "nfs";
|
||||
options = [ "defaults" "nofail" "x-systemd.requires=network-online.target" ];
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
pkgs.docker
|
||||
pkgs.docker-compose
|
||||
# …plus anything else you want only on live VM…
|
||||
];
|
||||
|
||||
services.docker.enable = true;
|
||||
|
||||
systemd.services.dockerComposeApp = {
|
||||
description = "Auto-start Docker‐Compose stack";
|
||||
after = [ "network-online.target" "docker.service" ];
|
||||
wants = [ "network-online.target" "docker.service" ];
|
||||
serviceConfig = {
|
||||
WorkingDirectory = "/etc/docker-compose-app";
|
||||
ExecStart = "${pkgs.docker-compose}/bin/docker-compose -f /etc/docker-compose-app/docker-compose.yml up";
|
||||
ExecStop = "${pkgs.docker-compose}/bin/docker-compose -f /etc/docker-compose-app/docker-compose.yml down";
|
||||
Restart = "always";
|
||||
RestartSec = 10;
|
||||
};
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue