NixOS + home-manager configs, mirrored from GitLab SaaS. gitlab.com/andreijiroh-dev/nixops-config
nix-flake nixos home-manager nixpkgs nix-flakes
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

1This repository contains NixOS and Home Manager configurations for various machines. The goal is to manage system and user configurations declaratively using Nix. 2 3### Project Structure 4 5The repository is structured as a Nix flake. 6 7- `flake.nix`: The main entry point. It defines the flake's inputs (like `nixpkgs`, `home-manager`, etc.) and outputs. The main outputs are `nixosConfigurations` for NixOS hosts and `homeConfigurations` for home-manager configurations on both NixOS and non-NixOS hosts. 8- `hosts/`: Contains the configurations for specific machines. Each subdirectory corresponds to a host and contains a `configuration.nix` file, which is the main configuration for that host. 9- `shared/`: Contains modules that are shared across different hosts. This is where most of the configuration logic resides. 10 - `shared/desktop/`: Desktop specifics (Bluetooth, Plasma, Firefox, Yubikey, etc.). 11 - `shared/server/`: Server-side configurations (SSH, Firewall, Tailscale, Cockpit). 12 - `shared/home-manager/`: Home Manager configurations for user-specific dotfiles and packages. 13 - `shared/shells/`: Shell configurations (Bash, custom prompts). 14 - `shared/vscode/`: VSCode related settings. 15- `pkgs/`: Custom packages defined in this flake (e.g., `coolify-compose`, `detect-vscode-for-git`). 16- `scripts/`: Helper scripts for deployment and maintenance. 17- `misc/`: Miscellaneous configurations and library scripts (e.g., `starship.toml`, bash helper functions). 18 19### Key Concepts 20 21- **NixOS Modules**: The configurations are built using the NixOS module system. The `shared/` directory contains many reusable modules. When you need to add or change a configuration, you'll likely be editing one of these files or creating a new one. 22- **Home Manager**: Home Manager is used to manage user-level configurations (dotfiles, packages, services). The main Home Manager configuration is in `shared/home-manager/main.nix`. 23- **Flake Outputs**: 24 - `nixosConfigurations`: System configurations for hosts. 25 - `homeConfigurations`: Standalone Home Manager configurations. 26 - `packages`: Custom packages exported by this flake. 27 - `overlays`: Nixpkgs overlays to make custom packages available to system configurations. 28 - `exportedConfigs`: Reusable modules exported for external consumers. 29 30### Developer Workflow 31 32#### Adding a new host 33 341. Create a new directory in `hosts/` for the new host. 352. Add a `configuration.nix` file inside the new directory. You can use one of the existing host configurations as a template. 363. Add a new entry to the `nixosConfigurations` in `flake.nix` for the new host, pointing to your new `configuration.nix`. 374. Import the necessary shared modules into your `configuration.nix`. 38 39#### Modifying a configuration 40 411. Identify which module or host configuration you need to change. 422. Make your changes to the respective `.nix` file. 433. To apply the changes to a machine, run `sudo nixos-rebuild switch --flake .#<hostname>` on that machine, where `<hostname>` is the name of the host you want to update. 44 45#### Updating dependencies 46 47To update the flake's inputs (e.g., `nixpkgs`), run: 48 49```bash 50nix flake update 51``` 52 53This will update the `flake.lock` file with the latest versions of the dependencies. 54 55### Important Files 56 57- `flake.nix`: The central point of the configuration. 58- `shared/meta.nix`: Imports a base set of shared modules. 59- `shared/home-manager/main.nix`: The main entry point for user-specific configurations managed by Home Manager. 60- `shared/home-manager/nogui.nix`: A headless Home Manager configuration (used in `plain` configs). 61- `hosts/<hostname>/configuration.nix`: The main configuration file for a specific host. 62- `hosts/<hostname>/users/<username>.nix`: User-specific configurations for a given host, leveraging Home Manager. See `hosts/stellapent-cier/users/gildedguy.nix` for an example. 63- `hosts/live-cd/base.nix` and `hosts/live-cd/kde-plasma.nix`: Live CD-specific NixOS configurations 64- `.idx/`: Firebase Studio specific dev environment configurations. See @.idx/AGENT.md for details. 65 66When working on this codebase, remember that it's all about declarative configuration. Instead of changing things imperatively on the system, you declare the desired state in these `.nix` files, and Nix takes care of making it happen.