From ab742a1ebc61d571bb9d13d7692ef7e245bba192 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 27 Mar 2023 08:32:49 -0300 Subject: Build HTML and install it via CI --- src/infrastructure/guix/packages.scm | 70 +++++++++++++++++++++++++++++++ src/infrastructure/guix/system.scm | 7 ++++ src/infrastructure/scripts/reconfigure.sh | 5 +++ 3 files changed, 82 insertions(+) create mode 100644 src/infrastructure/guix/packages.scm (limited to 'src') diff --git a/src/infrastructure/guix/packages.scm b/src/infrastructure/guix/packages.scm new file mode 100644 index 0000000..c2f76e1 --- /dev/null +++ b/src/infrastructure/guix/packages.scm @@ -0,0 +1,70 @@ +(define-module (packages) + #:use-module ((ice-9 popen) #:prefix popen:) + #:use-module ((ice-9 rdelim) #:prefix rdelim:) + #:use-module ((org euandre queue) #:prefix queue:) + #:use-module ((xyz euandreh heredoc) #:prefix heredoc:) + #:use-module (gnu) + #:use-module (guix build utils) + #:use-module (guix build-system gnu) + #:use-module (guix packages)) +(use-package-modules + check + finance + groff + haskell-apps + haskell-xyz + imagemagick + python + python-web + python-xyz + version-control) +(heredoc:enable-syntax) + + +(define working-dir + (if (directory-exists? "/opt/deploy/current") + "/opt/deploy/current" + (canonicalize-path "."))) + +(define version-cmd #"- + if grep -q deployer /etc/passwd && [ -e /opt/deploy/current ]; then + sudo -u deployer git -C /opt/deploy/current rev-parse HEAD + else + git rev-parse HEAD + fi + "#) + +(define repo-version + (let* ((port (popen:open-input-pipe version-cmd)) + (v (rdelim:read-line port))) + (popen:close-pipe port) + v)) + +(define-public servers + (package + (name "servers") + (version repo-version) + (source + (local-file working-dir #:recursive? #t)) + (build-system gnu-build-system) + (arguments + (list + #:make-flags #~(list (string-append "PREFIX=" %output)) + #:phases + #~(modify-phases %standard-phases + (delete 'configure) + (add-after 'install 'installcheck + (lambda* (#:key make-flags #:allow-other-keys) + (define dash-j (format #f "-j~a" (parallel-job-count))) + (apply invoke "make" dash-j "installcheck" make-flags)))))) + (native-inputs + (list + git-minimal + shellcheck)) + (home-page #f) + (synopsis #f) + (description #f) + (license #f))) + +(list + servers) diff --git a/src/infrastructure/guix/system.scm b/src/infrastructure/guix/system.scm index 0cc8377..9257cc6 100644 --- a/src/infrastructure/guix/system.scm +++ b/src/infrastructure/guix/system.scm @@ -40,6 +40,12 @@ "/opt/deploy/current" (canonicalize-path "."))) +(add-to-load-path + (string-append working-dir "/src/infrastructure/guix")) +(use-modules + ((packages) #:prefix packages:)) + + (define (str . rest) (apply string-append rest)) @@ -307,6 +313,7 @@ trash-cli tree)) (list + packages:servers (script "gc" (file "src/infrastructure/scripts/gc.sh")) (script "check" (file "src/infrastructure/scripts/check.sh")) (script "backup" (file "src/infrastructure/scripts/backup.sh")) diff --git a/src/infrastructure/scripts/reconfigure.sh b/src/infrastructure/scripts/reconfigure.sh index 51c7de8..4936e07 100755 --- a/src/infrastructure/scripts/reconfigure.sh +++ b/src/infrastructure/scripts/reconfigure.sh @@ -130,5 +130,10 @@ else sudo -i guix system -c$NPROC -v3 reconfigure /etc/guix/system.scm + rsync \ + --chmod=D775,F664 \ + -a \ + --exclude='dev/ci/*' \ + /run/current-system/profile/share/doc/servers/ /srv/www/s/servers/ deploy fi -- cgit v1.2.3