Skip to content

explorier/nixos-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NixOS Modular Configuration

This repository contains a modular setup for managing NixOS configurations across multiple virtual machines (VMs). Common configurations are stored in base.nix, and VM-specific configurations are stored in the vm-configs/ directory. Each VM's configuration.nix will import the appropriate configuration while leaving machine-specific files (like hardware-configuration.nix) untouched.

YMMV with this setup. It was only used in a prototyped manner. Adopt and fork for your own use if desired!

Strategy Overview

  1. Modular Configuration: Common configurations are stored in base.nix, while each VM has its specific configuration in the vm-configs/ directory (e.g., metabase-app.nix).
  2. VM-Specific Configuration: Each machine should maintain its own hardware-configuration.nix, generated by NixOS, and its own configuration.nix, which imports the VM-specific configuration from the vm-configs/ directory.
  3. Git Tracking: The repository does not track configuration.nix and hardware-configuration.nix, allowing each machine to maintain these files independently.

Setup Instructions

1. Install to ProxMox VM

When setting up a ProxMox VM for NixOS, follow these steps:

  • Boot Mode: Default (SeaBIOS)
  • Network Bridge: Vmbr01 - For public IP addresses
  • Storage: Select local
  • ISO File: NixOS-minimal-24.05.iso

2. Run Installation Script

If you would like to paste commands into the noVNC console, you can use this Tampermonkey UserScript (caution advised!)

Once the system is booted, you are automatically logged in as the nixos user. The nixos user account has an empty password, so you can use sudo without a password.

Use the following commands to run the installation script. You will be prompted for your Git credentials.

sudo -i
curl -s https://gist.githubusercontent.com/explorier/c831de732ea8c582a98630950aa25bcb/raw/setup_nixos.sh -o setup_nixos.sh
bash setup_nixos.sh https://github.com/explorier/NixosConfig.git

Upon successful installation, the system will reboot.

3. Add VM-specific configuration

After reboot, login as root.

Then you can create a file to configure the current VM inside of the /etc/nixos/vm-configs directory and import it into the configuration.nix file.

To apply the base config, or test and build your config , run the nixos-rebuild switch command 🎉

If you'd like to set a password for the admin account to enable sudo su when connecting via SSH, run sudo passwd admin

Resources and Documentation

Contributing

Feel free to open an issue or submit a pull request if you have suggestions for improving this setup.


By following this strategy, we can maintain both shared and VM-specific configurations across multiple machines while keeping machine-specific files like hardware-configuration.nix untouched.


About

a modular setup for managing NixOS configurations across multiple virtual machines on ProxMox

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages