Files
dendritic/modules/nixos/lxc.nix
John Lancaster 8039d84347 started lxc
2026-03-08 21:55:01 -05:00

74 lines
2.2 KiB
Nix

{ inputs, ... }:
{
flake-file.inputs = {
vscode-server.url = "github:nix-community/nixos-vscode-server";
};
flake.lib.lxc =
let
inherit (inputs) nixpkgs vscode-server;
baseLxcModules = [
(nixpkgs + "/nixos/modules/virtualisation/proxmox-lxc.nix")
vscode-server.nixosModules.default
({ pkgs, ... }: {
system.stateVersion = "24.11";
nix.settings.experimental-features = [ "nix-command" "flakes" ];
services.vscode-server.enable = true;
environment.systemPackages = with pkgs; [ git ];
})
];
mkLxcSystem = { system ? "x86_64-linux", extraModules ? [], extraPackages ? [] }:
nixpkgs.lib.nixosSystem {
inherit system;
modules = baseLxcModules ++ extraModules ++ [
({ pkgs, ... }: {
environment.systemPackages = extraPackages;
})
];
};
in
{ inherit baseLxcModules mkLxcSystem; };
flake.nixosModules.lxc-bootstrap = { config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.lxc-bootstrap;
in {
options.services.lxc-bootstrap = {
enable = mkEnableOption "LXC bootstrap configuration";
extraPackages = mkOption {
type = types.listOf types.package;
default = [];
description = "Extra packages to install";
};
enableVscodeServer = mkOption {
type = types.bool;
default = true;
description = "Whether to enable VSCode server";
};
};
config = mkIf cfg.enable {
system.stateVersion = "24.11";
nix.settings.experimental-features = [ "nix-command" "flakes" ];
services.vscode-server.enable = cfg.enableVscodeServer;
environment.systemPackages = with pkgs; [ git ] ++ cfg.extraPackages;
};
};
flake.modules.nixos.lxc-base = { pkgs, ... }: {
imports = [
inputs.vscode-server.nixosModules.default
(inputs.nixpkgs + "/nixos/modules/virtualisation/proxmox-lxc.nix")
];
system.stateVersion = "24.11";
nix.settings.experimental-features = [ "nix-command" "flakes" ];
services.vscode-server.enable = true;
environment.systemPackages = with pkgs; [ git ];
};
}