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
+20
-10
No files matched your search
@@ -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
|
||||||
let
|
{
|
||||||
systems = [ "x86_64-linux" "aarch64-darwin" ]; # only the systems the project needs
|
description = "Multi-system development shell without extra inputs";
|
||||||
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
in {
|
outputs = { self, nixpkgs }:
|
||||||
devShells = forAllSystems (pkgs: { default = pkgs.mkShellNoCC { packages = [ pkgs.jq ]; }; });
|
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 ];
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user