🗑 nix-darwin now includes an IPFS service

This commit is contained in:
James Walker 2023-06-19 16:15:17 -04:00
parent 51fff43d2a
commit 22e576d8e9
Signed by: walkah
GPG Key ID: 3C127179D6086E93
3 changed files with 35 additions and 88 deletions

68
flake.lock generated
View File

@ -105,11 +105,11 @@
]
},
"locked": {
"lastModified": 1686307493,
"narHash": "sha256-R4VEFnDn7nRmNxAu1LwNbjns5DPM8IBsvnrWmZ8ymPs=",
"lastModified": 1687110393,
"narHash": "sha256-SnkdWeZ8PZd3Dc74iFF8xiE7qDp5+z3Yps2mE79tsM0=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "7c16d31383a90e0e72ace0c35d2d66a18f90fb4f",
"rev": "8a5af0da9d8dab8a188436750489e304ac682085",
"type": "github"
},
"original": {
@ -126,11 +126,11 @@
"utils": "utils"
},
"locked": {
"lastModified": 1685948350,
"narHash": "sha256-1FldJ059so0X/rScdbIiOlQbjjSNCCTdj2cUr5pHU4A=",
"lastModified": 1686747123,
"narHash": "sha256-XUQK9kwHpTeilHoad7L4LjMCCyY13Oq383CoFADecRE=",
"owner": "serokell",
"repo": "deploy-rs",
"rev": "65211db63ba1199f09b4c9f27e5eba5ec50d76ac",
"rev": "724463b5a94daa810abfc64a4f87faef4e00f984",
"type": "github"
},
"original": {
@ -525,11 +525,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1685518550,
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
"lastModified": 1687171271,
"narHash": "sha256-BJlq+ozK2B1sJDQXS3tzJM5a+oVZmi1q0FlBK/Xqv7M=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
"rev": "abfb11bd1aec8ced1c9bb9adfe68018230f4fb3c",
"type": "github"
},
"original": {
@ -679,11 +679,11 @@
"nixpkgs": "nixpkgs_8"
},
"locked": {
"lastModified": 1686564129,
"narHash": "sha256-jzb2mHvQEZJL3a3ANhTeLIaa1nyjFJ/RzUJjCJme/V4=",
"lastModified": 1687204608,
"narHash": "sha256-rZ0e0iAIQM7vlsMd2/pcGfymZzNBRawObFgqIpxE94c=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "9e37a1b6f9507ed27080518ff4007988a50c957e",
"rev": "f06a43dca05fb7f1aa44742bf861d9c827b45122",
"type": "github"
},
"original": {
@ -988,11 +988,11 @@
},
"nixlib": {
"locked": {
"lastModified": 1685840432,
"narHash": "sha256-VJIbiKsY7Xy4E4WcgwUt/UiwYDmN5BAk8tngAjcWsqY=",
"lastModified": 1687049841,
"narHash": "sha256-FBNZQfWtA7bb/rwk92mfiWc85x4hXta2OAouDqO5W8w=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "961e99baaaa57f5f7042fe7ce089a88786c839f4",
"rev": "908af6d1fa3643c5818ea45aa92b21d6385fbbe5",
"type": "github"
},
"original": {
@ -1009,11 +1009,11 @@
]
},
"locked": {
"lastModified": 1685943944,
"narHash": "sha256-GpaQwOkvwkmSWxvWaZqbMKyyOSaBAwgdEcHCqLW/240=",
"lastModified": 1687183443,
"narHash": "sha256-foX4pkph2AwUdJL3JURa7IHog+YRIheZ54vwHwxqwhU=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "122dcc32cadf14c5015aa021fae8882c5058263a",
"rev": "09140f23f5ffce828db4ef040070bdd9595b1f3a",
"type": "github"
},
"original": {
@ -1024,11 +1024,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1686452266,
"narHash": "sha256-zLKiX0iu6jZFeZDpR1gE6fNyMr8eiM8GLnj9SoUCjFs=",
"lastModified": 1686838567,
"narHash": "sha256-aqKCUD126dRlVSKV6vWuDCitfjFrZlkwNuvj5LtjRRU=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "2a807ad6e8dc458db08588b78cc3c0f0ec4ff321",
"rev": "429f232fe1dc398c5afea19a51aad6931ee0fb89",
"type": "github"
},
"original": {
@ -1184,16 +1184,16 @@
},
"nixpkgs-stable_2": {
"locked": {
"lastModified": 1686392259,
"narHash": "sha256-hqSS9hKhWldIZr1bBp9xKhIznnGPICGKzuehd2LH0UA=",
"lastModified": 1687031877,
"narHash": "sha256-yMFcVeI+kZ6KD2QBrFPNsvBrLq2Gt//D0baHByMrjFY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ef24b2fa0c5f290a35064b847bc211f25cb85c88",
"rev": "e2e2059d19668dab1744301b8b0e821e3aae9c99",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "release-22.11",
"ref": "release-23.05",
"repo": "nixpkgs",
"type": "github"
}
@ -1311,11 +1311,11 @@
},
"nixpkgs_8": {
"locked": {
"lastModified": 1685931219,
"narHash": "sha256-8EWeOZ6LKQfgAjB/USffUSELPRjw88A+xTcXnOUvO5M=",
"lastModified": 1686501370,
"narHash": "sha256-G0WuM9fqTPRc2URKP9Lgi5nhZMqsfHGrdEbrLvAPJcg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "7409480d5c8584a1a83c422530419efe4afb0d19",
"rev": "75a5ebf473cd60148ba9aec0d219f72e5cf52519",
"type": "github"
},
"original": {
@ -1327,11 +1327,11 @@
},
"nixpkgs_9": {
"locked": {
"lastModified": 1686519857,
"narHash": "sha256-VkBhuq67aXXiCoEmicziuDLUPPjeOTLQoj6OeVai5zM=",
"lastModified": 1687103638,
"narHash": "sha256-dwy/TK6Db5W7ivcgmcxUykhFwodIg0jrRzOFt7H5NUc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6b1b72c0f887a478a5aac355674ff6df0fc44f44",
"rev": "91430887645a0953568da2f3e9a3a3bb0a0378ac",
"type": "github"
},
"original": {
@ -1426,11 +1426,11 @@
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
"lastModified": 1686453485,
"narHash": "sha256-75iPAcS6xuw4SNfqLmFCi9wWG1JmDNKaC8l3WJUkmDk=",
"lastModified": 1687058111,
"narHash": "sha256-xDSn/APfAdJinHV4reTfplX5XnLsJSGdVwHpmdgP9Mo=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "cb85e297937af1bd1434cf5f85a3f86a21dc8207",
"rev": "1634d2da53f079e7f5924efa7a96511cd9596f81",
"type": "github"
},
"original": {

View File

@ -6,8 +6,6 @@
../../modules/base/darwin.nix
../../modules/dev
../../modules/builder
../../services/ipfs-darwin.nix
];
nixpkgs.config.allowBroken = true;
@ -20,10 +18,7 @@
services.nix-daemon.enable = true;
services.lorri.enable = true;
services.ipfs = {
enable = true;
package = pkgs.kubo_carmirror;
};
services.ipfs.enable = true;
system = {
defaults = {

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;
};
};
};
}