diff --git a/darwin/shiro/services/default.nix b/darwin/shiro/services/default.nix index 06bbc855..ea782c81 100644 --- a/darwin/shiro/services/default.nix +++ b/darwin/shiro/services/default.nix @@ -4,9 +4,9 @@ ./skhd.nix ./tailscale.nix ./autossh.nix + ./homeassistant.nix # ./zerotier.nix # ./jellyfin.nix - # ./homeassistant.nix # ./aerospace.nix ]; } diff --git a/darwin/shiro/services/homeassistant.nix b/darwin/shiro/services/homeassistant.nix index b17e5ec2..5a912340 100644 --- a/darwin/shiro/services/homeassistant.nix +++ b/darwin/shiro/services/homeassistant.nix @@ -17,7 +17,7 @@ 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.volumes = ["/etc/localtime:/etc/localtime:ro" "/run/dbus:/run/dbus:ro" "/var/lib/homeassistant:/config"]; service.privileged = true; service.network_mode = "host"; service.restart = "unless-stopped"; diff --git a/deploy.nix b/deploy.nix index 958912b6..c8a33789 100644 --- a/deploy.nix +++ b/deploy.nix @@ -13,8 +13,7 @@ }; }; tsuba = { - hostname = "192.168.0.125"; - # hostname = "tsuba.darksailor.dev"; + hostname = "tsuba.darksailor.dev"; profiles.system = { sshUser = "servius"; path = inputs.deploy-rs.lib.aarch64-linux.activate.nixos self.nixosConfigurations.tsuba; diff --git a/flake.lock b/flake.lock index fa3543bb..20528cfb 100644 --- a/flake.lock +++ b/flake.lock @@ -1262,6 +1262,27 @@ "type": "github" } }, + "home-manager-stable": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1752208517, + "narHash": "sha256-aRY1cYOdVdXdNjcL/Twpa27CknO7pVHxooPsBizDraE=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "c6a01e54af81b381695db796a43360bf6db5702f", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-25.05", + "repo": "home-manager", + "type": "github" + } + }, "home-manager_2": { "inputs": { "nixpkgs": [ @@ -2578,6 +2599,7 @@ "ghostty": "ghostty", "guihua": "guihua", "home-manager": "home-manager", + "home-manager-stable": "home-manager-stable", "hyprland": "hyprland", "hyprlock": "hyprlock", "ironbar": "ironbar", diff --git a/flake.nix b/flake.nix index aac176d7..f601801d 100644 --- a/flake.nix +++ b/flake.nix @@ -13,6 +13,10 @@ url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + home-manager-stable = { + url = "github:nix-community/home-manager/release-25.05"; + inputs.nixpkgs.follows = "nixpkgs"; + }; nix-darwin = { url = "github:LnL7/nix-darwin"; inputs.nixpkgs.follows = "nixpkgs"; @@ -189,6 +193,7 @@ self, nixpkgs, home-manager, + home-manager-stable, nix-darwin, flake-utils, anyrun, @@ -298,7 +303,7 @@ }) // ( import ./nixos/tsuba { - inherit inputs nixpkgs home-manager overlays nur nixos-raspberrypi; + inherit inputs nixpkgs home-manager-stable overlays nur nixos-raspberrypi; devices = rpi_devices; } ); @@ -359,7 +364,7 @@ }; devShells = { default = pkgs.mkShell { - packages = with pkgs; [sops just]; + packages = with pkgs; [sops just clang]; }; }; } diff --git a/home/programs/ddcbacklight.nix b/home/programs/ddcbacklight.nix new file mode 100644 index 00000000..6842bf86 --- /dev/null +++ b/home/programs/ddcbacklight.nix @@ -0,0 +1,3 @@ +{pkgs, ...}: { + home.packages = [pkgs.ddcbacklight]; +} diff --git a/home/programs/default.nix b/home/programs/default.nix index 735c1bfe..4f15e7d1 100644 --- a/home/programs/default.nix +++ b/home/programs/default.nix @@ -31,6 +31,8 @@ ./zoxide.nix ./mpris-scrobbler.nix ./omnix.nix + # ./ddcbacklight.nix + ./yt-dlp.nix # ./magika.nix # ./ncmpcpp.nix # ./neomutt.nix @@ -66,35 +68,13 @@ sd tldr vcpkg-tool - yt-dlp ] ++ lib.optionals (!device.isServer) [ - clang - cmake - d2 - devenv - go - hasklig - jujutsu monaspace nerd-fonts.fira-code nerd-fonts.hasklug nerd-fonts.symbols-only - qmk - ttyper - yarn - ] - ++ lib.optionals device.isLinux [ - dig - gptfdisk - handlr-regex - handlr-xdg - lsof - ncpamixer - rr - sbctl - usbutils - ddcbacklight ] + ++ lib.optionals device.isLinux [] ++ lib.optionals device.isDarwin []; } diff --git a/home/programs/sbctl.nix b/home/programs/sbctl.nix new file mode 100644 index 00000000..6b675888 --- /dev/null +++ b/home/programs/sbctl.nix @@ -0,0 +1,3 @@ +{pkgs, ...}: { + home.packages = [pkgs.sbctl]; +} diff --git a/home/programs/yt-dlp.nix b/home/programs/yt-dlp.nix new file mode 100644 index 00000000..567c7386 --- /dev/null +++ b/home/programs/yt-dlp.nix @@ -0,0 +1,3 @@ +{pkgs, ...}: { + home.packages = [pkgs.yt-dlp]; +} diff --git a/nixos/mirai/services/homepage.nix b/nixos/mirai/services/homepage.nix index b9eee522..eb979de6 100644 --- a/nixos/mirai/services/homepage.nix +++ b/nixos/mirai/services/homepage.nix @@ -49,12 +49,6 @@ href = "https://prowlarr.tsuba.darksailor.dev"; }; } - { - "Jackett" = { - description = "Jackett"; - href = "https://jackett.tsuba.darksailor.dev"; - }; - } { "Home Assistant" = { description = "Home Automation"; diff --git a/nixos/tsuba/configuration.nix b/nixos/tsuba/configuration.nix index 09d137a4..4e60fda6 100644 --- a/nixos/tsuba/configuration.nix +++ b/nixos/tsuba/configuration.nix @@ -44,7 +44,7 @@ }; users.users.${device.user} = { isNormalUser = true; - extraGroups = ["wheel"]; + extraGroups = ["wheel" "media"]; initialPassword = "aaa"; openssh.authorizedKeys.keyFiles = [ ../../secrets/id_ed25519.pub @@ -57,6 +57,7 @@ ../../secrets/id_ed25519.pub ]; }; + users.groups.media = {}; system.stateVersion = "25.05"; services.openssh.enable = true; } diff --git a/nixos/tsuba/default.nix b/nixos/tsuba/default.nix index 8a8eb8b6..4042ba12 100644 --- a/nixos/tsuba/default.nix +++ b/nixos/tsuba/default.nix @@ -3,7 +3,7 @@ devices, inputs, overlays, - home-manager, + home-manager-stable, nur, nixos-raspberrypi, ... @@ -18,9 +18,12 @@ }; system = device.system; modules = [ + inputs.arion.nixosModules.arion inputs.disko.nixosModules.disko - nur.modules.nixos.default inputs.sops-nix.nixosModules.sops + inputs.nix-minecraft.nixosModules.minecraft-servers + nur.modules.nixos.default + home-manager-stable.nixosModules.home-manager { nixpkgs.overlays = overlays; imports = with nixos-raspberrypi.nixosModules; [ @@ -28,6 +31,19 @@ raspberry-pi-5.display-vc4 raspberry-pi-5.bluetooth ]; + home-manager = { + backupFileExtension = "bak"; + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { + inherit inputs; + inherit device; + stablePkgs = inputs.nixpkgs-stable.legacyPackages.${device.system}; + }; + users.${device.user}.imports = [ + ../../home + ]; + }; } ./configuration.nix ./services diff --git a/nixos/tsuba/disk-config.nix b/nixos/tsuba/disk-config.nix index 95755ef7..da8bb2d4 100644 --- a/nixos/tsuba/disk-config.nix +++ b/nixos/tsuba/disk-config.nix @@ -133,6 +133,9 @@ in { type = "filesystem"; format = "ext4"; mountpoint = "/volumes/media"; + mountOptions = [ + "nofail" + ]; }; }; }; diff --git a/nixos/tsuba/services/caddy.nix b/nixos/tsuba/services/caddy.nix index fc3462f7..71203e63 100644 --- a/nixos/tsuba/services/caddy.nix +++ b/nixos/tsuba/services/caddy.nix @@ -20,6 +20,7 @@ propagation_timeout -1 propagation_delay 120s dns hetzner {env.HETZNER_API_KEY} + resolvers 1.1.1.1 } } ''; diff --git a/nixos/tsuba/services/default.nix b/nixos/tsuba/services/default.nix index 7f2fdb45..02414ba8 100644 --- a/nixos/tsuba/services/default.nix +++ b/nixos/tsuba/services/default.nix @@ -9,5 +9,6 @@ # ./radarr.nix # ./prowlarr.nix ./deluge.nix + ./homeassistant.nix ]; } diff --git a/nixos/tsuba/services/homeassistant.nix b/nixos/tsuba/services/homeassistant.nix new file mode 100644 index 00000000..bedce8ea --- /dev/null +++ b/nixos/tsuba/services/homeassistant.nix @@ -0,0 +1,57 @@ +{ + pkgs, + lib, + ... +}: { + virtualisation.docker.enable = true; + users.extraUsers.servius.extraGroups = ["docker"]; + services.caddy = { + virtualHosts."home.darksailor.dev".extraConfig = '' + import hetzner + reverse_proxy localhost:8123 + ''; + }; + + # environment.systemPackages = [pkgs.arion pkgs.docker pkgs.podman]; + # virtualisation.podman.enable = true; + # virtualisation.podman.dockerSocket.enable = true; + # # networking.firewall.allowedTCPPorts = [21063 21064]; + # # networking.firewall.allowedUDPPorts = [5353]; + # + # virtualisation.arion = { + # backend = "podman-socket"; + # 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" "/var/lib/homeassistant:/config"]; + # service.privileged = true; + # service.network_mode = "host"; + # service.restart = "unless-stopped"; + # }; + # }; + # }; + # }; +} +# { +# virtualisation.podman.enable = true; +# virtualisation.podman.dockerSocket.enable = true; +# users.extraUsers.servius.extraGroups = ["podman"]; +# networking.firewall.enable = false; +# virtualisation.oci-containers = { +# backend = "podman"; +# containers.homeassistant = { +# # environment.TZ = "Asia/Kolkata"; +# # Note: The image will not be updated on rebuilds, unless the version label changes +# image = "ghcr.io/home-assistant/home-assistant:stable"; +# volumes = ["/etc/localtime:/etc/localtime:ro" "/run/dbus:/run/dbus:ro" "/var/lib/homeassistant:/config"]; +# 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" +# ]; +# }; +# }; +# } + diff --git a/nixos/tsuba/services/jellyfin.nix b/nixos/tsuba/services/jellyfin.nix index 2f2afe54..f63d4738 100644 --- a/nixos/tsuba/services/jellyfin.nix +++ b/nixos/tsuba/services/jellyfin.nix @@ -1,12 +1,12 @@ {...}: { - # services = { - # jellyseerr.enable = true; - # jellyfin.enable = true; - # caddy = { - # virtualHosts."jellyfin.tsuba.darksailor.dev".extraConfig = '' - # import hetzner - # reverse_proxy localhost:8096 - # ''; - # }; - # }; + services = { + jellyseerr.enable = true; + # jellyfin.enable = true; + caddy = { + virtualHosts."jellyfin.tsuba.darksailor.dev".extraConfig = '' + import hetzner + reverse_proxy localhost:8096 + ''; + }; + }; } diff --git a/nixos/tsuba/services/servarr.nix b/nixos/tsuba/services/servarr.nix index 08539c43..5c452d03 100644 --- a/nixos/tsuba/services/servarr.nix +++ b/nixos/tsuba/services/servarr.nix @@ -1,23 +1,44 @@ { unstablePkgs, config, + lib, ... }: let - mkServarr = name: { - ${name} = { - enable = true; - package = unstablePkgs.${name}; - }; + mkCaddy = name: { caddy.virtualHosts."${name}.tsuba.darksailor.dev".extraConfig = '' import hetzner reverse_proxy localhost:${builtins.toString config.services.${name}.settings.server.port} ''; }; in { - services = - mkServarr "radarr" - // mkServarr "sonarr" - // mkServarr "prowlarr"; - # // mkServarr "readarr" - # // mkServarr "bazarr"; + services = { + sonarr = { + enable = true; + package = unstablePkgs.sonarr; + group = "media"; + }; + radarr = { + enable = true; + package = unstablePkgs.radarr; + group = "media"; + }; + prowlarr = { + enable = true; + package = unstablePkgs.prowlarr; + }; + caddy.virtualHosts = { + "sonarr.tsuba.darksailor.dev".extraConfig = '' + import hetzner + reverse_proxy localhost:${builtins.toString config.services.sonarr.settings.server.port} + ''; + "radarr.tsuba.darksailor.dev".extraConfig = '' + import hetzner + reverse_proxy localhost:${builtins.toString config.services.radarr.settings.server.port} + ''; + "prowlarr.tsuba.darksailor.dev".extraConfig = '' + import hetzner + reverse_proxy localhost:${builtins.toString config.services.prowlarr.settings.server.port} + ''; + }; + }; } diff --git a/nixos/tsuba/tsuba.nix b/nixos/tsuba/tsuba.nix index 2b2984da..7fc5fe6e 100644 --- a/nixos/tsuba/tsuba.nix +++ b/nixos/tsuba/tsuba.nix @@ -27,11 +27,11 @@ # ]; # }; # }; - hardware.raspberry-pi.extra-config = '' - [all] - dtparam=pciex1 - dtparam=pciex1_gen=2 - ''; + # hardware.raspberry-pi.extra-config = '' + # [all] + # dtparam=pciex1 + # dtparam=pciex1_gen=2 + # ''; } # ({ # config,