move all expressions to nix/; include modularized home-manager config
This commit is contained in:
parent
d76a7f963b
commit
13bd5e9000
65 changed files with 1726 additions and 511 deletions
32
nix/tests/buildvmwithbootloader/build-vm.nix
Normal file
32
nix/tests/buildvmwithbootloader/build-vm.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{ system ? builtins.currentSystem
|
||||
, vmPkgsPath
|
||||
, buildPkgsPath
|
||||
, nixosConfigPath
|
||||
}:
|
||||
|
||||
let
|
||||
buildPkgs = import buildPkgsPath {};
|
||||
vmPkgs'= import vmPkgsPath {};
|
||||
vmPkgs = vmPkgs' // {
|
||||
runtimeShell = "${vmPkgs'.bash}/${vmPkgs'.bash.shellPath}";
|
||||
};
|
||||
|
||||
importWithPkgs = { path, pkgs }: args: import path (args // { inherit pkgs; });
|
||||
|
||||
nixosConfig = importWithPkgs { path = "${nixosConfigPath}"; pkgs = vmPkgs; };
|
||||
vmConfig = importWithPkgs { path = "${buildPkgsPath}/nixos/modules/virtualisation/qemu-vm.nix"; pkgs = vmPkgs; };
|
||||
evalConfig = importWithPkgs { path = "${vmPkgsPath}/nixos/lib/eval-config.nix"; pkgs = null; };
|
||||
|
||||
vmWithBootLoaderConfigMixed = (evalConfig {
|
||||
modules = [
|
||||
nixosConfig
|
||||
vmConfig
|
||||
{
|
||||
virtualisation.useBootLoader = true;
|
||||
}
|
||||
|
||||
];
|
||||
}).config;
|
||||
in {
|
||||
vmWithBootLoaderMixed = vmWithBootLoaderConfigMixed.system.build.vm;
|
||||
}
|
16
nix/tests/buildvmwithbootloader/build-vm.sh
Executable file
16
nix/tests/buildvmwithbootloader/build-vm.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
set -x
|
||||
rm *.qcow2
|
||||
rm result*
|
||||
set -e
|
||||
|
||||
BUILD_NIXPKGS="${BUILD_NIXPKGS:-${HOME}/src/github/NixOS/nixpkgs.dev}"
|
||||
NIXOS_CONFIG="${NIXOS_CONFIG_OVERRIDE:-${PWD}/configuration.nix}"
|
||||
|
||||
nix-build -K --show-trace build-vm.nix \
|
||||
--arg vmPkgsPath '<nixos-18.03>' \
|
||||
--argstr buildPkgsPath "${BUILD_NIXPKGS}" \
|
||||
--argstr nixosConfigPath "${NIXOS_CONFIG}" \
|
||||
-A vmWithBootLoaderMixed
|
||||
|
||||
./result/bin/run-*-vm
|
38
nix/tests/buildvmwithbootloader/configuration.nix
Normal file
38
nix/tests/buildvmwithbootloader/configuration.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
{ pkgs, lib, ... }:
|
||||
let
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
boot.loader.grub = {
|
||||
enable = true;
|
||||
version = 2;
|
||||
device = "/dev/vda";
|
||||
efiSupport = true;
|
||||
enableCryptodisk = true;
|
||||
};
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
|
||||
boot.initrd.luks.devices = [ {
|
||||
name = "crypt";
|
||||
device = "/dev/disk/uuid/463d886d-7dfe-421b-8cef-f9af3a3fa09d";
|
||||
preLVM = true;
|
||||
allowDiscards = true;
|
||||
}
|
||||
];
|
||||
fileSystems."/" = {
|
||||
label = "root";
|
||||
};
|
||||
|
||||
fileSystems."/boot" = {
|
||||
label = "boot";
|
||||
};
|
||||
|
||||
boot.tmpOnTmpfs = true;
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
|
||||
|
||||
users.extraUsers.root.initialPassword = lib.mkForce "toorroot";
|
||||
users.mutableUsers = false;
|
||||
}
|
30
nix/tests/buildvmwithbootloader/debug-vm.sh
Executable file
30
nix/tests/buildvmwithbootloader/debug-vm.sh
Executable file
|
@ -0,0 +1,30 @@
|
|||
# /nix/store/lya9qyl9z5xb4vzdzh4vzcr7gfssk47z-qemu-host-cpu-only-for-vm-tests-2.12.0/bin/qemu-kvm \
|
||||
# -cpu \
|
||||
# kvm64 \
|
||||
# -name \
|
||||
# nixos \
|
||||
# -m \
|
||||
# 384 \
|
||||
# -smp \
|
||||
# 1 \
|
||||
# -device \
|
||||
# virtio-rng-pci \
|
||||
# -net \
|
||||
# nic,netdev=user.0,model=virtio \
|
||||
# -netdev \
|
||||
# user,id=user.0 \
|
||||
# -virtfs \
|
||||
# local,path=/nix/store,security_model=none,mount_tag=store \
|
||||
# -virtfs \
|
||||
# local,path=/tmp/nix-vm.j7eRAzkZvB/xchg,security_model=none,mount_tag=xchg \
|
||||
# -virtfs \
|
||||
# local,path=/tmp/nix-vm.j7eRAzkZvB/xchg,security_model=none,mount_tag=shared \
|
||||
# -drive \
|
||||
# index=1,id=drive2,file=/tmp/nix-vm.j7eRAzkZvB/disk.img,media=disk,if=virtio \
|
||||
# -drive \
|
||||
# index=0,id=drive1,file=/home/steveej/src/steveej/nix-expressions/nixos.qcow2,cache=writeback,werror=report,if=virtio \
|
||||
|
||||
|
||||
/nix/store/0i6fr8vv559a50w0vipvd22r0kkg1kx1-qemu-host-cpu-only-for-vm-tests-3.0.0/bin/qemu-kvm -cpu kvm64 -name nixos -m 384 -smp 1 -device virtio-rng-pci -net nic,netdev=user.0,model=virtio -netdev user,id=user.0 -virtfs local,path=/nix/store,security_model=none,mount_tag=store -virtfs local,path=/tmp/nix-vm.BXlbOnli8K/xchg,security_model=none,mount_tag=xchg -virtfs local,path=/tmp/nix-vm.BXlbOnli8K/xchg,security_model=none,mount_tag=shared \
|
||||
-drive index=1,id=drive2,file=/tmp/nix-vm.BXlbOnli8K/disk.img,media=disk,if=virtio \
|
||||
-drive index=0,id=drive1,file=/home/steveej/src/steveej/nix-expressions/tests/nixos.qcow2,cache=writeback,werror=report,if=virtio \
|
1
nix/tests/buildvmwithbootloader/result
Symbolic link
1
nix/tests/buildvmwithbootloader/result
Symbolic link
|
@ -0,0 +1 @@
|
|||
/nix/store/xh6p394kh1bncmc3lr6l9fb81284ckhf-nixos-vm
|
7
nix/tests/test-vm.nix
Normal file
7
nix/tests/test-vm.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{ lib, config, pkgs, fetchgit, ... }:
|
||||
{
|
||||
boot.consoleLogLevel=6;
|
||||
users.users.root.initialPassword = "root";
|
||||
systemd.services."serial-getty@ttyS0".enable = true;
|
||||
networking.firewall.enable = false;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue