From d6f156c017357973241790edca04e6b22cc8075c Mon Sep 17 00:00:00 2001 From: Astro Date: Mon, 1 Apr 2019 03:07:53 +0200 Subject: [PATCH] update lxc-template stuff --- hosts/storage-ng/lxc-template.nix | 34 +++---------------------------- hosts/storage-ng/lxc-template.sh | 4 +--- lib/lxc-container.nix | 1 + 3 files changed, 5 insertions(+), 34 deletions(-) diff --git a/hosts/storage-ng/lxc-template.nix b/hosts/storage-ng/lxc-template.nix index 0bffb1ff..c8ee8bf4 100644 --- a/hosts/storage-ng/lxc-template.nix +++ b/hosts/storage-ng/lxc-template.nix @@ -6,30 +6,12 @@ { imports = - [ + [ ../../lib/lxc-container.nix + ../../lib/shared.nix ]; - nix.useSandbox = false; - nix.maxJobs = lib.mkDefault 4; - - boot.isContainer = true; - # /sbin/init - boot.loader.initScript.enable = true; - boot.loader.grub.enable = false; - #boot.supportedFilesystems = ["zfs" "ext2" "ext3" "vfat" "fat32" "bcache" "bcachefs"]; - - fileSystems."/" = { fsType = "rootfs"; device = "rootfs"; }; networking.hostName = "nixbert"; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - networking.useNetworkd = true; - - # Set your time zone. - time.timeZone = "Europe/Berlin"; - # Select internationalisation properties. - i18n = { - defaultLocale = "en_US.UTF-8"; - supportedLocales = lib.mkForce [ "en_US.UTF-8/UTF-8" ]; - }; + networking.useNetworkd = false; # List packages installed in system profile. To search, run: # $ nix search wget @@ -37,16 +19,6 @@ wget vim ]; - # Create a few files early before packing tarball for Proxmox - # architecture/OS detection. - system.extraSystemBuilderCmds = - '' - mkdir -m 0755 -p $out/bin - ln -s ${pkgs.bash}/bin/bash $out/bin/sh - mkdir -m 0755 -p $out/sbin - ln -s ../init $out/sbin/init - ''; - # This value determines the NixOS release with which your system is to be # compatible, in order to avoid breaking some software such as database # servers. You should change this only after NixOS release notes say you diff --git a/hosts/storage-ng/lxc-template.sh b/hosts/storage-ng/lxc-template.sh index 2551089e..7703a382 100755 --- a/hosts/storage-ng/lxc-template.sh +++ b/hosts/storage-ng/lxc-template.sh @@ -1,5 +1,3 @@ #!/usr/bin/env bash -# Doesn't boot in Proxmox, use nixos-install to generate an image instead! - -nix-build -E '(import ../../nixpkgs/nixos/release.nix { configuration = import ./lxc-template.nix; }).containerTarball.x86_64-linux' +nix-build -I nixos-config=./lxc-template.nix '' -A config.system.build.tarball diff --git a/lib/lxc-container.nix b/lib/lxc-container.nix index 9990f523..613523c8 100644 --- a/lib/lxc-container.nix +++ b/lib/lxc-container.nix @@ -3,6 +3,7 @@ { imports = [ + ]; nix.useSandbox = false; nix.maxJobs = lib.mkDefault 1;