add home assistant

This commit is contained in:
Stefan Kempinger 2025-11-19 15:18:29 +01:00
parent e591a7a60c
commit c626bc4b9f
3 changed files with 44 additions and 19 deletions

View file

@ -58,7 +58,9 @@
22 22
80 80
443 443
3000 2222 # forgejo ssh
3000 # forgejo frontend
8123 # homeassistant
9000 9000
]; ];
@ -68,14 +70,6 @@
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINGHadFhDCUU/ta3p1FQgpm7NExHkyHNrJbNJP6np5w9 kempinger@ins.jku.at" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINGHadFhDCUU/ta3p1FQgpm7NExHkyHNrJbNJP6np5w9 kempinger@ins.jku.at"
]; ];
}; };
# Service users for containers
users.users.docker-user = {
isSystemUser = true;
group = "docker-user";
extraGroups = [ "docker" ];
};
users.groups.docker-user = { };
# Security # Security
# security.sudo.wheelNeedsPassword = false; # security.sudo.wheelNeedsPassword = false;
@ -89,6 +83,9 @@
}; };
}; };
hardware.bluetooth.enable = true;
services.blueman.enable = true;
# Packages # Packages
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
vim vim
@ -100,6 +97,9 @@
docker-compose docker-compose
nixd nixd
nixfmt nixfmt
systemd
nil
]; ];
# Nix settings # Nix settings

6
flake.lock generated
View file

@ -20,11 +20,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1761907660, "lastModified": 1762977756,
"narHash": "sha256-kJ8lIZsiPOmbkJypG+B5sReDXSD1KGu2VEPNqhRa/ew=", "narHash": "sha256-4PqRErxfe+2toFJFgcRKZ0UI9NSIOJa+7RXVtBhy4KE=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "2fb006b87f04c4d3bdf08cfdbc7fab9c13d94a15", "rev": "c5ae371f1a6a7fd27823bc500d9390b38c05fa55",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -59,7 +59,11 @@ in
# You need to specify this to remove the port from URLs in the web UI. # You need to specify this to remove the port from URLs in the web UI.
ROOT_URL = "https://${srv.DOMAIN}/"; ROOT_URL = "https://${srv.DOMAIN}/";
HTTP_PORT = 3000; HTTP_PORT = 3000;
DISABLE_SSH = false;
SSH_PORT = 2222;
START_SSH_SERVER=true;
}; };
# You can temporarily allow registration to create an admin user. # You can temporarily allow registration to create an admin user.
service.DISABLE_REGISTRATION = true; service.DISABLE_REGISTRATION = true;
# Add support for actions, based on act: https://github.com/nektos/act # Add support for actions, based on act: https://github.com/nektos/act
@ -87,12 +91,33 @@ in
#services.vscode-server.enable = true; #services.vscode-server.enable = true;
# Virtualisation # Virtualisation
virtualisation.docker = { virtualisation = {
enable = true; containers.enable = true;
enableOnBoot = true; podman = {
rootless = {
enable = true; enable = true;
setSocketVariable = true; dockerCompat = true;
defaultNetwork.settings.dns_enabled = true; # Required for containers under podman-compose to be able to talk to each other.
};
};
virtualisation.oci-containers = {
backend = "podman";
containers.homeassistant = {
#autoStart = true;
volumes = [
"home-assistant:/config"
"/run/dbus:/run/dbus:ro"
];
environment.TZ = "Europe/Berlin";
# Note: The image will not be updated on rebuilds, unless the version label changes
image = "ghcr.io/home-assistant/home-assistant:stable";
extraOptions = [
# Use the host network namespace for all sockets
"--network=host"
# Pass devices into the container, so Home Assistant can discover and make use of them
#"--device=/dev/ttyACM0:/dev/ttyACM0"
"--privileged"
];
}; };
}; };
} }