From 611a8b04155d9c102dd57b920ef7137cf35aff44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Pacana?= Date: Mon, 29 Jun 2026 22:12:52 +0200 Subject: [PATCH] Add Nix dev shell and formatter to the flake - formatter = nixfmt-rfc-style so 'nix fmt' formats the tree. - devShells.default ships nixd (LSP), nixfmt, and deadnix for editing this repo; .envrc loads it on cd via the existing nix-direnv. - Exposed for both the Mac and the Linux VM via forAllSystems. - statix omitted for now: its test suite fails to build on current nixos-unstable. - gitignore .direnv. --- .envrc | 1 + .gitignore | 3 +++ flake.nix | 21 +++++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index e918ea3..25a4d78 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,7 @@ result result-* +# direnv / nix-direnv cache +.direnv + .DS_Store diff --git a/flake.nix b/flake.nix index 036d819..cd2d6ee 100644 --- a/flake.nix +++ b/flake.nix @@ -30,6 +30,9 @@ let username = "mostlyobvious"; + # Systems we expose dev tooling for: the Mac host and the Linux VM. + forAllSystems = nixpkgs.lib.genAttrs [ "aarch64-darwin" "aarch64-linux" ]; + # One Apple Silicon Mac. hostname flows to networking.* and the home layer; # per-host specifics (extra casks, host-only modules) go in extraModules. mkDarwin = { hostname, system ? "aarch64-darwin", extraModules ? [ ] }: @@ -65,5 +68,23 @@ extraSpecialArgs = { inherit username; }; modules = [ ./modules/home/common.nix ]; }; + + # `nix fmt` formats the tree. + formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style); + + # Tooling for editing this repo, loaded on cd via .envrc + nix-direnv. + devShells = forAllSystems (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + default = pkgs.mkShell { + packages = with pkgs; [ + nixd + nixfmt-rfc-style + deadnix + ]; + }; + }); }; } -- 2.51.2