项目作者: z0al

项目描述 :
My personal Pop OS/Debian configurations 🐧
高级语言: Shell
项目地址: git://github.com/z0al/dotfiles.git
创建时间: 2018-04-15T15:28:02Z
项目社区:https://github.com/z0al/dotfiles

开源协议:MIT License

下载


Dotfiles

An opinionated flake-based system configuration for both NixOS[^1] and macOS (via nix-darwin).

If you have no idea what any of that means, I highly recommend checking out Matthias’s excellent YouTube mini-course.

🛍️ Goodies

Here are some of the unique features of my configuration you might find interesting:

  • 💻 Device Manager: Generates a nix.mobileconfig profile on macOS e.g. used to configure policies for Chromium-based browsers, which can then be manually installed via System Settings. The module warns the user if the profile changes and needs reapplying.

  • 👨‍💻 VS Code: A fully declarative VS Code configuration. The final settings.json file is copied (not linked), allowing for quick on-the-fly tweaks.

  • 🔐 1Password: Uses 1Password as an SSH agent, Git authentication, and signing program. This keeps SSH keys and tokens in the password manager instead of on disk.

  • 🪟 Tiling: Configures AeroSpace for automatic window tiling on macOS.

  • ⚙️ Plist-manager: A human-friendly macOS user defaults manager. The module has since been extracted and moved to z0al/plist-manager.

Structure

Home vs NixOS/Darwin modules

This repo doesn’t follow the usual /home, /nixos, /darwin structure. Instead, modules are organized by feature under /modules and ALL modules are system (nixos/nix-darwin) modules e.g.

  1. modules
  2. ├── config
  3. ├── ...
  4. └── <module-a>.nix # cross-platform module
  5. ├── programs
  6. ├── <module-b> # module with platform-specific implementations
  7. ├── _darwin.nix # → nix-darwin module
  8. ├── _nixos.nix # → nixos module
  9. └── default.nix
  10. ├── ...
  11. └── <module-c>.nix # another cross-platform module
  12. └── ...

How does it work?

  • <module>/default.nix defines the shared module configuration. It typically includes the module option definitions like my.<module>.enable. All custom modules are prefixed with my.* to avoid conflicts with upstream modules.
  • **/*/_nixos.nix files are automatically imported in modules/nixos.nix.
  • **/*/_darwin.nix files are automatically imported in modules/darwin.nix.
  • Wherever possible, NixOS/nix-darwin modules are preferred over home-manager.
  • Home-manager is mostly used to link home content via home.file. When required, the configuration is written inline using aliass.

A practical example of a module that defines both _nixos.nix and _darwin.nix is the 1Password module in modules/programs/1password.

Presets

Presets are flags that group related programs. For example, enabling my.presets.devOps.enable activates Docker, Kubernetes, Terraform, and others by default.

  1. # Enable DevOps tools e.g. Docker, Terraform ..etc
  2. my.presets.devOps.enable = true;
  3. # Exclude Terraform
  4. my.programs.terraform.enable = false;

Available presets can be found in modules/presets.nix.

Aliases

For convenience, I use the following option aliases:

  • homehome-manager.users.<username>.home
    • e.g., home.file
  • xdghome-manager.users.<username>.xdg
    • e.g., xdg.configFile
  • my.userusers.users.<username>
    • e.g., my.user.extraGroups

The <username> refers to the primary user login, configured in modules/config/users.

📚 Credits

🧑‍⚖️ License

MIT © z0al

[^1]:
This repo used to be heavily focused on NixOS, but life happens and I’m currently stuck on macOS 😔.
While most NixOS-specific configurations have been removed, the repo is still NixOS-ready and waiting for the day I switch back soon ™️ (looking at you, Asahi Linux 👀).