Reorganize configuration root
While I might still bikeshed how the rest of the configuration is sourced, at least the import points should be stable.
This commit is contained in:
parent
dd6f579f74
commit
6444f8f517
21
build-vm.sh
21
build-vm.sh
|
@ -1,21 +0,0 @@
|
||||||
#/usr/bin/env sh
|
|
||||||
|
|
||||||
# Build a NixOS VM for testing
|
|
||||||
#
|
|
||||||
# For x86_64 hosts: use curacao config
|
|
||||||
# For aarch64 hosts: use pindakaas config
|
|
||||||
|
|
||||||
if ! command -v nom-build
|
|
||||||
then
|
|
||||||
exec nix-shell -p nix-output-monitor --run $0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$(uname -m)" == "x86_64" ]
|
|
||||||
then
|
|
||||||
config=./curacao.nix
|
|
||||||
elif [ "$(uname -m)" == "aarch64" ]
|
|
||||||
then
|
|
||||||
config=./pindakaas.nix
|
|
||||||
fi
|
|
||||||
nom-build '<nixpkgs/nixos>' -A vm \
|
|
||||||
-I nixos-config=${config}
|
|
14
curacao.nix
14
curacao.nix
|
@ -1,14 +0,0 @@
|
||||||
{ ... }:
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
"${builtins.fetchTarball "https://github.com/NixOS/nixos-hardware/archive/468a7a108108908c7a35d6549f1e1f0236a9448a.tar.gz"}/dell/g3/3779"
|
|
||||||
./os/loader.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
|
||||||
|
|
||||||
networking.hostName = "curacao";
|
|
||||||
frogeye.extra = true;
|
|
||||||
frogeye.desktop.xorg = true;
|
|
||||||
frogeye.dev.docker = true;
|
|
||||||
}
|
|
8
curacao/hardware.nix
Normal file
8
curacao/hardware.nix
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
"${builtins.fetchTarball "https://github.com/NixOS/nixos-hardware/archive/468a7a108108908c7a35d6549f1e1f0236a9448a.tar.gz"}/dell/g3/3779"
|
||||||
|
];
|
||||||
|
|
||||||
|
boot.loader.efi.canTouchEfiVariables = lib.mkDefault true;
|
||||||
|
}
|
10
curacao/options.nix
Normal file
10
curacao/options.nix
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
frogeye = {
|
||||||
|
desktop.xorg = true;
|
||||||
|
dev = {
|
||||||
|
docker = true;
|
||||||
|
};
|
||||||
|
extra = true;
|
||||||
|
};
|
||||||
|
}
|
11
curacao/os.nix
Normal file
11
curacao/os.nix
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
../os
|
||||||
|
./options.nix
|
||||||
|
./hardware.nix
|
||||||
|
./disko.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
networking.hostName = "curacao";
|
||||||
|
}
|
|
@ -1,18 +0,0 @@
|
||||||
{ ... }:
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
./hm/loader.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
home.username = "gnix";
|
|
||||||
home.homeDirectory = "/home/gnix";
|
|
||||||
|
|
||||||
frogeye.extra = true;
|
|
||||||
frogeye.desktop.xorg = true;
|
|
||||||
frogeye.desktop.nixGLIntel = true;
|
|
||||||
frogeye.dev.ansible = true;
|
|
||||||
frogeye.dev.c = true;
|
|
||||||
frogeye.dev.docker = true;
|
|
||||||
frogeye.dev.fpga = true;
|
|
||||||
frogeye.dev.python = true;
|
|
||||||
}
|
|
12
curacao_test/hm.nix
Normal file
12
curacao_test/hm.nix
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
../hm
|
||||||
|
../curacao/options.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
home.username = "gnix";
|
||||||
|
home.homeDirectory = "/home/gnix";
|
||||||
|
|
||||||
|
frogeye.desktop.nixGLIntel = true;
|
||||||
|
}
|
|
@ -3,10 +3,14 @@
|
||||||
#! nix-shell -p bash nixos-install-tools
|
#! nix-shell -p bash nixos-install-tools
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
|
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
function help {
|
function help {
|
||||||
echo "Usage: $0 -e"
|
echo "Usage: $0 profile [-e]"
|
||||||
|
echo
|
||||||
|
echo "Arguments:"
|
||||||
|
echo " file: OS/disk profile to use"
|
||||||
echo
|
echo
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " -h: Display this help message."
|
echo " -h: Display this help message."
|
||||||
|
@ -32,11 +36,31 @@ do
|
||||||
done
|
done
|
||||||
shift "$(($OPTIND -1))"
|
shift "$(($OPTIND -1))"
|
||||||
|
|
||||||
if [ "$#" -gt 0 ]
|
if [ "$#" -ne 1 ]
|
||||||
then
|
then
|
||||||
help
|
help
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
profile="$1"
|
||||||
|
|
||||||
|
profile_dir="${SCRIPT_DIR}/${profile}"
|
||||||
|
if [ ! -d "$profile_dir" ]
|
||||||
|
then
|
||||||
|
echo "Profile not found."
|
||||||
|
fi
|
||||||
|
|
||||||
|
disko_config="${profile_dir}/disko.nix"
|
||||||
|
if [ ! -f "$disko_config" ]
|
||||||
|
then
|
||||||
|
echo "Disk configuration not found."
|
||||||
|
fi
|
||||||
|
|
||||||
|
nixos_config="${profile_dir}/os.nix"
|
||||||
|
if [ ! -f "$nixos_config" ]
|
||||||
|
then
|
||||||
|
echo "NixOS configuration not found."
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
|
@ -45,7 +69,7 @@ set -x
|
||||||
sudo ./add_channels.sh
|
sudo ./add_channels.sh
|
||||||
|
|
||||||
# Format or mount disk
|
# Format or mount disk
|
||||||
sudo nix --extra-experimental-features nix-command --extra-experimental-features flakes run github:nix-community/disko -- --mode $disko_mode ./pindakaas_disko.nix
|
sudo nix --extra-experimental-features nix-command --extra-experimental-features flakes run github:nix-community/disko -- --mode "$disko_mode" "$disko_config"
|
||||||
|
|
||||||
# Generate hardware-config.nix
|
# Generate hardware-config.nix
|
||||||
sudo nixos-generate-config --no-filesystems --root /mnt
|
sudo nixos-generate-config --no-filesystems --root /mnt
|
||||||
|
@ -53,11 +77,11 @@ sudo nixos-generate-config --no-filesystems --root /mnt
|
||||||
|
|
||||||
# Plug system configuration into this git repo
|
# Plug system configuration into this git repo
|
||||||
sudo mkdir -p /mnt/etc/nixos
|
sudo mkdir -p /mnt/etc/nixos
|
||||||
echo "{ ... }: { imports = [ ./hardware-configuration.nix /home/geoffrey/.config/dotfiles/pindakaas.nix ]; }" | sudo tee /mnt/etc/nixos/configuration.nix > /dev/null
|
echo "{ ... }: { imports = [ ./hardware-configuration.nix ${nixos_config} ]; }" | sudo tee /mnt/etc/nixos/configuration.nix > /dev/null
|
||||||
# Everything there should be covered by (and conflicts with) the repo anyways.
|
# Everything there should be covered by (and conflicts with) the repo anyways.
|
||||||
|
|
||||||
# Install NixOS! Or create a new generation.
|
# Install NixOS! Or create a new generation.
|
||||||
sudo nixos-install
|
sudo nixos-install --no-root-password
|
||||||
|
|
||||||
# Install dotfiles. Actually not needed by nixos-install since it doesn't rewrite global paths to /mnt.
|
# Install dotfiles. Actually not needed by nixos-install since it doesn't rewrite global paths to /mnt.
|
||||||
# Without it no nixos-rebuild from the system itself once installed though.
|
# Without it no nixos-rebuild from the system itself once installed though.
|
||||||
|
@ -66,6 +90,5 @@ sudo nixos-install
|
||||||
# sudo cp -a ../dotfiles /mnt/home/geoffrey/.config/
|
# sudo cp -a ../dotfiles /mnt/home/geoffrey/.config/
|
||||||
# sudo chown geoffrey:geoffrey /mnt/home/geoffrey -R
|
# sudo chown geoffrey:geoffrey /mnt/home/geoffrey -R
|
||||||
|
|
||||||
# Signal we're done!
|
# Signal the installation is done!
|
||||||
# Although it might ask for passwords beforehand, so not sure it's really useful
|
|
||||||
echo
|
echo
|
|
@ -22,7 +22,7 @@
|
||||||
home-manager = {
|
home-manager = {
|
||||||
users.geoffrey = { pkgs, ... }: {
|
users.geoffrey = { pkgs, ... }: {
|
||||||
imports = [
|
imports = [
|
||||||
../hm/loader.nix
|
../hm
|
||||||
];
|
];
|
||||||
frogeye = config.frogeye;
|
frogeye = config.frogeye;
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,9 +3,8 @@
|
||||||
imports = [
|
imports = [
|
||||||
# First commit before 23.05 release date:
|
# First commit before 23.05 release date:
|
||||||
"${builtins.fetchTarball "https://github.com/NixOS/nixos-hardware/archive/468a7a108108908c7a35d6549f1e1f0236a9448a.tar.gz"}/pine64/pinebook-pro"
|
"${builtins.fetchTarball "https://github.com/NixOS/nixos-hardware/archive/468a7a108108908c7a35d6549f1e1f0236a9448a.tar.gz"}/pine64/pinebook-pro"
|
||||||
./os/loader.nix
|
|
||||||
./pindakaas_disko.nix
|
|
||||||
];
|
];
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
# nixos-hardware use latest kernel by default. It has been set a while ago, we maybe don't need it anymore?
|
# nixos-hardware use latest kernel by default. It has been set a while ago, we maybe don't need it anymore?
|
||||||
kernelPackages = pkgs.linuxPackages;
|
kernelPackages = pkgs.linuxPackages;
|
||||||
|
@ -25,14 +24,4 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
networking.hostName = "pindakaas";
|
|
||||||
|
|
||||||
# DEBUG Barebones is faster
|
|
||||||
frogeye.dev.ansible = false;
|
|
||||||
frogeye.dev.python = false;
|
|
||||||
|
|
||||||
# frogeye.extra = false; # FIXME Not working yet
|
|
||||||
# frogeye.desktop.xorg = true;
|
|
||||||
# frogeye.dev.docker = true;
|
|
||||||
}
|
}
|
6
pindakaas/options.nix
Normal file
6
pindakaas/options.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
frogeye.extra = false; # FIXME Not working yet
|
||||||
|
frogeye.desktop.xorg = true;
|
||||||
|
frogeye.dev.docker = true;
|
||||||
|
}
|
11
pindakaas/os.nix
Normal file
11
pindakaas/os.nix
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
../os
|
||||||
|
./hardware.nix
|
||||||
|
./disko.nix
|
||||||
|
./options.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
networking.hostName = "pindakaas";
|
||||||
|
}
|
|
@ -22,11 +22,34 @@
|
||||||
};
|
};
|
||||||
root = {
|
root = {
|
||||||
size = "100%";
|
size = "100%";
|
||||||
|
# content = {
|
||||||
|
# type = "filesystem";
|
||||||
|
# format = "ext4";
|
||||||
|
# mountpoint = "/";
|
||||||
|
# };
|
||||||
content = {
|
content = {
|
||||||
type = "filesystem";
|
type = "btrfs";
|
||||||
format = "ext4";
|
extraArgs = [ "-f" ];
|
||||||
mountpoint = "/";
|
subvolumes = {
|
||||||
};
|
"/nixos" = {
|
||||||
|
mountpoint = "/";
|
||||||
|
mountOptions = [ "compress=zstd" "noatime" ];
|
||||||
|
};
|
||||||
|
"/home" = {
|
||||||
|
mountpoint = "/home";
|
||||||
|
mountOptions = [ "compress=zstd" "relatime" ];
|
||||||
|
};
|
||||||
|
"/nix" = {
|
||||||
|
mountpoint = "/nix";
|
||||||
|
mountOptions = [ "compress=zstd" "noatime" ];
|
||||||
|
};
|
||||||
|
# Maybe later
|
||||||
|
# "/swap" = {
|
||||||
|
# mountpoint = "/.swapvol";
|
||||||
|
# swap.swapfile.size = "20M";
|
||||||
|
# };
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
# FIXME Hang on Linux boot, for some reason
|
# FIXME Hang on Linux boot, for some reason
|
||||||
# luks = {
|
# luks = {
|
6
pindakaas_sd/options.nix
Normal file
6
pindakaas_sd/options.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
# Barebones is faster to test partition schemes
|
||||||
|
frogeye.dev.ansible = false;
|
||||||
|
frogeye.dev.python = false;
|
||||||
|
}
|
11
pindakaas_sd/os.nix
Normal file
11
pindakaas_sd/os.nix
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{ pkgs, config, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
../os
|
||||||
|
../pindakaas/hardware.nix
|
||||||
|
./disko.nix
|
||||||
|
./options.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
networking.hostName = "pindakaas_sd";
|
||||||
|
}
|
0
.gitignore → vm/.gitignore
vendored
0
.gitignore → vm/.gitignore
vendored
11
vm/build.sh
Executable file
11
vm/build.sh
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/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
|
14
vm/options.nix
Normal file
14
vm/options.nix
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
frogeye = {
|
||||||
|
desktop.xorg = true;
|
||||||
|
dev = {
|
||||||
|
ansible = true;
|
||||||
|
c = true;
|
||||||
|
docker = true;
|
||||||
|
fpga = true;
|
||||||
|
python = true;
|
||||||
|
};
|
||||||
|
# extra = true; # FIXME Should support aarch64
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue