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.

at main 199 lines 7.1 kB view raw view rendered
1# `@andreijiroh-dev/nixops-config` - ~ajhalili2006's NixOS + home-manager configs in a flake 2 3This is @ajhalili2006's NixOS + Home Manager configuration for his laptop and homelabs, 4alongside in tildes with Nix installed and in sync with the [nixpkgs-specific branch][nix-dots] 5of my dotfiles repository. 6 7[nix-dots]: https://gitlab.com/andreijiroh-dev/dotfiles/tree/nixpkgs 8 9## CI Status 10 11| Workflow Name and Type | CI Platform | Badge/Link | 12| --- | --- | --- | 13| Nix Flake Builds (push) | GitHub Actions | [![Nix Flake Builds](https://github.com/andreijiroh-dev/nixops-config/actions/workflows/flake-ci.yml/badge.svg)](https://github.com/andreijiroh-dev/nixops-config/actions/workflows/flake-ci.yml) | 14| Nix Flake Builds (schedule, every 06:30 UTC Saturday) | GitHub Actions | [![Nix Flake Builds](https://github.com/andreijiroh-dev/nixops-config/actions/workflows/flake-ci.yml/badge.svg?event=schedule)](https://github.com/andreijiroh-dev/nixops-config/actions/workflows/flake-ci.yml) | 15 16## Mirrors 17 18Canonically published at [GitLab SaaS](https://gitlab.com/andreijiroh-dev/nixops-config), 19with push mirroring enabled to [GitHub](https://github.com/andreijiroh-dev/nixops-config). 20Along with the following mirrors: 21 22- [sourcehut hosted](https://git.sr.ht/~ajhalili2006/nixops-config) 23- [Manimun GitLab](https://mau.dev/andreijiroh-dev/nixops-config) 24- [Hack Club Nest's Forgejo instance](https://git.hackclub.app/andreijiroh-dev/nixops-config) 25 26## Usage 27 28### Poking around Gemini CLI + Chat in VS Code? 29 30I already ported my GitHub Copilot instructions into the standard `AGENT.md` file 31so your AI tools can easily speedrun things in different shell sessions with Gemini 32CLI up and running. While this is untested, I symlinked the old file location for 33compatibility so you're good to go if you are contributing patches or just forking 34around and finding out. 35 36### Installing NixOS 37 38It is recommended to install NixOS using either the Calamares-based graphical 39installer or manually through the `nixos-install` utility, especially 40when you have consider partitioning on your drive to ensure that you can roll back 41safely in case things go wrong. 42 43After installation, copy the generated NixOS configuration files from `/etc/nixos` 44into a new directory named `hosts/<host-name>`. Note that on the rest of 45the README, the placeholder `<host-name>` is used to denote the hostname of a new 46or existing machine under Nix flake-based setup. 47 48```bash 49cp -rv /etc/nixos/ hosts/<host-name>/ 50``` 51 52On the `flake.nix` file, under the `nixosConfigurations` block, add the new host using the template below 53 54```nix 55<host-name> = nixpkgs.lib.nixosSystem { 56 system = "x86_64-linux"; 57 modules = [ 58 ./hosts/<host-name>/configuration.nix 59 60 # load Determinate Nix and the rest 61 determinate.nixosModules.default 62 home-manager.nixosModules.home-manager 63 vscode-server.nixosModules.default 64 nix-ld.nixosModules.nix-ld 65 66 # one-liners? 67 { programs.nix-ld.dev.enable = true; } 68 ]; 69}; 70``` 71 72Then on your `hosts/<host-name>/configuration.nix`, add the needed imports 73as needed: 74 75```nix 76imports = [ 77 ./hardware-configuration.nix 78 ../../shared/gnupg.nix 79 ../../shared/meta-configs.nix 80 ../../shared/server/ssh.nix 81 ../../shared/server/tailscale.nix 82 ../../shared/systemd.nix 83 ../../shared/yubikey.nix 84 # add more imports here 85] 86``` 87 88Adjust as needed before running a `nixos-rebuild switch` into the new configuration. 89 90### Updating configuration or upgrading NixOS system 91 92```bash 93EDITOR="nano" # or code if you do 94$EDITOR <path/to/nixfile.nix> 95git stage <path/to/nixfile.nix> 96git commit --signoff 97 98# update the flake.lock file manually 99nix flake update 100 101# on the another machine... 102# change {hostname} to something like stellapent-cier 103sudo nixos-rebuild --flake github:andreijiroh-dev/nixops-config#{hostname} <switch|boot|build> 104``` 105 106**From a local copy**: 107 108```bash 109# update the flake.lock file manually 110nix flake update 111 112# change {hostname} to something like stellapent-cier 113sudo nixos-rebuild --flake .#{hostname} <switch|boot|build> 114``` 115 116### As an external flake module 117 118You can easily use this flake as an external module in your own flake-based NixOS configuration 119if you want to reuse some of my configurations. 120 121```nix 122{ 123 description = "My NixOS configuration"; 124 inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; # use nixos-unstable instead if preferred 125 inputs.andreijiroh-dev.url = "github:andreijiroh-dev/nixops-config"; 126 # needed if you use stable instead of unstable 127 inputs.andreijiroh-dev.inputs.nixpkgs.follows = "nixpkgs"; 128 129 outputs = { self, andreijiroh-dev, nixpkgs }: { 130 { 131 nixosConfigurations.{hostname} = nixpkgs.lib.nixosSystem { 132 # your customizations here 133 }; 134 135 nixosConfigurations.your-mom = nixpkgs.lib.nixosSystem { 136 system = "x86_64-linux"; 137 modules = [ 138 andreijiroh-dev.exportedConfigs.networking # or any other modules 139 ]; 140 }; 141 }; 142} 143``` 144 145If you also want to use the custom packages I built through the nixpkgs' system, just add it 146to your `nixpkgs.overlays` config. 147 148```nix 149# make sure to pass `andreijiroh-dev` as `extraSpecialArgs` to your NixOS/home-manager config 150# on the flake.nix to avoid issues 151{ pkgs, andreijiroh-dev, lib, ... }: 152 153{ 154 nixpkgs.overlays = [ 155 andreijiroh-dev.overlays.default 156 # other overlays 157 ]; 158} 159``` 160 161### Installing utility packages 162 163Replace `<package-name>` with the package you want to use. [See the `pkgs` README for details.](./pkgs/README.md) 164 165```shell 166nix profile install github:andreijiroh-dev/nixops-config#<package-name> 167``` 168 169### Building a minimial ISO for recovery 170 171Currently available as `amd64` (`x86-64`) Linux ISO only for now, but you can copy 172the `recoverykit-amd64` NixOS configuration and change `system` to any supported CPU 173architectures by NixOS. 174 175```bash 176# Build using the sources as remote 177nix build github:andreijiroh-dev/nixops-config/main#nixosConfigurations.recoverykit-amd64.config.system.build.isoImage 178 179# ...or via a local clone 180nix build .#nixosConfigurations.recoverykit-amd64.config.system.build.isoImage 181``` 182 183## Available shared configs 184 185These are accessible via `exportedConfigs` object after importing this flake on your `flake.nix` file. 186 187- `base` - Individual base components' configuration (systemd, networking, etc.) 188 - [`sshKeys`](./shared/ssh-keys.nix) - My SSH public keys, declaratively managed. 189 = [`hostsFile`](./shared/hosts-file.nix) - Static list of host entries, used for merging with host-specific hosts file. 190 - [`systemd`](./shared/systemd.nix) - Systemd configurations and service units. 191 - [`networking`](./shared/networking.nix) - Networking configurations, mostly for configuring DNS resolvers via `systemd-resolved`. 192 - [`locale`](./shared/locale.nix) - Time and locale settings (e.g. timezone, i18n configs). 193 - [`gnupg`](./shared/gnupg.nix) - GPG Agent settings and packages related to GPG and friends 194 = [`metaConfigs`](./shared/meta-configs.nix) - Nixpkgs and Nix settings, also contains the `system.stateVersion` setting. 195- [`meta`](./shared/meta.nix) - same as `base`, but oneliner import. 196 197## License 198 199MPL-2.0