mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-14 17:04:42 +00:00
4f0dadbf38
After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
67 lines
1.9 KiB
Nix
67 lines
1.9 KiB
Nix
{ lib, ... }:
|
|
{
|
|
name = "kubo";
|
|
meta = with lib.maintainers; {
|
|
maintainers = [
|
|
mguentner
|
|
Luflosi
|
|
];
|
|
};
|
|
|
|
nodes.machine =
|
|
{ config, ... }:
|
|
{
|
|
services.kubo = {
|
|
enable = true;
|
|
# Also will add a unix domain socket socket API address, see module.
|
|
startWhenNeeded = true;
|
|
settings.Addresses.API = "/ip4/127.0.0.1/tcp/2324";
|
|
dataDir = "/mnt/ipfs";
|
|
};
|
|
users.users.alice = {
|
|
isNormalUser = true;
|
|
extraGroups = [ config.services.kubo.group ];
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
start_all()
|
|
|
|
with subtest("Automatic socket activation"):
|
|
ipfs_hash = machine.succeed(
|
|
"echo fnord0 | su alice -l -c 'ipfs add --quieter'"
|
|
)
|
|
machine.succeed(f"ipfs cat /ipfs/{ipfs_hash.strip()} | grep fnord0")
|
|
|
|
machine.stop_job("ipfs")
|
|
|
|
with subtest("IPv4 socket activation"):
|
|
machine.succeed("ipfs --api /ip4/127.0.0.1/tcp/2324 id")
|
|
ipfs_hash = machine.succeed(
|
|
"echo fnord | ipfs --api /ip4/127.0.0.1/tcp/2324 add --quieter"
|
|
)
|
|
machine.succeed(f"ipfs cat /ipfs/{ipfs_hash.strip()} | grep fnord")
|
|
|
|
machine.stop_job("ipfs")
|
|
|
|
with subtest("Unix domain socket activation"):
|
|
ipfs_hash = machine.succeed(
|
|
"echo fnord2 | ipfs --api /unix/run/ipfs.sock add --quieter"
|
|
)
|
|
machine.succeed(
|
|
f"ipfs --api /unix/run/ipfs.sock cat /ipfs/{ipfs_hash.strip()} | grep fnord2"
|
|
)
|
|
|
|
machine.stop_job("ipfs")
|
|
|
|
with subtest("Socket activation for the Gateway"):
|
|
machine.succeed(
|
|
f"curl 'http://127.0.0.1:8080/ipfs/{ipfs_hash.strip()}' | grep fnord2"
|
|
)
|
|
|
|
with subtest("Setting dataDir works properly with the hardened systemd unit"):
|
|
machine.succeed("test -e /mnt/ipfs/config")
|
|
machine.succeed("test ! -e /var/lib/ipfs/")
|
|
'';
|
|
}
|