From 79d838108cf7773a71a6421092d59b52b261e480 Mon Sep 17 00:00:00 2001
From: Garionion <git@entr0py.de>
Date: Sat, 28 Jan 2023 20:55:52 +0100
Subject: [PATCH] feat: link against musl

---
 .drone.yml  | 7 ++++---
 package.nix | 9 ++++++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/.drone.yml b/.drone.yml
index 4220ec5..5eafecb 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -5,9 +5,8 @@ name: default
 steps:
   - name: build
     image: "nixos/nix"
-    environment:
-      USER: root
     commands:
+      - whoami
       - nix --extra-experimental-features 'nix-command flakes' build
 
   - name: upload
@@ -16,7 +15,9 @@ steps:
       TOKEN:
         from_secret: gitea
     commands:
-      - curl --user garionion:$TOKEN --upload-file ./result/bin/tcp-proxy https://git.entr0py.de/api/packages/garionion/generic/tcp-stream-proxy/${DRONE_TAG}/tcp-proxy
+      - realpath ./result/bin/tcp-proxy
+      - export FILE=$(realpath ./result/bin/tcp-proxy)
+      - curl --user garionion:$TOKEN --upload-file $FILE https://git.entr0py.de/api/packages/garionion/generic/tcp-stream-proxy/${DRONE_TAG}/tcp-proxy
     when:
       ref:
         - refs/tags/*
\ No newline at end of file
diff --git a/package.nix b/package.nix
index fbb574b..701f84d 100644
--- a/package.nix
+++ b/package.nix
@@ -1,7 +1,7 @@
 { pkgs ? import <nixpkgs> { } }:
 with pkgs;
 let
-    version = "0.0.1";
+    version = "0.0.2";
     deps = [ ];
     nativeDeps = [ ];
 in
@@ -10,15 +10,18 @@ pkgs.buildGo119Module {
   inherit version;
   src = ./.;
   buildInputs = [
-    stdenv glibc.static
+    stdenv
   ] ++deps;
   nativeBuildInputs = [
+    musl
   ] ++nativeDeps;
   tags = [ ];
+
+  CGO_ENABLED = 0;
   ldflags = [
       "-s" "-w"
       "-linkmode external"
-      "-extldflags -static"
+      "-extldflags '-static -L${musl}/lib'"
     ];
 
   allowGoReference = false;