mirror of
https://github.com/bonfire-networks/bonfire-app.git
synced 2024-05-18 09:02:41 +00:00
Add Guix development environment.
This commit is contained in:
parent
a54ea8da09
commit
a228b33288
28
.envrc
28
.envrc
|
@ -1,6 +1,27 @@
|
||||||
use flake
|
if [ "${BONFIRE_DEV_GUIX}" = "true" ]; then
|
||||||
watch_file deps.nix
|
# not sure if this is useful at all or if it could be useful also for nix
|
||||||
watch_file props.nix
|
# it comes from
|
||||||
|
# https://web.archive.org/web/20240207222746/https://lists.gnu.org/archive/html/help-guix/2021-01/msg00166.html
|
||||||
|
mkdir -p .guix-mix
|
||||||
|
mkdir -p .guix-hex
|
||||||
|
export MIX_HOME="${PWD}/.guix-mix"
|
||||||
|
export HEX_HOME="${PWD}/.guix-hex"
|
||||||
|
PATH_add "${MIX_HOME}/bin"
|
||||||
|
PATH_add "${HEX_HOME}/bin"
|
||||||
|
|
||||||
|
export WITH_DOCKER=partial
|
||||||
|
|
||||||
|
use guix git-cal -m manifest.scm
|
||||||
|
|
||||||
|
clear
|
||||||
|
git-cal --author="$(git config user.name)"
|
||||||
|
else
|
||||||
|
use flake
|
||||||
|
watch_file deps.nix
|
||||||
|
watch_file props.nix
|
||||||
|
export WITH_DOCKER=no
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
function env_file_watch {
|
function env_file_watch {
|
||||||
config_file_path="config/${MIX_ENV:-dev}"
|
config_file_path="config/${MIX_ENV:-dev}"
|
||||||
|
@ -12,4 +33,3 @@ function env_file_watch {
|
||||||
}
|
}
|
||||||
|
|
||||||
env_file_watch
|
env_file_watch
|
||||||
export WITH_DOCKER=no
|
|
||||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -4,7 +4,9 @@
|
||||||
/deps/
|
/deps/
|
||||||
/.cache/
|
/.cache/
|
||||||
/.hex/
|
/.hex/
|
||||||
|
/.guix-hex/
|
||||||
/.mix/
|
/.mix/
|
||||||
|
/.guix-mix/
|
||||||
/.nova/
|
/.nova/
|
||||||
/.npm/
|
/.npm/
|
||||||
/.config/
|
/.config/
|
||||||
|
|
2
justfile
2
justfile
|
@ -76,7 +76,7 @@ config:
|
||||||
echo "Switching to flavour '$select_flavour' in $MIX_ENV env..."
|
echo "Switching to flavour '$select_flavour' in $MIX_ENV env..."
|
||||||
just pre-config $select_flavour
|
just pre-config $select_flavour
|
||||||
just pre-setup-env $select_flavour
|
just pre-setup-env $select_flavour
|
||||||
printf "\nNow make sure to finish the flavour setup with 'just setup'. You can also edit your config for flavour '$select_flavour' in /.env and ./config/ more generally."
|
printf "\nNow make sure to finish the flavour setup with 'just setup'. You can also edit your config for flavour '$select_flavour' in /.env and ./config/ more generally.\n"
|
||||||
|
|
||||||
setup:
|
setup:
|
||||||
{{ if MIX_ENV == "prod" { "just setup-prod" } else { "just setup-dev" } }}
|
{{ if MIX_ENV == "prod" { "just setup-prod" } else { "just setup-dev" } }}
|
||||||
|
|
137
manifest.scm
Normal file
137
manifest.scm
Normal file
|
@ -0,0 +1,137 @@
|
||||||
|
(define-module (manifest)
|
||||||
|
#:use-module (gnu packages)
|
||||||
|
#:use-module (gnu packages base)
|
||||||
|
#:use-module (gnu packages bash)
|
||||||
|
#:use-module (gnu packages docker)
|
||||||
|
#:use-module (gnu packages node)
|
||||||
|
#:use-module (guix profiles)
|
||||||
|
#:use-module (guix packages)
|
||||||
|
#:use-module (guix gexp)
|
||||||
|
#:use-module (guix download)
|
||||||
|
#:use-module (guix build-system copy)
|
||||||
|
#:use-module (guix licenses)
|
||||||
|
#:use-module (guix utils)
|
||||||
|
#:use-module (gnu packages node)
|
||||||
|
#:use-module (ice-9 match))
|
||||||
|
|
||||||
|
(define-public docker-compose-plugin
|
||||||
|
(package
|
||||||
|
(inherit docker-compose)
|
||||||
|
(version "2.24.5")
|
||||||
|
(source (origin
|
||||||
|
(method url-fetch)
|
||||||
|
(uri
|
||||||
|
(let ((arch (match (or (%current-target-system) (%current-system))
|
||||||
|
("aarch64-linux" "aarch64")
|
||||||
|
("armhf-linux" "armv7")
|
||||||
|
(_ "x86_64"))))
|
||||||
|
(string-append
|
||||||
|
"https://github.com/docker/compose/releases/download/v"
|
||||||
|
version "/docker-compose-linux-" arch)))
|
||||||
|
(sha256
|
||||||
|
(base32
|
||||||
|
"1qdklhrxm3x7ybhmaycag4q7qqn7snc0yjd1pl5h95fks7hmndcl"))))
|
||||||
|
(build-system copy-build-system)
|
||||||
|
(arguments
|
||||||
|
(list
|
||||||
|
#:substitutable? #f
|
||||||
|
#:install-plan
|
||||||
|
#~'(("docker-compose" "libexec/docker/cli-plugins/"))
|
||||||
|
#:phases
|
||||||
|
#~(modify-phases %standard-phases
|
||||||
|
(replace 'unpack
|
||||||
|
(lambda _
|
||||||
|
(copy-file #$source "./docker-compose")
|
||||||
|
(chmod "docker-compose" #o644)))
|
||||||
|
(add-before 'install 'chmod
|
||||||
|
(lambda _
|
||||||
|
(chmod "docker-compose" #o555)))
|
||||||
|
(add-after 'install 'setup-bin
|
||||||
|
(lambda _
|
||||||
|
(let ((bin (string-append #$output "/bin"))
|
||||||
|
(lib (string-append #$output "/libexec/docker/cli-plugins")))
|
||||||
|
(mkdir bin)
|
||||||
|
(symlink (string-append lib "/docker-compose")
|
||||||
|
(string-append bin "/docker-compose"))))))))))
|
||||||
|
|
||||||
|
(define-public docker-cli-with-docker-compose
|
||||||
|
(package
|
||||||
|
(inherit docker-cli)
|
||||||
|
(arguments
|
||||||
|
(substitute-keyword-arguments (package-arguments docker-cli)
|
||||||
|
((#:phases phases)
|
||||||
|
#~(modify-phases #$phases
|
||||||
|
(add-after 'unpack 'patch-plugin-path
|
||||||
|
(lambda _
|
||||||
|
(substitute* "src/github.com/docker/cli/cli-plugins/manager/manager_unix.go"
|
||||||
|
(("/usr/libexec/docker/cli-plugins")
|
||||||
|
(string-append #$output "/libexec/docker/cli-plugins")))))
|
||||||
|
(add-after 'install 'symlink-plugin
|
||||||
|
(lambda _
|
||||||
|
(let ((plugins-directory
|
||||||
|
(string-append #$output "/libexec/docker/cli-plugins")))
|
||||||
|
(mkdir-p plugins-directory)
|
||||||
|
(symlink (string-append #$(this-package-input "docker-compose")
|
||||||
|
"/libexec/docker/cli-plugins/docker-compose")
|
||||||
|
(string-append plugins-directory "/docker-compose")))))))))
|
||||||
|
(inputs (list docker-compose-plugin))))
|
||||||
|
|
||||||
|
(define-public yarn
|
||||||
|
(package
|
||||||
|
(name "yarn")
|
||||||
|
(version "4.1.0")
|
||||||
|
(source (origin
|
||||||
|
(method url-fetch/tarbomb)
|
||||||
|
(uri (string-append "https://github.com/yarnpkg/yarn/releases/download/v"
|
||||||
|
version
|
||||||
|
"/yarn-v"
|
||||||
|
version
|
||||||
|
".tar.gz"))
|
||||||
|
|
||||||
|
(sha256
|
||||||
|
(base32
|
||||||
|
"0hf15amsn54cbsy4pvqcq2c03d1l11w3799p19sympz4j93gnr66"))))
|
||||||
|
(build-system copy-build-system)
|
||||||
|
(inputs (list coreutils bash-minimal node-lts sed))
|
||||||
|
(arguments
|
||||||
|
(list #:install-plan
|
||||||
|
#~'(("yarn-v1.22.5/bin" "bin")
|
||||||
|
("yarn-v1.22.5/lib" "lib")
|
||||||
|
("yarn-v1.22.5/package.json"
|
||||||
|
"lib/package.json"))
|
||||||
|
#:phases
|
||||||
|
#~(modify-phases %standard-phases
|
||||||
|
(add-after 'install 'delete-powershell-entrypoints
|
||||||
|
(lambda _
|
||||||
|
(delete-file (string-append #$output "/bin/yarn.cmd"))
|
||||||
|
(delete-file (string-append #$output "/bin/yarnpkg.cmd"))))
|
||||||
|
(add-after 'delete-powershell-entrypoints 'wrap-entrypoints
|
||||||
|
(lambda _
|
||||||
|
(for-each
|
||||||
|
(lambda (entrypoint)
|
||||||
|
(wrap-program (string-append #$output "/bin/" entrypoint)
|
||||||
|
`("PATH" = (,(string-append
|
||||||
|
#$output "/bin:"
|
||||||
|
#$(this-package-input "bash-minimal") "/bin:"
|
||||||
|
#$(this-package-input "coreutils") "/bin:"
|
||||||
|
#$(this-package-input "sed") "/bin:"
|
||||||
|
#$(this-package-input "node") "/bin")))))
|
||||||
|
'("yarn" "yarnpkg")))))))
|
||||||
|
(home-page "https://yarnpkg.com/")
|
||||||
|
(synopsis "Dependency management tool for JavaScript")
|
||||||
|
(description "Fast, reliable, and secure dependency management tool
|
||||||
|
for JavaScript. Acts as a drop-in replacement for NodeJS's npm.")
|
||||||
|
(license bsd-2)))
|
||||||
|
|
||||||
|
(packages->manifest
|
||||||
|
(append (list yarn)
|
||||||
|
(map specification->package
|
||||||
|
'("erlang"
|
||||||
|
"elixir"
|
||||||
|
"elixir-hex"
|
||||||
|
"gcc-toolchain"
|
||||||
|
"just"
|
||||||
|
"inotify-tools"
|
||||||
|
"make"
|
||||||
|
"node"
|
||||||
|
"rebar3"))))
|
Loading…
Reference in a new issue