Skip to content

Commit

Permalink
add membacking, remove dhcp in favour nixos module kea
Browse files Browse the repository at this point in the history
  • Loading branch information
NeverBehave committed Nov 8, 2023
1 parent 6234c05 commit 70f81d3
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 279 deletions.
2 changes: 1 addition & 1 deletion modules/networking/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
./rename-interfaces
./routing
./wireguard
./dhcp
# DHCP should directly use NixOS module --- kea

./isp-split-tunnel
];
Expand Down
50 changes: 0 additions & 50 deletions modules/networking/dhcp/default.nix

This file was deleted.

34 changes: 0 additions & 34 deletions modules/networking/dhcp/host-options.nix

This file was deleted.

63 changes: 0 additions & 63 deletions modules/networking/dhcp/subnet-options.nix

This file was deleted.

131 changes: 0 additions & 131 deletions modules/networking/dhcp/utils.nix

This file was deleted.

17 changes: 17 additions & 0 deletions modules/virtualization/libvirt/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,27 @@ let

buildMemoryBacking = md: ''
<memoryBacking>
${shouldWrite md.hugepages ''
<hugepages>
${md.hugepages}
</hugepages>
''}
${shouldWrite md.nosharepages ''
<nosharepages/>
''}
${shouldWrite md.locked ''
<locked/>
''}
${shouldWrite md.sourceType ''
<source type='${md.sourceType}'/>
''}
<access mode='${md.accessMode}'/>
${shouldWrite md.allocation ''
<allocation mode=${md.allocation.mode} ${shouldWrite md.allocation.threads ''threads=${md.allocation.threads}''}
''}
${shouldWrite md.discard ''
<discard/>
''}
</memoryBacking>
'';

Expand Down
38 changes: 38 additions & 0 deletions modules/virtualization/libvirt/memoryBacking.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
{ lib, ... }:
with lib;
let
allocationModule = {
options = {
mode = mkOption {
type = types.nullOr (types.enum ["immediate" "ondemand"]);
default = null;
};
threads = mkOption {
type = types.nullOr types.int;
default = null;
};
};
};
in
{
options = {
Expand All @@ -13,5 +25,31 @@ in
type = types.enum [ "shared" "private" ];
default = "shared";
};

hugepages = mkOption {
type = types.nullOr types.str;
default = null;
description = "add xml def or empty string to enable";
};

nosharepages = mkOption {
type = types.bool;
default = false;
};

locked = mkOption {
type = types.bool;
default = false;
};

allocation = mkOption {
type = types.nullOr (types.submodule allocationModule);
default = null;
};

discard = mkOption {
type = types.bool;
default = false;
};
};
}

0 comments on commit 70f81d3

Please sign in to comment.