Dan's NixOS, nix-on-droid, and home-manager configuration using the subflake model.
just update: Updates the flake.lock to the latestjust switch: Builds nix and applies the new versionjust clean: cleans the nix store
name=..
device=nixos|droid
keep_garbage=10d
max_jobs=100nix flake show github:danhab99/dotfiles#devShells
nix flake show github:danhab99/dotfiles#templates
Each subflake in ./subflakes/ is a self-contained flake that exposes one or more of:
| Type | Output | Usage |
|---|---|---|
| Module | nixosModules.subflake / homeManagerModules.subflake |
Enable with module.<name>.enable = true |
| Devshell | devShells.* |
Run with nix develop .#<name> |
| Template | templates.* |
Init with nix flake init -t .#<name> |
- Add the subflake as a path input in your machine's
flake.nix:
inputs = {
# ... other inputs ...
git.url = "github:danhab99/dotfiles?dir=subflakes/git";
audio.url = "github:danhab99/dotfiles?dir=subflakes/audio";
};- Enable the module in
hostCfg.module:
hostCfg = {
module = {
git = {
enable = true;
signingKey = "0x...";
email = "you@example.com";
};
audio = {
enable = true;
enableBluetooth = true;
};
};
};The output.nix builder automatically collects all nixosModules.subflake from your inputs using get.nix, so no extra imports are needed.
Each subflake uses ../output.nix as a unified wrapper. It supports three modes determined by which argument you pass:
Module mode — provides NixOS and home-manager config:
outputs = inputs: import ../output.nix inputs {
name = "my-module";
options = { lib }: {
myOption = lib.mkOption { type = lib.types.str; };
};
output = { pkgs, cfg, ... }: {
packages = [ pkgs.hello ];
nixos = { services.foo.enable = true; };
homeManager = { programs.bash.enable = true; };
};
};Devshell mode — provides development shells:
outputs = inputs: import ../output.nix inputs {
name = "go";
devshells = { pkgs, ... }: {
"" = { packages = [ pkgs.go pkgs.gopls ]; };
"1.21" = { packages = [ pkgs.go_1_21 ]; };
};
};Template mode — provides project templates:
outputs = inputs: import ../output.nix inputs {
name = "blank";
description = "blank project";
template = ./_files;
};Run the following to see what's available:
# List all modules, devshells, and templates
nix flake show
# Or browse the directory
ls subflakes/-
cd to
./machineand run./mkMachine.sh -
Copy hardware-configuration.nix to the correct machine
-
Configure modules
-
cd to
./modulesand run./mkModule.sh -
Fillout nixos and homemanager modules
-
Git add new module
-
Enable module in machine file
cd to ./modules/templates and run ./mkTemplate.sh. This will copy blank into the new workflow.
-
cd to
./usersand run./mkUser.sh -
Disable any of the things you want to disable