Move shells to separate files
This commit is contained in:
parent
7d60967e74
commit
fbe31586f9
10 changed files with 211 additions and 205 deletions
214
flake.nix
214
flake.nix
|
@ -85,7 +85,7 @@
|
|||
inherit self inputs;
|
||||
channels.nixpkgs = {
|
||||
input = nixpkgs;
|
||||
patches = map (patch: ./patches + "/${patch}") (builtins.filter (x: x != ".keep") (builtins.attrNames (builtins.readDir ./patches)));
|
||||
patches = builtins.map (patch: ./patches + "/${patch}") (builtins.filter (x: x != ".keep") (builtins.attrNames (builtins.readDir ./patches)));
|
||||
overlaysBuilder = _: [
|
||||
devshell.overlay
|
||||
emacs-overlay.overlay
|
||||
|
@ -118,210 +118,14 @@
|
|||
let pkgs = channels.nixpkgs; in
|
||||
{
|
||||
packages = customPackages pkgs.callPackage;
|
||||
devShells = rec {
|
||||
default = nixos-config;
|
||||
nixos-config = pkgs.devshell.mkShell {
|
||||
name = "NixOS config";
|
||||
packages = [
|
||||
pkgs.nixpkgs-fmt
|
||||
(pkgs.writeShellScriptBin "fetchpatch" "curl -L https://github.com/NixOS/nixpkgs/pull/$1.patch -o patches/$1.patch")
|
||||
agenix.defaultPackage.x86_64-linux
|
||||
];
|
||||
};
|
||||
accentor-api-client-js = pkgs.devshell.mkShell {
|
||||
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 SUPERUSER;" | postgres --single -E postgres
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "pg:start";
|
||||
category = "database";
|
||||
help = "Start postgres instance";
|
||||
command = ''
|
||||
[ ! -d $PGDATA ] && pg:setup
|
||||
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" ];
|
||||
packages = with pkgs; [
|
||||
(pkgs.lowPrio binutils)
|
||||
chromedriver
|
||||
findutils
|
||||
gnumake
|
||||
nodejs
|
||||
nodePackages.typescript-language-server
|
||||
ruby_3_0
|
||||
yarn
|
||||
];
|
||||
env = [
|
||||
{ name = "DATABASE_URL"; value = "mysql2://root:dodona@127.0.0.1:3306/dodona"; }
|
||||
{ name = "TEST_DATABASE_URL"; value = "mysql2://root:dodona@127.0.0.1:3306/dodona_test"; }
|
||||
{ name = "GEM_HOME"; eval = "$PRJ_DATA_DIR/bundle/$(ruby -e 'puts RUBY_VERSION')"; }
|
||||
{ name = "PATH"; prefix = "$GEM_HOME/bin"; }
|
||||
];
|
||||
commands = [
|
||||
{
|
||||
name = "memcached";
|
||||
category = "general commands";
|
||||
help = "Start caching server";
|
||||
package = pkgs.memcached;
|
||||
}
|
||||
{
|
||||
name = "mysql";
|
||||
category = "general commands";
|
||||
help = "Start mysql (in docker container)";
|
||||
command = ''
|
||||
trap "systemd-run --user --no-block docker stop dodona-db" 0
|
||||
docker run -d --name dodona-db -p 3306:3306 --rm -v dodona-db-data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=dodona mariadb:latest
|
||||
while [ 1 -eq 1 ]
|
||||
do
|
||||
sleep 1000
|
||||
done
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "server-support";
|
||||
category = "general commands";
|
||||
help = "Run everything required for a server";
|
||||
command = ''
|
||||
memcached &
|
||||
mysql &
|
||||
bundle install
|
||||
yarn install
|
||||
rails jobs:work &
|
||||
yarn build:css --watch &
|
||||
yarn build:js --watch
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "server";
|
||||
category = "general commands";
|
||||
help = "Run everything";
|
||||
command = ''
|
||||
server-support &
|
||||
rails s
|
||||
'';
|
||||
}
|
||||
];
|
||||
language.c = {
|
||||
compiler = pkgs.gcc;
|
||||
includes = [ pkgs.libmysqlclient pkgs.zlib ];
|
||||
libraries = [ pkgs.libmysqlclient pkgs.zlib ];
|
||||
};
|
||||
};
|
||||
dodona-docs = pkgs.devshell.mkShell {
|
||||
name = "Dodona Docs";
|
||||
env = [{ name = "PUPPETEER_EXECUTABLE_PATH"; eval = "${pkgs.ungoogled-chromium}/bin/chromium"; }];
|
||||
packages = with pkgs; [ nodejs yarn ];
|
||||
};
|
||||
dodona-judge-r = pkgs.devshell.mkShell {
|
||||
name = "R judge";
|
||||
packages = [
|
||||
(pkgs.rWrapper.override {
|
||||
packages = with pkgs.rPackages; [ base64enc dplyr dslabs jsonlite knitr lintr R6 rlang styler ];
|
||||
})
|
||||
];
|
||||
};
|
||||
objectgericht-project = pkgs.devshell.mkShell {
|
||||
name = "Scriptingtalen project";
|
||||
packages = with pkgs; [ openssl maven openjdk ];
|
||||
};
|
||||
};
|
||||
devShells =
|
||||
let
|
||||
ls = builtins.readDir ./shells;
|
||||
files = builtins.filter (name: ls.${name} == "regular") (builtins.attrNames ls);
|
||||
shellNames = builtins.map (filename: builtins.head (builtins.split "\\." filename)) files;
|
||||
nameToValue = name: import (./shells + "/${name}.nix") { inherit pkgs inputs; };
|
||||
in
|
||||
builtins.listToAttrs (builtins.map (name: { inherit name; value = nameToValue name; }) shellNames);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
4
shells/accentor-api-client-js.nix
Normal file
4
shells/accentor-api-client-js.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{ pkgs, ... }: pkgs.devshell.mkShell {
|
||||
name = "Accentor API client in JavaScript";
|
||||
packages = with pkgs; [ nodejs yarn ];
|
||||
}
|
1
shells/default.nix
Normal file
1
shells/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
import ./nixos-config.nix
|
5
shells/dodona-docs.nix
Normal file
5
shells/dodona-docs.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{ pkgs, ... }: pkgs.devshell.mkShell {
|
||||
name = "Dodona Docs";
|
||||
env = [{ name = "PUPPETEER_EXECUTABLE_PATH"; eval = "${pkgs.ungoogled-chromium}/bin/chromium"; }];
|
||||
packages = with pkgs; [ nodejs yarn ];
|
||||
}
|
8
shells/dodona-judge-r.nix
Normal file
8
shells/dodona-judge-r.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{ pkgs, ... }: pkgs.devshell.mkShell {
|
||||
name = "R judge";
|
||||
packages = [
|
||||
(pkgs.rWrapper.override {
|
||||
packages = with pkgs.rPackages; [ base64enc dplyr dslabs jsonlite knitr lintr R6 rlang styler ];
|
||||
})
|
||||
];
|
||||
}
|
69
shells/dodona.nix
Normal file
69
shells/dodona.nix
Normal file
|
@ -0,0 +1,69 @@
|
|||
{ pkgs, inputs }: pkgs.devshell.mkShell {
|
||||
name = "Dodona";
|
||||
imports = [ "${inputs.devshell}/extra/language/c.nix" ];
|
||||
packages = with pkgs; [
|
||||
(pkgs.lowPrio binutils)
|
||||
chromedriver
|
||||
findutils
|
||||
gnumake
|
||||
nodejs
|
||||
nodePackages.typescript-language-server
|
||||
ruby_3_0
|
||||
yarn
|
||||
];
|
||||
env = [
|
||||
{ name = "DATABASE_URL"; value = "mysql2://root:dodona@127.0.0.1:3306/dodona"; }
|
||||
{ name = "TEST_DATABASE_URL"; value = "mysql2://root:dodona@127.0.0.1:3306/dodona_test"; }
|
||||
{ name = "GEM_HOME"; eval = "$PRJ_DATA_DIR/bundle/$(ruby -e 'puts RUBY_VERSION')"; }
|
||||
{ name = "PATH"; prefix = "$GEM_HOME/bin"; }
|
||||
];
|
||||
commands = [
|
||||
{
|
||||
name = "memcached";
|
||||
category = "general commands";
|
||||
help = "Start caching server";
|
||||
package = pkgs.memcached;
|
||||
}
|
||||
{
|
||||
name = "mysql";
|
||||
category = "general commands";
|
||||
help = "Start mysql (in docker container)";
|
||||
command = ''
|
||||
trap "systemd-run --user --no-block docker stop dodona-db" 0
|
||||
docker run -d --name dodona-db -p 3306:3306 --rm -v dodona-db-data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=dodona mariadb:latest
|
||||
while [ 1 -eq 1 ]
|
||||
do
|
||||
sleep 1000
|
||||
done
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "server-support";
|
||||
category = "general commands";
|
||||
help = "Run everything required for a server";
|
||||
command = ''
|
||||
memcached &
|
||||
mysql &
|
||||
bundle install
|
||||
yarn install
|
||||
rails jobs:work &
|
||||
yarn build:css --watch &
|
||||
yarn build:js --watch
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "server";
|
||||
category = "general commands";
|
||||
help = "Run everything";
|
||||
command = ''
|
||||
server-support &
|
||||
rails s
|
||||
'';
|
||||
}
|
||||
];
|
||||
language.c = {
|
||||
compiler = pkgs.gcc;
|
||||
includes = [ pkgs.libmysqlclient pkgs.zlib ];
|
||||
libraries = [ pkgs.libmysqlclient pkgs.zlib ];
|
||||
};
|
||||
}
|
63
shells/gamification2.nix
Normal file
63
shells/gamification2.nix
Normal file
|
@ -0,0 +1,63 @@
|
|||
{ pkgs, inputs }: pkgs.devshell.mkShell {
|
||||
name = "Gamification 2";
|
||||
imports = [ "${inputs.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 SUPERUSER;" | postgres --single -E postgres
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "pg:start";
|
||||
category = "database";
|
||||
help = "Start postgres instance";
|
||||
command = ''
|
||||
[ ! -d $PGDATA ] && pg:setup
|
||||
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 ];
|
||||
};
|
||||
}
|
8
shells/nixos-config.nix
Normal file
8
shells/nixos-config.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{ pkgs, inputs }: pkgs.devshell.mkShell {
|
||||
name = "NixOS config";
|
||||
packages = [
|
||||
pkgs.nixpkgs-fmt
|
||||
(pkgs.writeShellScriptBin "fetchpatch" "curl -L https://github.com/NixOS/nixpkgs/pull/$1.patch -o patches/$1.patch")
|
||||
inputs.agenix.defaultPackage.x86_64-linux
|
||||
];
|
||||
}
|
4
shells/objectgericht-project.nix
Normal file
4
shells/objectgericht-project.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{ pkgs, ... }: pkgs.devshell.mkShell {
|
||||
name = "Objectgericht programmeren project";
|
||||
packages = with pkgs; [ openssl maven openjdk ];
|
||||
}
|
40
shells/tab.nix
Normal file
40
shells/tab.nix
Normal file
|
@ -0,0 +1,40 @@
|
|||
{ pkgs, inputs }: pkgs.devshell.mkShell {
|
||||
name = "Tab";
|
||||
imports = [ "${inputs.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 ];
|
||||
};
|
||||
}
|
Loading…
Add table
Reference in a new issue