nix: set up tooling

This commit is contained in:
raf 2025-06-18 13:51:18 +03:00
commit 7a5207f3b4
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
5 changed files with 91 additions and 0 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake

27
flake.lock generated Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1750134718,
"narHash": "sha256-v263g4GbxXv87hMXMCpjkIxd/viIF7p3JpJrwgKdNiI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9e83b64f727c88a7711a2c463a7b16eedb69a84c",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

25
flake.nix Normal file
View file

@ -0,0 +1,25 @@
{
description = "Fast and minimal parallel TCP connection testing utility ";
inputs.nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
outputs = {
self,
nixpkgs,
...
}: let
systems = ["x86_64-linux" "aarch64-linux"];
forEachSystem = nixpkgs.lib.genAttrs systems;
pkgsForEach = nixpkgs.legacyPackages;
in {
packages = forEachSystem (system: {
default = pkgsForEach.${system}.callPackage ./nix/package.nix {};
});
devShells = forEachSystem (system: {
default = pkgsForEach.${system}.callPackage ./nix/shell.nix {};
});
hydraJobs = self.packages;
};
}

24
nix/package.nix Normal file
View file

@ -0,0 +1,24 @@
{
lib,
buildGoModule,
}: let
fs = lib.fileset;
s = ../.;
in
buildGoModule {
pname = "tct";
version = "0.1.0";
src = fs.toSource {
root = s;
fileset = fs.unions [
(fs.fileFilter (file: builtins.any file.hasExt ["go"]) s)
../go.mod
../go.sum
];
};
vendorHash = "sha256-m5mBubfbXXqXKsygF5j7cHEY+bXhAMcXUts5KBKoLzM=";
ldflags = ["-s" "-w"];
}

14
nix/shell.nix Normal file
View file

@ -0,0 +1,14 @@
{
mkShell,
go,
gopls,
delve,
}:
mkShell {
name = "go";
packages = [
delve
go
gopls
];
}