Write all modules with destructured arguments #93
Labels
No labels
0 points
0.5 points
1 point
13 points
2 points
21 points
3 points
34 points
5 points
55 points
8 points
api service
blocked
component: fediversity panel
component: nixops4
documentation
estimation high: >3d
estimation low: <2h
estimation mid: <8h
infinite points
productisation
project-management
question
role: application developer
role: application operator
role: hosting provider
role: maintainer
security
technical debt
testing
type unclear
type: bug
type: key result
type: objective
type: task
type: user story
user experience
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Blocks
#224 automated dev-ops workflows}
fediversity/fediversity
#288 external developers empowered to contribute}
fediversity/fediversity
Reference: fediversity/fediversity#93
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
This is an authoritative decision I'm making here, and maybe we want to record it somewhere. Rationale:
The underlying problem that prompted this issue is that currently some deployment code depends on at least one module to be denoted as a plain attrset, and this needs to be refactored.
You may also specify the
_classmodule attribute, which documents and enforces the purpose of the module, and has potential to be a recognizable keyword for those who read the code. They are checked againstclass, so they also provide a clear error message when, for example, anixosTestmodule is imported into a NixOS configuration.Common class declarations would be:
_class = "nixos";_class = "nixosTest";_class = "nixops4Resource";_class = "nixops4Deployment";A good place is at the top of the module attribute set literal:
Alternatively, instead of specifying
_classmanually, you could usemodules.<class>.<name>and/or derive that from a directory structure.I could work on upstream documentation for the module syntax if that is deemed necessary.
Do you mean also == "instead of" xor also == "in addition to"?
Does your authoritative decision also hold for modules that are not the only thing in a file? For instance, in a NixOps4 resource:
Should this also be written:
?
Not fully sure, but I tend towards yes, since all the same arguments apply.
as per Fediversity/Fediversity#395 (comment) i may need an example to understand this issue 😶
@fricklerhandwerk i understand conclude you want
{ ... }:over plain modules.@roberth's suggestion arguably better distinguishes different types of modules tho - how would you feel about that?
Yes, module classes good.
PS: attrset syntax is not “plain”, it’s just very shorthand to a degree it’s often confusing. At the core modules are functions
{ lib, config, options, **specialArgs, **_module.args } -> { imports, options, config }_classmodule attributes to explicitly declare module types #398i def learned something useful here - thanks @roberth!
nixops4 apply testerror:proxmox-qemu-vm.nix was imported into nixops4Resource instead of nixos#431nixops4 apply testerror:proxmox-qemu-vm.nix was imported into nixops4Resource instead of nixos#431