Skip to content

Commit

Permalink
nix: update nixos module
Browse files Browse the repository at this point in the history
  • Loading branch information
pnmadelaine committed Sep 26, 2023
1 parent 26adbf6 commit 8fb91d7
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions nix/nixos/typhon.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ typhon: {
typhonPackages = typhon.packages.${config.nixpkgs.system};
inherit (lib) mkEnableOption mkIf mkOption types;
cfg = config.services.typhon;
execstart = let
gcrootsDir = "/nix/var/nix/gcroots/typhon";
init-execstart = pkgs.writeShellScript "typhon-init" ''
[ -e ${gcrootsDir} ] || mkdir ${gcrootsDir}
chown typhon:typhon ${gcrootsDir}
'';
typhon-execstart = let
protocol =
if cfg.https
then "https"
Expand Down Expand Up @@ -64,16 +69,28 @@ in {
};
users.groups.typhon = {};

systemd.services.typhon-init = {
description = "Typhon init";
wantedBy = ["multi-user.target"];
serviceConfig = {
ExecStart = init-execstart;
RemainAfterExit = true;
Type = "oneshot";
};
};

systemd.services.typhon = {
description = "Typhon service";
wantedBy = ["multi-user.target"];
path = [pkgs.nix pkgs.git pkgs.bubblewrap];
serviceConfig = {
ExecStart = execstart;
ExecStart = typhon-execstart;
Type = "simple";
User = "typhon";
Group = "typhon";
};
requires = ["typhon-init.service"];
after = ["typhon-init.service"];
};

services.nginx = {
Expand Down

0 comments on commit 8fb91d7

Please sign in to comment.