Better dev setup
This commit is contained in:
parent
92a6311027
commit
15cdefda83
4 changed files with 24 additions and 21 deletions
|
@ -13,12 +13,15 @@ windows:
|
|||
panes:
|
||||
- nvim
|
||||
- git status
|
||||
- desktop:
|
||||
root: "/home/charlotte/repos/accentor/desktop"
|
||||
layout: main-vertical
|
||||
panes:
|
||||
- nvim
|
||||
- git status
|
||||
- run:
|
||||
layout: even-horizontal
|
||||
panes:
|
||||
- postgres:
|
||||
- cd api
|
||||
- postgres
|
||||
- rails:
|
||||
- cd api
|
||||
- bundle exec rails s
|
||||
|
@ -28,4 +31,6 @@ windows:
|
|||
- vue:
|
||||
- cd web
|
||||
- yarn run serve
|
||||
|
||||
- postgres:
|
||||
- cd api
|
||||
- start-db
|
||||
|
|
|
@ -32,24 +32,21 @@ pkgs.mkShell {
|
|||
};
|
||||
}
|
||||
)
|
||||
(
|
||||
pkgs.writeScriptBin "start-db" ''
|
||||
#!/${pkgs.zsh}/bin/zsh
|
||||
|
||||
trap "docker stop accentor-db" 0
|
||||
docker run --name accentor-db -p 5432:5432 --rm -v accentor-db-data:/var/lib/postgresql/data -e POSTGRES_PASSWORD=accentor postgres:latest &
|
||||
|
||||
child=$!
|
||||
wait $child
|
||||
''
|
||||
)
|
||||
];
|
||||
shellHook = ''
|
||||
export PGDATA=$PWD/tmp/postgres_data
|
||||
export PGHOST=$PWD/tmp/postgres
|
||||
export PGDATABASE=postgres
|
||||
export DATABASE_URL="postgresql:///postgres?host=$PGHOST"
|
||||
if [ ! -d $PGHOST ]; then
|
||||
mkdir -p $PGHOST
|
||||
fi
|
||||
if [ ! -d $PGDATA ]; then
|
||||
echo 'Initializing postgresql database...'
|
||||
initdb $PGDATA --auth=trust >/dev/null
|
||||
fi
|
||||
cat >"$PGDATA/postgresql.conf" <<HERE
|
||||
listen_addresses = '''
|
||||
unix_socket_directories = '$PGHOST'
|
||||
HERE
|
||||
export GEM_HOME="$PWD/vendor/rubygems"
|
||||
export DATABASE_URL="postgres://postgres:accentor@127.0.0.1:5432/accentor"
|
||||
export GEM_HOME="$PWD/vendor/rubygems/$(ruby -e 'puts RUBY_VERSION')"
|
||||
export PATH="$GEM_HOME/bin:$PATH"
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ pkgs.mkShell {
|
|||
];
|
||||
shellHook = ''
|
||||
export DATABASE_URL="mysql2://root:dodona@127.0.0.1:3306/dodona"
|
||||
export GEM_HOME="$PWD/vendor/rubygems"
|
||||
export GEM_HOME="$PWD/vendor/rubygems/$(ruby -e 'puts RUBY_VERSION')"
|
||||
export PATH="$GEM_HOME/bin:$PATH"
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
baseVimConfig = import ../programs/neovim/base.nix { inherit pkgs; };
|
||||
jdtls = import ../packages/jdtls/default.nix { inherit pkgs; stdenv = pkgs.stdenv; };
|
||||
in
|
||||
pkgs.mkShell {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue