commit 0ab944bc8376301636137530d41f7da5fe8cbb0f Author: Arne Weiss Date: Thu Jan 12 23:01:41 2023 +0100 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..169217d --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +config.json +result diff --git a/config.json.example b/config.json.example new file mode 100644 index 0000000..2936205 --- /dev/null +++ b/config.json.example @@ -0,0 +1,4 @@ +{ "endpoint":"https://api-ipv4.porkbun.com/api/json/v3", + "apikey": "", + "secretapikey": "" +} \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..b860c30 --- /dev/null +++ b/flake.lock @@ -0,0 +1,45 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1659446231, + "narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "eabc38219184cc3e04a974fe31857d8e0eac098d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-21.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "pbddns": { + "flake": false, + "locked": { + "lastModified": 1668469222, + "narHash": "sha256-wCI3nRh3iMkIE3p4SNfri3o9IY0+6Vskfry1Q/8pXso=", + "owner": "skoobasteeve", + "repo": "porkbun-dynamic-dns-python", + "rev": "19c37dea3e113dfa452d10b04e60dfc892fffa16", + "type": "github" + }, + "original": { + "owner": "skoobasteeve", + "ref": "ddns-no-delete-unless-change", + "repo": "porkbun-dynamic-dns-python", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "pbddns": "pbddns" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..e1c5c74 --- /dev/null +++ b/flake.nix @@ -0,0 +1,30 @@ +{ + description = "Script to refresh the Quantum Go DNS server"; + + inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-21.11; + inputs.pbddns.url = github:skoobasteeve/porkbun-dynamic-dns-python/ddns-no-delete-unless-change; + inputs.pbddns.flake = false; + + outputs = { self, nixpkgs, pbddns }: { + defaultPackage.x86_64-linux = + with import nixpkgs { system = "x86_64-linux"; }; + stdenv.mkDerivation rec { + name = "qgo-dns-refresher"; + src = self; + inherit pbddns; + py3 = python3.withPackages (p: [p.requests]); + buildInputs = [ py3 refreshDns ]; + refreshDns = pkgs.writeShellScriptBin "porkbun-ddns" '' + ${py3}/bin/python3 ${pbddns}/porkbun-ddns.py $1 quantumgo.net + ${py3}/bin/python3 ${pbddns}/porkbun-ddns.py $1 quantumgo.net test + ''; + # buildPhase = "gcc -o hello ./hello.c"; + installPhase = '' + mkdir -p $out/bin + install -t $out/bin $refreshDns/bin/porkbun-ddns + ''; + }; + + }; +} +