Skip to content

Commit 8e732cf

Browse files
committed
flake/dev: rename nixpkgs input to avoid shadowing
Rename `inputs.nixpkgs` to `inputs.dev-nixpkgs` to avoid shadowing the root flake's `inputs.nixpkgs`. Having the dev flake shadow an input can be confusing, since overriding the root flake's input will have no effect when evaluating outputs that depend on the dev partition. The only reason we specify a `nixpkgs` input at all here, is so the other inputs can follow it. Once nix 2.26 is more prevalent, we can follow the root flake's inputs using a `"path:../.."` input.
1 parent 1c0dd32 commit 8e732cf

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

.github/workflows/update.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ jobs:
126126
root_nixpkgs=$(nix eval --raw --file . 'inputs.nixpkgs.rev')
127127
old=$(git show --no-patch --format=%h)
128128
nix flake update --commit-lock-file \
129-
--override-input nixpkgs "github:NixOS/nixpkgs/$root_nixpkgs" \
129+
--override-input 'dev-nixpkgs' "github:NixOS/nixpkgs/$root_nixpkgs" \
130130
--flake './flake/dev'
131131
new=$(git show --no-patch --format=%h)
132132
if [ "$old" != "$new" ]; then

flake/dev/flake.nix

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,36 @@
22
description = "Private inputs for development purposes. These are used by the top level flake in the `dev` partition, but do not appear in consumers' lock files.";
33

44
inputs = {
5-
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
5+
# NOTE: Use a different name to the root flake's inputs.nixpkgs to avoid shadowing it.
6+
# NOTE: The only reason we specify a nixpkgs input at all here, is so the other inputs can follow it.
7+
# TODO: Once nix 2.26 is more prevalent, follow the root flake's inputs using a "path:../.." input.
8+
dev-nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
69

710
home-manager = {
811
url = "github:nix-community/home-manager";
9-
inputs.nixpkgs.follows = "nixpkgs";
12+
inputs.nixpkgs.follows = "dev-nixpkgs";
1013
};
1114

1215
nix-darwin = {
1316
url = "github:lnl7/nix-darwin";
14-
inputs.nixpkgs.follows = "nixpkgs";
17+
inputs.nixpkgs.follows = "dev-nixpkgs";
1518
};
1619

1720
devshell = {
1821
url = "github:numtide/devshell";
19-
inputs.nixpkgs.follows = "nixpkgs";
22+
inputs.nixpkgs.follows = "dev-nixpkgs";
2023
};
2124

2225
treefmt-nix = {
2326
url = "github:numtide/treefmt-nix";
24-
inputs.nixpkgs.follows = "nixpkgs";
27+
inputs.nixpkgs.follows = "dev-nixpkgs";
2528
};
2629

2730
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
2831

2932
git-hooks = {
3033
url = "github:cachix/git-hooks.nix";
31-
inputs.nixpkgs.follows = "nixpkgs";
34+
inputs.nixpkgs.follows = "dev-nixpkgs";
3235
inputs.flake-compat.follows = "flake-compat";
3336
};
3437
};

0 commit comments

Comments
 (0)