diff --git a/flake.nix b/flake.nix index 8c7c5d32..75d2f222 100644 --- a/flake.nix +++ b/flake.nix @@ -129,6 +129,109 @@ name = "Accentor API client in JavaScript"; packages = with pkgs; [ nodejs yarn ]; }; + gamification2 = pkgs.devshell.mkShell { + name = "Gamification 2"; + imports = [ "${devshell}/extra/language/c.nix" ]; + packages = with pkgs; [ + (pkgs.lowPrio binutils) + findutils + cmake + gnumake + nodejs + postgresql_14 + ruby_3_1 + yarn + ]; + env = [ + { name = "PGDATA"; eval = "$PRJ_DATA_DIR/postgres"; } + { name = "DATABASE_HOST"; eval = "$PGDATA"; } + { name = "GEM_HOME"; eval = "$PRJ_DATA_DIR/bundle/$(ruby -e 'puts RUBY_VERSION')"; } + { name = "PATH"; prefix = "$GEM_HOME/bin"; } + ]; + commands = [ + { + name = "pg:setup"; + category = "database"; + help = "Setup postgres in project folder"; + command = '' + initdb --encoding=UTF8 --no-locale --no-instructions -U postgres + echo "listen_addresses = ${"'"}${"'"}" >> $PGDATA/postgresql.conf + echo "unix_socket_directories = '$PGDATA'" >> $PGDATA/postgresql.conf + echo "CREATE USER gamification2 WITH PASSWORD 'gamification2' CREATEDB;" | postgres --single -E postgres + ''; + } + { + name = "pg:start"; + category = "database"; + help = "Start postgres instance"; + command = '' + [ ! -d $PGDATA ] && setup-db + pg_ctl -D $PGDATA -U postgres start -l log/postgres.log + ''; + } + { + name = "pg:stop"; + category = "database"; + help = "Stop postgres instance"; + command = '' + pg_ctl -D $PGDATA -U postgres stop + ''; + } + { + name = "pg:console"; + category = "database"; + help = "Open database console"; + command = '' + psql --host $PGDATA -U postgres + ''; + } + ]; + language.c = { + compiler = pkgs.gcc; + includes = [ pkgs.zlib pkgs.openssl ]; + libraries = [ pkgs.zlib pkgs.openssl ]; + }; + }; + tab = pkgs.devshell.mkShell { + name = "Tab"; + imports = [ "${devshell}/extra/language/c.nix" ]; + packages = with pkgs; [ + (pkgs.lowPrio binutils) + findutils + gnumake + ruby_3_1 + nodejs + yarn + ]; + env = [ + { name = "GEM_HOME"; eval = "$PRJ_DATA_DIR/bundle/$(ruby -e 'puts RUBY_VERSION')"; } + { name = "PATH"; prefix = "$GEM_HOME/bin"; } + ]; + commands = [ + { + name = "server-support"; + category = "general commands"; + help = "Run everything required for a server"; + command = '' + bundle install + ''; + } + { + name = "server"; + category = "general commands"; + help = "Run everything"; + command = '' + server-support + rails s + ''; + } + ]; + language.c = { + compiler = pkgs.gcc; + includes = [ pkgs.sqlite pkgs.libmysqlclient pkgs.zlib ]; + libraries = [ pkgs.sqlite pkgs.libmysqlclient pkgs.zlib ]; + }; + }; dodona = pkgs.devshell.mkShell { name = "Dodona"; imports = [ "${devshell}/extra/language/c.nix" ];