chore(nix): nix setup and dev shell

This commit is contained in:
Guz
2026-01-09 11:15:42 -03:00
parent 95fe290a3f
commit 8542290011
4 changed files with 87 additions and 0 deletions

1
.envrc Normal file
View File

@@ -0,0 +1 @@
use flake

1
.gitignore vendored
View File

@@ -20,3 +20,4 @@ go.work.sum
# env file
.env
.direnv

27
flake.lock generated Normal file
View File

@@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1767640445,
"narHash": "sha256-UWYqmD7JFBEDBHWYcqE6s6c77pWdcU/i+bwD6XxMb8A=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "9f0c42f8bc7151b8e7e5840fb3bd454ad850d8c5",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

58
flake.nix Normal file
View File

@@ -0,0 +1,58 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = {
self,
nixpkgs,
...
}: let
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = f:
nixpkgs.lib.genAttrs systems (system: let
pkgs = import nixpkgs {inherit system;};
in
f {
inherit (pkgs) lib stdenv;
inherit pkgs;
});
in {
devShells = forAllSystems ({pkgs, ...}: {
default = pkgs.mkShell {
CGO_ENABLED = "0";
hardeningDisable = ["all"];
buildInputs = with pkgs; [
# Go tools
go
golangci-lint
gofumpt
gotools
delve
];
};
});
packages = forAllSystems ({
pkgs,
lib,
stdenv,
...
}: {
default = self.packages.${stdenv.hostPlatform.system}.depgraph;
depgraph = pkgs.buildGo125Module {
pname = "depgraph";
version = "0.0.0";
src = lib.cleanSource ./.;
vendorHash = null;
meta = {
license = lib.licenses.mpl20;
};
};
});
};
}