{"id":13611044,"url":"https://github.com/dustinlyons/nixos-config","last_synced_at":"2025-05-14T12:09:17.763Z","repository":{"id":37647888,"uuid":"420004805","full_name":"dustinlyons/nixos-config","owner":"dustinlyons","description":"General purpose Nix configuration for macOS / NixOS (with starter templates!)","archived":false,"fork":false,"pushed_at":"2025-03-18T00:40:03.000Z","size":8687,"stargazers_count":2445,"open_issues_count":24,"forks_count":144,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-04-11T04:58:13.765Z","etag":null,"topics":["agenix","dotfiles","emacs","home-manager","literate-configuration","macos","nix","nix-config","nix-darwin","nix-flake","nixos","nixos-configuration"],"latest_commit_sha":null,"homepage":"","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dustinlyons.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-22T07:25:20.000Z","updated_at":"2025-04-11T03:15:09.000Z","dependencies_parsed_at":"2024-01-16T21:22:21.161Z","dependency_job_id":"45aaaff3-9a85-4825-ad9d-11576eed0c0d","html_url":"https://github.com/dustinlyons/nixos-config","commit_stats":{"total_commits":2002,"total_committers":11,"mean_commits":182.0,"dds":"0.20429570429570432","last_synced_commit":"4089894584a4c0f8ca4fff5bd4c05cb1503a9aaf"},"previous_names":["dustinlyons/nixos-config"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dustinlyons%2Fnixos-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dustinlyons%2Fnixos-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dustinlyons%2Fnixos-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dustinlyons%2Fnixos-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dustinlyons","download_url":"https://codeload.github.com/dustinlyons/nixos-config/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248345273,"owners_count":21088244,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agenix","dotfiles","emacs","home-manager","literate-configuration","macos","nix","nix-config","nix-darwin","nix-flake","nixos","nixos-configuration"],"created_at":"2024-08-01T19:01:51.204Z","updated_at":"2025-05-14T12:09:17.747Z","avatar_url":"https://github.com/dustinlyons.png","language":"Nix","funding_links":["https://www.buymeacoffee.com/dustinlyons1"],"categories":["计算机编程_数据结构与算法","Nix","nix","Nix Configurations"],"sub_categories":["资源传输下载"],"readme":"# General Purpose Nix Configuration (macOS + NixOS)\n[![Build Starter Template](https://github.com/dustinlyons/nixos-config/actions/workflows/build.yml/badge.svg)](https://github.com/dustinlyons/nixos-config/actions/workflows/build.yml)\n[![Statix Lint](https://github.com/dustinlyons/nixos-config/actions/workflows/lint.yml/badge.svg)](https://github.com/dustinlyons/nixos-config/actions/workflows/lint.yml)\n\n## Overview\nHey, you made it! Welcome. 🤓\n\nNix is a powerful package manager for Linux and Unix systems that ensures reproducible, declarative, and reliable software management. \n\nThis repository contains configuration for a general-purpose development environment that runs Nix on macOS, NixOS, or both simultaneously.\n\nI use it daily on my 🧑🏻‍💻 Macbook Pro and an x86 PC in my home office. It also runs as a VM on your Mac. Many others have reported that it's working for them too.\n\nCheck out the step-by-step commands below to get started!\n\n## Table of Contents\n\n- [Nix Config for macOS + NixOS](#nix-config-for-macos--nixos)\n  - [Overview](#overview)\n  - [Table of Contents](#table-of-contents)\n  - [Features](#features)\n  - [Testimonials](#testimonials)\n  - [Videos](#videos)\n    - [macOS](#macos)\n      - [Updating dependencies with one command](#updating-dependencies-with-one-command)\n      - [Instant Emacs 29 thanks to daemon mode](#instant-emacs-29-thanks-to-daemon-mode)\n    - [NixOS](#nixos)\n  - [Disclaimer](#disclaimer)\n  - [Layout](#layout)\n  - [Installing](#installing)\n    - [For macOS (May 2025)](#for-macos-may-2025)\n      - [1. Install dependencies](#1-install-dependencies)\n      - [2. Install Nix](#2-install-nix)\n      - [3. Initialize a starter template](#3-initialize-a-starter-template)\n      - [4. Make apps executable](#4-make-apps-executable)\n      - [5. Apply your current user info](#5-apply-your-current-user-info)\n      - [6. Decide what packages to install](#6-decide-what-packages-to-install)\n      - [7. Review your shell configuration](#7-review-your-shell-configuration)\n      - [8. Optional: Setup secrets](#8-optional-setup-secrets)\n      - [9. Install configuration](#9-install-configuration)\n      - [10. Make changes](#10-make-changes)\n    - [For NixOS](#for-nixos)\n      - [1. Burn and use the latest ISO](#1-burn-and-use-the-latest-iso)\n      - [2. Optional: Setup secrets](#2-optional-setup-secrets)\n      - [3. Install configuration](#3-install-configuration)\n      - [4. Set user password](#4-set-user-password)\n  - [How to Create Secrets](#how-to-create-secrets)\n  - [Making Changes](#making-changes)\n      - [Development workflow](#development-workflow)\n      - [Trying packages](#trying-packages)\n  - [Compatibility and Feedback](#compatibility-and-feedback)\n    - [Platforms](#platforms)\n    - [Contributing](#contributing)\n    - [Feedback and Questions](#feedback-and-questions)\n    - [License](#license)\n  - [Appendix](#appendix)\n    - [Why Nix Flakes](#why-nix-flakes)\n    - [NixOS Components](#nixos-components)\n    - [Support](#support)\n    - [Stars](#stars)\n\n\n\n\n\n## Features\n- **Nix Flakes**: No confusing `configuration.nix` entry point, [no Nix channels](#why-nix-flakes)─ just `flake.nix`\n- **Same Environment Everywhere**: Easily share config across Linux and macOS (both Nix and Home Manager)\n- **macOS Dream Setup**: Fully declarative macOS (Apple / Intel) w/ UI, dock and macOS App Store apps\n- **Simple Bootstrap**: Simple Nix commands to start from zero, both x86 and macOS platforms\n- **Managed Homebrew**: Zero maintenance homebrew environment with `nix-darwin` and `nix-homebrew`\n- **Disk Management**: Declarative disk management with `disko`, say goodbye to disk utils\n- **Secrets Management**: Declarative secrets with `agenix` for SSH, PGP, syncthing, and other tools\n- **Super Fast Emacs**: Bleeding edge Emacs that fixes itself, thanks to a [community overlay](https://github.com/nix-community/emacs-overlay)\n- **Built In Home Manager**: `home-manager` module for seamless configuration (no extra clunky CLI steps)\n- **NixOS Environment**: Extensively configured NixOS including clean aesthetic + window animations\n- **Nix Overlays**: [Auto-loading of Nix overlays](https://github.com/dustinlyons/nixos-config/tree/main/overlays): drop a file in a dir and it runs _(great for patches!)_\n- **Declarative Sync**: No-fuss Syncthing: managed keys, certs, and configuration across all platforms\n- **Emacs Literate Configuration**: [Large Emacs literate configuration](https://github.com/dustinlyons/nixos-config/blob/main/modules/shared/config/emacs/config.org) to explore (if that's your thing)\n- **Simplicity and Readability**: Optimized for simplicity and readability in all cases, not small files everywhere\n- **Backed by Continuous Integration**: Flake auto updates weekly if changes don't break starter build\n\n## Testimonials\n\n![Screenshot 2024-10-31 at 9 32 38 AM](https://github.com/user-attachments/assets/0fb34422-adcb-41e3-b6a8-dcfebf0f40b8)\n\n![Screenshot 2024-10-31 at 11 07 07 AM](https://github.com/user-attachments/assets/53873d42-de6e-4368-9184-c9b71b6ebd01)\n\n![Screenshot 2024-10-31 at 9 33 27 AM](https://github.com/user-attachments/assets/eaf19ca6-2fb9-4536-98b6-8df70aa04039)\n\n![Screenshot 2024-10-31 at 11 00 11 AM](https://github.com/user-attachments/assets/8f306a62-5a89-4f10-ab08-c151e7951c27)\n\n![Screenshot 2025-01-28 at 1 56 59 PM](https://github.com/user-attachments/assets/14d29d81-53b1-4e0e-b8f7-189677e3a36c)\n\n## Videos\n### macOS\n#### Updating dependencies with one command\nhttps://github.com/dustinlyons/nixos-config/assets/1292576/2168d482-6eea-4b51-adc1-2ef1291b6598\n\n#### Instant Emacs 29 thanks to daemon mode\n- **GUI**\n\nhttps://github.com/dustinlyons/nixos-config/assets/1292576/66001066-2bbf-4492-bc9e-60ea1abeb987\n\n- **Terminal**\n\nhttps://github.com/dustinlyons/nixos-config/assets/1292576/d96f59ce-f540-4f14-bc61-6126a74f9f52\n\n### NixOS\n\nhttps://github.com/dustinlyons/nixos-config/assets/1292576/fa54a87f-5971-41ee-98ce-09be048018b8\n\n## Disclaimer\nInstalling Nix on macOS will create an entirely separate volume. It may exceed many gigabytes in size. \n\nSome folks don't like this. If this is you, turn back now!\n\n\u003e [!NOTE]\n\u003e Don't worry, you can always [uninstall](https://github.com/DeterminateSystems/nix-installer#uninstalling) Nix later.\n\n## Layout\n```\n.\n├── apps         # Nix commands used to bootstrap and build configuration\n├── hosts        # Host-specific configuration\n├── modules      # macOS and nix-darwin, NixOS, and shared configuration\n├── overlays     # Drop an overlay file in this dir, and it runs. So far, mainly patches.\n├── templates    # Starter versions of this configuration\n```\n\n## Installing\n## For macOS (May 2025)\nThis configuration supports both Intel and Apple Silicon Macs.\n\n### 1. Install dependencies\n```sh\nxcode-select --install\n```\n\n### 2. Install Nix\nThank you for the [installer](https://zero-to-nix.com/concepts/nix-installer), [Determinate Systems](https://determinate.systems/)!\n```sh\ncurl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install\n```\n\nAfter installation, open a new terminal session to make the `nix` executable available in your `$PATH`. You'll need this in the steps ahead.\n\n\u003e [!IMPORTANT]\n\u003e\n\u003e The installer will ask if you want to install Determinate Nix. Answer _No_ as it [currently conflicts](https://github.com/dustinlyons/nixos-config/issues/146) with `nix-darwin`.\n\n\u003e [!IMPORTANT]\n\u003e\n\u003e If using [the official installation instructions](https://nixos.org/download) instead, [`flakes`](https://nixos.wiki/wiki/Flakes) and [`nix-command`](https://nixos.wiki/wiki/Nix_command) aren't available by default.\n\u003e\n\u003e You'll need to enable them.\n\u003e \n\u003e **Add this line to your `/etc/nix/nix.conf` file**\n\u003e ```\n\u003e experimental-features = nix-command flakes\n\u003e ```\n\u003e \n\u003e **_OR_**\n\u003e\n\u003e **Specify experimental features when using `nix run` below**\n\u003e ```\n\u003e nix --extra-experimental-features 'nix-command flakes' run .#\u003ccommand\u003e\n\u003e ```\n\n\u003e [!IMPORTANT]\n\u003e\n\u003e If you haven't upgraded to macOS Sequioa yet, read this article: [Nix Support for macOS Sequioa](https://determinate.systems/posts/nix-support-for-macos-sequoia/).\n\n### 3. Initialize a starter template\n*Choose one of two options*\n\n**Simplified version without secrets management**\n* Great for beginners, enables you to get started quickly and test out Nix.\n* Forgoing secrets just means you must configure apps that depend on keys, passwords, etc., yourself.\n* You can always add secrets later.\n\n```sh\nmkdir -p nixos-config \u0026\u0026 cd nixos-config \u0026\u0026 nix flake --extra-experimental-features 'nix-command flakes' init -t github:dustinlyons/nixos-config#starter\n```\n**Full version with secrets management**\n* Choose this to add more moving parts for a 100% declarative configuration.\n* This template offers you a place to keep passwords, private keys, etc. *as part of your configuration*.\n\n```sh\nmkdir -p nixos-config \u0026\u0026 cd nixos-config \u0026\u0026 nix flake --extra-experimental-features 'nix-command flakes' init -t github:dustinlyons/nixos-config#starter-with-secrets\n```\n\n### 4. Make [apps](https://github.com/dustinlyons/nixos-config/tree/main/apps) executable\n```sh\nfind apps/$(uname -m | sed 's/arm64/aarch64/')-darwin -type f \\( -name apply -o -name build -o -name build-switch -o -name create-keys -o -name copy-keys -o -name check-keys -o -name rollback \\) -exec chmod +x {} \\;\n```\n\n### 5. Apply your current user info\nRun this Nix command to replace stub values with your system properties, username, full name, and email.\n\u003e Your email is only used in the `git` configuration.\n```sh\nnix run .#apply\n```\n\u003e [!NOTE]\n\u003e If you're using a git repository, only files in the working tree will be copied to the [Nix Store](https://zero-to-nix.com/concepts/nix-store).\n\u003e\n\u003e You must run `git add .` first.\n\n### 6. Decide what packages to install\nYou can search for packages on the [official NixOS website](https://search.nixos.org/packages).\n\n**Review these files**\n\n* [`modules/darwin/casks.nix`](https://github.com/dustinlyons/nixos-config/blob/main/modules/darwin/casks.nix)\n* [`modules/darwin/packages.nix`](https://github.com/dustinlyons/nixos-config/blob/main/modules/darwin/packages.nix)\n* [`modules/shared/packages.nix`](https://github.com/dustinlyons/nixos-config/blob/main/modules/shared/packages.nix)\n\n### 7. Review your shell configuration\nAdd anything from your existing `~/.zshrc`, or just review the new configuration.\n\n**Review these files**\n\n* [`modules/darwin/home-manager`](https://github.com/dustinlyons/nixos-config/blob/main/modules/darwin/home-manager.nix)\n* [`modules/shared/home-manager`](https://github.com/dustinlyons/nixos-config/blob/main/modules/shared/home-manager.nix)\n\n### 8. Optional: Setup secrets\nIf you are using the starter with secrets, there are a few additional steps.\n\n#### 8a. Create a private Github repo to hold your secrets\nIn Github, create a private [`nix-secrets`](https://github.com/dustinlyons/nix-secrets-example) repository with at least one file (like a `README`). You'll enter this name during installation.\n\n#### 8b. Install keys\nBefore generating your first build, these keys must exist in your `~/.ssh` directory. Don't worry, I provide a few commands to help you.\n\n| Key Name            | Platform         | Description                                                                              | \n|---------------------|------------------|------------------------------------------------------------------------------------------|\n| id_ed25519          | macOS / NixOS    | Github key with access to `nix-secrets`. Not copied to host, used only during bootstrap. |\n| id_ed25519_agenix   | macOS / NixOS    | Primary key for encrypting and decrypting secrets. Copied over to host as `id_ed25519`.  |\n\nRun one of these commands:\n\n##### Copy keys from USB drive\nThis command auto-detects a USB drive connected to the current system.\n\u003e Keys must be named `id_ed25519` and `id_ed25519_agenix`.\n```sh\nnix run .#copy-keys\n```\n\n##### Create new keys\n```sh\nnix run .#create-keys\n```\n\u003e [!NOTE]\n\u003e If you choose this option, make sure to [save the value](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account) of `id_ed25519.pub` to Github.\n\u003e \n\u003e ```sh\n\u003e cat /Users/$USER/.ssh/id_ed25519.pub | pbcopy # Copy key to clipboard\n\u003e ```\n\n##### Check existing keys\nIf you're rolling your own, just check they are installed correctly.\n```sh\nnix run .#check-keys\n```\n\n### 9. Install configuration\nEnsure the build works before deploying the configuration, run:\n```sh\nnix run .#build\n```\n\u003e [!NOTE]\n\u003e If you're using a git repository, only files in the working tree will be copied to the [Nix Store](https://zero-to-nix.com/concepts/nix-store).\n\u003e\n\u003e You must run `git add .` first.\n\n\u003e [!WARNING]\n\u003e You may encounter `error: Unexpected files in /etc, aborting activation` if `nix-darwin` detects it will overwrite\n\u003e an existing `/etc/` file. The error will list the files like this:\n\u003e \n\u003e ```\n\u003e The following files have unrecognized content and would be overwritten:\n\u003e \n\u003e   /etc/nix/nix.conf\n\u003e   /etc/bashrc\n\u003e \n\u003e Please check there is nothing critical in these files, rename them by adding .before-nix-darwin to the end, and then try again.\n\u003e ```\n\u003e Backup and move the files out of the way and/or edit your Nix configuration before continuing.\n\n\u003e [!WARNING]\n\u003e You may encounter `error: Build user group has mismatching GID, aborting activation` if you have already upgraded to Sequoia but had not [prepared Nix](https://determinate.systems/posts/nix-support-for-macos-sequoia/) before that.\n\u003e The error will list the files like this:\n\u003e \n\u003e ```\n\u003e error: Build user group has mismatching GID, aborting activation\n\u003e The default Nix build user group ID was changed from 30000 to 350.\n\u003e You are currently managing Nix build users with nix-darwin, but your\n\u003e nixbld group has GID 350, whereas we expected 30000.\n\u003e ```\n\u003e\n\u003e You will have to [uninstall Nix](https://zero-to-nix.com/start/uninstall/), and [install Nix](https://zero-to-nix.com/start/install/) again with `--nix-build-group-id 30000` flag. See more here:\n\u003e * [Nix Suppport for macOS Sequoia](https://determinate.systems/posts/nix-support-for-macos-sequoia/)\n\u003e * [macOS 15 Sequoia clobbers _nixbld1-4 users](https://github.com/NixOS/nix/issues/10892)\n\u003e * [macOS Sequoia replaces _nixbld{1,2,3,4} with system users causing darwin-rebuild to fail](https://github.com/LnL7/nix-darwin/issues/970)\n\n### 10. Make changes\nFinally, alter your system with this command:\n```sh\nnix run .#build-switch\n```\n\u003e [!CAUTION]\n\u003e `~/.zshrc` will be replaced with the [`zsh` configuration](https://github.com/dustinlyons/nixos-config/blob/main/templates/starter/modules/shared/home-manager.nix#L8) from this repository. Make sure this is what you want.\n\n## For NixOS\nThis configuration supports both `x86_64` and `aarch64` platforms.\n\n### 1. Burn and use the latest ISO\nDownload and burn [the minimal ISO image](https://nixos.org/download.html) to a USB, or create a new VM with the ISO as base. Boot the installer.\n\u003e If you're building a VM on an Apple Silicon Mac, choose [64-bit ARM](https://channels.nixos.org/nixos-23.05/latest-nixos-minimal-aarch64-linux.iso).\n\n**Quick Links**\n\n* [64-bit Intel/AMD](https://channels.nixos.org/nixos-23.05/latest-nixos-minimal-x86_64-linux.iso)\n* [64-bit ARM](https://channels.nixos.org/nixos-23.05/latest-nixos-minimal-aarch64-linux.iso)\n\n### 2. Optional: Setup secrets\nIf you are using the starter with secrets, there are a few additional steps.\n\n#### 2a. Create a private Github repo to hold your secrets\nIn Github, create a private [`nix-secrets`](https://github.com/dustinlyons/nix-secrets-example) repository with at least one file (like a `README`). You'll enter this name during installation.\n\n#### 2b. Install keys\nBefore generating your first build, these keys must exist in your `~/.ssh` directory. Don't worry, I provide a few commands to help you.\n\n| Key Name            | Platform         | Description                                                                              | \n|---------------------|------------------|------------------------------------------------------------------------------------------|\n| id_ed25519          | macOS / NixOS    | Github key with access to `nix-secrets`. Not copied to host, used only during bootstrap. |\n| id_ed25519_agenix   | macOS / NixOS    | Primary key for encrypting and decrypting secrets. Copied over to host as `id_ed25519`.  |\n\nRun one of these commands:\n\n##### Copy keys from USB drive\nThis command auto-detects a USB drive connected to the current system.\n\u003e Keys must be named `id_ed25519` and `id_ed25519_agenix`.\n```sh\nsudo nix run --extra-experimental-features 'nix-command flakes' github:dustinlyons/nixos-config#copy-keys\n```\n\n##### Create new keys\n```sh\nsudo nix run --extra-experimental-features 'nix-command flakes' github:dustinlyons/nixos-config#create-keys\n```\n\n##### Check existing keys\nIf you're rolling your own, just check they are installed correctly.\n```sh\nsudo nix run --extra-experimental-features 'nix-command flakes' github:dustinlyons/nixos-config#check-keys\n```\n\n### 3. Install configuration\n#### Pick your template\n\n\u003e [!IMPORTANT]\n\u003e For Nvidia cards, select the second option, `nomodeset`, when booting the installer, or you will see a blank screen.\n\n\u003e [!CAUTION]\n\u003e Running this will reformat your drive to the `ext4` filesystem.\n\n**Simple**\n* Great for beginners, enables you to get started quickly and test out Nix.\n* Forgoing secrets means you must configure apps that depend on keys or passwords yourself.\n* You can always add secrets later.\n```sh\nsudo nix run --extra-experimental-features 'nix-command flakes' github:dustinlyons/nixos-config#install\n```\n\n**With secrets**\n* Choose this to add more moving parts for a 100% declarative configuration.\n* This template offers you a place to keep passwords, private keys, etc. *as part of your configuration*.\n```sh\nsudo nix run --extra-experimental-features 'nix-command flakes' github:dustinlyons/nixos-config#install-with-secrets\n```\n\n### 4. Set user password\nOn first boot at the login screen:\n- Use shortcut `Ctrl-Alt-F2` (or `Fn-Ctrl-Option-F2` if on a Mac) to move to a terminal session\n- Login as `root` using the password created during installation\n- Set the user password with `passwd \u003cuser\u003e`\n- Go back to the login screen: `Ctrl-Alt-F7`\n\n## How to create secrets\nTo create a new secret `secret.age`, first [create a `secrets.nix` file](https://github.com/ryantm/agenix#tutorial) at the root of your [`nix-secrets`](https://github.com/dustinlyons/nix-secrets-example) repository. Use this code:\n\n\u003e [!NOTE]\n\u003e `secrets.nix` is interpreted by the imperative `agenix` commands to pick the \"right\" keys for your secrets.\n\u003e\n\u003e Think of this file as the config file for `agenix`. It's not part of your system configuration.\n\n**secrets.nix**\n```nix\nlet\n  user1 = \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL0idNvgGiucWgup/mP78zyC23uFjYq0evcWdjGQUaBH\";\n  users = [ user1 ];\n\n  system1 = \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPJDyIr/FSz1cJdcoW69R+NrWzwGK/+3gJpqD1t8L2zE\";\n  systems = [ system1 ];\nin\n{\n  \"secret.age\".publicKeys = [ user1 system1 ];\n}\n```\nValues for `user1` should be your public key, or if you prefer to have keys attached to hosts, use the `system1` declaration. \n\nNow that we've configured `agenix` with our `secrets.nix`, it's time to create our first secret. \n\nRun the command below. \n\n```\nEDITOR=vim nix run github:ryantm/agenix -- -e secret.age\n```\n\nThis opens an editor to accept, encrypt, and write your secret to disk. \n\nThe command will look up the public key for `secret.age`, defined in your `secrets.nix`, and check for its private key in `~/.ssh/.`\n\n\u003e To override the SSH path, provide the `-i` flag with a path to your `id_ed25519` key.\n\nWrite your secret in the editor, save, and commit the file to your [`nix-secrets`](https://github.com/dustinlyons/nix-secrets-example) repo. \n\nNow we have two files: `secrets.nix` and our `secret.age`. \n\nHere's a more step-by-step example:\n\n## Secrets Example\nLet's say I wanted to create a new secret to hold my Github SSH key. \n\nI would `cd` into my [`nix-secrets`](https://github.com/dustinlyons/nix-secrets-example) repo directory, verify the `agenix` configuration (named `secrets.nix`) exists, then run \n```\nEDITOR=vim nix run github:ryantm/agenix -- -e github-ssh-key.age\n```\n\nThis would start a `vim` session.\n\nI would enter insert mode `:i`, copy+paste the key, hit Esc and then type `:w` to save it, resulting in the creation of a new file, `github-ssh-key.age`.\n\nThen, I would edit `secrets.nix` to include a line specifying the public key to use for my new secret. I specify a user key, but I could just as easily specify a host key.\n\n**secrets.nix**\n```nix\nlet\n  dustin = \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL0idNvgGiucWgup/mP78zyC23uFjYq0evcWdjGQUaBH\";\n  users = [ dustin ];\n  systems = [ ];\nin\n{\n  \"github-ssh-key.age\".publicKeys = [ dustin ];\n}\n```\n\nFinally, I'd commit all changes to the [`nix-secrets`](https://github.com/dustinlyons/nix-secrets-example) repository, go back to my `nixos-config` and run `nix flake update` to update the lock file.\n\nThe secret is now ready to use. Here's an [example](https://github.com/dustinlyons/nixos-config/blob/3b95252bc6facd7f61c6c68ceb1935481cb6b457/nixos/secrets.nix#L28) from my configuration. In the end, this creates a symlink to a decrypted file in the Nix Store that reflects my original file.\n\n## Making changes\nWith Nix, changes to your system are made by \n- editing your system configuration\n- building the [system closure](https://zero-to-nix.com/concepts/closures)\n- creating [a new generation](https://nixos.wiki/wiki/Terms_and_Definitions_in_Nix_Project#generation) based on this closure and switching to it\n\nThis is all wrapped up in the `build-switch` run command.\n\n### Development workflow\nSo, in general, the workflow for managing your environment will look like\n- make changes to the configuration\n- run `nix run .#build-switch`\n- watch Nix, `nix-darwin`, `home-manager`, etc do their thing\n- go about your way and benefit from a declarative environment\n  \n### Trying packages\nFor quickly trying a package without installing it, I usually run\n```sh\nnix shell nixpkgs#hello\n```\n\nwhere `hello` is the package name from [nixpkgs](https://search.nixos.org/packages).\n\n## Compatibility and Feedback\n### Platforms\nThis configuration has been tested and confirmed to work on the following platforms:\n- Newer M1/M2/M3 Apple Silicon Macs\n- Older x86_64 (Intel) Macs\n- Bare metal x86_64 PCs\n- NixOS VMs inside VMWare on macOS\n- macOS Sonoma VMs inside Parallels on macOS\n\n### Feedback and Questions\nHave feedback or questions? Feel free to use the [discussion forum](https://github.com/dustinlyons/nixos-config/discussions).\n\n### Contributing\nInterested in contributing to this project? Here's how you can help:\n\n- **Code Contributions**: If you're interested in contributing code, please start by looking at open issues or feature requests. Fork the repository, make your changes, and submit a pull request. Make sure your code adheres to the existing style. For significant changes, consider opening an issue for discussion before starting work.\n\n- **Reporting Bugs**: If you encounter bugs or issues, please help by reporting them. Open a GitHub Issue and include as much detail as possible: what you were doing when the bug occurred, steps to reproduce the issue, and any relevant logs or error messages.\n\n## Appendix\n### Why Nix Flakes\n**Reasons to jump into flakes and skip `nix-env`, Nix channels, etc**\n- Flakes work just like other package managers you already know: `npm`, `cargo`, `poetry`, `composer`, etc. Channels work more like traditional Linux distributions (like Ubuntu), which most devs don't know.\n- Flakes encapsulate not just project dependencies, but Nix expressions, Nix apps, and other configurations in a single file. It's all there in a single file. This is nice.\n- Channels lock all packages to one big global `nixpkgs` version. Flakes lock each individual package to a version, which is more precise and makes it much easier to manage overall.\n- Flakes have a growing ecosystem (see [Flake Hub](https://flakehub.com/) or [Dev Env](https://devenv.sh/)), so you're future-proofing yourself.\n  \n### NixOS Components\n\n| Component                   | Description                                     | \n| --------------------------- | :---------------------------------------------  |\n| **Window Manager**          | Xorg + bspwm                                    |\n| **Terminal Emulator**       | alacritty                                       |\n| **Bar**                     | polybar                                         |\n| **Application Launcher**    | rofi                                            |\n| **Notification Daemon**     | dunst                                           |\n| **Display Manager**         | lightdm                                         |\n| **File Manager**            | thunar                                          |\n| **Text Editor**             | emacs daemon mode                               |\n| **Media Player**            | cider                                           |\n| **Image Viewer**            | feh                                             |\n| **Screenshot Software**     | flameshot                                       |\n\n### License\nThis project is released under the [BSD-3-Clause license](https://github.com/dustinlyons/nixos-config/blob/main/LICENSE).\n\n### Support\nDid you find my project useful? Your support is appreciated.\n\n\n\u003ca href=\"https://www.buymeacoffee.com/dustinlyons1\" target=\"_blank\"\u003e\u003cimg src=\"https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png\" alt=\"Buy Me A Coffee\" style=\"height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;\" \u003e\u003c/a\u003e\n\n### Stars\n\n\u003e \"All we have to decide is what to do with the time that is given us.\" - J.R.R. Tolkien\n\n[![Star History Chart](https://api.star-history.com/svg?repos=dustinlyons/nixos-config\u0026type=Date)](https://star-history.com/#dustinlyons/nixos-config\u0026Date)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdustinlyons%2Fnixos-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdustinlyons%2Fnixos-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdustinlyons%2Fnixos-config/lists"}