add ipfs service for darwin machines

This commit is contained in:
2022-11-13 17:39:35 -05:00
parent da846292a6
commit d845616f35
3 changed files with 57 additions and 18 deletions

36
services/ipfs-darwin.nix Normal file
View File

@ -0,0 +1,36 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.ipfs;
in
{
options = {
services.ipfs = {
enable = mkEnableOption "Enable kubo on darwin";
logFile = mkOption {
type = types.nullOr types.path;
default = "/var/tmp/ipfs.log";
description = "Absolute path to log all stderr and stdout";
};
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.ipfs ];
launchd.user.agents.ipfs = {
command = with pkgs; "${ipfs}/bin/ipfs daemon --migrate";
serviceConfig = {
KeepAlive = true;
RunAtLoad = true;
ProcessType = "Background";
StandardOutPath = cfg.logFile;
StandardErrorPath = cfg.logFile;
EnvironmentVariables = { NIX_PATH = "nixpkgs=" + toString pkgs.path; };
};
};
};
}