Skip to content

Commit

Permalink
nix module add Pocketbase address option
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic Wrege committed Jan 6, 2024
1 parent 56f82eb commit ef35267
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 34 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/build.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
- name: Login to Github
uses: docker/login-action@v2
with:
username: ${{ secrets.USERNAME }}
Expand Down
18 changes: 12 additions & 6 deletions nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,23 @@ in
type = types.port;
default = 8090;
description = ''
Pokcetbase Host Port
Pokcetbase Host Port.
'';
};

pocketBaseAddr = lib.mkOption {
type = types.str;
default = "0.0.0.0";
description = ''
Pokcetbase Addr to use.
'';
};

};
};

config =
let pocketBaseHost = "127.0.0.1:${toString cfg.pocketBasePort}";
in
lib.mkIf (cfg.enable)
lib.mkIf cfg.enable
{
users.users.parkfuchs = {
isSystemUser = true;
Expand All @@ -66,7 +72,7 @@ in
Group = "parkfuchs";
StateDirectory = stateDir;
# Starts the web server (default to 127.0.0.1:8090 if no domain is specified)
ExecStart = "${pkgs.pocketbase}/bin/pocketbase serve --http='${pocketBaseHost}' --dir=/var/lib/${stateDir}";
ExecStart = "${pkgs.pocketbase}/bin/pocketbase serve --http='${cfg.pocketBaseAddr}:${toString cfg.pocketBasePort}' --dir=/var/lib/${stateDir}";
};
};

Expand All @@ -78,7 +84,7 @@ in
ADDR = cfg.addr;
PORT = toString cfg.port;
TOMTOM_KEY = cfg.tomtomKey;
DB_HOST = "http://${pocketBaseHost}";
DB_HOST = "http://127.0.0.1:${toString cfg.pocketBasePort}";
};
serviceConfig = {
Type = "simple";
Expand Down

0 comments on commit ef35267

Please sign in to comment.