Skip to content

Commit

Permalink
Problem: gomod2nix is not in nix develop shell
Browse files Browse the repository at this point in the history
Solution:
- add gomod2nix to default devShell
- build gomod2nix with the same go version
  • Loading branch information
yihuang committed Feb 28, 2024
1 parent 01d9dc6 commit f5c898a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ jobs:
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
if: steps.changed-files.outputs.any_changed == 'true'
- name: gomod2nix
run: nix run -f ./nix gomod2nix
run: nix develop -c gomod2nix
if: steps.changed-files.outputs.any_changed == 'true'
- name: check working directory is clean
id: changes
Expand Down
16 changes: 8 additions & 8 deletions flake.lock

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

23 changes: 11 additions & 12 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
url = "github:3noch/nix-bundle-exe";
flake = false;
};
gomod2nix = {
gomod2nix-flake = {
url = "github:nix-community/gomod2nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.utils.follows = "flake-utils";
inputs.flake-utils.follows = "flake-utils";
};
};

outputs = { self, nixpkgs, nix-bundle-exe, gomod2nix, flake-utils }:
outputs = { self, nixpkgs, nix-bundle-exe, gomod2nix-flake, flake-utils }:
let
rev = self.shortRev or "dirty";
mkApp = drv: {
Expand All @@ -28,7 +28,7 @@
inherit system;
overlays = [
(import ./nix/build_overlay.nix)
gomod2nix.overlays.default
gomod2nix-flake.overlays.default
self.overlay
];
config = { };
Expand All @@ -44,20 +44,19 @@
};
defaultPackage = packages.cronosd;
defaultApp = apps.cronosd;
devShells = {
cronosd = pkgs.mkShell {
buildInputs = with pkgs; [
go_1_22
rocksdb
];
};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
go
rocksdb
gomod2nix
];
};
devShell = devShells.cronosd;
legacyPackages = pkgs;
}
)
) // {
overlay = final: super: {
go = super.go_1_22;
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 f5c898a

Please sign in to comment.