refactor(glance): moved to nixos module

This commit is contained in:
Mohammad Rafiq 2025-04-28 19:34:43 +08:00
parent 36b1088d34
commit 5745510e1a
No known key found for this signature in database
4 changed files with 36 additions and 15 deletions

View file

@ -1,6 +1,5 @@
{ {
imports = [ imports = [
./services/glance.nix
./services/wakapi.nix ./services/wakapi.nix
./services/nginx.nix ./services/nginx.nix
]; ];

View file

@ -5,4 +5,5 @@
]; ];
boot-config.bootloader = "systemd-boot"; boot-config.bootloader = "systemd-boot";
hardware-config.cpu = "intel"; hardware-config.cpu = "intel";
service-glance.enable = true;
} }

View file

@ -15,6 +15,7 @@ in
./gaming.nix ./gaming.nix
./filesystems.nix ./filesystems.nix
./networking.nix ./networking.nix
./services/glance.nix
]; ];
options = { options = {

View file

@ -1,4 +1,12 @@
{
config,
lib,
...
}:
let let
moduleName = "service-glance";
cfg = config."${moduleName}";
glancePort = 1227; glancePort = 1227;
homeColumn = { homeColumn = {
size = "full"; size = "full";
@ -65,7 +73,17 @@ let
}; };
in in
{ {
home-manager.users.rafiq.services.glance = { options = {
"${moduleName}" = {
enable = lib.mkEnableOption "Enable ${moduleName}.";
};
};
config = lib.mkIf cfg.enable (
lib.mkMerge [
{
networking.firewall.allowedTCPPorts = [ glancePort ];
services.glance = {
enable = true; enable = true;
settings.server = { settings.server = {
host = "0.0.0.0"; host = "0.0.0.0";
@ -80,5 +98,7 @@ in
} }
]; ];
}; };
networking.firewall.allowedTCPPorts = [ glancePort ]; }
]
);
} }