-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
294 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
version, | ||
pkgs, | ||
buildGoApplication ? pkgs.buildGoApplication, | ||
}: | ||
buildGoApplication { | ||
pname = "narcos"; | ||
version = version; | ||
pwd = ./.; | ||
src = ./.; | ||
modules = ./gomod2nix.toml; | ||
postInstall = '' | ||
mv $out/bin/narcos $out/bin/narc | ||
''; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,36 @@ | ||
{ | ||
description = "NARC CLI"; | ||
description = "narcos cli - for nais admins"; | ||
|
||
inputs.nixpkgs.url = "nixpkgs/nixos-unstable"; | ||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
inputs.flake-utils.url = "github:numtide/flake-utils"; | ||
inputs.gomod2nix.url = "github:nix-community/gomod2nix"; | ||
inputs.gomod2nix.inputs.nixpkgs.follows = "nixpkgs"; | ||
inputs.gomod2nix.inputs.flake-utils.follows = "flake-utils"; | ||
|
||
outputs = { | ||
self, | ||
nixpkgs, | ||
flake-utils, | ||
gomod2nix, | ||
}: let | ||
version = builtins.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101"); | ||
goOverlay = final: prev: { | ||
go = prev.go.overrideAttrs (old: { | ||
version = "1.22.5"; | ||
src = prev.fetchurl { | ||
url = "https://go.dev/dl/go1.22.5.src.tar.gz"; | ||
hash = "sha256-rJxyPyJJaa7mJLw0/TTJ4T8qIS11xxyAfeZEu0bhEvY="; | ||
}; | ||
}); | ||
}; | ||
withSystem = nixpkgs.lib.genAttrs ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]; | ||
withPkgs = callback: | ||
withSystem ( | ||
system: | ||
callback | ||
(import nixpkgs { | ||
inherit system; | ||
overlays = [goOverlay]; | ||
}) | ||
); | ||
in { | ||
packages = withPkgs ( | ||
pkgs: rec { | ||
narc = pkgs.buildGoModule { | ||
pname = "narc"; | ||
inherit version; | ||
src = ./.; | ||
vendorHash = "sha256-z8H602yJbmpvoOER41TU5P0F5HOuhMAcuupExJ7r19c="; | ||
postInstall = '' | ||
mv $out/bin/narcos $out/bin/narc | ||
''; | ||
}; | ||
default = narc; | ||
} | ||
); | ||
in ( | ||
flake-utils.lib.eachDefaultSystem | ||
(system: let | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
|
||
devShells = withPkgs (pkgs: { | ||
default = pkgs.mkShell { | ||
buildInputs = with pkgs; [go gopls gotools go-tools]; | ||
# The current default sdk for macOS fails to compile go projects, so we use a newer one for now. | ||
# This has no effect on other platforms. | ||
callPackage = pkgs.darwin.apple_sdk_11_0.callPackage or pkgs.callPackage; | ||
in { | ||
packages.default = callPackage ./. { | ||
inherit (gomod2nix.legacyPackages.${system}) buildGoApplication; | ||
inherit version; | ||
}; | ||
}); | ||
|
||
formatter = withPkgs (pkgs: pkgs.nixfmt-rfc-style); | ||
}; | ||
devShells.default = callPackage ./shell.nix { | ||
inherit (gomod2nix.legacyPackages.${system}) mkGoEnv gomod2nix; | ||
}; | ||
formatter = pkgs.nixfmt-rfc-style; | ||
}) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
schema = 3 | ||
|
||
[mod] | ||
[mod."cloud.google.com/go/auth"] | ||
version = "v0.9.3" | ||
hash = "sha256-yqMFaHHiBRNp0WCCsfJvJ40m7sJMpGYZIuOo2c/5zg8=" | ||
[mod."cloud.google.com/go/auth/oauth2adapt"] | ||
version = "v0.2.4" | ||
hash = "sha256-GRXPQMHEEgeKhdCOBjoDL7+UW3yBdSei5ULuZGBE4tw=" | ||
[mod."cloud.google.com/go/compute/metadata"] | ||
version = "v0.5.0" | ||
hash = "sha256-IyVEEElHNPLTRFUMF8ymV3FfQEJQfEdTSeU5PodfOzA=" | ||
[mod."github.com/cpuguy83/go-md2man/v2"] | ||
version = "v2.0.4" | ||
hash = "sha256-pQ+H8Psh92KWTang8hK0cHFLomH+4X0rMMilIJUQ4Qc=" | ||
[mod."github.com/davecgh/go-spew"] | ||
version = "v1.1.2-0.20180830191138-d8f796af33cc" | ||
hash = "sha256-fV9oI51xjHdOmEx6+dlq7Ku2Ag+m/bmbzPo6A4Y74qc=" | ||
[mod."github.com/felixge/httpsnoop"] | ||
version = "v1.0.4" | ||
hash = "sha256-c1JKoRSndwwOyOxq9ddCe+8qn7mG9uRq2o/822x5O/c=" | ||
[mod."github.com/fxamacker/cbor/v2"] | ||
version = "v2.7.0" | ||
hash = "sha256-ln5ms4UxxQ563bZ2UaNLG/bNsmohlgK18K+UUOyZNA0=" | ||
[mod."github.com/go-logr/logr"] | ||
version = "v1.4.2" | ||
hash = "sha256-/W6qGilFlZNTb9Uq48xGZ4IbsVeSwJiAMLw4wiNYHLI=" | ||
[mod."github.com/go-logr/stdr"] | ||
version = "v1.2.2" | ||
hash = "sha256-rRweAP7XIb4egtT1f2gkz4sYOu7LDHmcJ5iNsJUd0sE=" | ||
[mod."github.com/gogo/protobuf"] | ||
version = "v1.3.2" | ||
hash = "sha256-pogILFrrk+cAtb0ulqn9+gRZJ7sGnnLLdtqITvxvG6c=" | ||
[mod."github.com/golang/groupcache"] | ||
version = "v0.0.0-20210331224755-41bb18bfe9da" | ||
hash = "sha256-7Gs7CS9gEYZkbu5P4hqPGBpeGZWC64VDwraSKFF+VR0=" | ||
[mod."github.com/google/gofuzz"] | ||
version = "v1.2.0" | ||
hash = "sha256-T6Gz741l45L3F6Dt7fiAuQvQQg59Qtap3zG05M2cfqU=" | ||
[mod."github.com/google/s2a-go"] | ||
version = "v0.1.8" | ||
hash = "sha256-H4jy3iElh82CTujW3UpaSvsdfN7fZHBLJ4Z4M7kiMSk=" | ||
[mod."github.com/google/uuid"] | ||
version = "v1.6.0" | ||
hash = "sha256-VWl9sqUzdOuhW0KzQlv0gwwUQClYkmZwSydHG2sALYw=" | ||
[mod."github.com/googleapis/enterprise-certificate-proxy"] | ||
version = "v0.3.4" | ||
hash = "sha256-RVHWa0I68CTegjlXnM/GlishoZhmmwG4z+9KBucAJ1A=" | ||
[mod."github.com/googleapis/gax-go/v2"] | ||
version = "v2.13.0" | ||
hash = "sha256-p1SEjRjI/SkWSBWjeptQ5M/Tgrcj8IiH/beXBYqRVko=" | ||
[mod."github.com/imdario/mergo"] | ||
version = "v0.3.16" | ||
hash = "sha256-gh2TEAq8YrZOEAf6SFW4AIcEEUguD68G+7/VUnBeWwM=" | ||
[mod."github.com/json-iterator/go"] | ||
version = "v1.1.12" | ||
hash = "sha256-To8A0h+lbfZ/6zM+2PpRpY3+L6725OPC66lffq6fUoM=" | ||
[mod."github.com/kr/text"] | ||
version = "v0.2.0" | ||
hash = "sha256-fadcWxZOORv44oak3jTxm6YcITcFxdGt4bpn869HxUE=" | ||
[mod."github.com/modern-go/concurrent"] | ||
version = "v0.0.0-20180306012644-bacd9c7ef1dd" | ||
hash = "sha256-OTySieAgPWR4oJnlohaFTeK1tRaVp/b0d1rYY8xKMzo=" | ||
[mod."github.com/modern-go/reflect2"] | ||
version = "v1.0.2" | ||
hash = "sha256-+W9EIW7okXIXjWEgOaMh58eLvBZ7OshW2EhaIpNLSBU=" | ||
[mod."github.com/nais/device"] | ||
version = "v0.0.0-20231015180516-b1b78f6570b9" | ||
hash = "sha256-rSHcrgFpZ4sdLoSp3ju2rh296UVzYkie84Ek6BvhgIY=" | ||
[mod."github.com/pmezard/go-difflib"] | ||
version = "v1.0.1-0.20181226105442-5d4384ee4fb2" | ||
hash = "sha256-XA4Oj1gdmdV/F/+8kMI+DBxKPthZ768hbKsO3d9Gx90=" | ||
[mod."github.com/russross/blackfriday/v2"] | ||
version = "v2.1.0" | ||
hash = "sha256-R+84l1si8az5yDqd5CYcFrTyNZ1eSYlpXKq6nFt4OTQ=" | ||
[mod."github.com/spf13/pflag"] | ||
version = "v1.0.5" | ||
hash = "sha256-w9LLYzxxP74WHT4ouBspH/iQZXjuAh2WQCHsuvyEjAw=" | ||
[mod."github.com/stretchr/objx"] | ||
version = "v0.5.2" | ||
hash = "sha256-VKYxrrFb1nkX6Wu3tE5DoP9+fCttwSl9pgLN6567nck=" | ||
[mod."github.com/stretchr/testify"] | ||
version = "v1.9.0" | ||
hash = "sha256-uUp/On+1nK+lARkTVtb5RxlW15zxtw2kaAFuIASA+J0=" | ||
[mod."github.com/urfave/cli/v2"] | ||
version = "v2.27.4" | ||
hash = "sha256-8gkLizRt7U9BfTok/hTysMt78HBP8syiEJ0eYhFrAvo=" | ||
[mod."github.com/x448/float16"] | ||
version = "v0.8.4" | ||
hash = "sha256-VKzMTMS9pIB/cwe17xPftCSK9Mf4Y6EuBEJlB4by5mE=" | ||
[mod."github.com/xrash/smetrics"] | ||
version = "v0.0.0-20240521201337-686a1a2994c1" | ||
hash = "sha256-CsyN59w6sKERDI5kkdpq0YKmqdixyCHuN4FYE/56/BQ=" | ||
[mod."go.opencensus.io"] | ||
version = "v0.24.0" | ||
hash = "sha256-4H+mGZgG2c9I1y0m8avF4qmt8LUKxxVsTqR8mKgP4yo=" | ||
[mod."go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"] | ||
version = "v0.54.0" | ||
hash = "sha256-LN3VAATkV+DxdH0XaYAVf+FkOuczSb5/QPA7pkIirrU=" | ||
[mod."go.opentelemetry.io/otel"] | ||
version = "v1.29.0" | ||
hash = "sha256-r7tAmSEaiM9EMH7+Qo/iwvo4CE4hu3J7yJd2TQPXym4=" | ||
[mod."go.opentelemetry.io/otel/metric"] | ||
version = "v1.29.0" | ||
hash = "sha256-8gm1J5gCGW6LilOopNh4UlgsY2QaTjhO4py2sV2CSmw=" | ||
[mod."go.opentelemetry.io/otel/trace"] | ||
version = "v1.29.0" | ||
hash = "sha256-VdqoHwkkEZ3lUbgNHJkTThnvXe2pVfun9dFhZhcnouU=" | ||
[mod."golang.org/x/crypto"] | ||
version = "v0.27.0" | ||
hash = "sha256-8HP4+gr4DbXI22GhdgZmCWr1ijtI9HNLsTcE0kltY9o=" | ||
[mod."golang.org/x/net"] | ||
version = "v0.29.0" | ||
hash = "sha256-dH9Rdf5T04KJ4B5WvIZh12ogMbADWiWgIt77nvPTk2k=" | ||
[mod."golang.org/x/oauth2"] | ||
version = "v0.23.0" | ||
hash = "sha256-K1X4ROG88PprttNjZCikDlZw8YYiQIQRdtbZBH3GJgM=" | ||
[mod."golang.org/x/sys"] | ||
version = "v0.25.0" | ||
hash = "sha256-PXZ9EQZ7SFpcL7d3E1+KGTxziYlHEIZPfoXEbnaVD3I=" | ||
[mod."golang.org/x/term"] | ||
version = "v0.24.0" | ||
hash = "sha256-PfC5psjzEWKRm1DlnBXX0ntw9OskJFrq1RRjyBa1lOk=" | ||
[mod."golang.org/x/text"] | ||
version = "v0.18.0" | ||
hash = "sha256-aNvJW4gQs+MTfdz6DZqyyHQS2GJ9W8L8qKPVODPn4+k=" | ||
[mod."golang.org/x/time"] | ||
version = "v0.6.0" | ||
hash = "sha256-gW9TVK9HjLk52lzfo5rBzSunc01gS0+SG2nk0X1w55M=" | ||
[mod."google.golang.org/api"] | ||
version = "v0.197.0" | ||
hash = "sha256-OMqA6/WODEKiiMp79GZ3XjnAC7Sc9XFUJcPTlJgHRSE=" | ||
[mod."google.golang.org/genproto/googleapis/api"] | ||
version = "v0.0.0-20240827150818-7e3bb234dfed" | ||
hash = "sha256-jokCI67natAdpqW41OrF/Ah0JABdl6THx7U7LHq2HCA=" | ||
[mod."google.golang.org/genproto/googleapis/rpc"] | ||
version = "v0.0.0-20240903143218-8af14fe29dc1" | ||
hash = "sha256-4T4DTrmFbqT4tD7PSL7Ie7u8ZN2iwGkhK02nWugssxk=" | ||
[mod."google.golang.org/grpc"] | ||
version = "v1.66.2" | ||
hash = "sha256-ZGEQK9lLC55Jkdifef/SO9mRPwEZmMJPXLH6MAKIGDA=" | ||
[mod."google.golang.org/protobuf"] | ||
version = "v1.34.2" | ||
hash = "sha256-nMTlrDEE2dbpWz50eQMPBQXCyQh4IdjrTIccaU0F3m0=" | ||
[mod."gopkg.in/check.v1"] | ||
version = "v1.0.0-20201130134442-10cb98267c6c" | ||
hash = "sha256-VlIpM2r/OD+kkyItn6vW35dyc0rtkJufA93rjFyzncs=" | ||
[mod."gopkg.in/inf.v0"] | ||
version = "v0.9.1" | ||
hash = "sha256-z84XlyeWLcoYOvWLxPkPFgLkpjyb2Y4pdeGMyySOZQI=" | ||
[mod."gopkg.in/yaml.v2"] | ||
version = "v2.4.0" | ||
hash = "sha256-uVEGglIedjOIGZzHW4YwN1VoRSTK8o0eGZqzd+TNdd0=" | ||
[mod."gopkg.in/yaml.v3"] | ||
version = "v3.0.1" | ||
hash = "sha256-FqL9TKYJ0XkNwJFnq9j0VvJ5ZUU1RvH/52h/f5bkYAU=" | ||
[mod."k8s.io/apimachinery"] | ||
version = "v0.31.1" | ||
hash = "sha256-yj8N0Y4OkmdiidrEq76ysqZoYyKTnB4WmfcZp4uR8gY=" | ||
[mod."k8s.io/client-go"] | ||
version = "v0.31.1" | ||
hash = "sha256-VKS+h00fJtLC8lYqriNzQj95+ic1oMu/QmVLYbyA7P8=" | ||
[mod."k8s.io/klog/v2"] | ||
version = "v2.130.1" | ||
hash = "sha256-n5vls1o1a0V0KYv+3SULq4q3R2Is15K8iDHhFlsSH4o=" | ||
[mod."k8s.io/utils"] | ||
version = "v0.0.0-20240711033017-18e509b52bc8" | ||
hash = "sha256-asDLYotyW+oWIsCmiu9fLuLk77mAsKBkG6QnAbRsyoE=" | ||
[mod."sigs.k8s.io/json"] | ||
version = "v0.0.0-20221116044647-bc3834ca7abd" | ||
hash = "sha256-XDBMN2o450IHiAwEpBVsvo9e7tYZa+EXWrifUNTdNMU=" | ||
[mod."sigs.k8s.io/structured-merge-diff/v4"] | ||
version = "v4.4.1" | ||
hash = "sha256-FcZHHZCKNNZW6/s1T1sKiS5Vj1TpHPmxVWr6YlL60xA=" | ||
[mod."sigs.k8s.io/yaml"] | ||
version = "v1.4.0" | ||
hash = "sha256-Hd/M0vIfIVobDd87eb58p1HyVOjYWNlGq2bRXfmtVno=" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
pkgs, | ||
mkGoEnv ? pkgs.mkGoEnv, | ||
gomod2nix ? pkgs.gomod2nix, | ||
}: let | ||
goEnv = mkGoEnv {pwd = ./.;}; | ||
in | ||
pkgs.mkShell { | ||
packages = [ | ||
goEnv | ||
gomod2nix | ||
]; | ||
} |