From d410977305d210727856093291c851487efcf87a Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 18 Nov 2020 02:50:37 +0100 Subject: tv x220: use services.tlp.settings --- tv/2configs/hw/x220.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tv/2configs/hw/x220.nix b/tv/2configs/hw/x220.nix index 61b47553..aadfc669 100644 --- a/tv/2configs/hw/x220.nix +++ b/tv/2configs/hw/x220.nix @@ -48,9 +48,9 @@ }; services.tlp.enable = true; - services.tlp.extraConfig = '' - START_CHARGE_THRESH_BAT0=80 - ''; + services.tlp.settings = { + START_CHARGE_THRESH_BAT0 = 80; + }; nix = { buildCores = 2; -- cgit v1.2.3 From ad9b2a538e4adf2401565997351fb5c3539887ac Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 18 Nov 2020 03:11:28 +0100 Subject: tv config: enable nscd by default --- tv/2configs/default.nix | 3 --- 1 file changed, 3 deletions(-) diff --git a/tv/2configs/default.nix b/tv/2configs/default.nix index 87a5c2e1..07e7ff11 100644 --- a/tv/2configs/default.nix +++ b/tv/2configs/default.nix @@ -90,9 +90,6 @@ with import ; { services.cron.enable = false; - services.nscd.enable = - # Since 20.09 nscd doesn't cache anymore. - versionAtLeast (versions.majorMinor version) "20.09"; services.ntp.enable = false; services.timesyncd.enable = true; } -- cgit v1.2.3 From 5b455f5cca910198dfbb7b0fbd1b01acede64446 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 23 Nov 2020 15:52:51 +0100 Subject: tv elm-package-proxy: add rudimentary publish API --- tv/2configs/elm-packages-proxy.nix | 52 +++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/tv/2configs/elm-packages-proxy.nix b/tv/2configs/elm-packages-proxy.nix index 17a0d230..bc471a32 100644 --- a/tv/2configs/elm-packages-proxy.nix +++ b/tv/2configs/elm-packages-proxy.nix @@ -4,20 +4,43 @@ cfg.packageDir = "/var/lib/elm-packages"; cfg.port = 7782; + # TODO secret files + cfg.htpasswd = "/var/lib/certs/package.elm-lang.org/htpasswd"; + cfg.sslCertificate = "/var/lib/certs/package.elm-lang.org/fullchain.pem"; + cfg.sslCertificateKey = "/var/lib/certs/package.elm-lang.org/key.pem"; + + semverRegex = + "(?0|[1-9]\\d*)\\.(?0|[1-9]\\d*)\\.(?0|[1-9]\\d*)(?:-(?(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+(?[0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?"; + in { services.nginx.virtualHosts."package.elm-lang.org" = { addSSL = true; - # TODO secret files - sslCertificate = "/var/lib/certs/package.elm-lang.org/fullchain.pem"; - sslCertificateKey = "/var/lib/certs/package.elm-lang.org/key.pem"; + sslCertificate = cfg.sslCertificate; + sslCertificateKey = cfg.sslCertificateKey; locations."/all-packages/since/".extraConfig = '' proxy_pass http://127.0.0.1:${toString config.krebs.htgen.elm-packages-proxy.port}; proxy_pass_header Server; ''; - locations."~ ^/packages/(?[A-Za-z0-9-]+)/(?[A-Za-z0-9-]+)/(?(?0|[1-9]\\d*)\\.(?0|[1-9]\\d*)\\.(?0|[1-9]\\d*)(?:-(?(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+(?[0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?)/(?:zipball|elm.json|endpoint.json)\$".extraConfig = '' + locations."~ ^/packages/(?[A-Za-z0-9-]+)/(?[A-Za-z0-9-]+)/(?${semverRegex})\$".extraConfig = '' + auth_basic "Restricted Area"; + auth_basic_user_file ${cfg.htpasswd}; + + proxy_set_header X-Author $author; + proxy_set_header X-Package $pname; + proxy_set_header X-Version $version; + proxy_pass_header Server; + + if ($request_method != POST) { + return 405; + } + + proxy_pass http://127.0.0.1:${toString config.krebs.htgen.elm-packages-proxy.port}; + ''; + + locations."~ ^/packages/(?[A-Za-z0-9-]+)/(?[A-Za-z0-9-]+)/(?${semverRegex})/(?:zipball|elm.json|endpoint.json)\$".extraConfig = '' set $zipball "${cfg.packageDir}/$author/$pname/$version/zipball"; proxy_set_header X-Author $author; proxy_set_header X-Package $pname; @@ -119,6 +142,27 @@ in { ;; esac ;; + 'POST /packages/'*) + + author=$req_x_author + pname=$req_x_package + version=$req_x_version + + zipball=${cfg.packageDir}/$author/$pname/$version/zipball + + if test -e "$zipball"; then + string_response 409 Conflict \ + "package already exists: $author/$pname@$version" \ + text/plain + else + mkdir -p "$(dirname "$zipball")" + head -c $req_content_length > "$zipball" + string_response 200 OK \ + "package created: $author/$pname@$version" \ + text/plain + fi + exit + ;; 'POST /all-packages/since/'*) # TODO only show newest? -- cgit v1.2.3 From f9e11a96488d5404cab04244b044d7be371eb45e Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 23 Nov 2020 15:54:13 +0100 Subject: tv elm-package-proxy: list newest packages first --- tv/2configs/elm-packages-proxy.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tv/2configs/elm-packages-proxy.nix b/tv/2configs/elm-packages-proxy.nix index bc471a32..cc1e119c 100644 --- a/tv/2configs/elm-packages-proxy.nix +++ b/tv/2configs/elm-packages-proxy.nix @@ -165,7 +165,6 @@ in { ;; 'POST /all-packages/since/'*) - # TODO only show newest? my_packages=$( cd ${cfg.packageDir} find -mindepth 3 -maxdepth 3 | @@ -174,7 +173,9 @@ in { map( select(.!="") | sub("^\\./(?[^/]+)/(?[^/]+)/(?[^/]+)$";"\(.author)/\(.pname)@\(.version)") - ) + ) | + sort_by(split("@") | [.[0]]+(.[1]|split("."))) | + reverse ' ) -- cgit v1.2.3 From fe4d6d217f2e26dca3412b5d682ac830e2ec7141 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 23 Nov 2020 16:02:06 +0100 Subject: tv elm-package-proxy: log uploads --- tv/2configs/elm-packages-proxy.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tv/2configs/elm-packages-proxy.nix b/tv/2configs/elm-packages-proxy.nix index cc1e119c..7961bce3 100644 --- a/tv/2configs/elm-packages-proxy.nix +++ b/tv/2configs/elm-packages-proxy.nix @@ -28,6 +28,7 @@ in { auth_basic "Restricted Area"; auth_basic_user_file ${cfg.htpasswd}; + proxy_set_header X-User $remote_user; proxy_set_header X-Author $author; proxy_set_header X-Package $pname; proxy_set_header X-Version $version; @@ -146,6 +147,7 @@ in { author=$req_x_author pname=$req_x_package + user=$req_x_user version=$req_x_version zipball=${cfg.packageDir}/$author/$pname/$version/zipball @@ -155,6 +157,7 @@ in { "package already exists: $author/$pname@$version" \ text/plain else + echo "user $user is uploading package $pname@$version" >&2 mkdir -p "$(dirname "$zipball")" head -c $req_content_length > "$zipball" string_response 200 OK \ -- cgit v1.2.3 From ab1ba36b8fc8d6fa26ed5b0e4210daf33f56bcf9 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 24 Nov 2020 20:13:48 +0100 Subject: tv gitrepos: add mailaids --- tv/2configs/gitrepos.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tv/2configs/gitrepos.nix b/tv/2configs/gitrepos.nix index 59090c8e..991281ed 100644 --- a/tv/2configs/gitrepos.nix +++ b/tv/2configs/gitrepos.nix @@ -83,6 +83,9 @@ let { krops = { cgit.desc = "deployment tools"; }; + mailaids = { + cgit.desc = "Assortment of aids for working with electronic mail"; + }; much = {}; netcup = { cgit.desc = "netcup command line interface"; -- cgit v1.2.3 From 5022ddc71b74c276974c07a4d1cb669ca0dfc35c Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 24 Nov 2020 20:19:05 +0100 Subject: tv mailaids: init at 1.0.0 --- tv/5pkgs/haskell/mailaids.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tv/5pkgs/haskell/mailaids.nix diff --git a/tv/5pkgs/haskell/mailaids.nix b/tv/5pkgs/haskell/mailaids.nix new file mode 100644 index 00000000..b705c7c6 --- /dev/null +++ b/tv/5pkgs/haskell/mailaids.nix @@ -0,0 +1,21 @@ +{ mkDerivation, aeson, aeson-pretty, base, bytestring +, case-insensitive, fetchgit, lens, optparse-applicative +, purebred-email, stdenv, text, vector, word8 +}: +mkDerivation { + pname = "mailaids"; + version = "1.0.0"; + src = fetchgit { + url = "https://cgit.krebsco.de/mailaids"; + sha256 = "15h0k82czm89gkwhp1rwdy77jz8dmb626qdz7c2narvz9j7169v5"; + rev = "8f11927ea74d6adb332c884502ebd9c486837523"; + fetchSubmodules = true; + }; + isLibrary = false; + isExecutable = true; + executableHaskellDepends = [ + aeson aeson-pretty base bytestring case-insensitive lens + optparse-applicative purebred-email text vector word8 + ]; + license = stdenv.lib.licenses.mit; +} -- cgit v1.2.3 From 64c99a011f3e709dae034fe1b0c3950ba4e8b57b Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 25 Nov 2020 21:44:18 +0100 Subject: tv editor-input: init --- tv/5pkgs/simple/editor-input.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tv/5pkgs/simple/editor-input.nix diff --git a/tv/5pkgs/simple/editor-input.nix b/tv/5pkgs/simple/editor-input.nix new file mode 100644 index 00000000..931179af --- /dev/null +++ b/tv/5pkgs/simple/editor-input.nix @@ -0,0 +1,18 @@ +{ pkgs }: +pkgs.writeDashBin "editor-input" '' + exec \ + ${pkgs.utillinux}/bin/setsid -f \ + ${pkgs.with-tmpdir}/bin/with-tmpdir -t editor-input.XXXXXXXX \ + ${pkgs.writeDash "editor-input.sh" '' + f=$TMPDIR/input + ${pkgs.rxvt_unicode}/bin/urxvt -name editor-input-urxvt -e \ + ${pkgs.vim}/bin/vim --cmd ':set noeol binary' -c startinsert "$f" + if test -e "$f"; then + ${pkgs.xsel}/bin/xsel -ip < "$f" + ${pkgs.xsel}/bin/xsel -ib < "$f" + ${pkgs.xdotool}/bin/xdotool key --clearmodifiers shift+Insert + ${pkgs.xsel}/bin/xsel -dp + ${pkgs.xsel}/bin/xsel -db + fi + ''} +'' -- cgit v1.2.3 From 05538a6aed36c62381f7b68d1d03131b2b5b9d4f Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 25 Nov 2020 23:12:03 +0100 Subject: tv rxvt_unicode: do not call perl_destruct --- tv/5pkgs/override/rxvt_unicode.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tv/5pkgs/override/rxvt_unicode.nix b/tv/5pkgs/override/rxvt_unicode.nix index da657fb2..971a03d9 100644 --- a/tv/5pkgs/override/rxvt_unicode.nix +++ b/tv/5pkgs/override/rxvt_unicode.nix @@ -5,5 +5,11 @@ rxvt_unicode.overrideAttrs (old: { url = https://cgit.krebsco.de/rxvt-unicode/patch/?id=15f3f94; sha256 = "12vldwsds27c9l15ffc6svk9mj17jhypcz736pvpmpqbsymlkz2p"; }) + + # Fix segfault when calling editor-input from XMonad. + (fetchurl { + url = "https://cgit.krebsco.de/rxvt-unicode/patch/?id=d63f96a"; + sha256 = "0i8nqrqgprv7cygflkrdp5zx75dv9bv84vrr2yc3vnfpqxamc43n"; + }) ]; }) -- cgit v1.2.3 From ba1bc1e8d493fd785d01fe39025cfe8888d72813 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 25 Nov 2020 23:12:39 +0100 Subject: tv rxvt_unicode: name patches sensibly --- tv/5pkgs/override/rxvt_unicode.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tv/5pkgs/override/rxvt_unicode.nix b/tv/5pkgs/override/rxvt_unicode.nix index 971a03d9..4d9c3abc 100644 --- a/tv/5pkgs/override/rxvt_unicode.nix +++ b/tv/5pkgs/override/rxvt_unicode.nix @@ -2,12 +2,14 @@ rxvt_unicode.overrideAttrs (old: { patches = old.patches ++ [ (fetchurl { + name = "rxvt-unicode.cancel-running-selection-request.patch"; url = https://cgit.krebsco.de/rxvt-unicode/patch/?id=15f3f94; sha256 = "12vldwsds27c9l15ffc6svk9mj17jhypcz736pvpmpqbsymlkz2p"; }) # Fix segfault when calling editor-input from XMonad. (fetchurl { + name = "rxvt-unicode.no-perl_destruct.patch"; url = "https://cgit.krebsco.de/rxvt-unicode/patch/?id=d63f96a"; sha256 = "0i8nqrqgprv7cygflkrdp5zx75dv9bv84vrr2yc3vnfpqxamc43n"; }) -- cgit v1.2.3 From 4d31a33a7241ca3aee36c8ae45f5b3992bc2555c Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 27 Nov 2020 10:55:21 +0100 Subject: tv elm-package-proxy: add POST /all-packages --- tv/2configs/elm-packages-proxy.nix | 63 ++++++++++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 16 deletions(-) diff --git a/tv/2configs/elm-packages-proxy.nix b/tv/2configs/elm-packages-proxy.nix index 7961bce3..b8bbcff4 100644 --- a/tv/2configs/elm-packages-proxy.nix +++ b/tv/2configs/elm-packages-proxy.nix @@ -19,6 +19,11 @@ in { sslCertificate = cfg.sslCertificate; sslCertificateKey = cfg.sslCertificateKey; + locations."/all-packages".extraConfig = '' + proxy_pass http://127.0.0.1:${toString config.krebs.htgen.elm-packages-proxy.port}; + proxy_pass_header Server; + ''; + locations."/all-packages/since/".extraConfig = '' proxy_pass http://127.0.0.1:${toString config.krebs.htgen.elm-packages-proxy.port}; proxy_pass_header Server; @@ -166,11 +171,47 @@ in { fi exit ;; + 'POST /all-packages') + + response=$(mktemp -t htgen.$$.elm-packages-proxy.all-packages.XXXXXXXX) + trap "rm $response >&2" EXIT + + { + # upstream packages + curl -fsS https://package.elm-lang.org"$Request_URI" + + # private packages + (cd ${cfg.packageDir}; find -mindepth 3 -maxdepth 3) | + jq -Rs ' + split("\n") | + map( + select(.!="") | + match("^\\./(?[^/]+)/(?[^/]+)/(?[^/]+)$").captures | + map({key:.name,value:.string}) | + from_entries + ) | + reduce .[] as $item ({}; + ($item|"\(.author)/\(.pname)") as $name | + . + { "\($name)": ((.[$name] // []) + [$item.version]) } + ) + ' + } | + jq -cs add > $response + + file_response 200 OK "$response" 'application/json; charset=UTF-8' + exit + ;; 'POST /all-packages/since/'*) - my_packages=$( - cd ${cfg.packageDir} - find -mindepth 3 -maxdepth 3 | + response=$(mktemp -t htgen.$$.elm-packages-proxy.all-packages.XXXXXXXX) + trap "rm $response >&2" EXIT + + { + # upstream packages + curl -fsS https://package.elm-lang.org"$Request_URI" + + # private packages + (cd ${cfg.packageDir}; find -mindepth 3 -maxdepth 3) | jq -Rs ' split("\n") | map( @@ -180,20 +221,10 @@ in { sort_by(split("@") | [.[0]]+(.[1]|split("."))) | reverse ' - ) - - new_upstream_packages=$( - curl -fsS https://package.elm-lang.org"$Request_URI" - ) - - response=$( - jq -n \ - --argjson my_packages "$my_packages" \ - --argjson new_upstream_packages "$new_upstream_packages" \ - '$new_upstream_packages + $my_packages' - ) + } | + jq -cs add > $response - string_response 200 OK "$response" 'application/json; charset=UTF-8' + file_response 200 OK "$response" 'application/json; charset=UTF-8' exit ;; esac -- cgit v1.2.3 From a054df1437fda82f5a8f85962cfea2b7a053cf74 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 27 Nov 2020 10:55:38 +0100 Subject: tv elm-package-proxy: don't append garbage on OK --- tv/2configs/elm-packages-proxy.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tv/2configs/elm-packages-proxy.nix b/tv/2configs/elm-packages-proxy.nix index b8bbcff4..5c2900e1 100644 --- a/tv/2configs/elm-packages-proxy.nix +++ b/tv/2configs/elm-packages-proxy.nix @@ -68,7 +68,7 @@ in { krebs.htgen.elm-packages-proxy = { port = cfg.port; - script = /* sh */ ''(. ${pkgs.writeDash "elm-packages-proxy.sh" '' + script = /* sh */ ''. ${pkgs.writeDash "elm-packages-proxy.sh" '' PATH=${lib.makeBinPath [ pkgs.coreutils pkgs.curl @@ -228,6 +228,6 @@ in { exit ;; esac - ''})''; + ''}''; }; } -- cgit v1.2.3 From f654a4ce8643d64706c56461ac3c389df71dc541 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 27 Nov 2020 11:27:42 +0100 Subject: tv elm-package-proxy: unzip -> p7zip --- tv/2configs/elm-packages-proxy.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tv/2configs/elm-packages-proxy.nix b/tv/2configs/elm-packages-proxy.nix index 5c2900e1..4a0491b0 100644 --- a/tv/2configs/elm-packages-proxy.nix +++ b/tv/2configs/elm-packages-proxy.nix @@ -75,7 +75,7 @@ in { pkgs.findutils pkgs.gnugrep pkgs.jq - pkgs.unzip + pkgs.p7zip ]} export PATH file_response() {( @@ -128,7 +128,7 @@ in { ;; elm.json) if ! test -f "$elmjson"; then - unzip -p "$zipball" \*/elm.json > "$elmjson" + 7z x -so "$zipball" \*/elm.json > "$elmjson" fi file_response 200 OK "$elmjson" 'application/json; charset=UTF-8' exit -- cgit v1.2.3 From dc23115abef2b02d7566cc2303abcb15c15dbcfb Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 27 Nov 2020 12:04:51 +0100 Subject: tv elm-package-proxy: log qualified package names --- tv/2configs/elm-packages-proxy.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tv/2configs/elm-packages-proxy.nix b/tv/2configs/elm-packages-proxy.nix index 4a0491b0..67be0478 100644 --- a/tv/2configs/elm-packages-proxy.nix +++ b/tv/2configs/elm-packages-proxy.nix @@ -162,7 +162,7 @@ in { "package already exists: $author/$pname@$version" \ text/plain else - echo "user $user is uploading package $pname@$version" >&2 + echo "user $user is uploading package $author/$pname@$version" >&2 mkdir -p "$(dirname "$zipball")" head -c $req_content_length > "$zipball" string_response 200 OK \ -- cgit v1.2.3 From be9250c92277bec7672e6f23ced21820888ea065 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 28 Nov 2020 10:33:01 +0100 Subject: tv exim-smarthost: RIP destroy.dyn.shackspace.de --- tv/2configs/exim-smarthost.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/tv/2configs/exim-smarthost.nix b/tv/2configs/exim-smarthost.nix index 68fbcd15..4a0dcf61 100644 --- a/tv/2configs/exim-smarthost.nix +++ b/tv/2configs/exim-smarthost.nix @@ -26,7 +26,6 @@ with import ; { from = "postmaster@viljetic.de"; to = tv.mail; } # RFC 822 { from = "mirko@viljetic.de"; to = mv-ni.mail; } { from = "tomislav@viljetic.de"; to = tv.mail; } - { from = "tv@destroy.dyn.shackspace.de"; to = tv.mail; } { from = "tv@viljetic.de"; to = tv.mail; } { from = "tv@shackspace.de"; to = tv.mail; } ]; -- cgit v1.2.3 From 08e9db31d6b20cbef0a10414e135cb58b39f91e5 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 2 Dec 2020 00:43:07 +0100 Subject: tv elm-package-proxy: allow GET on /all-packages --- tv/2configs/elm-packages-proxy.nix | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tv/2configs/elm-packages-proxy.nix b/tv/2configs/elm-packages-proxy.nix index 67be0478..ecced3da 100644 --- a/tv/2configs/elm-packages-proxy.nix +++ b/tv/2configs/elm-packages-proxy.nix @@ -39,10 +39,6 @@ in { proxy_set_header X-Version $version; proxy_pass_header Server; - if ($request_method != POST) { - return 405; - } - proxy_pass http://127.0.0.1:${toString config.krebs.htgen.elm-packages-proxy.port}; ''; @@ -171,7 +167,7 @@ in { fi exit ;; - 'POST /all-packages') + 'GET /all-packages'|'POST /all-packages') response=$(mktemp -t htgen.$$.elm-packages-proxy.all-packages.XXXXXXXX) trap "rm $response >&2" EXIT @@ -201,7 +197,7 @@ in { file_response 200 OK "$response" 'application/json; charset=UTF-8' exit ;; - 'POST /all-packages/since/'*) + 'GET /all-packages/since/'*|'POST /all-packages/since/'*) response=$(mktemp -t htgen.$$.elm-packages-proxy.all-packages.XXXXXXXX) trap "rm $response >&2" EXIT -- cgit v1.2.3 From 29827720520b6a4885dbdcb3237070e6e45dd910 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 1 Dec 2020 23:11:59 +0100 Subject: cabal-read: make compatible with Cabal >=3.0.0 --- krebs/5pkgs/simple/cabal-read.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/krebs/5pkgs/simple/cabal-read.nix b/krebs/5pkgs/simple/cabal-read.nix index f8fc71e0..03b42ef2 100644 --- a/krebs/5pkgs/simple/cabal-read.nix +++ b/krebs/5pkgs/simple/cabal-read.nix @@ -5,6 +5,7 @@ writeHaskellPackage "cabal-read" { executables.ghc-options = { extra-depends = ["Cabal"]; text = /* haskell */ '' + {-# LANGUAGE CPP #-} module Main (main) where import Data.List import Data.Maybe @@ -26,6 +27,9 @@ writeHaskellPackage "cabal-read" { case lookup (mkUnqualComponentName name) (condExecutables desc) of Just exe -> putStrLn . intercalate " " . fromMaybe [] . lookup GHC + #if MIN_VERSION_Cabal(3,0,0) + . perCompilerFlavorToList + #endif . options . buildInfo . condTreeData $ exe Nothing -> -- cgit v1.2.3 From 0a5554cd488af0958bc9fb01abdcae3644cbdb0f Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 5 Dec 2020 12:38:30 +0100 Subject: tv elm-package-proxy: add \n to string reponse --- tv/2configs/elm-packages-proxy.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tv/2configs/elm-packages-proxy.nix b/tv/2configs/elm-packages-proxy.nix index ecced3da..9493a40b 100644 --- a/tv/2configs/elm-packages-proxy.nix +++ b/tv/2configs/elm-packages-proxy.nix @@ -98,7 +98,7 @@ in { printf "HTTP/1.1 $status_code $status_reason\r\n" printf 'Connection: close\r\n' - printf 'Content-Length: %d\r\n' ''${#response_body} + printf 'Content-Length: %d\r\n' "$(expr ''${#response_body} + 1)" printf 'Content-Type: %s\r\n' "$content_type" printf 'Server: %s\r\n' "$Server" printf '\r\n' -- cgit v1.2.3 From 2a9d2a1738028c40204eab493840b5dad01ebdb0 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 5 Dec 2020 12:37:42 +0100 Subject: tv elm-package-proxy: allow replacing own packages --- tv/2configs/elm-packages-proxy.nix | 45 +++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/tv/2configs/elm-packages-proxy.nix b/tv/2configs/elm-packages-proxy.nix index 9493a40b..097d706c 100644 --- a/tv/2configs/elm-packages-proxy.nix +++ b/tv/2configs/elm-packages-proxy.nix @@ -66,6 +66,7 @@ in { port = cfg.port; script = /* sh */ ''. ${pkgs.writeDash "elm-packages-proxy.sh" '' PATH=${lib.makeBinPath [ + pkgs.attr pkgs.coreutils pkgs.curl pkgs.findutils @@ -151,20 +152,44 @@ in { user=$req_x_user version=$req_x_version + action=uploading + force=''${req_x_force-false} zipball=${cfg.packageDir}/$author/$pname/$version/zipball + elmjson=$HOME/cache/$author%2F$pname%2F$version%2Felm.json + endpointjson=$HOME/cache/$author%2F$pname%2F$version%2Fendpoint.json if test -e "$zipball"; then - string_response 409 Conflict \ - "package already exists: $author/$pname@$version" \ - text/plain - else - echo "user $user is uploading package $author/$pname@$version" >&2 - mkdir -p "$(dirname "$zipball")" - head -c $req_content_length > "$zipball" - string_response 200 OK \ - "package created: $author/$pname@$version" \ - text/plain + if test "$force" = true; then + zipball_owner=$(attr -q -g X-User "$zipball" || :) + if test "$zipball_owner" = "$req_x_user"; then + action=replacing + rm -f "$elmjson" + rm -f "$endpointjson" + else + string_response 403 Forbidden \ + "package already exists: $author/$pname@$version" \ + text/plain + exit + fi + else + string_response 409 Conflict \ + "package already exists: $author/$pname@$version" \ + text/plain + exit + fi fi + + echo "user $user is $action package $author/$pname@$version" >&2 + # TODO check package + mkdir -p "$(dirname "$zipball")" + head -c $req_content_length > "$zipball" + + attr -q -s X-User -V "$user" "$zipball" || : + + string_response 200 OK \ + "package created: $author/$pname@$version" \ + text/plain + exit ;; 'GET /all-packages'|'POST /all-packages') -- cgit v1.2.3 From 37ef25d0c04d98b963edd6bd2e8f7aee0f5e1d4f Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 6 Dec 2020 23:39:27 +0100 Subject: tv rox-filer: init at 14354e2 --- tv/5pkgs/simple/rox-filer.nix | 113 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 tv/5pkgs/simple/rox-filer.nix diff --git a/tv/5pkgs/simple/rox-filer.nix b/tv/5pkgs/simple/rox-filer.nix new file mode 100644 index 00000000..fe5342b1 --- /dev/null +++ b/tv/5pkgs/simple/rox-filer.nix @@ -0,0 +1,113 @@ +{ autoconf, stdenv, fetchFromGitHub, pkgconfig, libxml2, libSM +, shared-mime-info + +# Even though imported, this causes: +# (rox:32319): Gtk-WARNING **: 20:16:03.163: Could not find the icon 'text-x-log'. The 'hicolor' theme +# was not found either, perhaps you need to install it. +# You can get a copy from: +# http://icon-theme.freedesktop.org/releases +# +# XXX can we use propagatedBuildInputs instead? +, hicolor-icon-theme + +, libxslt, docbook_xml_dtd_412, docbook_xsl +, gtk ? gtk2, gtk2 # This is normally in top-level/all-packages.nix +}: + +let + version = "2.11"; +in stdenv.mkDerivation rec { + name = "rox-filer-${version}-tv"; + + src = fetchFromGitHub { + owner = "seirios"; + repo = "rox-filer"; + rev = "14354e21bf94a5f3906238706f6b7ac968fa7fce"; + sha256 = "07fz6ns9g7bh1764agl8myy3b0j7qvlkns6dq1lsd5kcf4yx201c"; + }; + + nativeBuildInputs = [ + autoconf + docbook_xsl + pkgconfig + libxslt + ]; + + buildInputs = [ libxml2 gtk shared-mime-info hicolor-icon-theme libSM ]; + + #patches = [ + # + #]; + + # go to the source directory after unpacking the sources + setSourceRoot = "export sourceRoot=source/ROX-Filer"; + + ## patch source with defined patches + #patchFlags = "-p0"; + + # patch the main.c to disable the lookup of the APP_DIR environment variable, + # which is used to lookup the location for certain images when rox-filer + # starts; rather override the location with an absolute path to the directory + # where images are stored to prevent having to use a wrapper, which sets the + # APP_DIR environment variable prior to starting rox-filer + preConfigure = '' + (cd src && autoconf) + sed -i -e "s:g_strdup(getenv(\"APP_DIR\")):\"$out\":" src/main.c + mkdir build + cd build + ''; + + preBuild = '' + for f in \ + ../src/Docs/Manual.xml \ + ../src/Docs/Manual-fr.xml \ + ../src/Docs/Manual-it.xml ; + do + substituteInPlace "$f" \ + --replace \ + /usr/share/sgml/docbook/dtd/xml/4.1.2/docbookx.dtd \ + ${docbook_xml_dtd_412}/xml/dtd/docbook/docbookx.dtd + done + make -C ../src/Docs MAN=.. || exit 1 + ''; + + configureScript = "../src/configure"; + + installPhase = '' + mkdir -p "$out" + cd .. + cp -av Help Messages Options.xml ROX images style.css .DirIcon "$out" + + mkdir -p "$out/share/man/man1" + cp -av src/rox.1 "$out/share/man/man1" + + # the main executable + mkdir "$out/bin/" + cp -v ROX-Filer "$out/bin/rox" + + # mime types + mkdir -p "$out/ROX/MIME" + cd "$out/ROX/MIME" + ln -sv text-x-{diff,patch}.png + ln -sv application-x-font-{afm,type1}.png + ln -sv application-xml{,-dtd}.png + ln -sv application-xml{,-external-parsed-entity}.png + ln -sv application-{,rdf+}xml.png + ln -sv application-x{ml,-xbel}.png + ln -sv application-{x-shell,java}script.png + ln -sv application-x-{bzip,xz}-compressed-tar.png + ln -sv application-x-{bzip,lzma}-compressed-tar.png + ln -sv application-x-{bzip-compressed-tar,lzo}.png + ln -sv application-x-{bzip,xz}.png + ln -sv application-x-{gzip,lzma}.png + ln -sv application-{msword,rtf}.png + ''; + + meta = with stdenv.lib; { + description = "Fast, lightweight, gtk2 file manager"; + homepage = http://rox.sourceforge.net/desktop; + license = with licenses; [ gpl2 lgpl2 ]; + platforms = platforms.linux; + maintainers = [ maintainers.eleanor ]; + }; +} -- cgit v1.2.3 From 4075e7a347b2fbd12cd216960300f466b3f7c609 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 6 Dec 2020 23:40:48 +0100 Subject: tv rox-filer: GitHub -> GitLab --- tv/5pkgs/simple/rox-filer.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tv/5pkgs/simple/rox-filer.nix b/tv/5pkgs/simple/rox-filer.nix index fe5342b1..6f00a0b2 100644 --- a/tv/5pkgs/simple/rox-filer.nix +++ b/tv/5pkgs/simple/rox-filer.nix @@ -1,4 +1,4 @@ -{ autoconf, stdenv, fetchFromGitHub, pkgconfig, libxml2, libSM +{ autoconf, stdenv, fetchFromGitLab, pkgconfig, libxml2, libSM , shared-mime-info # Even though imported, this causes: @@ -19,7 +19,7 @@ let in stdenv.mkDerivation rec { name = "rox-filer-${version}-tv"; - src = fetchFromGitHub { + src = fetchFromGitLab { owner = "seirios"; repo = "rox-filer"; rev = "14354e21bf94a5f3906238706f6b7ac968fa7fce"; -- cgit v1.2.3 From eda867803aece664ad3708538abd0d697ee024fc Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 6 Dec 2020 23:47:55 +0100 Subject: tv rox-filer: 14354e2 -> 3c3ad5d --- tv/5pkgs/simple/rox-filer.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tv/5pkgs/simple/rox-filer.nix b/tv/5pkgs/simple/rox-filer.nix index 6f00a0b2..71cb9ca0 100644 --- a/tv/5pkgs/simple/rox-filer.nix +++ b/tv/5pkgs/simple/rox-filer.nix @@ -22,8 +22,8 @@ in stdenv.mkDerivation rec { src = fetchFromGitLab { owner = "seirios"; repo = "rox-filer"; - rev = "14354e21bf94a5f3906238706f6b7ac968fa7fce"; - sha256 = "07fz6ns9g7bh1764agl8myy3b0j7qvlkns6dq1lsd5kcf4yx201c"; + rev = "3c3ad5d85a1ab548574bf450f730886b60092587"; + sha256 = "0h743zpx1v9rrsaxn0q3nwpq8wkjf6icgzrg8jpqldsphw3ygkhr"; }; nativeBuildInputs = [ -- cgit v1.2.3 From 311c93143c80dc363f6e2dac3b9f5fa9834db015 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 7 Dec 2020 00:17:33 +0100 Subject: tv rox-filer: cleanup --- tv/5pkgs/simple/rox-filer.nix | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/tv/5pkgs/simple/rox-filer.nix b/tv/5pkgs/simple/rox-filer.nix index 71cb9ca0..bce89cac 100644 --- a/tv/5pkgs/simple/rox-filer.nix +++ b/tv/5pkgs/simple/rox-filer.nix @@ -1,23 +1,11 @@ -{ autoconf, stdenv, fetchFromGitLab, pkgconfig, libxml2, libSM -, shared-mime-info - -# Even though imported, this causes: -# (rox:32319): Gtk-WARNING **: 20:16:03.163: Could not find the icon 'text-x-log'. The 'hicolor' theme -# was not found either, perhaps you need to install it. -# You can get a copy from: -# http://icon-theme.freedesktop.org/releases -# -# XXX can we use propagatedBuildInputs instead? -, hicolor-icon-theme - +{ autoconf, stdenv, fetchFromGitLab, pkgconfig, libxml2, libSM, shared-mime-info , libxslt, docbook_xml_dtd_412, docbook_xsl -, gtk ? gtk2, gtk2 # This is normally in top-level/all-packages.nix +, gtk ? gtk2, gtk2 }: -let - version = "2.11"; -in stdenv.mkDerivation rec { - name = "rox-filer-${version}-tv"; +stdenv.mkDerivation { + pname = "rox-filer"; + version = "2.11-tv"; src = fetchFromGitLab { owner = "seirios"; @@ -29,22 +17,15 @@ in stdenv.mkDerivation rec { nativeBuildInputs = [ autoconf docbook_xsl - pkgconfig libxslt + pkgconfig ]; - buildInputs = [ libxml2 gtk shared-mime-info hicolor-icon-theme libSM ]; - - #patches = [ - # - #]; + buildInputs = [ libxml2 gtk shared-mime-info libSM ]; # go to the source directory after unpacking the sources setSourceRoot = "export sourceRoot=source/ROX-Filer"; - ## patch source with defined patches - #patchFlags = "-p0"; - # patch the main.c to disable the lookup of the APP_DIR environment variable, # which is used to lookup the location for certain images when rox-filer # starts; rather override the location with an absolute path to the directory @@ -105,7 +86,7 @@ in stdenv.mkDerivation rec { meta = with stdenv.lib; { description = "Fast, lightweight, gtk2 file manager"; - homepage = http://rox.sourceforge.net/desktop; + homepage = "http://rox.sourceforge.net/desktop"; license = with licenses; [ gpl2 lgpl2 ]; platforms = platforms.linux; maintainers = [ maintainers.eleanor ]; -- cgit v1.2.3 From 20d546e8b6755577f79e2df71281ca2b93ef405c Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 9 Dec 2020 16:02:16 +0100 Subject: tv: drop custom boot.initrd.luks.cryptoModules --- tv/1systems/alnus/config.nix | 1 - tv/1systems/mu/config.nix | 1 - tv/1systems/nomic/config.nix | 5 +---- tv/1systems/querel/config.nix | 9 +++------ tv/1systems/wu/config.nix | 5 +---- tv/1systems/xu/config.nix | 5 +---- tv/1systems/zu/config.nix | 5 +---- 7 files changed, 7 insertions(+), 24 deletions(-) diff --git a/tv/1systems/alnus/config.nix b/tv/1systems/alnus/config.nix index ed5fb671..54f845ec 100644 --- a/tv/1systems/alnus/config.nix +++ b/tv/1systems/alnus/config.nix @@ -11,7 +11,6 @@ with import ; boot = { initrd = { availableKernelModules = [ "ahci" ]; - luks.cryptoModules = [ "aes" "sha512" "xts" ]; luks.devices.luksroot.device = "/dev/sda2"; }; }; diff --git a/tv/1systems/mu/config.nix b/tv/1systems/mu/config.nix index b6a25a2b..d5169281 100644 --- a/tv/1systems/mu/config.nix +++ b/tv/1systems/mu/config.nix @@ -15,7 +15,6 @@ with import ; tv.x0vncserver.enable = true; boot.initrd.luks.devices.muca.device = "/dev/sda2"; - boot.initrd.luks.cryptoModules = [ "aes" "sha512" "xts" ]; boot.initrd.availableKernelModules = [ "ahci" ]; boot.kernelModules = [ "fbcon" "kvm-intel" ]; boot.extraModulePackages = [ ]; diff --git a/tv/1systems/nomic/config.nix b/tv/1systems/nomic/config.nix index 38cc6236..4dc0b4e8 100644 --- a/tv/1systems/nomic/config.nix +++ b/tv/1systems/nomic/config.nix @@ -15,10 +15,7 @@ with import ; ]; - boot.initrd.luks = { - cryptoModules = [ "aes" "sha512" "xts" ]; - devices.luks1.device = "/dev/sda2"; - }; + boot.initrd.luks.devices.luks1.device = "/dev/sda2"; # Don't use UEFI because current disk was partitioned/formatted for AO753. # TODO remove following bool.loader section after repartitioning/reformatting diff --git a/tv/1systems/querel/config.nix b/tv/1systems/querel/config.nix index e58a9b21..96d8d2b6 100644 --- a/tv/1systems/querel/config.nix +++ b/tv/1systems/querel/config.nix @@ -11,12 +11,9 @@ with import ; krebs.build.user = mkForce config.krebs.users.itak; boot.initrd.availableKernelModules = [ "ahci" ]; - boot.initrd.luks = { - cryptoModules = [ "aes" "sha512" "xts" ]; - devices.querel-luks1 = { - allowDiscards = true; - device = "/dev/sda2"; - }; + boot.initrd.luks.devices.querel-luks1 = { + allowDiscards = true; + device = "/dev/sda2"; }; boot.kernelModules = [ "kvm-intel" ]; boot.loader = { diff --git a/tv/1systems/wu/config.nix b/tv/1systems/wu/config.nix index d4114f00..f9c3860e 100644 --- a/tv/1systems/wu/config.nix +++ b/tv/1systems/wu/config.nix @@ -16,10 +16,7 @@ with import ; ]; - boot.initrd.luks = { - cryptoModules = [ "aes" "sha512" "xts" ]; - devices.wuca.device = "/dev/sda2"; - }; + boot.initrd.luks.devices.wuca.device = "/dev/sda2"; fileSystems = { "/" = { diff --git a/tv/1systems/xu/config.nix b/tv/1systems/xu/config.nix index 65b49ed9..86c2b13e 100644 --- a/tv/1systems/xu/config.nix +++ b/tv/1systems/xu/config.nix @@ -111,10 +111,7 @@ with import ; } ]; - boot.initrd.luks = { - cryptoModules = [ "aes" "sha512" "xts" ]; - devices.xuca.device = "/dev/sda2"; - }; + boot.initrd.luks.devices.xuca.device = "/dev/sda2"; fileSystems = { "/" = { diff --git a/tv/1systems/zu/config.nix b/tv/1systems/zu/config.nix index 5a69601e..8a3040a3 100644 --- a/tv/1systems/zu/config.nix +++ b/tv/1systems/zu/config.nix @@ -16,10 +16,7 @@ with import ; ]; - boot.initrd.luks = { - cryptoModules = [ "aes" "sha512" "xts" ]; - devices.zuca.device = "/dev/sda2"; - }; + boot.initrd.luks.devices.zuca.device = "/dev/sda2"; fileSystems = { "/" = { -- cgit v1.2.3 From 26b24a49581d1c753ab2bf8fcd0957f61a49dcbb Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 30 Dec 2020 11:26:59 +0100 Subject: tv xu: disable virtualbox --- tv/1systems/xu/config.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/tv/1systems/xu/config.nix b/tv/1systems/xu/config.nix index 86c2b13e..90d90ef3 100644 --- a/tv/1systems/xu/config.nix +++ b/tv/1systems/xu/config.nix @@ -151,6 +151,4 @@ with import ; # The NixOS release to be compatible with for stateful data such as databases. system.stateVersion = "15.09"; - - virtualisation.virtualbox.host.enable = true; } -- cgit v1.2.3 From 9c2529b2910bdb3b73bcd69ed958d82e01bf7943 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 30 Dec 2020 11:58:05 +0100 Subject: htgen: 1.2.8 -> 1.3.0 --- krebs/5pkgs/simple/htgen/default.nix | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/krebs/5pkgs/simple/htgen/default.nix b/krebs/5pkgs/simple/htgen/default.nix index c3f6d177..9ed97242 100644 --- a/krebs/5pkgs/simple/htgen/default.nix +++ b/krebs/5pkgs/simple/htgen/default.nix @@ -1,24 +1,22 @@ -{ coreutils, dash, fetchgit, gnused, stdenv, ucspi-tcp }: -with import ; -let - version = "1.2.8"; -in stdenv.mkDerivation { - name = "htgen-${version}"; +{ fetchgit, lib, pkgs, stdenv }: +stdenv.mkDerivation rec { + pname = "htgen"; + version = "1.3.0"; src = fetchgit { url = "http://cgit.krebsco.de/htgen"; rev = "refs/tags/v${version}"; - sha256 = "046c05jswar2agagqixad3idqxca494aaf199h6bdn02cyzygnpq"; + sha256 = "0p3517wkfpvip4z0axh0b4v1jm1nqpppldnhq4806c0p33vrjxnf"; }; installPhase = '' mkdir -p $out/bin { - echo '#! ${dash}/bin/dash' - echo 'export PATH=${makeBinPath [ - coreutils - gnused - ucspi-tcp + echo '#! ${pkgs.dash}/bin/dash' + echo 'export PATH=${lib.makeBinPath [ + pkgs.coreutils + pkgs.jq + pkgs.ucspi-tcp ]}''${PATH+":$PATH"}' sed 's:^Server=htgen$:&/${version}:' htgen } > $out/bin/htgen -- cgit v1.2.3