Skip to content

Commit 815acba

Browse files
committed
nix: add a flake.nix with a devshell that delegates to shell.nix
Handling of the flake.lock file is a bit tricky because nix wants to force-add it to git when it does any changes to it. You can get around that with sth like: ```shell $ git update-index --assume-unchanged misc/nix/flake.lock ``` Use the devshell like this: ```shell $ nix develop ./misc/nix -c <your shell> ``` Where I use fish for <your shell>. You can also leave out the -c argument if the default shell is fine for you. Bonus content: You can prevent garbage collection of the devshell dependencies but installing a profile (which acts as a GC root): ```shell $ nix develop --profile path/to/some-profile ./misc/nix -c fish ``` For example, you could keep live profiles in a hidden directory in your home.
1 parent 93ec1e0 commit 815acba

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,9 @@ junit_*.xml
2828
perf.data*
2929
**/*.rej
3030
**/*.orig
31+
32+
# This is un-orthodox, but adding it to the repo would "tie" it to each users
33+
# local version of nixpkgs. This way, we can all use the flake and have a
34+
# flake.lock that works well with the rest of the package versions on our
35+
# system.
36+
**/flake.lock

misc/nix/flake.nix

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright Materialize, Inc. and contributors. All rights reserved.
2+
#
3+
# Use of this software is governed by the Business Source License
4+
# included in the LICENSE file.
5+
#
6+
# As of the Change Date specified in that file, in accordance with
7+
# the Business Source License, use of this software will be governed
8+
# by the Apache License, Version 2.0.
9+
10+
{
11+
description = "Devshell for materialize that delegates to the legacy shell.nix";
12+
13+
inputs.flake-utils.url = "github:numtide/flake-utils";
14+
15+
outputs = { self, nixpkgs, flake-utils }:
16+
flake-utils.lib.eachDefaultSystem (system:
17+
let pkgs = nixpkgs.legacyPackages.${system}; in
18+
rec {
19+
# we pass `pkgs` directly to shell.nix
20+
devShell = import ./shell.nix { inherit pkgs; };
21+
}
22+
);
23+
}

0 commit comments

Comments
 (0)