Do not restrict VMs to a single config
Also "allows" full-system build without install.
This commit is contained in:
parent
3806e023f6
commit
224f769324
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
*/system
|
||||||
|
*/vm
|
||||||
|
*/vmWithBootLoader
|
||||||
|
*.qcow2
|
66
build_os.sh
Executable file
66
build_os.sh
Executable file
|
@ -0,0 +1,66 @@
|
||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#! nix-shell -i bash
|
||||||
|
#! nix-shell -p bash nix-output-monitor
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
|
|
||||||
|
# Parse arguments
|
||||||
|
function help {
|
||||||
|
echo "Usage: $0 [-h|-v|-b] profile"
|
||||||
|
echo
|
||||||
|
echo "Arguments:"
|
||||||
|
echo " profile: OS/disk profile to use"
|
||||||
|
echo
|
||||||
|
echo "Options:"
|
||||||
|
echo " -h: Display this help message."
|
||||||
|
echo " -v: Build a virtual machine."
|
||||||
|
echo " -b: Build a virtual machine with boot loader."
|
||||||
|
}
|
||||||
|
|
||||||
|
attr=system
|
||||||
|
while getopts "hvb" OPTION
|
||||||
|
do
|
||||||
|
case "$OPTION" in
|
||||||
|
h)
|
||||||
|
help
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
v)
|
||||||
|
attr=vm
|
||||||
|
;;
|
||||||
|
b)
|
||||||
|
attr=vmWithBootLoader
|
||||||
|
;;
|
||||||
|
?)
|
||||||
|
help
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift "$(($OPTIND -1))"
|
||||||
|
|
||||||
|
if [ "$#" -ne 1 ]
|
||||||
|
then
|
||||||
|
help
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
profile="$1"
|
||||||
|
|
||||||
|
profile_dir="${SCRIPT_DIR}/${profile}"
|
||||||
|
if [ ! -d "$profile_dir" ]
|
||||||
|
then
|
||||||
|
echo "Profile not found."
|
||||||
|
fi
|
||||||
|
|
||||||
|
nixos_config="${profile_dir}/os.nix"
|
||||||
|
if [ ! -f "$nixos_config" ]
|
||||||
|
then
|
||||||
|
echo "NixOS configuration not found."
|
||||||
|
fi
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
nom-build '<nixpkgs/nixos>' -I "nixos-config=${nixos_config}" -A "$attr" -o "${profile_dir}/${attr}"
|
||||||
|
|
||||||
|
echo
|
6
full/README.md
Normal file
6
full/README.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# full profile
|
||||||
|
|
||||||
|
Fake configuration that contains everything I could ever need,
|
||||||
|
used for debugging.
|
||||||
|
Can't build a full system due to not having a filesystem / bootloader configuration,
|
||||||
|
build as a VM (without bootloader).
|
|
@ -9,6 +9,6 @@
|
||||||
fpga = true;
|
fpga = true;
|
||||||
python = true;
|
python = true;
|
||||||
};
|
};
|
||||||
# extra = true; # FIXME Should support aarch64
|
extra = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -7,10 +7,10 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
|
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
function help {
|
function help {
|
||||||
echo "Usage: $0 [-e] [-h] profile"
|
echo "Usage: $0 [-h|-e] profile"
|
||||||
echo
|
echo
|
||||||
echo "Arguments:"
|
echo "Arguments:"
|
||||||
echo " file: OS/disk profile to use"
|
echo " profile: OS/disk profile to use"
|
||||||
echo
|
echo
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " -h: Display this help message."
|
echo " -h: Display this help message."
|
||||||
|
@ -18,7 +18,7 @@ function help {
|
||||||
}
|
}
|
||||||
|
|
||||||
disko_mode=mount
|
disko_mode=mount
|
||||||
while getopts "e" OPTION
|
while getopts "he" OPTION
|
||||||
do
|
do
|
||||||
case "$OPTION" in
|
case "$OPTION" in
|
||||||
h)
|
h)
|
||||||
|
|
2
vm/.gitignore
vendored
2
vm/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
||||||
*.qcow2
|
|
||||||
result
|
|
11
vm/build.sh
11
vm/build.sh
|
@ -1,11 +0,0 @@
|
||||||
#!/usr/bin/env nix-shell
|
|
||||||
#! nix-shell -i bash
|
|
||||||
#! nix-shell -p bash nix-output-monitor
|
|
||||||
|
|
||||||
# Build a NixOS VM for testing
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
||||||
|
|
||||||
nom-build '<nixpkgs/nixos>' -A vm \
|
|
||||||
-I nixos-config=./os.nix
|
|
Loading…
Reference in a new issue