mirror of
https://github.com/genebean/dots.git
synced 2026-03-27 17:37:43 -04:00
Update documentation for new structure
- Update README with new modules/shared structure - Update examples/flake-structure.nix to use lib/
This commit is contained in:
parent
5047d93b86
commit
1312755c4b
2 changed files with 111 additions and 98 deletions
173
README.md
173
README.md
|
|
@ -3,8 +3,8 @@
|
||||||
This repo is a Nix flake that manages most of my setup on macOS and fully manages machines I have that run NixOS as their operating system.
|
This repo is a Nix flake that manages most of my setup on macOS and fully manages machines I have that run NixOS as their operating system.
|
||||||
|
|
||||||
- [Flake structure](#flake-structure)
|
- [Flake structure](#flake-structure)
|
||||||
- [Note](#note)
|
|
||||||
- [Repo structure](#repo-structure)
|
- [Repo structure](#repo-structure)
|
||||||
|
- [Hosts](#hosts)
|
||||||
- [Historical bits](#historical-bits)
|
- [Historical bits](#historical-bits)
|
||||||
- [Adding a new macOS host](#adding-a-new-macos-host)
|
- [Adding a new macOS host](#adding-a-new-macos-host)
|
||||||
- [Extras steps not done by Nix and/or Homebrew and/or mas](#extras-steps-not-done-by-nix-andor-homebrew-andor-mas)
|
- [Extras steps not done by Nix and/or Homebrew and/or mas](#extras-steps-not-done-by-nix-andor-homebrew-andor-mas)
|
||||||
|
|
@ -18,100 +18,119 @@ This repo is a Nix flake that manages most of my setup on macOS and fully manage
|
||||||
|
|
||||||
## Flake structure
|
## Flake structure
|
||||||
|
|
||||||
> **RESTRUCTURING IN PROGRESS**: please note, I am restructuring this to remove a lot of complexity. This first pass is done and moves home manager bits into modules that have home in the name. Things that apply to everything under a part of the tree are in a corresponding `default.nix`
|
The Nix bits are driven by `flake.nix` which pulls in things under `modules/`. Both Intel and Apple Silicon macOS are supported, as is NixOS.
|
||||||
|
|
||||||
The Nix bits are driven by `flake.nix` which pulls in things under `modules/`. Both Intel and Apple Silicon macOS are suppoted, as is NixOS. The flake is structured like so:
|
|
||||||
|
|
||||||
- description: a human readable description of this flake
|
|
||||||
- inputs: all the places things are pulled from
|
- inputs: all the places things are pulled from
|
||||||
- outputs:
|
- outputs:
|
||||||
- all the outputs from the inputs
|
- all the outputs from the inputs
|
||||||
- a `let` ... `in` block that contains:
|
- a `let` ... `in` block that contains:
|
||||||
- `darwinHostConfig` which takes a set of paramters as an attribute set and pulls in all the things needed to use Nix on a macOS host
|
- `mkDarwinHost` which takes a set of parameters and pulls in all the things needed to use Nix on a macOS host
|
||||||
- `mkNixosHost` which takes a set of parameters as an attribute set and pulls in all the things needed to configure a NixOS host
|
- `mkNixosHost` which takes a set of parameters and pulls in all the things needed to configure a NixOS host
|
||||||
- `linuxHomeConfig` which takes a set of paramters as an attribute set and pulls in the things I manage on non-NixOS Linux hosts
|
- `mkHomeConfig` which takes a set of parameters and pulls in things for standalone Home Manager (non-NixOS Linux)
|
||||||
- the body of outputs that contains:
|
- the body of outputs that contains:
|
||||||
- `darwinConfigurations` contains is an attribute set that contains keys named for each macOS host set to the results of a call to `darwinHostConfig` with values for each of the required parameters
|
- `darwinConfigurations` - an attribute set keyed by hostname for each macOS host
|
||||||
- `nixosConfigurations` contains is an attribute set that contains keys named for each NixOS host set to the results of a call to `darwinHostConfig` with values for each of the required parameters
|
- `nixosConfigurations` - an attribute set keyed by hostname for each NixOS host
|
||||||
- `homeConfigurations` contains an entry for each username set to the results of a call to `linuxHomeConfig` with values for each of the required parameters
|
- `homeConfigurations` - an attribute set keyed by username for standalone HM users
|
||||||
|
|
||||||
The parameters on `darwinHostConfig` & `mkNixosHost` are:
|
The parameters on `mkDarwinHost`, `mkNixosHost`, and `mkHomeConfig` are:
|
||||||
|
|
||||||
- `system:` the system definition to use for nixpkgs
|
- `system:` the system definition to use for nixpkgs (e.g., "x86_64-linux", "aarch64-darwin")
|
||||||
- `hostname:` the hostname of the machine being configured
|
- `hostname:` the hostname of the machine being configured
|
||||||
- `username:` the username being configured on the host (all code currently assumes there is a single human user managed by Nix)
|
- `username:` the username being configured on the host (all code currently assumes there is a single human user managed by Nix)
|
||||||
- `additionalModules:` any nix modules that are desired to supplement the default for the host. An example use case for this is adding in the hardware specific module from `nixos-hardware`.
|
- `additionalModules:` any nix modules that are desired to supplement the default for the host
|
||||||
- `additionalSpecialArgs:` any supplemental arguments to be passed to `specialArgs`.
|
- `additionalSpecialArgs:` any supplemental arguments to be passed to `specialArgs`
|
||||||
|
|
||||||
The parameters on `linxuHomeConfig` are the same as the above.
|
|
||||||
|
|
||||||
## Note
|
|
||||||
|
|
||||||
> All the bits below here are useful, but may be slightly outdated... I have not done a good job of keeping them updated.
|
|
||||||
|
|
||||||
## Repo structure
|
## Repo structure
|
||||||
|
|
||||||
The Nix stuff is structured like so, at least for now:
|
Key files at the root level:
|
||||||
|
- `flake.nix` - Main flake entry point, defines all hosts and inputs
|
||||||
|
- `flake.lock` - Lock file for pinned dependencies
|
||||||
|
- `lib/` - Helper functions (mkDarwinHost, mkNixosHost, mkHomeConfig)
|
||||||
|
- `modules/hosts/` - All host configurations (see tree below)
|
||||||
|
- `.sops.yaml` - SOPS secrets management configuration
|
||||||
|
- `examples/flake-structure.nix` - Minimal example showing flake structure
|
||||||
|
|
||||||
|
The Nix stuff is structured like so:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ tree . -I legacy* -I link* --gitignore --dirsfirst
|
$ tree modules -I secrets.yaml --dirsfirst
|
||||||
.
|
modules
|
||||||
├── modules
|
├── shared # Shared configurations (formerly common)
|
||||||
│ ├── home-manager
|
│ ├── all-gui.nix
|
||||||
│ │ ├── common
|
│ ├── default.nix
|
||||||
│ │ │ ├── linux-apps
|
│ ├── files # Home manager files (nvim, powershell, tilix, waybar, xfce4)
|
||||||
│ │ │ │ ├── tilix.nix
|
│ ├── linux
|
||||||
│ │ │ │ ├── waybar.nix
|
│ │ ├── apps # Linux-specific apps (waybar, tilix, etc.)
|
||||||
│ │ │ │ └── xfce4-terminal.nix
|
│ │ ├── home.nix
|
||||||
│ │ │ ├── all-cli.nix
|
│ │ ├── internationalisation.nix
|
||||||
│ │ │ ├── all-darwin.nix
|
│ │ ├── lets-encrypt.nix
|
||||||
│ │ │ ├── all-gui.nix
|
│ │ ├── nixroutes.nix
|
||||||
│ │ │ └── all-linux.nix
|
│ │ └── restic.nix
|
||||||
│ │ ├── files
|
│ └── linux-apps # (deprecated, apps moved to linux/)
|
||||||
│ │ │ ├── tilix
|
└── hosts
|
||||||
│ │ │ │ └── Beanbag-Mathias.json
|
├── darwin # macOS system & home configs
|
||||||
│ │ │ ├── waybar
|
│ ├── AirPuppet
|
||||||
│ │ │ │ ├── config
|
│ │ └── home-gene.nix
|
||||||
│ │ │ │ └── style.css
|
│ ├── Blue-Rock
|
||||||
│ │ │ ├── xfce4
|
│ │ ├── default.nix
|
||||||
│ │ │ │ └── terminal
|
│ │ └── home-gene.liverman.nix
|
||||||
│ │ │ │ ├── accels.scm
|
│ ├── default.nix
|
||||||
│ │ │ │ └── terminalrc
|
│ ├── home.nix
|
||||||
│ │ │ └── Microsoft.PowerShell_profile.ps1
|
│ └── mightymac
|
||||||
│ │ └── hosts
|
│ ├── default.nix
|
||||||
│ │ ├── Blue-Rock
|
│ └── home-gene.liverman.nix
|
||||||
│ │ │ └── gene.liverman.nix
|
├── home-manager-only # Standalone Home Manager (non-NixOS Linux)
|
||||||
│ │ ├── nixnuc
|
│ ├── default.nix
|
||||||
│ │ │ └── gene.nix
|
│ ├── home-gene.liverman.nix
|
||||||
│ │ └── rainbow-planet
|
│ └── home-gene.nix
|
||||||
│ │ └── gene.nix
|
└── nixos # NixOS system & home configs
|
||||||
│ ├── hosts
|
├── bigboy
|
||||||
│ │ ├── darwin
|
│ ├── default.nix
|
||||||
│ │ │ └── Blue-Rock
|
│ ├── hardware-configuration.nix
|
||||||
│ │ │ └── default.nix
|
│ └── home-gene.nix
|
||||||
│ │ └── nixos
|
├── default.nix
|
||||||
│ │ ├── nixnuc
|
├── hetznix01
|
||||||
│ │ │ ├── default.nix
|
│ ├── default.nix
|
||||||
│ │ │ └── hardware-configuration.nix
|
│ ├── disk-config.nix
|
||||||
│ │ └── rainbow-planet
|
│ ├── hardware-configuration.nix
|
||||||
│ │ ├── default.nix
|
│ ├── home-gene.nix
|
||||||
│ │ └── hardware-configuration.nix
|
│ ├── post-install # Post-install services
|
||||||
│ └── system
|
│ │ ├── containers
|
||||||
│ └── common
|
│ │ ├── default.nix
|
||||||
│ ├── linux
|
│ │ ├── matrix-synapse.nix
|
||||||
│ │ └── internationalisation.nix
|
│ │ ├── monitoring.nix
|
||||||
│ ├── all-darwin.nix
|
│ │ ├── mosquitto.nix
|
||||||
│ └── all-nixos.nix
|
│ │ └── nginx.nix
|
||||||
├── LICENSE
|
│ └── secrets.yaml
|
||||||
├── README.md
|
├── hetznix02
|
||||||
├── Vagrantfile
|
├── kiosk-entryway
|
||||||
├── flake.lock
|
├── kiosk-gene-desk
|
||||||
└── flake.nix
|
├── nixnas1
|
||||||
|
│ ├── default.nix
|
||||||
23 directories, 29 files
|
│ ├── disk-config.nix
|
||||||
|
│ ├── hardware-configuration.nix
|
||||||
|
│ ├── home-gene.nix
|
||||||
|
│ └── secrets.yaml
|
||||||
|
├── nixnuc
|
||||||
|
│ ├── containers
|
||||||
|
│ ├── default.nix
|
||||||
|
│ ├── hardware-configuration.nix
|
||||||
|
│ ├── home-gene.nix
|
||||||
|
│ └── monitoring-stack.nix
|
||||||
|
└── rainbow-planet
|
||||||
|
├── default.nix
|
||||||
|
├── gnome.nix
|
||||||
|
├── hardware-configuration.nix
|
||||||
|
└── home-gene.nix
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Hosts
|
||||||
|
|
||||||
|
- **Darwin (macOS)**: AirPuppet, Blue-Rock, mightymac
|
||||||
|
- **NixOS**: bigboy, hetznix01, hetznix02, kiosk-entryway, kiosk-gene-desk, nixnas1, nixnuc, rainbow-planet
|
||||||
|
- **Home Manager only**: gene (x86_64-linux, aarch64-linux)
|
||||||
|
|
||||||
## Historical bits
|
## Historical bits
|
||||||
|
|
||||||
This repo historically contained my dot files. Historically symlinked files on Windows are still in `windows/`. Everything else is just in git history now.
|
This repo historically contained my dot files. Historically symlinked files on Windows are still in `windows/`. Everything else is just in git history now.
|
||||||
|
|
|
||||||
|
|
@ -1,48 +1,42 @@
|
||||||
{
|
{
|
||||||
inputs = {};
|
inputs = {
|
||||||
outputs = inputs@{}: let
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
|
||||||
darwinHostConfig = { system, hostname, username, additionalModules, additionalSpecialArgs }:
|
home-manager.url = "github:nix-community/home-manager";
|
||||||
nix-darwin.lib.darwinSystem { };
|
nix-darwin.url = "github:lnl7/nix-darwin";
|
||||||
|
nixos-hardware.url = "github:NixOS/nixos-hardware";
|
||||||
mkNixosHost = { system, hostname, username, additionalModules, additionalSpecialArgs }:
|
};
|
||||||
nixpkgs.lib.nixosSystem { };
|
|
||||||
|
|
||||||
linuxHomeConfig = { system, hostname, username, additionalModules, additionalSpecialArgs }:
|
|
||||||
home-manager.lib.homeManagerConfiguration { };
|
|
||||||
|
|
||||||
|
outputs = inputs@{ self, ... }: let
|
||||||
|
# Import helper functions from lib/
|
||||||
|
localLib = import ./lib { inherit inputs; };
|
||||||
in {
|
in {
|
||||||
# Darwin (macOS) hosts
|
# Darwin (macOS) hosts
|
||||||
darwinConfigurations = {
|
darwinConfigurations = {
|
||||||
mightymac = darwinHostConfig {
|
mightymac = localLib.mkDarwinHost {
|
||||||
system = "aarch64-darwin";
|
system = "aarch64-darwin";
|
||||||
hostname = "mightymac";
|
hostname = "mightymac";
|
||||||
username = "gene.liverman";
|
username = "gene.liverman";
|
||||||
additionalModules = [];
|
|
||||||
additionalSpecialArgs = {};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# NixOS hosts
|
# NixOS hosts
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
rainbow-planet = mkNixosHost {
|
rainbow-planet = localLib.mkNixosHost {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
hostname = "rainbow-planet";
|
hostname = "rainbow-planet";
|
||||||
username = "gene";
|
username = "gene";
|
||||||
additionalModules = [
|
additionalModules = [
|
||||||
nixos-hardware.nixosModules.dell-xps-13-9360
|
inputs.nixos-hardware.nixosModules.dell-xps-13-9360
|
||||||
];
|
];
|
||||||
additionalSpecialArgs = {};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Home Manager (only) users
|
# Home Manager (only) users
|
||||||
homeConfigurations = {
|
homeConfigurations = {
|
||||||
gene = linuxHomeConfig {
|
gene = localLib.mkHomeConfig {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
hostname = "mini-watcher";
|
homeDirectory = "/home/gene";
|
||||||
username = "gene";
|
username = "gene";
|
||||||
additionalModules = [];
|
|
||||||
additionalSpecialArgs = {};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue