about summary refs log tree commit diff
path: root/tools/ipconverter/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'tools/ipconverter/default.nix')
-rw-r--r--tools/ipconverter/default.nix39
1 files changed, 26 insertions, 13 deletions
diff --git a/tools/ipconverter/default.nix b/tools/ipconverter/default.nix
index c4d2f3a..ae08d0f 100644
--- a/tools/ipconverter/default.nix
+++ b/tools/ipconverter/default.nix
@@ -1,15 +1,28 @@
-{ pkgs, buildGoModule, ... }:
-
-buildGoModule rec {
-  name = "ipconverter";
-  src = ./.;
-  vendorSha256 = "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo=";
-  nativeBuildInputs = with pkgs; [ go ];
-
-  meta = with pkgs.lib; {
-    description = "CLI to convert IP addresses to integer and vice versa";
-    license = licenses.mit;
-    platforms = platforms.linux;
-    maintainers = [ ];
+{ lib, python3, stdenvNoCC, pkgs }:
+
+stdenvNoCC.mkDerivation rec {
+  pname = "ipconverter";
+  version = "0.1.0";
+
+  src = ./ipconverter.py;
+
+  buildInputs = [ python3 ];
+
+  dontUnpack = true;
+  dontBuild = true;
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp $src $out/bin/${pname}
+    chmod a+x $out/bin/${pname}
+    ln -s $out/bin/${pname} $out/bin/ip2int
+    ln -s $out/bin/${pname} $out/bin/int2ip
+  '';
+
+  meta = with lib; {
+    description = "Helper script to convert an IP address to an integer.";
+    license = with licenses; [ mit ];
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ fcuny ];
   };
 }