diff options
author | sinanmohd <sinan@sinanmohd.com> | 2024-03-08 10:50:28 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2024-03-08 10:52:52 +0530 |
commit | cd942d253bda8f511fdb921ea29f69f382a9368e (patch) | |
tree | 2c7aac5f66e5b614ecdd0871df23432bae4dc6db /hosts/lia/modules/lxc.nix | |
parent | 2abeb90fbff1d33aadfec37ce80a6bc4d3551661 (diff) |
repo: restructure source tree
Diffstat (limited to 'hosts/lia/modules/lxc.nix')
-rw-r--r-- | hosts/lia/modules/lxc.nix | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/hosts/lia/modules/lxc.nix b/hosts/lia/modules/lxc.nix deleted file mode 100644 index 259c316..0000000 --- a/hosts/lia/modules/lxc.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ pkgs, ... }: let - container = { - name = "ubu"; - distro = "ubuntu"; - release = "jammy"; - }; - - bridge = "lan"; -in { - virtualisation.lxc.enable = true; - - environment.systemPackages = with pkgs; [ wget ]; - systemd.services."lxc-${container.name}-provision" = { - description = "auto provision ${container.name} lxc container"; - wantedBy = [ "multi-user.target" ]; - after = [ "network-online.target" ]; - wants = [ "network-online.target" ]; - stopIfChanged = false; - - serviceConfig = { - Type = "oneshot"; - RemainAfterExit = true; - }; - - path = with pkgs; [ wget lxc util-linux gnutar xz gawk ]; - script = '' - if ! lxc-ls | grep -q ${container.name}; then - lxc-create -n ${container.name} -t download -- \ - --arch amd64 \ - --release ${container.release} \ - --dist ${container.distro} - - sed 's/lxcbr0/${bridge}/g' -i /var/lib/lxc/${container.name}/config - fi - - lxc-start -n ${container.name} - ''; - - preStop = "lxc-stop --name ${container.name}"; - }; -} |