Compare commits

..

4 Commits

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
2 changed files with 61 additions and 187 deletions

158
flake.lock generated
View File

@@ -1,158 +0,0 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1750798083,
"narHash": "sha256-DTCCcp6WCFaYXWKFRA6fiI2zlvOLCf5Vwx8+/0R8Wc4=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "ff31a4677c1a8ae506aa7e003a3dba08cb203f82",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"home-manager_2": {
"inputs": {
"nixpkgs": [
"nix-home",
"nixpkgs"
]
},
"locked": {
"lastModified": 1750033262,
"narHash": "sha256-TcFN78w6kPspxpbPsxW/8vQ1GAtY8Y3mjBaC+oB8jo4=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "66523b0efe93ce5b0ba96dcddcda15d36673c1f0",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nix-home": {
"inputs": {
"home-manager": "home-manager_2",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1750825763,
"narHash": "sha256-gUtcO/8Bcw4YerJpSIRu+Q2MYKxWrtT+8Bp3Mh1Qfmw=",
"ref": "refs/heads/main",
"rev": "1ab1e4b9e610dcd40a3d728f377b6ac8a302d977",
"revCount": 26,
"type": "git",
"url": "https://gitea.john-stream.com/john/nix-home"
},
"original": {
"type": "git",
"url": "https://gitea.john-stream.com/john/nix-home"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1750506804,
"narHash": "sha256-VLFNc4egNjovYVxDGyBYTrvVCgDYgENp5bVi9fPTDYc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "4206c4cb56751df534751b058295ea61357bbbaa",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1682134069,
"narHash": "sha256-TnI/ZXSmRxQDt2sjRYK/8j8iha4B4zP2cnQCZZ3vp7k=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "fd901ef4bf93499374c5af385b2943f5801c0833",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nix-home": "nix-home",
"nixpkgs": "nixpkgs",
"vscode-server": "vscode-server"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"vscode-server": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1750353031,
"narHash": "sha256-Bx7DOPLhkr8Z60U9Qw4l0OidzHoqLDKQH5rDV5ef59A=",
"owner": "nix-community",
"repo": "nixos-vscode-server",
"rev": "4ec4859b12129c0436b0a471ed1ea6dd8a317993",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-vscode-server",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View File

@@ -4,44 +4,76 @@
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
vscode-server.url = "github:nix-community/nixos-vscode-server"; vscode-server.url = "github:nix-community/nixos-vscode-server";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-home = {
url = "git+https://gitea.john-stream.com/john/nix-home";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = { self, ... }@inputs: outputs = { self, ... }@inputs:
let let
inherit (self) outputs; inherit (self) outputs;
nixosSystem = inputs.nixpkgs.lib.nixosSystem; nixosSystem = inputs.nixpkgs.lib.nixosSystem;
pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
in # Define the base modules list once
{ baseLxcModules = [
nixosConfigurations.appdaemon = nixosSystem {
system = "x86_64-linux";
modules = [
(inputs.nixpkgs + "/nixos/modules/virtualisation/proxmox-lxc.nix") (inputs.nixpkgs + "/nixos/modules/virtualisation/proxmox-lxc.nix")
inputs.nix-home.nixosModules.default { user = "john"; }
inputs.vscode-server.nixosModules.default inputs.vscode-server.nixosModules.default
({ pkgs, ... }: { ({ pkgs, ... }: {
system.stateVersion = "24.11"; system.stateVersion = "24.11";
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [ "nix-command" "flakes" ];
services.vscode-server.enable = true; services.vscode-server.enable = true;
virtualisation.docker.enable = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
git git
devenv
]; ];
}) })
inputs.home-manager.nixosModules.home-manager { ];
home-manager.useGlobalPkgs = true;
home-manager.users.root.home.stateVersion = "24.11"; # 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, ... }: {
environment.systemPackages = extraPackages;
})
]; ];
}; };
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 { };
}; };
} }