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.

chore(github): generate Copilot instructions Markdown file for AI agent-based copiloting

Used Gemini 2.5 Pro model to generate the instructions file using the provided prompt from VS Code.

Signed-off-by: Andrei Jiroh Halili <ajhalili2006@andreijiroh.dev>

+54
+54
.github/copilot-instructions.md
··· 1 + This 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 + 5 + The 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` and `homeConfigurations`. 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. These modules are organized into subdirectories based on their purpose (e.g., `desktop`, `server`, `home-manager`). 10 + - `home-manager/`: Contains configurations for Home Manager, which is used to manage user-specific dotfiles and packages. 11 + 12 + ### Key Concepts 13 + 14 + - **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. 15 + - **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`. 16 + - **Flake Outputs**: 17 + - `nixosConfigurations`: Defines the system configurations for different hosts. Each attribute in this set corresponds to a host. 18 + - `homeConfigurations`: Defines user configurations that can be deployed with Home Manager. 19 + - `exportedConfigs`: These are configurations that can be used by other flakes. 20 + 21 + ### Developer Workflow 22 + 23 + #### Adding a new host 24 + 25 + 1. Create a new directory in `hosts/` for the new host. 26 + 2. Add a `configuration.nix` file inside the new directory. You can use one of the existing host configurations as a template. 27 + 3. Add a new entry to the `nixosConfigurations` in `flake.nix` for the new host, pointing to your new `configuration.nix`. 28 + 4. Import the necessary shared modules into your `configuration.nix`. 29 + 30 + #### Modifying a configuration 31 + 32 + 1. Identify which module or host configuration you need to change. 33 + 2. Make your changes to the respective `.nix` file. 34 + 3. 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. 35 + 36 + #### Updating dependencies 37 + 38 + To update the flake's inputs (e.g., `nixpkgs`), run: 39 + 40 + ```bash 41 + nix flake update 42 + ``` 43 + 44 + This will update the `flake.lock` file with the latest versions of the dependencies. 45 + 46 + ### Important Files 47 + 48 + - `flake.nix`: The central point of the configuration. 49 + - `shared/meta.nix`: Imports a base set of shared modules. 50 + - `shared/home-manager/main.nix`: The main entry point for user-specific configurations managed by Home Manager. 51 + - `hosts/<hostname>/configuration.nix`: The main configuration file for a specific host. 52 + - `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. 53 + 54 + When 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.