Compare commits

...

3 Commits

Author SHA1 Message Date
Brian Picciano
61aa5ee1fb Upgrade nebula to 1.6.1 2022-10-07 15:46:35 +02:00
Brian Picciano
1c3fa3341e Move each overlay into its own file 2022-10-07 15:40:38 +02:00
Brian Picciano
f6a59961bd Upgrade nix pkgs to 22-05 2022-10-07 15:19:10 +02:00
4 changed files with 85 additions and 58 deletions

27
nix/nebula.nix Normal file
View File

@ -0,0 +1,27 @@
{
buildGoModule,
fetchFromGitHub,
}: buildGoModule rec {
pname = "nebula";
# If this changes, remember to change:
# - the AppDir/etc/daemon.yml vpn.firewall docs
# - the version imported in go-workspace
version = "1.6.1";
src = fetchFromGitHub {
owner = "slackhq";
repo = pname;
rev = "v${version}";
sha256 = "sha256-IsLSlQsrfw3obkz4jHL23BRQY2fviGbPEvs5j0zkdX0=";
};
vendorSha256 = "sha256-GvMiOEC3Y/pGG++Z+XCgLVADKymUR9shDxjx3xIz8u0=";
subPackages = [ "cmd/nebula" "cmd/nebula-cert" ];
ldflags = [ "-X main.Build=${version}" ];
}

View File

@ -2,76 +2,39 @@ rec {
overlays = [ overlays = [
(final: prev: { # Make both buildGoModules use static compilation by default.
(final: prev:
# rebase is a helper which takes all files/dirs under oldroot, and let
# creates a new derivation with those files/dirs copied under newroot
# (where newroot is a relative path to the root of the derivation).
rebase = name: oldroot: newroot: prev.stdenv.mkDerivation {
name = name;
inherit oldroot newroot;
builder = builtins.toFile "builder.sh" ''
source $stdenv/setup
mkdir -p "$out"/"$newroot"
cp -rL "$oldroot"/* "$out"/"$newroot"
'';
};
# make buildGoModule default to static compilation buildArgs = {
buildGoModule = args: prev.buildGoModule ({
doCheck = false; doCheck = false;
CGO_ENABLED=0; CGO_ENABLED=0;
tags = [ "netgo" "timetzdata" ]; tags = [ "netgo" "timetzdata" ];
ldflags = [ "-w" "-extldflags=-static" ]; ldflags = [ "-w" "-extldflags=-static" ];
} // args);
})
(final: prev: {
yq-go = prev.buildGoModule rec {
pname = "yq-go";
version = "4.21.1";
src = prev.fetchFromGitHub {
owner = "mikefarah";
repo = "yq";
rev = "v${version}";
sha256 = "sha256-283xe7FVHYSsRl4cZD7WDzIW1gqNAFsNrWYJkthZheU=";
}; };
vendorSha256 = "sha256-F11FnDYJ59aKrdRXDPpKlhX52yQXdaN1sblSkVI2j9w="; in {
};
nebula = prev.buildGoModule rec { buildGoModule = args: prev.buildGoModule (buildArgs // args);
pname = "nebula"; buildGo118Module = args: prev.buildGo118Module (buildArgs // args);
# If this changes, remember to change: }
# - the AppDir/etc/daemon.yml vpn.firewall docs )
# - the version imported in go-workspace
version = "1.4.0";
src = prev.fetchFromGitHub { (final: prev: { rebase = prev.callPackage ./rebase.nix {}; })
owner = "slackhq"; (final: prev: { yq-go = prev.callPackage ./yq-go.nix {}; })
repo = pname;
rev = "v${version}";
sha256 = "lu2/rSB9cFD7VUiK+niuqCX9CI2x+k4Pi+U5yksETSU=";
};
vendorSha256 = "p1inJ9+NAb2d81cn+y+ofhxFz9ObUiLgj+9cACa6Jqg="; (final: prev: { nebula = prev.callPackage ./nebula.nix {
buildGoModule = prev.buildGo118Module;
subPackages = [ "cmd/nebula" "cmd/nebula-cert" ]; }; })
};
})
]; ];
stableSrc = fetchTarball { stableSrc = fetchTarball {
name = "nixpkgs-21-05"; name = "nixpkgs-22-05";
url = "https://github.com/NixOS/nixpkgs/archive/7e9b0dff974c89e070da1ad85713ff3c20b0ca97.tar.gz"; url = "https://github.com/NixOS/nixpkgs/archive/2aec372cdcd4d73b94863611fea70e0884270fdc.tar.gz";
sha256 = "1ckzhh24mgz6jd1xhfgx0i9mijk6xjqxwsshnvq789xsavrmsc36"; sha256 = "1pbfhlh4v8l70p44gspsci3i6w0wk70vaisiawg3jhka2nxb8367";
}; };
stable = import stableSrc { inherit overlays; }; stable = import stableSrc { inherit overlays; };

18
nix/rebase.nix Normal file
View File

@ -0,0 +1,18 @@
# rebase is a helper which takes all files/dirs under oldroot, and
# creates a new derivation with those files/dirs copied under newroot
# (where newroot is a relative path to the root of the derivation).
{
stdenv,
}: name: oldroot: newroot: stdenv.mkDerivation {
inherit name oldroot newroot;
builder = builtins.toFile "builder.sh" ''
source $stdenv/setup
mkdir -p "$out"/"$newroot"
cp -rL "$oldroot"/* "$out"/"$newroot"
'';
}

19
nix/yq-go.nix Normal file
View File

@ -0,0 +1,19 @@
{
buildGoModule,
fetchFromGitHub,
}: buildGoModule rec {
pname = "yq-go";
version = "4.21.1";
src = fetchFromGitHub {
owner = "mikefarah";
repo = "yq";
rev = "v${version}";
sha256 = "sha256-283xe7FVHYSsRl4cZD7WDzIW1gqNAFsNrWYJkthZheU=";
};
vendorSha256 = "sha256-F11FnDYJ59aKrdRXDPpKlhX52yQXdaN1sblSkVI2j9w=";
}