13 src = fetchFromGitHub {
17 hash = "sha256-F/9yAF1vXG4eWMmS6l/qWqlEV8YkS7nihHN2vK3JFbE=";
23 "-X main.version=v${version}"
24 "-X main.builtBy=nixpkgs"
27 vendorHash = "sha256-MxkpK3CgQ+eoxGfLRqE3kudyZounDD0+cmzOoiPf1wc=";
29 nativeBuildInputs = [ installShellFiles ];
31 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
32 installShellCompletion --cmd nsc \
33 --bash <($out/bin/nsc completion bash) \
34 --fish <($out/bin/nsc completion fish) \
35 --zsh <($out/bin/nsc completion zsh)
39 # asc attempt to write to the home directory.
40 export HOME=$(mktemp -d)
43 preCheck = preInstall;
45 # Tests currently fail on darwin because of a test in nsc which
46 # expects command output to contain a specific path. However
47 # the test strips table formatting from the command output in a naive way
48 # that removes all the table characters, including '-'.
49 # The nix build directory looks something like:
50 # /private/tmp/nix-build-nsc-2.10.2.drv-0/nsc_test2000598938/keys
51 # Then the `-` are removed from the path unintentionally and the test fails.
52 # This should be fixed upstream to avoid mangling the path when
53 # removing the table decorations from the command output.
54 doCheck = !stdenv.hostPlatform.isDarwin;
57 description = "Tool for creating NATS account and user access configurations";
58 homepage = "https://github.com/nats-io/nsc";
59 license = with lib.licenses; [ asl20 ];
60 maintainers = with lib.maintainers; [ cbrewster ];