From 0d86918efdc8c74b9500f50e0ffc3258705c0f40 Mon Sep 17 00:00:00 2001 From: uttarayan21 Date: Tue, 4 Mar 2025 02:04:39 +0530 Subject: [PATCH] feat: Added home-assistant docker image for deoxys --- flake.lock | 70 +++++++++++++++++++++++-- flake.nix | 4 ++ nixos/default.nix | 1 + nixos/deoxys/configuration.nix | 1 + nixos/deoxys/services/default.nix | 5 ++ nixos/deoxys/services/homeassistant.nix | 26 +++++++++ 6 files changed, 102 insertions(+), 5 deletions(-) create mode 100644 nixos/deoxys/services/default.nix create mode 100644 nixos/deoxys/services/homeassistant.nix diff --git a/flake.lock b/flake.lock index 09cb0415..f7339763 100644 --- a/flake.lock +++ b/flake.lock @@ -191,6 +191,28 @@ "type": "github" } }, + "arion": { + "inputs": { + "flake-parts": "flake-parts_3", + "haskell-flake": "haskell-flake", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733918465, + "narHash": "sha256-hSuGa8Hh67EHr2x812Ay6WFyFT2BGKn+zk+FJWeKXPg=", + "owner": "hercules-ci", + "repo": "arion", + "rev": "f01c95c10f9d4f04bb08d97b3233b530b180f12e", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "arion", + "type": "github" + } + }, "crane": { "locked": { "lastModified": 1739053031, @@ -581,6 +603,27 @@ } }, "flake-parts_3": { + "inputs": { + "nixpkgs-lib": [ + "arion", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733312601, + "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_4": { "inputs": { "nixpkgs-lib": [ "lanzaboote", @@ -601,7 +644,7 @@ "type": "github" } }, - "flake-parts_4": { + "flake-parts_5": { "inputs": { "nixpkgs-lib": [ "nixvim", @@ -622,7 +665,7 @@ "type": "github" } }, - "flake-parts_5": { + "flake-parts_6": { "inputs": { "nixpkgs-lib": [ "nur", @@ -972,6 +1015,22 @@ "type": "github" } }, + "haskell-flake": { + "locked": { + "lastModified": 1675296942, + "narHash": "sha256-u1X1sblozi5qYEcLp1hxcyo8FfDHnRUVX3dJ/tW19jY=", + "owner": "srid", + "repo": "haskell-flake", + "rev": "c2cafce9d57bfca41794dc3b99c593155006c71e", + "type": "github" + }, + "original": { + "owner": "srid", + "ref": "0.1.0", + "repo": "haskell-flake", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -1441,7 +1500,7 @@ "inputs": { "crane": "crane_4", "flake-compat": "flake-compat_4", - "flake-parts": "flake-parts_3", + "flake-parts": "flake-parts_4", "nixpkgs": [ "nixpkgs" ], @@ -1884,7 +1943,7 @@ }, "nixvim": { "inputs": { - "flake-parts": "flake-parts_4", + "flake-parts": "flake-parts_5", "nixpkgs": [ "nixpkgs" ], @@ -1972,7 +2031,7 @@ }, "nur": { "inputs": { - "flake-parts": "flake-parts_5", + "flake-parts": "flake-parts_6", "nixpkgs": "nixpkgs_7", "treefmt-nix": "treefmt-nix" }, @@ -2138,6 +2197,7 @@ "anyrun-hyprwin": "anyrun-hyprwin", "anyrun-nixos-options": "anyrun-nixos-options", "anyrun-rink": "anyrun-rink", + "arion": "arion", "csshacks": "csshacks", "d2": "d2", "ddcbacklight": "ddcbacklight", diff --git a/flake.nix b/flake.nix index 6f0c4e58..dffb7678 100644 --- a/flake.nix +++ b/flake.nix @@ -154,6 +154,10 @@ url = "github:nvzone/volt"; flake = false; }; + arion = { + url = "github:hercules-ci/arion"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { diff --git a/nixos/default.nix b/nixos/default.nix index b220502b..d88ac2a1 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -24,6 +24,7 @@ builtins.listToAttrs (builtins.map (device: { home-manager.nixosModules.home-manager inputs.lanzaboote.nixosModules.lanzaboote inputs.musnix.nixosModules.musnix + inputs.arion.nixosModules.arion { nixpkgs.config.allowUnfree = true; home-manager = { diff --git a/nixos/deoxys/configuration.nix b/nixos/deoxys/configuration.nix index 62646037..6ce3d115 100644 --- a/nixos/deoxys/configuration.nix +++ b/nixos/deoxys/configuration.nix @@ -9,6 +9,7 @@ imports = [ # Include the results of the hardware scan. ./deoxys.nix + ./services ]; # Bootloader. diff --git a/nixos/deoxys/services/default.nix b/nixos/deoxys/services/default.nix new file mode 100644 index 00000000..e1bd169e --- /dev/null +++ b/nixos/deoxys/services/default.nix @@ -0,0 +1,5 @@ +{...}: { + imports = [ + ./homeassistant.nix + ]; +} diff --git a/nixos/deoxys/services/homeassistant.nix b/nixos/deoxys/services/homeassistant.nix new file mode 100644 index 00000000..72227bfc --- /dev/null +++ b/nixos/deoxys/services/homeassistant.nix @@ -0,0 +1,26 @@ +{ + pkgs, + lib, + ... +}: { + environment.systemPackages = [pkgs.arion pkgs.docker-client]; + virtualisation.docker.enable = lib.mkForce false; + virtualisation.podman.enable = true; + virtualisation.podman.dockerSocket.enable = true; + users.extraUsers.servius.extraGroups = ["podman"]; + + virtualisation.arion = { + backend = "docker"; + projects = { + homeassistant.settings.services = { + homeassistant = { + service.image = "ghcr.io/home-assistant/home-assistant:stable"; + service.volumes = ["/etc/localtime:/etc/localtime:ro" "/run/dbus:/run/dbus:ro"]; + service.privileged = true; + service.network_mode = "host"; + service.restart = "unless-stopped"; + }; + }; + }; + }; +}