2022-11-13 17:39:35 -05:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.ipfs;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
services.ipfs = {
|
|
|
|
enable = mkEnableOption "Enable kubo on darwin";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
environment.systemPackages = [ pkgs.ipfs ];
|
|
|
|
|
|
|
|
launchd.user.agents.ipfs = {
|
2022-11-17 22:39:47 -05:00
|
|
|
path = [ pkgs.ipfs ];
|
|
|
|
script = ''
|
|
|
|
if ! test -e $HOME/.ipfs/version; then
|
|
|
|
ipfs init
|
|
|
|
fi
|
|
|
|
ipfs daemon --migrate
|
|
|
|
'';
|
2022-11-13 17:39:35 -05:00
|
|
|
serviceConfig = {
|
|
|
|
KeepAlive = true;
|
|
|
|
RunAtLoad = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|