LXC config is imported in minimalConfig, enabled in flake.nix and proxmox-lxc.nix module is imported in flake

This commit is contained in:
Théo Barnouin 2024-10-16 15:37:45 +02:00
parent e29ce7840b
commit 4486f7bc2d
5 changed files with 14 additions and 10 deletions

View file

@ -98,12 +98,16 @@
nginx = nixpkgs.lib.nixosSystem { nginx = nixpkgs.lib.nixosSystem {
inherit system; inherit system;
modules = [ modules = [
"${inputs.nixpkgs}/nixos/modules/virtualisation/proxmox-lxc.nix"
"${inputs.self}/services" "${inputs.self}/services"
{ {
networking.hostName = "nginx"; networking.hostName = "nginx";
services.vm_nginx = { services.vm_nginx = {
enable = true; enable = true;
}; };
services.ct = {
enable = true;
};
} }
]; ];
}; };
@ -131,12 +135,16 @@
redis = nixpkgs.lib.nixosSystem { redis = nixpkgs.lib.nixosSystem {
inherit system; inherit system;
modules = [ modules = [
"${inputs.nixpkgs}/nixos/modules/virtualisation/proxmox-lxc.nix"
"${inputs.self}/services" "${inputs.self}/services"
{ {
networking.hostName = "redis"; networking.hostName = "redis";
services.vm_redis = { services.vm_redis = {
enable = true; enable = true;
}; };
services.ct = {
enable = true;
};
} }
]; ];
}; };

View file

@ -1,5 +1,8 @@
{ config, pkgs, lib, inputs, modulesPath, ... }: { config, pkgs, lib, inputs, modulesPath, ... }:
{ {
imports = [ ./lxc.nix ];
nix = { nix = {
settings.experimental-features = [ "nix-command" "flakes" ]; settings.experimental-features = [ "nix-command" "flakes" ];
settings.trusted-users = [ "root" "@wheel" ]; settings.trusted-users = [ "root" "@wheel" ];

View file

@ -1,19 +1,16 @@
{ inputs, lib, config, modulesPath, ... }: {lib, config, modulesPath, ...}:
let let
cfg = config.services.vm; cfg = config.services.ct;
in in
{ {
options.services.ct = { options.services.ct = {
enable = lib.mkEnableOption "Enable LXC container config"; enable = lib.mkEnableOption "Enable LXC container config";
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
imports = [ (modulesPath + "/virtualisation/proxmox-lxc.nix") ];
systemd.suppressedSystemUnits = [ systemd.suppressedSystemUnits = [
"dev-mqueue.mount" "dev-mqueue.mount"
"sys-kernel-debug.mount" "sys-kernel-debug.mount"
"sys-fs-fuse-connections.mount" "sys-fs-fuse-connections.mount"
]; ];
}; };
} }

View file

@ -2,6 +2,5 @@
{ {
imports = [ imports = [
./microvm.nix ./microvm.nix
./lxc.nix
]; ];
} }

View file

@ -1,11 +1,8 @@
{ inputs, lib, config, microvm, modulesPath, ... }: { inputs, lib, config, microvm, ... }:
let let
cfg = config.services.vm; cfg = config.services.vm;
in in
{ {
options.services.ct = {
enable = lib.mkEnableOption "Enable LXC container config";
};
options.services.vm = { options.services.vm = {
enable = lib.mkEnableOption "Enable NixOS microvm config"; enable = lib.mkEnableOption "Enable NixOS microvm config";
hostname = lib.mkOption { hostname = lib.mkOption {