3p/nixpkgs: post-bump fixups

This commit is contained in:
Luke Granger-Brown 2022-10-31 21:41:42 +00:00
parent 92b3d6365d
commit f143d0be51
6 changed files with 92 additions and 21 deletions

View file

@ -38,7 +38,7 @@
services.kubo = { services.kubo = {
enable = true; enable = true;
dataDir = "/store/ipfs"; dataDir = "/store/ipfs";
extraConfig = { settings = {
Experimental.FilestoreEnabled = true; Experimental.FilestoreEnabled = true;
Addresses = let Addresses = let
internalv4 = ["127.0.0.1" "10.100.0.203" config.my.ip.tailscale]; internalv4 = ["127.0.0.1" "10.100.0.203" config.my.ip.tailscale];

View file

@ -166,7 +166,7 @@ in {
services.kubo = { services.kubo = {
enable = true; enable = true;
extraConfig = { settings = {
Discovery.MDNS.Enabled = false; Discovery.MDNS.Enabled = false;
Swarm.DisableNatPortMap = true; Swarm.DisableNatPortMap = true;
Experimental.FilestoreEnabled = true; Experimental.FilestoreEnabled = true;

View file

@ -437,16 +437,12 @@ in {
}; };
services.grafana = { services.grafana = {
enable = true; enable = true;
addr = "0.0.0.0";
port = 3000;
domain = "grafana.int.lukegb.com";
rootUrl = "https://grafana.int.lukegb.com/";
extraOptions = let settings = {
convertName = name: lib.toUpper (builtins.replaceStrings ["." "-"] ["_" "_"] name); server.root_url = "https://grafana.int.lukegb.com/";
convertOptionSection = sectionName: lib.mapAttrsToList (name: value: { name = "${convertName sectionName}_${convertName name}"; inherit value; }); server.http_addr = "0.0.0.0";
convertOptions = opts: builtins.listToAttrs (builtins.concatLists (lib.mapAttrsToList convertOptionSection opts)); server.http_port = 3000;
in convertOptions { server.domain = "grafana.int.lukegb.com";
"auth.proxy" = { "auth.proxy" = {
enabled = "true"; enabled = "true";
header_name = "X-Pomerium-Claim-Email"; header_name = "X-Pomerium-Claim-Email";
@ -477,7 +473,7 @@ in {
services.kubo = { services.kubo = {
enable = true; enable = true;
dataDir = "/store/ipfs"; dataDir = "/store/ipfs";
extraConfig = { settings = {
Experimental.FilestoreEnabled = true; Experimental.FilestoreEnabled = true;
}; };
}; };

View file

@ -45,6 +45,11 @@ let
then "[${s 1}]:${s 3}" then "[${s 1}]:${s 3}"
else null; # not valid for listen datagram, skip else null; # not valid for listen datagram, skip
multiaddrsFunc = f: addrsRaw: if builtins.isString addrsRaw then let out = f addrsRaw; in lib.optional (out != null) out else lib.filter (x: x != null) (map f addrsRaw);
multiaddrsToListenStream = multiaddrsFunc multiaddrToListenStream;
multiaddrsToListenDatagram = multiaddrsFunc multiaddrToListenDatagram;
in in
{ {
@ -137,19 +142,19 @@ in
options = { options = {
Addresses.API = mkOption { Addresses.API = mkOption {
type = types.str; type = types.oneOf [ types.str (types.listOf types.str) ];
default = "/ip4/127.0.0.1/tcp/5001"; default = "/ip4/127.0.0.1/tcp/5001";
description = lib.mdDoc "Where Kubo exposes its API to"; description = lib.mdDoc "Where Kubo exposes its API to";
}; };
Addresses.Gateway = mkOption { Addresses.Gateway = mkOption {
type = types.str; type = types.oneOf [ types.str (types.listOf types.str) ];
default = "/ip4/127.0.0.1/tcp/8080"; default = "/ip4/127.0.0.1/tcp/8080";
description = lib.mdDoc "Where the IPFS Gateway can be reached"; description = lib.mdDoc "Where the IPFS Gateway can be reached";
}; };
Addresses.Swarm = mkOption { Addresses.Swarm = mkOption {
type = types.listOf types.str; type = types.oneOf [ types.str (types.listOf types.str) ];
default = [ default = [
"/ip4/0.0.0.0/tcp/4001" "/ip4/0.0.0.0/tcp/4001"
"/ip6/::/tcp/4001" "/ip6/::/tcp/4001"
@ -294,14 +299,14 @@ in
socketConfig = { socketConfig = {
ListenStream = ListenStream =
let let
fromCfg = multiaddrToListenStream cfg.settings.Addresses.Gateway; fromCfg = multiaddrsToListenStream cfg.settings.Addresses.Gateway;
in in
[ "" ] ++ lib.optional (fromCfg != null) fromCfg; [ "" ] ++ fromCfg;
ListenDatagram = ListenDatagram =
let let
fromCfg = multiaddrToListenDatagram cfg.settings.Addresses.Gateway; fromCfg = multiaddrsToListenDatagram cfg.settings.Addresses.Gateway;
in in
[ "" ] ++ lib.optional (fromCfg != null) fromCfg; [ "" ] ++ fromCfg;
}; };
}; };
@ -311,9 +316,9 @@ in
# in the multiaddr. # in the multiaddr.
socketConfig.ListenStream = socketConfig.ListenStream =
let let
fromCfg = multiaddrToListenStream cfg.settings.Addresses.API; fromCfg = multiaddrsToListenStream cfg.settings.Addresses.API;
in in
[ "" "%t/ipfs.sock" ] ++ lib.optional (fromCfg != null) fromCfg; [ "" "%t/ipfs.sock" ] ++ fromCfg;
}; };
}; };

View file

@ -0,0 +1,69 @@
diff --git a/nixos/modules/services/network-filesystems/kubo.nix b/nixos/modules/services/network-filesystems/kubo.nix
--- a/nixos/modules/services/network-filesystems/kubo.nix
+++ b/nixos/modules/services/network-filesystems/kubo.nix
@@ -45,6 +45,11 @@ let
then "[${s 1}]:${s 3}"
else null; # not valid for listen datagram, skip
+ multiaddrsFunc = f: addrsRaw: if builtins.isString addrsRaw then let out = f addrsRaw; in lib.optional (out != null) out else lib.filter (x: x != null) (map f addrsRaw);
+
+ multiaddrsToListenStream = multiaddrsFunc multiaddrToListenStream;
+ multiaddrsToListenDatagram = multiaddrsFunc multiaddrToListenDatagram;
+
in
{
@@ -137,19 +142,19 @@ in
options = {
Addresses.API = mkOption {
- type = types.str;
+ type = types.oneOf [ types.str (types.listOf types.str) ];
default = "/ip4/127.0.0.1/tcp/5001";
description = lib.mdDoc "Where Kubo exposes its API to";
};
Addresses.Gateway = mkOption {
- type = types.str;
+ type = types.oneOf [ types.str (types.listOf types.str) ];
default = "/ip4/127.0.0.1/tcp/8080";
description = lib.mdDoc "Where the IPFS Gateway can be reached";
};
Addresses.Swarm = mkOption {
- type = types.listOf types.str;
+ type = types.oneOf [ types.str (types.listOf types.str) ];
default = [
"/ip4/0.0.0.0/tcp/4001"
"/ip6/::/tcp/4001"
@@ -294,14 +299,14 @@ in
socketConfig = {
ListenStream =
let
- fromCfg = multiaddrToListenStream cfg.settings.Addresses.Gateway;
+ fromCfg = multiaddrsToListenStream cfg.settings.Addresses.Gateway;
in
- [ "" ] ++ lib.optional (fromCfg != null) fromCfg;
+ [ "" ] ++ fromCfg;
ListenDatagram =
let
- fromCfg = multiaddrToListenDatagram cfg.settings.Addresses.Gateway;
+ fromCfg = multiaddrsToListenDatagram cfg.settings.Addresses.Gateway;
in
- [ "" ] ++ lib.optional (fromCfg != null) fromCfg;
+ [ "" ] ++ fromCfg;
};
};
@@ -311,9 +316,9 @@ in
# in the multiaddr.
socketConfig.ListenStream =
let
- fromCfg = multiaddrToListenStream cfg.settings.Addresses.API;
+ fromCfg = multiaddrsToListenStream cfg.settings.Addresses.API;
in
- [ "" "%t/ipfs.sock" ] ++ lib.optional (fromCfg != null) fromCfg;
+ [ "" "%t/ipfs.sock" ] ++ fromCfg;
};
};

View file

@ -0,0 +1 @@
kubo-multiaddr.patch