1

Generate containers file for rofi

This commit is contained in:
2023-05-25 00:14:39 +02:00
parent f5c25b7a0b
commit bb8d06ee7f
5 changed files with 12 additions and 9 deletions

View File

@ -1,6 +0,0 @@
jellyfin
sonarr
radarr
hydra
sabnzbd
homeassistant

View File

@ -1,7 +1,7 @@
#!/usr/bin/env fish #!/usr/bin/env fish
# User chooses service, running services are marked in green # User chooses service, running services are marked in green
set SERVICES (cat ~/NixFlake/config/rofi/menus/containers.txt) # TODO: This file should probably be generated by nix? set SERVICES (cat /etc/rofi-containers)
set PROMPT "" set PROMPT ""
for SERVICE in $SERVICES for SERVICE in $SERVICES
set SERVICE_RUNNING "$(systemctl list-units podman-$SERVICE.service | grep podman-$SERVICE.service)" set SERVICE_RUNNING "$(systemctl list-units podman-$SERVICE.service | grep podman-$SERVICE.service)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/env fish #!/usr/bin/env fish
# User chooses VPN server, running servers are marked in green # User chooses VPN server, running servers are marked in green
set SERVERS (cat /etc/rofi-vpns) # TODO: This file should probably be generated by nix? set SERVERS (cat /etc/rofi-vpns)
set PROMPT "" set PROMPT ""
for SERVER in $SERVERS for SERVER in $SERVERS
set SERVER_RUNNING "$(systemctl list-units $SERVER.service | grep $SERVER.service)" set SERVER_RUNNING "$(systemctl list-units $SERVER.service | grep $SERVER.service)"

View File

@ -1,3 +1,5 @@
# TODO: Need some kind of menu generator API that is integrated with hyprland hotkeys
# VPN and Container modules should use this rofi module to enable their menus then
{ {
config, config,
nixosConfig, nixosConfig,

View File

@ -14,7 +14,7 @@ with mylib.modules; let
in { in {
options.modules.containers = import ./options.nix {inherit lib mylib;}; options.modules.containers = import ./options.nix {inherit lib mylib;};
config = mkIf cfg.enable { config = mkIf cfg.enable rec {
virtualisation.oci-containers.containers = { virtualisation.oci-containers.containers = {
# Home Automation # Home Automation
homeassistant = mkIf cfg.homeassistant.enable (mkOciContainer { homeassistant = mkIf cfg.homeassistant.enable (mkOciContainer {
@ -96,5 +96,12 @@ in {
netdns = "10.2.0.1"; netdns = "10.2.0.1";
}); });
}; };
environment.etc."rofi-containers".text = let
containers-list = attrNames virtualisation.oci-containers.containers;
containers-filtered = filter (c: cfg.${c}.enable) containers-list;
containers = concatStringsSep "\n" containers-filtered;
in
containers;
}; };
} }