Skip to content

Commit

Permalink
Add CLI for for atticd
Browse files Browse the repository at this point in the history
  • Loading branch information
Nebucatnetzer committed Apr 17, 2024
1 parent 4dbdbee commit 2a6a362
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion nixos/atticd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ let
exec ${cfg.package}/bin/atticadm -f ${checkedConfigFile} "$@"
'';

atticdShim = pkgs.writeShellScript "atticd" ''
exec ${cfg.package}/bin/atticd -f ${checkedConfigFile} "$@"
'';

atticadmWrapper = pkgs.writeShellScriptBin "atticd-atticadm" ''
exec systemd-run \
--quiet \
Expand All @@ -45,11 +49,28 @@ let
--property=DynamicUser=yes \
--property=User=${cfg.user} \
--property=Environment=ATTICADM_PWD=$(pwd) \
--property=ReadWritePaths=${cfg.settings.storage.path} \
--working-directory / \
-- \
${atticadmShim} "$@"
'';

atticdWrapper = pkgs.writeShellScriptBin "atticd-atticd" ''
exec systemd-run \
--quiet \
--pty \
--same-dir \
--wait \
--collect \
--service-type=exec \
--property=EnvironmentFile=${cfg.credentialsFile} \
--property=DynamicUser=yes \
--property=User=${cfg.user} \
--property=Environment=ATTICADM_PWD=$(pwd) \
--working-directory / \
-- \
${atticdShim} "$@"
'';
hasLocalPostgresDB = let
url = cfg.settings.database.url or "";
localStrings = [ "localhost" "127.0.0.1" "/run/postgresql" ];
Expand Down Expand Up @@ -212,7 +233,7 @@ in
};
};

environment.systemPackages = [ atticadmWrapper ];
environment.systemPackages = [ atticadmWrapper atticdWrapper ];
}
(lib.mkIf cfg.useFlakeCompatOverlay {
nixpkgs.overlays = [ overlay ];
Expand Down

0 comments on commit 2a6a362

Please sign in to comment.