🗑 nix-darwin now includes an IPFS service

This commit is contained in:
2023-06-19 16:15:17 -04:00
parent 51fff43d2a
commit 22e576d8e9
3 changed files with 35 additions and 88 deletions

View File

@ -1,48 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.ipfs;
in
{
options = {
services.ipfs = {
enable = mkEnableOption "Enable kubo on darwin";
package = mkOption {
type = types.package;
default = pkgs.kubo_carmirror;
defaultText = literalExpression "pkgs.kubo";
description = "The package to use for kubo";
};
logFile = mkOption {
type = types.nullOr types.path;
default = "/var/tmp/ipfs.log";
description = "Absolute path to log stderr / stdout";
};
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
launchd.user.agents.ipfs = {
path = [ cfg.package ];
script = ''
if ! test -e $HOME/.ipfs/version; then
${cfg.package}/bin/ipfs init
fi
${cfg.package}/bin/ipfs daemon --migrate
'';
serviceConfig = {
KeepAlive = true;
RunAtLoad = true;
ProcessType = "Background";
StandardErrorPath = cfg.logFile;
StandardOutPath = cfg.logFile;
};
};
};
}