fix(nix-devshell): permit missing pin in inventory and complete multi-system pattern

This commit is contained in:
kiskaadee committed 2026-10-23 13:09:25 -05:00
1 parent 77ed54fe01
commit df3bc8ec28
2 files changed
+16 -6

No files matched your search

+5 -4
View File
@@ -15,10 +15,11 @@ description: >-
containers, or devenv/devbox/flox. Lock updates go to `inspect-flake-update`. containers, or devenv/devbox/flox. Lock updates go to `inspect-flake-update`.
## Steps ## Steps
1. **Inspect before deciding.** Read the Nix files, `flake.lock` (pinned nixpkgs revision), 1. **Inspect before deciding.** Read the Nix files, `flake.lock` (pinned nixpkgs revision,
`.envrc`, language manifests, build scripts, CI, contributor docs, `git status`, and or record that none is present), `.envrc`, language manifests, build scripts, CI,
`nix --version` with enabled features. Write a short inventory of what exists and which contributor docs, `git status`, and `nix --version` with enabled features. Write a short
conventions (workflow, helper library, systems, constructor, input policy) you will keep. inventory of what exists and which conventions (workflow, helper library, systems,
constructor, input policy) you will keep.
2. **Establish requirements** from that evidence: tools, runtimes, native libraries, compiler, 2. **Establish requirements** from that evidence: tools, runtimes, native libraries, compiler,
env vars, startup behavior, project commands, target systems. Ask only about gaps that env vars, startup behavior, project commands, target systems. Ask only about gaps that
change the design and cannot be read from the repo. change the design and cannot be read from the repo.
@@ -62,14 +62,23 @@ Replace the system with the project's actual one(s); add systems only when requi
dependencies support them. The nixpkgs branch is a project decision (see dependencies support them. The nixpkgs branch is a project decision (see
[design-decisions.md](design-decisions.md#3-nixpkgs-inputs-and-lock-policy)). [design-decisions.md](design-decisions.md#3-nixpkgs-inputs-and-lock-policy)).
For several systems without an extra input (`Contextual`, one option among several): For several systems without an extra input (`Contextual`, standalone minimal flake pattern):
```nix ```nix
{
description = "Multi-system development shell without extra inputs";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }:
let let
systems = [ "x86_64-linux" "aarch64-darwin" ]; # only the systems the project needs systems = [ "x86_64-linux" "aarch64-darwin" ]; # only the systems the project needs
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system}); forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
in { in {
devShells = forAllSystems (pkgs: { default = pkgs.mkShellNoCC { packages = [ pkgs.jq ]; }; }); devShells = forAllSystems (pkgs: {
default = pkgs.mkShellNoCC {
packages = [ pkgs.jq ];
};
});
};
} }
``` ```