Skip to content

Commit

Permalink
feat(nix): init nix dev shell
Browse files Browse the repository at this point in the history
Provide overlay and devshell with go package from `.tool-versions`

Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
  • Loading branch information
noaccOS committed Jul 26, 2023
1 parent 74dfc9a commit 56bb1a3
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ astartectl
astartectl_*
.gobuild
dist/
/result

# Direnv
.direnv/
Expand Down
1 change: 1 addition & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(import .nix/flake-compat.nix).defaultNix
98 changes: 98 additions & 0 deletions flake.lock

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

28 changes: 28 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
description = "Astarte command line client utility";

inputs = {
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
go-utils = { url = "github:noaccOS/go-utils"; inputs.nixpkgs.follows = "nixpkgs"; };
flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};

outputs = { self, nixpkgs, flake-utils, go-utils, ... }:
flake-utils.lib.eachSystem go-utils.lib.defaultSystems (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.${system}.default ];
};
in
{
overlays.default = go-utils.lib.asdfOverlay { src = ./.; };
overlay = self.overlays.default;
devShells.default = pkgs.simpleGoShell;
}
);
}
10 changes: 10 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(import
(
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
builtins.fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{ src = ./.; }
).shellNix

0 comments on commit 56bb1a3

Please sign in to comment.