Skip to content

Commit

Permalink
Problem: support multiple direnv environment (#1352)
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang authored Mar 15, 2024
1 parent 6c2b816 commit bc73ca5
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 4 deletions.
2 changes: 0 additions & 2 deletions .envrc

This file was deleted.

5 changes: 5 additions & 0 deletions .envrc.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# default: go, gomod2nix
# rocksdb: go, gomod2nix, librocksdb
# full: go, gomod2nix, librocksdb, python env
use flake .#full
TMPDIR=/tmp
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ go.work.sum

# yaml for test
integration_tests/configs/*.yaml

# direnv
/.envrc
/.direnv
85 changes: 84 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};

outputs = { self, nixpkgs, nix-bundle-exe, gomod2nix, flake-utils }:
outputs = { self, nixpkgs, nix-bundle-exe, gomod2nix, flake-utils, poetry2nix }:
let
rev = self.shortRev or "dirty";
mkApp = drv: {
Expand All @@ -28,6 +33,7 @@
inherit system;
overlays = [
(import ./nix/build_overlay.nix)
poetry2nix.overlays.default
gomod2nix.overlays.default
self.overlay
];
Expand Down Expand Up @@ -58,13 +64,22 @@
pkgs.rocksdb
];
};
full = pkgs.mkShell {
buildInputs = [
defaultPackage.go
pkgs.gomod2nix
pkgs.rocksdb
pkgs.test-env
];
};
};
legacyPackages = pkgs;
}
)
) // {
overlay = final: super: {
go = super.go_1_22;
test-env = final.callPackage ./nix/testenv.nix { };
bundle-exe = final.pkgsBuildBuild.callPackage nix-bundle-exe { };
# make-tarball don't follow symbolic links to avoid duplicate file, the bundle should have no external references.
# reset the ownership and permissions to make the extract result more normal.
Expand Down

0 comments on commit bc73ca5

Please sign in to comment.