Use personal devshell fork

This commit is contained in:
Charlotte Van Petegem 2023-03-13 20:57:27 +01:00
parent 40f2eb127c
commit 725fe830f8
No known key found for this signature in database
GPG key ID: 019E764B7184435A
3 changed files with 27 additions and 42 deletions

17
flake.lock generated
View file

@ -153,15 +153,16 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1677856503, "lastModified": 1678737005,
"narHash": "sha256-TW8my47VpavO/PXA5hIumUcX80cj0AufojjUTdUonLw=", "narHash": "sha256-vZi9ToKb+0yETEGKzvHHs8n35iBI2lX1idJMCNHL3Z4=",
"owner": "numtide", "owner": "chvp",
"repo": "devshell", "repo": "devshell",
"rev": "643d1857fea4e71e7f251cb574f59b1d63778085", "rev": "774ed1133ae1890524d629ae5af166313b66d0bc",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "numtide", "owner": "chvp",
"ref": "background-services",
"repo": "devshell", "repo": "devshell",
"type": "github" "type": "github"
} }
@ -322,11 +323,11 @@
}, },
"nur": { "nur": {
"locked": { "locked": {
"lastModified": 1678730199, "lastModified": 1678736733,
"narHash": "sha256-yMiW6y2JZYrE180JFUWP77WebcsRS8DZbvfvN0n/mP4=", "narHash": "sha256-XMqRLhFTgtn/QLRXWE1J/ESGJJbnxSlqEL3ThvSHDX8=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "20de8d02be738e389a1daf6c324d60d947e053ad", "rev": "cfef6b0e312480d27fd2624a34e71dd6d3cff116",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -33,7 +33,7 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
devshell = { devshell = {
url = "github:numtide/devshell"; url = "github:chvp/devshell/background-services";
inputs = { inputs = {
flake-utils.follows = "flake-utils"; flake-utils.follows = "flake-utils";
nixpkgs.follows = "nixpkgs"; nixpkgs.follows = "nixpkgs";

View file

@ -1,18 +1,18 @@
{ pkgs, inputs }: { pkgs, inputs }:
let let
support-procfile-text = '' support-services = {
memcached: memcached memcached.command = "memcached";
mysql: mysql mysql.command = "mysql";
worker: rails jobs:work worker.command = "rails jobs:work";
css: yarn build:css --watch css.command = "yarn build:css --watch";
js: yarn build:js --watch js.command = "yarn build:js --watch";
''; };
support-procfile = pkgs.writeText "Procfile.supp" support-procfile-text; all-services = support-services // {
all-procfile-text = support-procfile-text + '' rails = {
server: rails s -p 3000 name = "server";
''; command = "rails s -p 3000";
all-procfile = pkgs.writeText "Procfile.all" all-procfile-text; };
};
in in
pkgs.devshell.mkShell { pkgs.devshell.mkShell {
name = "Dodona"; name = "Dodona";
@ -53,27 +53,11 @@ pkgs.devshell.mkShell {
docker run --name dodona-db -p 3306:3306 --rm -v dodona-db-data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=dodona mariadb:latest docker run --name dodona-db -p 3306:3306 --rm -v dodona-db-data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=dodona mariadb:latest
''; '';
} }
{
name = "server-support";
category = "general commands";
help = "Run everything required for a server";
command = ''
bundle install
yarn install
${pkgs.honcho}/bin/honcho start -f ${support-procfile} -d $PRJ_ROOT
'';
}
{
name = "server";
category = "general commands";
help = "Run everything";
command = ''
bundle install
yarn install
${pkgs.honcho}/bin/honcho start -f ${all-procfile} -d $PRJ_ROOT
'';
}
]; ];
serviceGroups = {
server.services = all-services;
server-support.services = support-services;
};
language.c = { language.c = {
compiler = pkgs.gcc; compiler = pkgs.gcc;
includes = [ pkgs.libmysqlclient pkgs.zlib pkgs.libffi ]; includes = [ pkgs.libmysqlclient pkgs.zlib pkgs.libffi ];