nixos-test-pixelfed-wip #22
Loading…
Reference in a new issue
No description provided.
Delete branch "nixos-test-pixelfed-wip"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Making a PR for the rest of the work from the WIP branch (@Niols' refactor) so I can give a proper review with comments and such
Nice work! I think this cleans things up well. I left some comments about how nixos stuff works and tends to work.
@ -0,0 +18,4 @@
enable = mkOption {
type = types.bool;
default = false;
};
This can just be
Thanks! Done in
2ff8975b6b
.@ -0,0 +21,4 @@
};
garage = mkOption {
type = types.anything;
You almost never need
types.anything
. And certainly in this case the set of sub-options should be defined. This can be done with simple attrsetsAlso
We don't need to have a very clear sense of which options belong where yet, but eventually I think the top-level
fediversity
options should be the ones that should be set publicly (via NixPanel), and probably the ports being used in garage shouldn't be among them.I'm not sure what the right namespace to use for those options is... maybe
fediversity-private
orfediversity.private
...Done in
73939b9d87
.@ -0,0 +25,4 @@
};
domain = mkOption {
type = types.string;
should be
types.str
types.string
was being used for too many thing so it got deprecated and now there are several different string types.types.str
is the one where you don't want to merge definitions if it's defined in more than one placeDone in
d97772ccc4
.@ -0,0 +30,4 @@
mastodon.enable = mkOption { type = types.bool; default = false; };
pixelfed.enable = mkOption { type = types.bool; default = false; };
peertube.enable = mkOption { type = types.bool; default = false; };
Similarly,
mkEnableOption
here@ -0,0 +34,4 @@
};
};
config.fediversity = {
This should probably be under a call to
lib.mkDefault
. Or simply put behind thedefault
argument ofmkOption
. It seems to be the custom (where possible---sometimes it's not) to put it under thedefault
argument.Done in
73939b9d87
.@ -0,0 +56,4 @@
pixelfed.domain = "pixelfed.${config.fediversity.domain}";
mastodon.domain = "mastdodon.${config.fediversity.domain}";
peertube.domain = "peertube.${config.fediversity.domain}";
there's a style decision here between
fediversity.pixelfed.domain
, andservices.pixelfed.domain
everywhere.(1) has the advantage of grouping everything in one place and under one naming scheme, as opposed to needing to know that e.g. mastodon's is under
services.mastodon.localDomain
instead.It has the disadvantage of having basically a duplicate option, that really should always be exactly identical to another option. Now if someone sets
services.pixelfed.domain
somewhere, it won't get propagated to all the other places that use it, because they refer tofediversity.pixelfed.domain
. It's also hard to know where to stop with option (1), since you could recategorize all the options under some different scheme at the top level, which might be somewhat more consistent.I tend to go with option (2), but in a tightly controlled module like we're planning, I don't think it's objectively the right choice, just a style difference as I said.
In the case of the
garage
options above, we sort of have the same question. But in that case there's information we can't easily get out of the options that are available inservices.garage
(e.g. just the port itself), so I think it does make sense to define our own options.Though we should probably discuss with the maintainer of the nixpkgs module if it makes sense to upstream those changes.
Though if you are going to define
fediversity.pixelfed.domain
, it does have to be declared as an option somewhere 😆@ -96,3 +96,4 @@
with subtest("access garage"):
## REVIEW: could we grab `config.fediversity.garage.api.url` here in some way?
server.succeed("mc alias set garage http://s3.garage.localhost:3900 --api s3v4 --path off $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY")
Yes! In typical nix dynamically-typed fashion,
testScript
can also be a function! And we can have@ -121,6 +122,7 @@ pkgs.nixosTest {
raise Exception("mastodon did not send a content security policy header")
csp = csp_match.group(1)
# the img-src content security policy should include the garage server
## REVIEW: could we grab `config.fediversity.garage.web.url` here in some way?
Yes, though we need to be careful about escaping for the regex
fediversity.internal.pixelfed.domain
43826e686b