started lxc
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
url = "github:Mic92/sops-nix";
|
url = "github:Mic92/sops-nix";
|
||||||
};
|
};
|
||||||
|
vscode-server.url = "github:nix-community/nixos-vscode-server";
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
73
modules/nixos/lxc.nix
Normal file
73
modules/nixos/lxc.nix
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
{ 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 ];
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user