2022-04-15 18:54:38 +00:00
{ config , lib , pkgs , utils , . . . }:
2016-10-30 19:39:53 +00:00
let
2022-07-24 18:49:05 +00:00
cfg = config . services . kubo ;
2016-10-30 19:39:53 +00:00
2022-10-04 10:44:48 +00:00
settingsFormat = pkgs . formats . json { } ;
2022-08-05 18:56:15 +00:00
rawDefaultConfig = lib . importJSON ( pkgs . runCommand " k u b o - d e f a u l t - c o n f i g " {
nativeBuildInputs = [ cfg . package ] ;
} ''
export IPFS_PATH = " $ T M P D I R "
ipfs init - - empty-repo - - profile = $ { profile }
ipfs - - offline config show > " $ o u t "
'' ) ;
# Remove the PeerID (an attribute of "Identity") of the temporary Kubo repo.
# The "Pinning" section contains the "RemoteServices" section, which would prevent
# the daemon from starting as that setting can't be changed via ipfs config replace.
defaultConfig = builtins . removeAttrs rawDefaultConfig [ " I d e n t i t y " " P i n n i n g " ] ;
customizedConfig = lib . recursiveUpdate defaultConfig cfg . settings ;
configFile = settingsFormat . generate " k u b o - c o n f i g . j s o n " customizedConfig ;
2023-04-14 00:26:32 +00:00
# Create a fake repo containing only the file "api".
# $IPFS_PATH will point to this directory instead of the real one.
# For some reason the Kubo CLI tools insist on reading the
# config file when it exists. But the Kubo daemon sets the file
# permissions such that only the ipfs user is allowed to read
# this file. This prevents normal users from talking to the daemon.
# To work around this terrible design, create a fake repo with no
# config file, only an api file and everything should work as expected.
fakeKuboRepo = pkgs . writeTextDir " a p i " ''
/unix/run/ipfs.sock
'' ;
2022-07-24 18:49:05 +00:00
kuboFlags = utils . escapeSystemdExecArgs (
2024-08-28 19:18:58 +00:00
lib . optional cfg . autoMount " - - m o u n t " ++
lib . optional cfg . enableGC " - - e n a b l e - g c " ++
lib . optional ( cfg . serviceFdlimit != null ) " - - m a n a g e - f d l i m i t = f a l s e " ++
lib . optional ( cfg . defaultMode == " o f f l i n e " ) " - - o f f l i n e " ++
lib . optional ( cfg . defaultMode == " n o r o u t i n g " ) " - - r o u t i n g = n o n e " ++
2022-03-06 15:57:57 +00:00
cfg . extraFlags
) ;
2016-10-30 19:39:53 +00:00
2021-09-08 14:50:36 +00:00
profile =
if cfg . localDiscovery
then " l o c a l - d i s c o v e r y "
else " s e r v e r " ;
2020-06-17 20:19:01 +00:00
splitMulitaddr = addrRaw : lib . tail ( lib . splitString " / " addrRaw ) ;
2023-04-14 13:56:10 +00:00
multiaddrsToListenStreams = addrIn :
let
2023-12-04 16:11:51 +00:00
addrs = if builtins . isList addrIn
2023-04-14 13:56:10 +00:00
then addrIn else [ addrIn ] ;
unfilteredResult = map multiaddrToListenStream addrs ;
in
builtins . filter ( addr : addr != null ) unfilteredResult ;
multiaddrsToListenDatagrams = addrIn :
let
2023-12-04 16:11:51 +00:00
addrs = if builtins . isList addrIn
2023-04-14 13:56:10 +00:00
then addrIn else [ addrIn ] ;
unfilteredResult = map multiaddrToListenDatagram addrs ;
in
builtins . filter ( addr : addr != null ) unfilteredResult ;
2021-08-31 00:16:55 +00:00
multiaddrToListenStream = addrRaw :
let
2020-06-17 20:19:01 +00:00
addr = splitMulitaddr addrRaw ;
s = builtins . elemAt addr ;
2021-08-31 00:16:55 +00:00
in
if s 0 == " i p 4 " && s 2 == " t c p "
then " ${ s 1 } : ${ s 3 } "
2020-06-17 20:19:01 +00:00
else if s 0 == " i p 6 " && s 2 == " t c p "
2021-08-31 00:16:55 +00:00
then " [ ${ s 1 } ] : ${ s 3 } "
2020-06-17 20:19:01 +00:00
else if s 0 == " u n i x "
2021-08-31 00:16:55 +00:00
then " / ${ lib . concatStringsSep " / " ( lib . tail addr ) } "
2020-06-17 20:19:01 +00:00
else null ; # not valid for listen stream, skip
2021-08-31 00:16:55 +00:00
multiaddrToListenDatagram = addrRaw :
let
2020-08-11 21:46:39 +00:00
addr = splitMulitaddr addrRaw ;
s = builtins . elemAt addr ;
2021-08-31 00:16:55 +00:00
in
if s 0 == " i p 4 " && s 2 == " u d p "
then " ${ s 1 } : ${ s 3 } "
2020-08-11 21:46:39 +00:00
else if s 0 == " i p 6 " && s 2 == " u d p "
2021-08-31 00:16:55 +00:00
then " [ ${ s 1 } ] : ${ s 3 } "
2020-08-11 21:46:39 +00:00
else null ; # not valid for listen datagram, skip
2021-08-31 00:16:55 +00:00
in
{
2016-10-30 19:39:53 +00:00
###### interface
options = {
2022-07-24 18:49:05 +00:00
services . kubo = {
2016-10-30 19:39:53 +00:00
2024-08-28 19:18:58 +00:00
enable = lib . mkEnableOption ''
2023-12-04 16:11:51 +00:00
the Interplanetary File System ( WARNING : may cause severe network degradation ) .
NOTE : after enabling this option and rebuilding your system , you need to log out
and back in for the ` IPFS_PATH ` environment variable to be present in your shell .
Until you do that , the CLI tools won't be able to talk to the daemon by default
'' ;
2016-10-30 19:39:53 +00:00
2024-08-28 19:18:58 +00:00
package = lib . mkPackageOption pkgs " k u b o " { } ;
2020-11-03 23:35:06 +00:00
2024-08-28 19:18:58 +00:00
user = lib . mkOption {
type = lib . types . str ;
2016-10-30 19:39:53 +00:00
default = " i p f s " ;
2022-07-24 18:49:05 +00:00
description = " U s e r u n d e r w h i c h t h e K u b o d a e m o n r u n s " ;
2016-10-30 19:39:53 +00:00
} ;
2024-08-28 19:18:58 +00:00
group = lib . mkOption {
type = lib . types . str ;
2016-10-30 19:39:53 +00:00
default = " i p f s " ;
2022-07-24 18:49:05 +00:00
description = " G r o u p u n d e r w h i c h t h e K u b o d a e m o n r u n s " ;
2016-10-30 19:39:53 +00:00
} ;
2024-08-28 19:18:58 +00:00
dataDir = lib . mkOption {
type = lib . types . str ;
2021-08-31 00:16:55 +00:00
default =
2024-08-28 19:18:58 +00:00
if lib . versionAtLeast config . system . stateVersion " 1 7 . 0 9 "
2021-08-31 00:16:55 +00:00
then " / v a r / l i b / i p f s "
else " / v a r / l i b / i p f s / . i p f s " ;
2024-08-28 19:18:58 +00:00
defaultText = lib . literalExpression ''
if lib . versionAtLeast config . system . stateVersion " 1 7 . 0 9 "
2021-08-31 00:16:55 +00:00
then " / v a r / l i b / i p f s "
else " / v a r / l i b / i p f s / . i p f s "
2021-11-26 00:16:05 +00:00
'' ;
2022-07-24 18:49:05 +00:00
description = " T h e d a t a d i r f o r K u b o " ;
2016-10-30 19:39:53 +00:00
} ;
2024-08-28 19:18:58 +00:00
defaultMode = lib . mkOption {
type = lib . types . enum [ " o n l i n e " " o f f l i n e " " n o r o u t i n g " ] ;
2017-08-12 13:40:05 +00:00
default = " o n l i n e " ;
2017-09-06 22:40:42 +00:00
description = " s y s t e m d s e r v i c e t h a t i s e n a b l e d b y d e f a u l t " ;
2017-08-12 13:40:05 +00:00
} ;
2024-08-28 19:18:58 +00:00
autoMount = lib . mkOption {
type = lib . types . bool ;
2017-09-16 16:03:37 +00:00
default = false ;
2022-07-24 18:49:05 +00:00
description = " W h e t h e r K u b o s h o u l d t r y t o m o u n t / i p f s a n d / i p n s a t s t a r t u p . " ;
2017-09-16 16:03:37 +00:00
} ;
2017-08-30 15:24:09 +00:00
2024-08-28 19:18:58 +00:00
autoMigrate = lib . mkOption {
type = lib . types . bool ;
2021-08-31 13:22:36 +00:00
default = true ;
2022-07-24 18:49:05 +00:00
description = " W h e t h e r K u b o s h o u l d t r y t o r u n t h e f s - r e p o - m i g r a t i o n a t s t a r t u p . " ;
2021-08-31 13:22:36 +00:00
} ;
2024-08-28 19:18:58 +00:00
enableGC = lib . mkOption {
type = lib . types . bool ;
2016-10-30 19:39:53 +00:00
default = false ;
2017-09-06 22:40:42 +00:00
description = " W h e t h e r t o e n a b l e a u t o m a t i c g a r b a g e c o l l e c t i o n " ;
2016-10-30 19:39:53 +00:00
} ;
2024-08-28 19:18:58 +00:00
emptyRepo = lib . mkOption {
type = lib . types . bool ;
2023-05-10 17:49:42 +00:00
default = true ;
description = " I f s e t t o f a l s e , t h e r e p o w i l l b e i n i t i a l i z e d w i t h h e l p f i l e s " ;
2017-01-13 18:28:06 +00:00
} ;
2024-08-28 19:18:58 +00:00
settings = lib . mkOption {
2022-10-04 10:44:48 +00:00
type = lib . types . submodule {
freeformType = settingsFormat . type ;
options = {
2024-08-28 19:18:58 +00:00
Addresses . API = lib . mkOption {
type = lib . types . oneOf [ lib . types . str ( lib . types . listOf lib . types . str ) ] ;
2023-04-14 14:37:32 +00:00
default = [ ] ;
2023-04-14 13:56:10 +00:00
description = ''
Multiaddr or array of multiaddrs describing the address to serve the local HTTP API on .
In addition to the multiaddrs listed here , the daemon will also listen on a Unix domain socket .
2023-04-14 14:37:32 +00:00
To allow the ipfs CLI tools to communicate with the daemon over that socket ,
add your user to the correct group , e . g . ` users . users . alice . extraGroups = [ config . services . kubo . group ] ; `
2023-04-14 13:56:10 +00:00
'' ;
2022-10-04 10:44:48 +00:00
} ;
2024-08-28 19:18:58 +00:00
Addresses . Gateway = lib . mkOption {
type = lib . types . oneOf [ lib . types . str ( lib . types . listOf lib . types . str ) ] ;
2022-10-04 10:44:48 +00:00
default = " / i p 4 / 1 2 7 . 0 . 0 . 1 / t c p / 8 0 8 0 " ;
description = " W h e r e t h e I P F S G a t e w a y c a n b e r e a c h e d " ;
} ;
2024-08-28 19:18:58 +00:00
Addresses . Swarm = lib . mkOption {
type = lib . types . listOf lib . types . str ;
2022-10-04 10:44:48 +00:00
default = [
" / i p 4 / 0 . 0 . 0 . 0 / t c p / 4 0 0 1 "
" / i p 6 / : : / t c p / 4 0 0 1 "
2023-03-22 15:26:51 +00:00
" / i p 4 / 0 . 0 . 0 . 0 / u d p / 4 0 0 1 / q u i c - v 1 "
" / i p 4 / 0 . 0 . 0 . 0 / u d p / 4 0 0 1 / q u i c - v 1 / w e b t r a n s p o r t "
2024-09-24 15:33:50 +00:00
" / i p 4 / 0 . 0 . 0 . 0 / u d p / 4 0 0 1 / w e b r t c - d i r e c t "
2023-03-22 15:26:51 +00:00
" / i p 6 / : : / u d p / 4 0 0 1 / q u i c - v 1 "
" / i p 6 / : : / u d p / 4 0 0 1 / q u i c - v 1 / w e b t r a n s p o r t "
2024-09-24 15:33:50 +00:00
" / i p 6 / : : / u d p / 4 0 0 1 / w e b r t c - d i r e c t "
2022-10-04 10:44:48 +00:00
] ;
description = " W h e r e K u b o l i s t e n s f o r i n c o m i n g p 2 p c o n n e c t i o n s " ;
} ;
2023-12-04 14:49:20 +00:00
2024-08-28 19:18:58 +00:00
Mounts . IPFS = lib . mkOption {
type = lib . types . str ;
2023-12-04 14:49:20 +00:00
default = " / i p f s " ;
description = " W h e r e t o m o u n t t h e I P F S n a m e s p a c e t o " ;
} ;
2024-08-28 19:18:58 +00:00
Mounts . IPNS = lib . mkOption {
type = lib . types . str ;
2023-12-04 14:49:20 +00:00
default = " / i p n s " ;
description = " W h e r e t o m o u n t t h e I P N S n a m e s p a c e t o " ;
} ;
2022-10-04 10:44:48 +00:00
} ;
} ;
2017-09-06 22:40:42 +00:00
description = ''
2022-08-05 18:56:15 +00:00
Attrset of daemon configuration .
2022-10-04 10:44:48 +00:00
See [ https://github.com/ipfs/kubo/blob/master/docs/config.md ] ( https://github.com/ipfs/kubo/blob/master/docs/config.md ) for reference .
2022-08-05 18:56:15 +00:00
You can't set ` Identity ` or ` Pinning ` .
2017-09-06 22:40:42 +00:00
'' ;
2021-08-31 00:16:55 +00:00
default = { } ;
2017-08-27 16:52:56 +00:00
example = {
Datastore . StorageMax = " 1 0 0 G B " ;
Discovery . MDNS . Enabled = false ;
Bootstrap = [
" / i p 4 / 1 2 8 . 1 9 9 . 2 1 9 . 1 1 1 / t c p / 4 0 0 1 / i p f s / Q m S o L S a f T M B s P K a d T E g a X c t D Q V c q N 8 8 C N L H X M k T N w M K P n u "
" / i p 4 / 1 6 2 . 2 4 3 . 2 4 8 . 2 1 3 / t c p / 4 0 0 1 / i p f s / Q m S o L u e R 4 x B e U b Y 9 W Z 9 x G U U x u n b K W c r N F T D A a d Q J m o c n W m "
] ;
Swarm . AddrFilters = null ;
} ;
} ;
2024-08-28 19:18:58 +00:00
extraFlags = lib . mkOption {
type = lib . types . listOf lib . types . str ;
2022-07-24 18:49:05 +00:00
description = " E x t r a f l a g s p a s s e d t o t h e K u b o d a e m o n " ;
2021-08-31 00:16:55 +00:00
default = [ ] ;
2016-10-30 19:39:53 +00:00
} ;
2017-08-27 16:52:56 +00:00
2024-08-28 19:18:58 +00:00
localDiscovery = lib . mkOption {
type = lib . types . bool ;
2022-07-24 18:49:05 +00:00
description = '' W h e t h e r t o e n a b l e l o c a l d i s c o v e r y f o r t h e K u b o d a e m o n .
This will allow Kubo to scan ports on your local network . Some hosting services will ban you if you do this .
2018-05-21 12:15:58 +00:00
'' ;
2021-09-08 15:00:29 +00:00
default = false ;
2018-05-21 12:15:58 +00:00
} ;
2024-08-28 19:18:58 +00:00
serviceFdlimit = lib . mkOption {
type = lib . types . nullOr lib . types . int ;
2017-07-31 14:15:02 +00:00
default = null ;
2022-07-24 18:49:05 +00:00
description = " T h e f d l i m i t f o r t h e K u b o s y s t e m d u n i t o r ` n u l l ` t o h a v e t h e d a e m o n a t t e m p t t o m a n a g e i t " ;
2021-08-31 00:16:55 +00:00
example = 64 * 1024 ;
2017-07-31 14:15:02 +00:00
} ;
2024-08-28 19:18:58 +00:00
startWhenNeeded = lib . mkOption {
type = lib . types . bool ;
2020-06-11 20:45:39 +00:00
default = false ;
2022-07-24 18:49:05 +00:00
description = " W h e t h e r t o u s e s o c k e t a c t i v a t i o n t o s t a r t K u b o w h e n n e e d e d . " ;
2020-06-11 20:45:39 +00:00
} ;
2016-10-30 19:39:53 +00:00
} ;
} ;
###### implementation
2024-08-28 19:18:58 +00:00
config = lib . mkIf cfg . enable {
2022-08-05 18:56:15 +00:00
assertions = [
{
assertion = ! builtins . hasAttr " I d e n t i t y " cfg . settings ;
message = ''
You can't set services . kubo . settings . Identity because the ` ` config replace ` ` subcommand used at startup does not support modifying any of the Identity settings .
'' ;
}
{
assertion = ! ( ( builtins . hasAttr " P i n n i n g " cfg . settings ) && ( builtins . hasAttr " R e m o t e S e r v i c e s " cfg . settings . Pinning ) ) ;
message = ''
You can't set services . kubo . settings . Pinning . RemoteServices because the ` ` config replace ` ` subcommand used at startup does not work with it .
'' ;
}
2023-07-04 12:38:54 +00:00
{
assertion = ! ( ( lib . versionAtLeast cfg . package . version " 0 . 2 1 " ) && ( builtins . hasAttr " E x p e r i m e n t a l " cfg . settings ) && ( builtins . hasAttr " A c c e l e r a t e d D H T C l i e n t " cfg . settings . Experimental ) ) ;
message = ''
2023-12-04 16:11:51 +00:00
The ` services . kubo . settings . Experimental . AcceleratedDHTClient ` option was renamed to ` services . kubo . settings . Routing . AcceleratedDHTClient ` in Kubo 0 .21 .
'' ;
2023-07-04 12:38:54 +00:00
}
2022-08-05 18:56:15 +00:00
] ;
2020-11-03 23:35:06 +00:00
environment . systemPackages = [ cfg . package ] ;
2023-04-14 00:26:32 +00:00
environment . variables . IPFS_PATH = fakeKuboRepo ;
2020-06-11 20:27:22 +00:00
2023-12-04 15:18:32 +00:00
# https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes
2024-08-28 19:18:58 +00:00
boot . kernel . sysctl . " n e t . c o r e . r m e m _ m a x " = lib . mkDefault 2500000 ;
boot . kernel . sysctl . " n e t . c o r e . w m e m _ m a x " = lib . mkDefault 2500000 ;
2021-08-31 00:17:57 +00:00
2024-08-28 19:18:58 +00:00
programs . fuse = lib . mkIf cfg . autoMount {
2019-08-11 13:36:33 +00:00
userAllowOther = true ;
} ;
2016-10-30 19:39:53 +00:00
2024-08-28 19:18:58 +00:00
users . users = lib . mkIf ( cfg . user == " i p f s " ) {
2016-10-30 19:39:53 +00:00
ipfs = {
group = cfg . group ;
home = cfg . dataDir ;
createHome = false ;
uid = config . ids . uids . ipfs ;
description = " I P F S d a e m o n u s e r " ;
2020-05-13 06:59:49 +00:00
packages = [
2022-07-24 18:49:05 +00:00
pkgs . kubo-migrator
2020-05-13 06:59:49 +00:00
] ;
2016-10-30 19:39:53 +00:00
} ;
} ;
2024-08-28 19:18:58 +00:00
users . groups = lib . mkIf ( cfg . group == " i p f s " ) {
2017-08-28 20:09:39 +00:00
ipfs . gid = config . ids . gids . ipfs ;
2016-10-30 19:39:53 +00:00
} ;
2024-01-11 21:10:18 +00:00
systemd . tmpfiles . settings . " 1 0 - k u b o " = let
defaultConfig = { inherit ( cfg ) user group ; } ;
in {
$ { cfg . dataDir } . d = defaultConfig ;
2024-08-28 19:18:58 +00:00
$ { cfg . settings . Mounts . IPFS } . d = lib . mkIf ( cfg . autoMount ) defaultConfig ;
$ { cfg . settings . Mounts . IPNS } . d = lib . mkIf ( cfg . autoMount ) defaultConfig ;
2024-01-11 21:10:18 +00:00
} ;
2019-02-24 17:49:02 +00:00
2022-03-17 15:40:54 +00:00
# The hardened systemd unit breaks the fuse-mount function according to documentation in the unit file itself
systemd . packages = if cfg . autoMount
then [ cfg . package . systemd_unit ]
else [ cfg . package . systemd_unit_hardened ] ;
2020-06-11 21:59:11 +00:00
2024-08-28 19:18:58 +00:00
services . kubo . settings = lib . mkIf cfg . autoMount {
2022-10-04 10:44:48 +00:00
Mounts . FuseAllowOther = lib . mkDefault true ;
} ;
2021-04-22 18:04:26 +00:00
systemd . services . ipfs = {
path = [ " / r u n / w r a p p e r s " cfg . package ] ;
2020-06-11 20:27:22 +00:00
environment . IPFS_PATH = cfg . dataDir ;
2021-04-22 18:04:26 +00:00
preStart = ''
2021-09-08 14:50:36 +00:00
if [ [ ! - f " $ I P F S _ P A T H / c o n f i g " ] ] ; then
2023-05-10 17:49:42 +00:00
ipfs init - - empty-repo = $ { lib . boolToString cfg . emptyRepo }
2018-05-23 14:44:31 +00:00
else
2021-09-08 14:50:36 +00:00
# After an unclean shutdown this file may exist which will cause the config command to attempt to talk to the daemon. This will hang forever if systemd is holding our sockets open.
rm - vf " $ I P F S _ P A T H / a p i "
2024-08-28 19:18:58 +00:00
'' + l i b . o p t i o n a l S t r i n g c f g . a u t o M i g r a t e ''
2024-09-24 14:40:56 +00:00
' $ { lib . getExe pkgs . kubo-migrator } ' - to ' $ { cfg . package . repoVersion } ' - y
2022-04-15 19:09:07 +00:00
'' + ''
2017-01-13 18:28:06 +00:00
fi
2022-08-05 18:56:15 +00:00
ipfs - - offline config show |
$ { pkgs . jq } /bin/jq - s ' . [ 0 ] . Pinning as $ Pinning | . [ 0 ] . Identity as $ Identity | . [ 1 ] + { $ Identity , $ Pinning } ' - ' $ { configFile } ' |
# This command automatically injects the private key and other secrets from
# the old config file back into the new config file.
# Unfortunately, it doesn't keep the original `Identity.PeerID`,
# so we need `ipfs config show` and jq above.
# See https://github.com/ipfs/kubo/issues/8993 for progress on fixing this problem.
# Kubo also wants a specific version of the original "Pinning.RemoteServices"
# section (redacted by `ipfs config show`), such that that section doesn't
# change when the changes are applied. Whyyyyyy.....
ipfs - - offline config replace -
2022-02-06 12:04:11 +00:00
'' ;
2024-08-28 19:18:58 +00:00
postStop = lib . mkIf cfg . autoMount ''
2023-12-04 14:49:20 +00:00
# After an unclean shutdown the fuse mounts at cfg.settings.Mounts.IPFS and cfg.settings.Mounts.IPNS are locked
umount - - quiet ' $ { cfg . settings . Mounts . IPFS } ' ' $ { cfg . settings . Mounts . IPNS } ' || true
2023-01-31 16:32:20 +00:00
'' ;
2020-06-11 20:27:22 +00:00
serviceConfig = {
2022-07-24 18:49:05 +00:00
ExecStart = [ " " " ${ cfg . package } / b i n / i p f s d a e m o n ${ kuboFlags } " ] ;
2020-06-11 20:27:22 +00:00
User = cfg . user ;
Group = cfg . group ;
2022-03-17 15:40:54 +00:00
StateDirectory = " " ;
2024-08-28 19:18:58 +00:00
ReadWritePaths = lib . optionals ( ! cfg . autoMount ) [ " " cfg . dataDir ] ;
2023-12-02 22:52:09 +00:00
# Make sure the socket units are started before ipfs.service
Sockets = [ " i p f s - g a t e w a y . s o c k e t " " i p f s - a p i . s o c k e t " ] ;
2024-08-28 19:18:58 +00:00
} // lib . optionalAttrs ( cfg . serviceFdlimit != null ) { LimitNOFILE = cfg . serviceFdlimit ; } ;
} // lib . optionalAttrs ( ! cfg . startWhenNeeded ) {
2020-06-11 20:45:39 +00:00
wantedBy = [ " d e f a u l t . t a r g e t " ] ;
} ;
2020-06-11 21:59:38 +00:00
systemd . sockets . ipfs-gateway = {
2020-06-11 20:45:39 +00:00
wantedBy = [ " s o c k e t s . t a r g e t " ] ;
2020-08-11 21:46:39 +00:00
socketConfig = {
2021-08-31 00:16:55 +00:00
ListenStream =
2023-04-14 13:56:10 +00:00
[ " " ] ++ ( multiaddrsToListenStreams cfg . settings . Addresses . Gateway ) ;
2021-08-31 00:16:55 +00:00
ListenDatagram =
2023-04-14 13:56:10 +00:00
[ " " ] ++ ( multiaddrsToListenDatagrams cfg . settings . Addresses . Gateway ) ;
2020-08-11 21:46:39 +00:00
} ;
2020-06-11 20:45:39 +00:00
} ;
2020-06-11 21:59:38 +00:00
systemd . sockets . ipfs-api = {
2020-06-11 20:45:39 +00:00
wantedBy = [ " s o c k e t s . t a r g e t " ] ;
2023-04-14 14:37:32 +00:00
socketConfig = {
# We also include "%t/ipfs.sock" because there is no way to put the "%t"
# in the multiaddr.
ListenStream =
[ " " " % t / i p f s . s o c k " ] ++ ( multiaddrsToListenStreams cfg . settings . Addresses . API ) ;
SocketMode = " 0 6 6 0 " ;
SocketUser = cfg . user ;
SocketGroup = cfg . group ;
} ;
2017-08-12 13:40:05 +00:00
} ;
2022-04-15 19:06:21 +00:00
} ;
2017-08-12 13:40:05 +00:00
2022-04-15 19:06:21 +00:00
meta = {
maintainers = with lib . maintainers ; [ Luflosi ] ;
2016-10-30 19:39:53 +00:00
} ;
2022-07-24 18:49:05 +00:00
imports = [
2024-08-28 19:18:58 +00:00
( lib . mkRenamedOptionModule [ " s e r v i c e s " " i p f s " " e n a b l e " ] [ " s e r v i c e s " " k u b o " " e n a b l e " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " i p f s " " p a c k a g e " ] [ " s e r v i c e s " " k u b o " " p a c k a g e " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " i p f s " " u s e r " ] [ " s e r v i c e s " " k u b o " " u s e r " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " i p f s " " g r o u p " ] [ " s e r v i c e s " " k u b o " " g r o u p " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " i p f s " " d a t a D i r " ] [ " s e r v i c e s " " k u b o " " d a t a D i r " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " i p f s " " d e f a u l t M o d e " ] [ " s e r v i c e s " " k u b o " " d e f a u l t M o d e " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " i p f s " " a u t o M o u n t " ] [ " s e r v i c e s " " k u b o " " a u t o M o u n t " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " i p f s " " a u t o M i g r a t e " ] [ " s e r v i c e s " " k u b o " " a u t o M i g r a t e " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " i p f s " " i p f s M o u n t D i r " ] [ " s e r v i c e s " " k u b o " " s e t t i n g s " " M o u n t s " " I P F S " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " i p f s " " i p n s M o u n t D i r " ] [ " s e r v i c e s " " k u b o " " s e t t i n g s " " M o u n t s " " I P N S " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " i p f s " " g a t e w a y A d d r e s s " ] [ " s e r v i c e s " " k u b o " " s e t t i n g s " " A d d r e s s e s " " G a t e w a y " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " i p f s " " a p i A d d r e s s " ] [ " s e r v i c e s " " k u b o " " s e t t i n g s " " A d d r e s s e s " " A P I " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " i p f s " " s w a r m A d d r e s s " ] [ " s e r v i c e s " " k u b o " " s e t t i n g s " " A d d r e s s e s " " S w a r m " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " i p f s " " e n a b l e G C " ] [ " s e r v i c e s " " k u b o " " e n a b l e G C " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " i p f s " " e m p t y R e p o " ] [ " s e r v i c e s " " k u b o " " e m p t y R e p o " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " i p f s " " e x t r a C o n f i g " ] [ " s e r v i c e s " " k u b o " " s e t t i n g s " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " i p f s " " e x t r a F l a g s " ] [ " s e r v i c e s " " k u b o " " e x t r a F l a g s " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " i p f s " " l o c a l D i s c o v e r y " ] [ " s e r v i c e s " " k u b o " " l o c a l D i s c o v e r y " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " i p f s " " s e r v i c e F d l i m i t " ] [ " s e r v i c e s " " k u b o " " s e r v i c e F d l i m i t " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " i p f s " " s t a r t W h e n N e e d e d " ] [ " s e r v i c e s " " k u b o " " s t a r t W h e n N e e d e d " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " k u b o " " e x t r a C o n f i g " ] [ " s e r v i c e s " " k u b o " " s e t t i n g s " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " k u b o " " g a t e w a y A d d r e s s " ] [ " s e r v i c e s " " k u b o " " s e t t i n g s " " A d d r e s s e s " " G a t e w a y " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " k u b o " " a p i A d d r e s s " ] [ " s e r v i c e s " " k u b o " " s e t t i n g s " " A d d r e s s e s " " A P I " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " k u b o " " s w a r m A d d r e s s " ] [ " s e r v i c e s " " k u b o " " s e t t i n g s " " A d d r e s s e s " " S w a r m " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " k u b o " " i p f s M o u n t D i r " ] [ " s e r v i c e s " " k u b o " " s e t t i n g s " " M o u n t s " " I P F S " ] )
( lib . mkRenamedOptionModule [ " s e r v i c e s " " k u b o " " i p n s M o u n t D i r " ] [ " s e r v i c e s " " k u b o " " s e t t i n g s " " M o u n t s " " I P N S " ] )
2022-07-24 18:49:05 +00:00
] ;
2016-10-30 19:39:53 +00:00
}