-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
60 lines (56 loc) · 1.76 KB
/
Copy pathflake.nix
File metadata and controls
60 lines (56 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{
description = "CLI tool that searches parent directories for files and returns the closest path";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs, ... }:
let
systems = [
"aarch64-darwin"
"x86_64-darwin"
"aarch64-linux"
"x86_64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
# Prefer the commit hash over a hand-maintained version: it can never
# go stale, and `nix run github:corrupt952/closest` always builds main.
version = self.shortRev or self.dirtyShortRev or "dev";
in
{
packages = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = pkgs.buildGoModule {
pname = "closest";
inherit version;
src = pkgs.lib.cleanSource self;
vendorHash = null;
# Keep in sync with .goreleaser.yml ldflags.
ldflags = [ "-s" "-w" "-X" "main.Version=${version}" ];
# The finder tests walk up parent directories from the working
# directory, which makes them sensitive to the sandbox's directory
# layout. CI runs `go test` directly.
doCheck = false;
meta.mainProgram = "closest";
};
});
checks = forAllSystems (system: {
default = self.packages.${system}.default;
});
devShells = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = pkgs.mkShellNoCC {
packages = with pkgs; [
go
gopls
gotools
golangci-lint
goreleaser
];
};
});
};
}