diff --git a/README.md b/README.md index 15493ba..7631af1 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ This repository contains: - **Dotfiles**: Configuration files for various tools and applications - **Nix Configuration**: Declarative system configuration using nix-darwin +- **NUR Integration**: Access to Nix User Repository for community packages - **Homebrew Integration**: Managed through nix-homebrew - **Pre-commit Hooks**: Ensuring code quality and security - **Command-line Tools**: Includes `jq` (JSON), `yq` (YAML), and other productivity tools @@ -56,9 +57,10 @@ Edit `dotfiles/nix/environment.nix` and add your aliases to the `shellAliases` s ### Installing New Packages - **Nix Packages**: Add to the `systemPackages` list in `dotfiles/nix/environment.nix` +- **NUR Packages**: Access community packages via `nur.repos..` (e.g., `nur.repos.goreleaser.goreleaser`) - **Homebrew Packages**: Add to the appropriate section in `dotfiles/nix/homebrew.nix` -Note: Always prefer nix packages over Homebrew packages when possible. +Note: Always prefer nix packages over Homebrew packages when possible. NUR provides access to community-maintained packages that may not be available in the main nixpkgs repository. ### Applying Changes diff --git a/dotfiles/nix/core.nix b/dotfiles/nix/core.nix index adee3d6..77364d2 100644 --- a/dotfiles/nix/core.nix +++ b/dotfiles/nix/core.nix @@ -1,4 +1,4 @@ -{ lib, ... }: { +{ lib, nur, ... }: { # Set Git commit hash for darwin-version. # system.configurationRevision = self.rev or self.dirtyRev or null; @@ -31,6 +31,10 @@ nixpkgs = { # The platform the configuration will be used on. hostPlatform = "aarch64-darwin"; + # Add NUR overlay to make packages available + overlays = [ + nur.overlay + ]; config = { allowUnsupportedSystem = true; allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ diff --git a/dotfiles/nix/environment.nix b/dotfiles/nix/environment.nix index 34071f5..9e369a2 100644 --- a/dotfiles/nix/environment.nix +++ b/dotfiles/nix/environment.nix @@ -1,7 +1,9 @@ -{ pkgs, lib, ... }: +{ pkgs, lib, nur, ... }: let homeDir = "/Users/larsartmann"; + # NUR packages can be accessed via nur.repos.. + # Example: nur.repos.goreleaser.goreleaser in { environment = { diff --git a/dotfiles/nix/flake.nix b/dotfiles/nix/flake.nix index d584904..bfec0b4 100644 --- a/dotfiles/nix/flake.nix +++ b/dotfiles/nix/flake.nix @@ -23,6 +23,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + nur = { + url = "github:nix-community/NUR"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nix-homebrew.url = "github:zhaofengli-wip/nix-homebrew"; # Optional: Declarative tap management homebrew-core = { @@ -36,7 +41,7 @@ colmena.url = "github:zhaofengli/colmena"; }; - outputs = { self, nix-darwin, nixpkgs, nix-homebrew, nixpkgs-nh-dev, home-manager, ... }@inputs: + outputs = { self, nix-darwin, nixpkgs, nix-homebrew, nixpkgs-nh-dev, home-manager, nur, ... }@inputs: let base = { system.configurationRevision = self.rev or self.dirtyRev or null; @@ -46,7 +51,7 @@ # Build darwin flake using: # $ darwin-rebuild build --flake .#Lars-MacBook-Air darwinConfigurations."Lars-MacBook-Air" = nix-darwin.lib.darwinSystem { - specialArgs = { inherit nixpkgs-nh-dev; }; + specialArgs = { inherit nixpkgs-nh-dev nur; }; modules = [ # Core system configuration base