From 701ddad4ce8e56795f7ccd2f34e387b9071e74a7 Mon Sep 17 00:00:00 2001 From: David Guibert Date: Thu, 2 Apr 2020 21:14:27 +0200 Subject: [PATCH] waitron: init at 2020-01-24 --- pkgs/tools/networking/waitron/default.nix | 30 ++++++++++ pkgs/tools/networking/waitron/deps.nix | 57 +++++++++++++++++++ .../waitron/staticfiles-directory.patch | 13 +++++ pkgs/top-level/all-packages.nix | 2 + 4 files changed, 102 insertions(+) create mode 100644 pkgs/tools/networking/waitron/default.nix create mode 100644 pkgs/tools/networking/waitron/deps.nix create mode 100644 pkgs/tools/networking/waitron/staticfiles-directory.patch diff --git a/pkgs/tools/networking/waitron/default.nix b/pkgs/tools/networking/waitron/default.nix new file mode 100644 index 00000000000..cc28455d06a --- /dev/null +++ b/pkgs/tools/networking/waitron/default.nix @@ -0,0 +1,30 @@ +# This file was generated by https://github.com/kamilchm/go2nix v1.3.0 +{ stdenv, buildGoPackage, fetchgit, fetchhg, fetchbzr, fetchsvn }: + +buildGoPackage rec { + name = "waitron-unstable-${version}"; + version = "2020-01-24"; + rev = "c96833619cbb0cf2bc71b1d7b534101e139cc6e6"; + + goPackagePath = "github.com/ns1/waitron"; + + src = fetchgit { + inherit rev; + url = "https://github.com/ns1/waitron"; + sha256 = "0lgw37iq1cvg3mqc94nzf0027mvv721ay8x6dw3fc814ww8a2hb6"; + }; + + patches = [ + ./staticfiles-directory.patch + ]; + + goDeps = ./deps.nix; + + meta = { + description = "A tool to manage network booting of machines"; + homepage = "https://github.com/ns1/waitron"; + license = stdenv.lib.licenses.asl20; + maintainers = with stdenv.lib.maintainers; [ guibert ]; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/tools/networking/waitron/deps.nix b/pkgs/tools/networking/waitron/deps.nix new file mode 100644 index 00000000000..46369c78318 --- /dev/null +++ b/pkgs/tools/networking/waitron/deps.nix @@ -0,0 +1,57 @@ +# This file was generated by https://github.com/kamilchm/go2nix v1.3.0 +[ + { + goPackagePath = "github.com/flosch/pongo2"; + fetch = { + type = "git"; + url = "https://github.com/flosch/pongo2"; + rev = "bbf5a6c351f4d4e883daa40046a404d7553e0a00"; + sha256 = "0yqh58phznnxakm64w82gawrpndb0r85vsd1s7h244qqrq7w4avq"; + }; + } + { + goPackagePath = "github.com/gorilla/handlers"; + fetch = { + type = "git"; + url = "https://github.com/gorilla/handlers"; + rev = "f08afc1876ad882db8074bcb8a4cc96107d3a5f4"; + sha256 = "1ysm6sw3jqa3h8pb5qpqgh44g91c23n3as277sh0vyp7282290jq"; + }; + } + { + goPackagePath = "github.com/juju/errors"; + fetch = { + type = "git"; + url = "https://github.com/juju/errors"; + rev = "d42613fe1ab9e303fc850e7a19fda2e8eeb6516e"; + sha256 = "0qggzzvh9lzlfk8ixlyw8bw645rh0lrjrd367505hhl6cg18v8yf"; + }; + } + { + goPackagePath = "github.com/julienschmidt/httprouter"; + fetch = { + type = "git"; + url = "https://github.com/julienschmidt/httprouter"; + rev = "8c9f31f047a304abedb5614d4a18a843cd5f4a40"; + sha256 = "00f5ja1yslrjclx3sf29mzpcsrpfd15kkw5ygv7n4jsyb4v3xgj6"; + }; + } + { + goPackagePath = "github.com/satori/go.uuid"; + fetch = { + type = "git"; + url = "https://github.com/satori/go.uuid"; + rev = "b2ce2384e17bbe0c6d34077efa39dbab3e09123b"; + sha256 = "1yz4cx02377ijlf8mnn84j1dcmlwh8ncx7y3kw1zg2qw0z4x119c"; + }; + } + { + goPackagePath = "gopkg.in/yaml.v2"; + fetch = { + type = "git"; + url = "https://gopkg.in/yaml.v2"; + rev = "53403b58ad1b561927d19068c655246f2db79d48"; + sha256 = "1inf7svydzscwv9fcjd2rm61a4xjk6jkswknybmns2n58shimapw"; + }; + } +] diff --git a/pkgs/tools/networking/waitron/staticfiles-directory.patch b/pkgs/tools/networking/waitron/staticfiles-directory.patch new file mode 100644 index 00000000000..b1096487fac --- /dev/null +++ b/pkgs/tools/networking/waitron/staticfiles-directory.patch @@ -0,0 +1,13 @@ +diff --git a/main.go b/main.go +index 4046911..a126bae 100644 +--- a/main.go ++++ b/main.go +@@ -411,7 +411,7 @@ func main() { + + if configuration.StaticFilesPath != "" { + fs := http.FileServer(http.Dir(configuration.StaticFilesPath)) +- r.Handler("GET", "/files/:filename", http.StripPrefix("/files/", fs)) ++ r.Handler("GET", "/files/*filepath", http.StripPrefix("/files/", fs)) + log.Println("Serving static files from " + configuration.StaticFilesPath) + } + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b72f851a2f0..2449037ddb2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2103,6 +2103,8 @@ in pixiecore = callPackage ../tools/networking/pixiecore {}; + waitron = callPackage ../tools/networking/waitron {}; + pyCA = python3Packages.callPackage ../applications/video/pyca {}; pyznap = python3Packages.callPackage ../tools/backup/pyznap {};