Skip to content

Commit

Permalink
❄️ Add shell.nix (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
fdnt7 authored May 8, 2024
1 parent d102e0c commit 20c6d3c
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 34 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.env
.vscode
.tmp
config.yml

lyra/target
Expand Down
59 changes: 33 additions & 26 deletions lyra/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions lyra/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "lyra"
readme = "../README.md"
description = "A featureful, self-hostable Discord music bot."
version = "0.5.0"
version = "0.5.1"
edition = "2021"
license = "GPL-3.0"
repository = "https://github.com/lyra-music/lyra"
Expand Down Expand Up @@ -46,7 +46,7 @@ unicode-segmentation = "1.11.0"
dashmap = "5.5.3"
dotenvy = "0.15.7"
dotenvy_macro = "0.15.7"
thiserror = "1.0.58"
thiserror = "1.0.60"
color-eyre = "0.6.3"
rstest = "0.19.0"
futures = "0.3.30"
Expand All @@ -66,7 +66,7 @@ rand = "0.8.5"
itertools = "0.12.1"
rayon = "1.10.0"
lazy_static = "1.4.0"
chrono = "0.4.37"
chrono = "0.4.38"
sqlx = { version = "0.7.4", features = ["postgres", "runtime-tokio-rustls"] }
mixbox = "2.0.0"
lavalink-rs = { version = "0.11.0", features = ["twilight16"] }
Expand Down Expand Up @@ -99,7 +99,7 @@ features = ["jpeg", "png", "gif", "tiff"]
default-features = false

[dependencies.palette]
version = "0.7.5"
version = "0.7.6"
features = ["std"]
default-features = false

Expand Down
4 changes: 2 additions & 2 deletions scripts/db
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
cd ./db && cargo sqlx database setup
#!/usr/bin/env sh
cd ./db && cargo sqlx database setup
4 changes: 2 additions & 2 deletions scripts/lavalink
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
#!/usr/bin/env bash
# For starting the lavalink server (Linux)

set -a # automatically export all variables
source .env
set +a

(cd lavalink && ./java -jar Lavalink.jar)
(cd lavalink && java -jar Lavalink.jar)
35 changes: 35 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{ pkgs ? import <nixpkgs> { } }:
pkgs.mkShell {
name = "dev";

nativeBuildInputs = with pkgs; [
clang
mold
pgcli
sqlx-cli
postgresql
zulu
];

LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib";

shellHook = ''
TMPD="$PWD/.tmp"
export PGDATA="$TMPD/mydb"
export SOCKET_DIRECTORIES="$TMPD/socket"
mkdir -p $SOCKET_DIRECTORIES
initdb
echo "unix_socket_directories = '$SOCKET_DIRECTORIES'" >> $PGDATA/postgresql.conf
pg_ctl -l $PGDATA/logfile start
createuser postgres --createdb -h localhost
./scripts/db
function end {
pg_ctl stop
rm -rf $TMPD
}
trap end EXIT
'';
}

0 comments on commit 20c6d3c

Please sign in to comment.