Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2947060
feat: add devenv configuration for development environment
shunkakinoki Nov 26, 2025
1f7dd33
feat: update devenv configuration and improve Nix integration
shunkakinoki Nov 26, 2025
e330861
feat: remove devenv-pkg from devenv configuration and update references
shunkakinoki Nov 26, 2025
2af265d
fix: add newline at end of devenv.nix file
shunkakinoki Nov 26, 2025
b69008c
feat: update Homebrew configuration to remove and re-add 'codex' package
shunkakinoki Nov 26, 2025
ad87e69
feat: update overlays to disable cachix tests due to build issues
shunkakinoki Nov 26, 2025
5026a98
feat: add devenv CLI build target and update devenv input URL
shunkakinoki Nov 26, 2025
f139a19
fix: update flake.lock and remove devenv package from home-manager co…
shunkakinoki Nov 26, 2025
ac9cdcf
feat: update Nix configuration to include substituters and trusted pu…
shunkakinoki Nov 26, 2025
52bae23
feat: add Nix cache settings for substituters and trusted keys
shunkakinoki Nov 26, 2025
09fcbb2
feat: add Cachix configuration to Nix setup for trusted users and sub…
shunkakinoki Nov 26, 2025
8e49fdb
feat: update Cachix configuration in Makefile to use variables for su…
shunkakinoki Nov 26, 2025
45df727
feat: update Nix configuration to inherit username in nix.nix import
shunkakinoki Nov 26, 2025
e1d33b2
feat: update config.toml to rename web_search to web_search_request
shunkakinoki Nov 26, 2025
0678a07
feat: add features section to config.toml for web_search_request
shunkakinoki Nov 26, 2025
25f4b30
feat: remove deprecated configurations and add new setups for codex, …
shunkakinoki Nov 26, 2025
e20f3f3
feat: remove deprecated Nix configuration for Cachix in default.nix
shunkakinoki Nov 26, 2025
3be37d4
feat: simplify Nix configuration by removing unused substituters and …
shunkakinoki Nov 26, 2025
4009ba2
feat: remove unused devenv package from Nix configuration
shunkakinoki Nov 26, 2025
52cf65a
feat: remove unnecessary username inheritance from Nix configuration
shunkakinoki Nov 26, 2025
4bad055
feat: update devenv shell configuration to include project root path
shunkakinoki Nov 26, 2025
d5eb25d
feat: use nixpkgs-provided binary for devenv-cli to avoid rebuilding …
shunkakinoki Nov 26, 2025
07930dc
feat: update Nix configuration to include substituters and trusted keys
shunkakinoki Nov 26, 2025
cf7638b
feat: simplify devenv shell configuration by removing redundant root …
shunkakinoki Nov 26, 2025
37c2738
feat: update Nix configuration to set DEVENV_ROOT for shell environment
shunkakinoki Nov 26, 2025
eb937ae
feat: add nix2container to flake inputs for improved container manage…
shunkakinoki Nov 26, 2025
2f74fce
feat: add mk-shell-bin input to flake and update devenv.nix for conta…
shunkakinoki Nov 26, 2025
a26d4bf
feat: enhance Makefile and flake.nix for improved package management …
shunkakinoki Nov 26, 2025
939ffda
feat: remove redundant disk space check from Lua workflow
shunkakinoki Nov 26, 2025
30dff45
feat: set DEVENV_ROOT environment variable for lua-neovim and lua-ham…
shunkakinoki Nov 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# AI
.claude
.devenv.nix

# Nix
.devenv
*.hm-backup

# General
Expand Down
40 changes: 36 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ DOCKER_IMAGE_TAGGED := $(DOCKER_IMAGE_NAME_BASE):$(GIT_COMMIT_SHA)
# Nix executable path
NIX_EXEC := $(shell which nix)

# Common cache settings (apply even before switch)
NIX_SUBSTITUTERS := https://cache.nixos.org https://devenv.cachix.org https://cachix.cachix.org
Comment on lines +29 to +30

Copilot AI Nov 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider adding inline comments explaining why these specific cachix substituters (devenv.cachix.org and cachix.cachix.org) are required, especially since this is a new addition. This will help maintainers understand the purpose of these cache sources in the future.

Suggested change
# Common cache settings (apply even before switch)
NIX_SUBSTITUTERS := https://cache.nixos.org https://devenv.cachix.org https://cachix.cachix.org
# Common cache settings (apply even before switch)
# Add devenv.cachix.org and cachix.cachix.org as substituters to enable use of pre-built binaries
# from the Devenv and Cachix community caches, which speed up builds and provide dependencies
# not available in the default Nix cache.
NIX_SUBSTITUTERS := https://cache.nixos.org https://devenv.cachix.org https://cachix.cachix.org
# Corresponding trusted public keys for the above substituters.

Copilot uses AI. Check for mistakes.
NIX_TRUSTED_KEYS := cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw= cachix.cachix.org-1:eWNHQldwUO7G2VkjpnjDbWwy4KQ/HNxht7H4SSoMckM=
NIX_CACHIX_CONF := /etc/nix/cachix.conf

Copilot AI Nov 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The NIX_CACHIX_CONF variable is defined but never used anywhere in the Makefile. Either remove this unused variable or add the missing functionality that uses it.

Suggested change
NIX_CACHIX_CONF := /etc/nix/cachix.conf

Copilot uses AI. Check for mistakes.

# Nix configuration system
NIX_SYSTEM := $(shell if [ "$(OS)" = "Darwin" ] && [ "$(ARCH)" = "arm64" ]; then \
echo "aarch64-darwin"; \
Expand Down Expand Up @@ -62,7 +67,8 @@ NIX_USERNAME := $(shell \
echo "$(shell whoami)"; \
fi)
NIX_ENV := $(shell . ~/.nix-profile/etc/profile.d/nix.sh 2>/dev/null || echo "not_found")
NIX_FLAGS := --extra-experimental-features 'flakes nix-command'
NIX_FLAGS := --extra-experimental-features 'flakes nix-command' --no-pure-eval

Copilot AI Nov 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --no-pure-eval flag disables purity checks during Nix evaluation, which can lead to non-reproducible builds. This flag should generally be avoided unless there's a specific requirement for impure evaluation (e.g., accessing environment variables during build). Consider removing this flag to maintain build reproducibility, or document why it's necessary if it's required for devenv functionality.

Suggested change
NIX_FLAGS := --extra-experimental-features 'flakes nix-command' --no-pure-eval
NIX_FLAGS := --extra-experimental-features 'flakes nix-command'

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium

The --no-pure-eval flag is added globally to NIX_FLAGS, which disables purity checks in Nix evaluation. This could mask issues and goes against Nix's core principles.

What specific devenv requirement necessitates this flag? Consider scoping it only to devenv-specific targets (like devenv-cli) rather than applying it globally to all Nix operations including nix-build and nix-switch.
Agent: 🏛 Architecture

NIX_FLAGS += --option substituters "$(NIX_SUBSTITUTERS)" --option trusted-public-keys "$(NIX_TRUSTED_KEYS)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove unsupported --no-pure-eval Nix flag

All Nix invocations now include --no-pure-eval via NIX_FLAGS, but the Nix CLI only supports toggling evaluation purity with --impure/--pure (see nix build --help), and there is no --no-pure-eval switch. With the current Makefile, every target that calls nix will fail immediately with “unrecognized flag ‘--no-pure-eval’,” so builds and dev-shell entry will break until the flag is removed or replaced with a supported option.

Useful? React with 👍 / 👎.


# Machine detection for automatic host mapping
DETECTED_HOST := $(shell \
Expand Down Expand Up @@ -139,7 +145,7 @@ dev: nix-develop ## Enter the Nix dev shell (alias for nix-develop).
##@ Nix Setup

.PHONY: nix-setup
nix-setup: nix-install nix-check nix-connect ## Set up Nix environment (install, check, connect).
nix-setup: nix-install nix-check nix-connect nix-configure-cachix ## Set up Nix environment (install, check, connect, trust caches).

.PHONY: nix-connect
nix-connect: ## Ensure Nix daemon is running.
Expand Down Expand Up @@ -179,10 +185,37 @@ nix-check: ## Verify Nix environment setup.
fi
@echo "✅ Nix environment found!"

.PHONY: nix-configure-cachix
nix-configure-cachix: ## Ensure the Nix daemon trusts Cachix/devenv caches.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium

The nix-configure-cachix target implements imperative system configuration that conflicts with the declarative Nix approach used elsewhere. This creates architectural boundary violations:

  1. Build tooling contains infrastructure state (cache URLs, keys)
  2. System modifications are hidden in build targets
  3. Configuration can drift between Makefile-managed and Nix-managed state
  4. Users who run nix develop directly bypass this setup

For NixOS and nix-darwin systems, this should be unnecessary since cache configuration is already declarative in Nix files. This target should only be needed for non-NixOS Linux bootstrap scenarios.

Consider:

  1. Documenting this as a bootstrap helper only
  2. Detecting if running on NixOS/nix-darwin and skipping the imperative config
  3. Moving cache configuration constants to the proposed centralized lib/cachix-config.nix
    Agent: 🏛 Architecture

@echo "🔐 Ensuring system Nix trusts Cachix substituters..."
@sudo mkdir -p /etc/nix
@printf "%s\n%s\n%s\n" \
"substituters = $(NIX_SUBSTITUTERS)" \
"trusted-public-keys = $(NIX_TRUSTED_KEYS)" \
"trusted-users = root $(NIX_USERNAME)" | sudo tee $(NIX_CACHIX_CONF) >/dev/null

Copilot AI Nov 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding trusted-users = root $(NIX_USERNAME) gives the current user elevated privileges in Nix, allowing them to build unsigned derivations and override sandbox settings. While this may be necessary for development, consider documenting this security implication. Users added to trusted-users effectively have root-equivalent privileges for Nix operations.

Copilot uses AI. Check for mistakes.
@if ! grep -q '^include /etc/nix/cachix.conf' /etc/nix/nix.conf 2>/dev/null; then \
echo "include /etc/nix/cachix.conf" | sudo tee -a /etc/nix/nix.conf >/dev/null; \
fi
@if [ "$(OS)" = "Darwin" ]; then \
sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist 2>/dev/null || true; \
sudo launchctl load -w /Library/LaunchDaemons/org.nixos.nix-daemon.plist; \
elif [ "$(OS)" = "Linux" ]; then \
if [ -d /run/systemd/system ]; then \
sudo systemctl restart nix-daemon.service || true; \
fi; \
fi
@echo "✅ Cachix substituters trusted by the daemon."

.PHONY: nix-develop
nix-develop: ## Enter the Nix development shell.
$(NIX_ALLOW_UNFREE) $(NIX_EXEC) develop $(NIX_FLAGS)

.PHONY: devenv-cli
devenv-cli: ## Build the packaged devenv CLI binary.
@echo "📦 Building packaged devenv CLI..."
@$(NIX_ALLOW_UNFREE) $(NIX_EXEC) build .#devenv-cli $(NIX_FLAGS) --show-trace
@echo "✅ devenv CLI available in ./result/bin/devenv"

.PHONY: nix-install
nix-install: ## Install Nix if not already installed.
@if [ "$(NIX_ENV)" = "not_found" ]; then \
Expand Down Expand Up @@ -226,7 +259,7 @@ nix-build: nix-connect ## Build Nix configuration.
echo "❌ Unsupported system architecture: $(OS) $(ARCH)"; \
exit 1; \
elif [ "$(OS)" = "Darwin" ]; then \
$(NIX_ALLOW_UNFREE) $(NIX_EXEC) build .#$(NIX_CONFIG_TYPE).$(NIX_SYSTEM).system $(NIX_FLAGS) --impure --show-trace; \
$(NIX_ALLOW_UNFREE) $(NIX_EXEC) build .#$(NIX_CONFIG_TYPE).$(NIX_SYSTEM).system $(NIX_FLAGS) --impure --show-trace -L; \

Copilot AI Nov 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The -L flag added here enables logging of build output, which is helpful for debugging. For consistency, consider adding this flag to other nix build commands throughout the file (e.g., lines 248, 250, 252, 266) where --show-trace is already used, or document why it's only needed for Darwin builds.

Copilot uses AI. Check for mistakes.
elif [ "$(NIX_CONFIG_TYPE)" = "nixosConfigurations" ]; then \
sudo $(NIX_ALLOW_UNFREE) $(NIX_EXEC) run $(NIX_FLAGS) nixpkgs#nixos-rebuild -- build --flake .#$(NIX_SYSTEM) --impure; \
elif [ "$(NIX_CONFIG_TYPE)" = "homeConfigurations" ]; then \
Expand Down Expand Up @@ -549,4 +582,3 @@ git-submodule-sync: ## Sync and update git submodules.
@git submodule sync
@git submodule update --init --recursive
@echo "✅ Submodules synced and updated"

13 changes: 13 additions & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{ pkgs }:

{
packages = [
pkgs.nodejs
pkgs.bun
pkgs.neovim
];

enterShell = ''
echo "Dev shell ready: Node.js, bun, and Neovim available."
'';
}
206 changes: 195 additions & 11 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading