nixos/lxc: remove with lib

This commit is contained in:
Adam Stephens 2023-12-02 09:41:52 -05:00
parent ccb7b8e309
commit 27064dd722
No known key found for this signature in database

View File

@ -2,24 +2,19 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib;
let let
cfg = config.virtualisation.lxc; cfg = config.virtualisation.lxc;
in in
{ {
###### interface
meta = { meta = {
maintainers = lib.teams.lxc.members; maintainers = lib.teams.lxc.members;
}; };
options.virtualisation.lxc = { options.virtualisation.lxc = {
enable = enable =
mkOption { lib.mkOption {
type = types.bool; type = lib.types.bool;
default = false; default = false;
description = description =
lib.mdDoc '' lib.mdDoc ''
@ -30,8 +25,8 @@ in
}; };
systemConfig = systemConfig =
mkOption { lib.mkOption {
type = types.lines; type = lib.types.lines;
default = ""; default = "";
description = description =
lib.mdDoc '' lib.mdDoc ''
@ -41,8 +36,8 @@ in
}; };
defaultConfig = defaultConfig =
mkOption { lib.mkOption {
type = types.lines; type = lib.types.lines;
default = ""; default = "";
description = description =
lib.mdDoc '' lib.mdDoc ''
@ -52,8 +47,8 @@ in
}; };
usernetConfig = usernetConfig =
mkOption { lib.mkOption {
type = types.lines; type = lib.types.lines;
default = ""; default = "";
description = description =
lib.mdDoc '' lib.mdDoc ''
@ -65,7 +60,7 @@ in
###### implementation ###### implementation
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
environment.systemPackages = [ pkgs.lxc ]; environment.systemPackages = [ pkgs.lxc ];
environment.etc."lxc/lxc.conf".text = cfg.systemConfig; environment.etc."lxc/lxc.conf".text = cfg.systemConfig;
environment.etc."lxc/lxc-usernet".text = cfg.usernetConfig; environment.etc."lxc/lxc-usernet".text = cfg.usernetConfig;