Skip to content

Commit

Permalink
nixos/xen: simplify main module
Browse files Browse the repository at this point in the history
- Deduplicates the removed options functions
- Inherits everything from the top-level `lib`.
- Clarifies that the maintainers are the xen team members, not just `members`.
- Removes some superfluous newlines

Signed-off-by: Fernando Rodrigues <[email protected]>
  • Loading branch information
SigmaSquadron committed Dec 30, 2024
1 parent 68f4114 commit 3029d1d
Showing 1 changed file with 20 additions and 60 deletions.
80 changes: 20 additions & 60 deletions nixos/modules/virtualisation/xen/dom0.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Xen Project Hypervisor (Dom0) support.

{
config,
lib,
Expand All @@ -8,34 +7,27 @@
}:

let
inherit (builtins) readFile;
inherit (lib.modules) mkRemovedOptionModule mkRenamedOptionModule mkIf;
inherit (lib.options)
mkOption
mkEnableOption
inherit (lib)
literalExpression
mkEnableOption
mkIf
mkOption
mkPackageOption
mkRemovedOptionModule
mkRenamedOptionModule
optional
optionalString
optionals
teams
types
;
inherit (lib.types)
listOf
str
inherit (types)
ints
lines
enum
listOf
path
submodule
addCheck
float
bool
int
nullOr
str
;
inherit (lib.lists) optional optionals;
inherit (lib.strings) hasSuffix optionalString;
inherit (lib.meta) getExe;
inherit (lib.attrsets) optionalAttrs;
inherit (lib.trivial) boolToString;
inherit (lib.teams.xen) members;

cfg = config.virtualisation.xen;
in
Expand All @@ -44,42 +36,11 @@ in
imports = [
./oxenstored.nix
./efi.nix
(mkRemovedOptionModule
[
"virtualisation"
"xen"
"bridge"
"name"
]
"The Xen Network Bridge options are currently unavailable. Please set up your own bridge manually."
)
(mkRemovedOptionModule
[
"virtualisation"
"xen"
"bridge"
"address"
]
"The Xen Network Bridge options are currently unavailable. Please set up your own bridge manually."
)
(mkRemovedOptionModule
[
"virtualisation"
"xen"
"bridge"
"prefixLength"
]
"The Xen Network Bridge options are currently unavailable. Please set up your own bridge manually."
)
(mkRemovedOptionModule
[
"virtualisation"
"xen"
"bridge"
"forwardDns"
]
"The Xen Network Bridge options are currently unavailable. Please set up your own bridge manually."
)
(mkRemovedOptionModule [
"virtualisation"
"xen"
"bridge"
] "The Xen Network Bridge options have been removed. Please set up your own bridge manually.")
(mkRenamedOptionModule
[
"virtualisation"
Expand Down Expand Up @@ -345,7 +306,6 @@ in
];

services = {

# While this service is installed by the `xen` package, it shouldn't be used in dom0.
xendriverdomain.enable = false;

Expand Down Expand Up @@ -399,5 +359,5 @@ in
};
};
};
meta.maintainers = members;
meta.maintainers = teams.xen.members;
}

0 comments on commit 3029d1d

Please sign in to comment.