4 Commits
git ... main

Author SHA1 Message Date
John Lancaster
fbc3741fca consolidated 2025-07-03 04:25:10 +00:00
88b6f01a35 fixed warning 2025-07-03 02:43:44 +00:00
cc48ba10d6 broke out basemodules 2025-07-03 02:34:29 +00:00
d1959792d2 started exports 2025-07-03 02:28:27 +00:00

View File

@@ -6,31 +6,74 @@
vscode-server.url = "github:nix-community/nixos-vscode-server"; vscode-server.url = "github:nix-community/nixos-vscode-server";
}; };
outputs = { self, ... }@args: outputs = { self, ... }@inputs:
let let
inherit (self) outputs; inherit (self) outputs;
nixosSystem = args.nixpkgs.lib.nixosSystem; nixosSystem = inputs.nixpkgs.lib.nixosSystem;
pkgs = args.nixpkgs.legacyPackages.x86_64-linux;
in # Define the base modules list once
{ baseLxcModules = [
nixosConfigurations.lxc = nixosSystem { (inputs.nixpkgs + "/nixos/modules/virtualisation/proxmox-lxc.nix")
system = "x86_64-linux"; inputs.vscode-server.nixosModules.default
specialArgs = { ({ pkgs, ... }: {
inherit pkgs; system.stateVersion = "24.11";
}; nix.settings.experimental-features = [ "nix-command" "flakes" ];
modules = [ services.vscode-server.enable = true;
(args.nixpkgs + "/nixos/modules/virtualisation/proxmox-lxc.nix") environment.systemPackages = with pkgs; [
args.vscode-server.nixosModules.default git
# ./configuration.nix ];
})
];
# Function to create LXC systems with custom modules
mkLxcSystem = { system ? "x86_64-linux", extraModules ? [], extraPackages ? [] }: nixosSystem {
inherit system;
modules = baseLxcModules ++ extraModules ++ [
# Add extra packages to the base configuration
({ pkgs, ... }: { ({ pkgs, ... }: {
system.stateVersion = "24.11"; environment.systemPackages = extraPackages;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
services.vscode-server.enable = true;
environment.systemPackages = with pkgs; [
git
];
}) })
]; ];
}; };
in
{
# Export the function and modules for reuse
lib = { inherit mkLxcSystem baseLxcModules; };
# Re-export inputs for downstream flakes
inherit (inputs) inputs;
# Export nixosModules for use in other flakes
nixosModules = {
# Alternative module with more options
lxc-configurable = { 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;
};
};
};
nixosConfigurations.lxc = mkLxcSystem { };
}; };
} }