fix(nix-devshell): permit missing pin in inventory and complete multi-system pattern
This commit is contained in:
1 parent
77ed54fe01
commit
df3bc8ec28
2 files changed
+18
-8
No files matched your search
@@ -15,10 +15,11 @@ description: >-
|
||||
containers, or devenv/devbox/flox. Lock updates go to `inspect-flake-update`.
|
||||
|
||||
## Steps
|
||||
1. **Inspect before deciding.** Read the Nix files, `flake.lock` (pinned nixpkgs revision),
|
||||
`.envrc`, language manifests, build scripts, CI, contributor docs, `git status`, and
|
||||
`nix --version` with enabled features. Write a short inventory of what exists and which
|
||||
conventions (workflow, helper library, systems, constructor, input policy) you will keep.
|
||||
1. **Inspect before deciding.** Read the Nix files, `flake.lock` (pinned nixpkgs revision,
|
||||
or record that none is present), `.envrc`, language manifests, build scripts, CI,
|
||||
contributor docs, `git status`, and `nix --version` with enabled features. Write a short
|
||||
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,
|
||||
env vars, startup behavior, project commands, target systems. Ask only about gaps that
|
||||
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
|
||||
[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
|
||||
let
|
||||
{
|
||||
description = "Multi-system development shell without extra inputs";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
systems = [ "x86_64-linux" "aarch64-darwin" ]; # only the systems the project needs
|
||||
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
|
||||
in {
|
||||
devShells = forAllSystems (pkgs: { default = pkgs.mkShellNoCC { packages = [ pkgs.jq ]; }; });
|
||||
in {
|
||||
devShells = forAllSystems (pkgs: {
|
||||
default = pkgs.mkShellNoCC {
|
||||
packages = [ pkgs.jq ];
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in new issue
Block a user