This Nix Configuration Manager is a Go-based tool designed to facilitate the management of NixOS configurations. It allows users to select and download specific Nix modules and generates a new configuration.nix
file based on the selected modules. The program also includes a backup feature that saves the current configuration.nix
file before generating a new one.
Psst, check out my other project https://github.com/soltros/nixpkg.py if you're deploying a NixOS system with Configbuilder. It makes managing packages on NixOS much easier.
Before you can run this program, you need to have the following installed:
- Go Programming Language: The program is written in Go, so you need to have Go installed on your system.
- Wget: The program uses
wget
to download Nix modules, sowget
needs to be installed. - Go Modules: The ConfigBuilder app requires several Go modules and packages for its functionality.
The app uses the following Go standard libraries and external packages:
-
Standard libraries:
fmt
os
os/exec
path/filepath
strings
log
io/ioutil
encoding/json
flag
-
External packages:
github.com/charmbracelet/bubbletea
github.com/charmbracelet/bubbles
github.com/charmbracelet/lipgloss
-
Clone the Repository: First, clone the ConfigBuilder repository to your local machine using Git:
git clone https://github.com/soltros/configbuilder.git
-
Navigate to the ConfigBuilder Directory: Change to the
configbuilder
directory:cd ~/configbuilder
-
Initialize Go Module: If the Go module hasn't been initialized in your project directory, do so with:
go mod init configbuilder
-
Tidy Module Dependencies: After adding the external package, tidy your module to ensure all dependencies are correctly listed:
go mod tidy
The Steam Deck module is still being ironed out. Use at your own risk.
You'll need to enable kde-plasma6.nix
in configbuilder. Then, use the unstable-setup.sh
tool.
If you wish to install NixOS with BcacheFS, you need kernel 6.7, and the nixos.bcachefs-tools
package. The current NixOS ISO ships with 6.1. As a result, you must generate your own ISO. Run this script to do that:
curl https://raw.githubusercontent.com/soltros/configbuilder/main/tools/bcachfs-iso-builder.sh | sh
As of now, configbuilder supports setting up Snap packages on NixOS, via the nix-snapd project. However, before you can enable snapd.nix, you must run the installation tool. This tool will download the nix-snapd
module, upgrade your NixOS system to Unstable, and build it. You can run the installer directly with the command below.
curl https://raw.githubusercontent.com/soltros/configbuilder/main/tools/snapd-installer.sh | sh
The standard libraries (fmt
, os
, os/exec
, path/filepath
, strings
, log
, io/ioutil
, encoding/json
, flag
) are part of the Go standard library and do not require separate installation. They are available by default with your Go installation.
If you don't have Go installed, do:
nix-env -iA nixos.go
Clone the repository containing the Nix Configuration Manager code:
git clone https://github.com/soltros/configbuilder.git
cd configbuilder
To run the program outside of /etc/nixos/, use --dir
.
go run configbuilder.go --dir /path/to/your/directory
For server modules, run:
go run configbuilder.go --dir /path/to/your/directory --server
To generate a configuration setup on a fresh install (like a live disk), use this flag:
go run configbuilder.go --dir /path/to/your/directory --fresh-install
To specify a new username and description, use the --new-user
and --user-description
flags:
go run configbuilder.go --dir /path/to/your/directory --new-user myusername --user-description "My Description"
This program is best built as a Go binary. You can build it yourself with:
go build configbuilder.go
This command will compile and run the program. Follow the on-screen prompts to select Nix modules and generate the configuration.nix
file.
- If you wish to customize
configbuilder.go
, feel free. Read the usage guide first. - Ensure you have proper permissions to create and modify files in
/etc/nixos/
. - Run the program with caution, especially in production environments, as it modifies system configuration files.