move src out of srv, clean up default.nix and Makefile

main
Brian Picciano 2 years ago
parent 5485984e05
commit 4f01edb923
  1. 28
      Makefile
  2. 50
      default.nix
  3. 0
      src/cfg/cfg.go
  4. 0
      src/cfg/cfg_test.go
  5. 0
      src/cfg/data_dir.go
  6. 0
      src/cfg/mediocre_blog.go
  7. 0
      src/cmd/hash-password/main.go
  8. 0
      src/cmd/load-test-data/galaxy.jpg
  9. 0
      src/cmd/load-test-data/main.go
  10. 0
      src/cmd/load-test-data/test-data.yml
  11. 0
      src/cmd/mailinglist-cli/main.go
  12. 0
      src/cmd/mediocre-blog/main.go
  13. 0
      src/go.mod
  14. 0
      src/go.sum
  15. 0
      src/http/api.go
  16. 0
      src/http/apiutil/apiutil.go
  17. 0
      src/http/assets.go
  18. 0
      src/http/auth.go
  19. 0
      src/http/auth_test.go
  20. 0
      src/http/csrf.go
  21. 0
      src/http/drafts.go
  22. 0
      src/http/feed.go
  23. 0
      src/http/index.go
  24. 0
      src/http/mailinglist.go
  25. 0
      src/http/middleware.go
  26. 0
      src/http/posts.go
  27. 0
      src/http/pow.go
  28. 0
      src/http/static/api.js
  29. 0
      src/http/static/component-oriented-design/v1/main.go
  30. 0
      src/http/static/component-oriented-design/v1/main_test.go
  31. 0
      src/http/static/component-oriented-design/v2/main.go
  32. 0
      src/http/static/component-oriented-design/v3/main.go
  33. 0
      src/http/static/markov/Makefile
  34. 0
      src/http/static/markov/markov.nix
  35. 0
      src/http/static/mediocre.css
  36. 0
      src/http/static/new.css
  37. 0
      src/http/static/solvePow.js
  38. 0
      src/http/static/trading-in-the-rain/CW.js
  39. 0
      src/http/static/trading-in-the-rain/Distributor.js
  40. 0
      src/http/static/trading-in-the-rain/MIDI.js/LICENSE.txt
  41. 0
      src/http/static/trading-in-the-rain/MIDI.js/inc/shim/Base64.js
  42. 0
      src/http/static/trading-in-the-rain/MIDI.js/inc/shim/Base64binary.js
  43. 0
      src/http/static/trading-in-the-rain/MIDI.js/inc/shim/WebAudioAPI.js
  44. 0
      src/http/static/trading-in-the-rain/MIDI.js/inc/shim/WebMIDIAPI.js
  45. 0
      src/http/static/trading-in-the-rain/MIDI.js/js/midi/audioDetect.js
  46. 0
      src/http/static/trading-in-the-rain/MIDI.js/js/midi/gm.js
  47. 0
      src/http/static/trading-in-the-rain/MIDI.js/js/midi/loader.js
  48. 0
      src/http/static/trading-in-the-rain/MIDI.js/js/midi/player.js
  49. 0
      src/http/static/trading-in-the-rain/MIDI.js/js/midi/plugin.audiotag.js
  50. 0
      src/http/static/trading-in-the-rain/MIDI.js/js/midi/plugin.webaudio.js
  51. 0
      src/http/static/trading-in-the-rain/MIDI.js/js/midi/plugin.webmidi.js
  52. 0
      src/http/static/trading-in-the-rain/MIDI.js/js/midi/synesthesia.js
  53. 0
      src/http/static/trading-in-the-rain/MIDI.js/js/util/dom_request_script.js
  54. 0
      src/http/static/trading-in-the-rain/MIDI.js/js/util/dom_request_xhr.js
  55. 0
      src/http/static/trading-in-the-rain/MusicBox.js
  56. 0
      src/http/static/trading-in-the-rain/RainCanvas.js
  57. 0
      src/http/static/trading-in-the-rain/SeriesComposer.js
  58. 0
      src/http/static/trading-in-the-rain/key.gpg
  59. 0
      src/http/static/trading-in-the-rain/main.js
  60. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3.js
  61. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/A0.mp3
  62. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/A1.mp3
  63. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/A2.mp3
  64. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/A3.mp3
  65. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/A4.mp3
  66. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/A5.mp3
  67. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/A6.mp3
  68. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/A7.mp3
  69. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/Ab1.mp3
  70. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/Ab2.mp3
  71. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/Ab3.mp3
  72. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/Ab4.mp3
  73. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/Ab5.mp3
  74. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/Ab6.mp3
  75. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/Ab7.mp3
  76. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/B0.mp3
  77. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/B1.mp3
  78. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/B2.mp3
  79. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/B3.mp3
  80. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/B4.mp3
  81. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/B5.mp3
  82. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/B6.mp3
  83. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/B7.mp3
  84. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/Bb0.mp3
  85. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/Bb1.mp3
  86. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/Bb2.mp3
  87. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/Bb3.mp3
  88. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/Bb4.mp3
  89. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/Bb5.mp3
  90. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/Bb6.mp3
  91. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/Bb7.mp3
  92. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/C1.mp3
  93. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/C2.mp3
  94. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/C3.mp3
  95. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/C4.mp3
  96. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/C5.mp3
  97. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/C6.mp3
  98. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/C7.mp3
  99. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/C8.mp3
  100. 0
      src/http/static/trading-in-the-rain/soundfont/acoustic_grand_piano-mp3/D1.mp3
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1,22 +1,22 @@
CONFIG = ./config.nix
BASH = $$(nix-build --no-out-link -A pkgs.bash)/bin/bash
entrypoint:
nix-build -A entrypoint \
--arg config '(import ${CONFIG})'
nix-build -A entrypoint --arg config '(import ${CONFIG})'
install:
$$(nix-build -A install --arg config '(import ${CONFIG})')
install-systemd:
$$(nix-build --no-out-link -A install --arg config '(import ${CONFIG})')
test:
$$(nix-build --no-out-link -A pkgs.bash)/bin/bash srv-dev-env.sh \
--run "cd srv/src && go test ./... -count=1 -tags integration"
@echo "\nTESTS PASSED!\n"
${BASH} tmp-dev-env.sh \
--run "cd src; go test ./... -count=1 -tags integration"
srv.dev-shell:
$$(nix-build --no-out-link -A pkgs.bash)/bin/bash srv-dev-env.sh \
--command "cd srv/src; return"
srv.shell:
nix-shell -A srv.shellWithBuild --arg config '(import ${CONFIG})' \
--command 'cd srv/src; return'
shell:
${BASH} tmp-dev-env.sh \
--command " \
cd src; \
echo 'Loading test data...'; \
(cd cmd/load-test-data && go run main.go); \
return; \
"

@ -1,6 +1,6 @@
{
pkgsArg ? import (fetchTarball {
pkgs ? import (fetchTarball {
name = "nixpkgs-21-05";
url = "https://github.com/NixOS/nixpkgs/archive/7e9b0dff974c89e070da1ad85713ff3c20b0ca97.tar.gz";
sha256 = "1ckzhh24mgz6jd1xhfgx0i9mijk6xjqxwsshnvq789xsavrmsc36";
@ -10,24 +10,60 @@
}: rec {
pkgs = pkgsArg;
inherit pkgs;
srv = pkgs.callPackage (import ./srv) {
inherit config;
};
init = pkgs.writeText "mediocre-blog-init" ''
export MEDIOCRE_BLOG_DATA_DIR="${config.dataDir}"
# mailing list
export MEDIOCRE_BLOG_ML_SMTP_ADDR="${config.mlSMTPAddr}"
export MEDIOCRE_BLOG_ML_SMTP_AUTH="${config.mlSMTPAuth}"
export MEDIOCRE_BLOG_ML_PUBLIC_URL="${config.publicURL}"
# pow
export MEDIOCRE_BLOG_POW_SECRET="${config.powSecret}"
# http
export MEDIOCRE_BLOG_HTTP_PUBLIC_URL="${config.publicURL}"
export MEDIOCRE_BLOG_HTTP_LISTEN_PROTO="${config.httpListenProto}"
export MEDIOCRE_BLOG_HTTP_LISTEN_ADDR="${config.httpListenAddr}"
export MEDIOCRE_BLOG_HTTP_AUTH_USERS='${builtins.toJSON config.httpAuthUsers}'
export MEDIOCRE_BLOG_HTTP_AUTH_RATELIMIT='${config.httpAuthRatelimit}'
'';
bin = pkgs.buildGoModule {
pname = "mediocre-blog";
version = "dev";
src = ./src;
vendorSha256 = "sha256:1vazrrg8rs9n8x40c9r53h9qnyxw59xkp0aq7jl15fliigk6q0cr";
subPackages = [ "cmd/mediocre-blog" ];
# disable tests
checkPhase = '''';
};
entrypoint = pkgs.writeScript "mediocre-blog-entrypoint" ''
#!/bin/sh
#!${pkgs.bash}/bin/bash
set -e
source ${init}
mkdir -p ${config.runDir}
mkdir -p ${config.dataDir}
exec ${srv.bin}
exec ${bin}/bin/mediocre-blog "$@"
'';
shell = pkgs.stdenv.mkDerivation {
name = "mediocre-blog-shell";
buildInputs = [ pkgs.go pkgs.sqlite ];
shellHook = ''
source ${init}
'';
};
service = pkgs.writeText "mediocre-blog" ''
[Unit]
Description=mediocregopher mediocre blog

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save