jupyter setup
This commit is contained in:
parent
c1c84aa5d2
commit
fe36910093
4 changed files with 108 additions and 0 deletions
|
@ -25,6 +25,9 @@
|
|||
./nextcloud.nix
|
||||
./mattermost.nix
|
||||
./borg.nix
|
||||
./metabase.nix
|
||||
./jupyter.nix
|
||||
./mysql.nix
|
||||
];
|
||||
|
||||
# todo: add this to each file instead summing that here
|
||||
|
|
69
configs/workhorse/jupyter.nix
Normal file
69
configs/workhorse/jupyter.nix
Normal file
|
@ -0,0 +1,69 @@
|
|||
{ pkgs, lib, config, ... }: {
|
||||
|
||||
services.jupyter = {
|
||||
enable = true;
|
||||
ip = "0.0.0.0";
|
||||
#In [1]: from notebook.auth import passwd
|
||||
#In [2]: passwd('test')
|
||||
#Out[2]: 'sha1:1b961dc713fb:88483270a63e57d18d43cf337e629539de1436ba'
|
||||
#NOTE: you need to keep the single quote inside nix string.
|
||||
password = "'sha1:1b961dc713fb:88483270a63e57d18d43cf337e629539de1436ba'";
|
||||
kernels = {
|
||||
python3 = let
|
||||
env = (pkgs.python3.withPackages (pythonPackages:
|
||||
with pythonPackages; [
|
||||
ipykernel
|
||||
pandas
|
||||
|
||||
# database stuff
|
||||
mysqlclient
|
||||
databases
|
||||
asyncpg
|
||||
psycopg2
|
||||
aiomysql
|
||||
pymysql
|
||||
aiosqlite
|
||||
#aiopg
|
||||
sqlalchemy
|
||||
|
||||
# pdf export
|
||||
nbconvert
|
||||
]));
|
||||
in {
|
||||
displayName = "Python 3";
|
||||
argv = [
|
||||
"${env.interpreter}"
|
||||
"-m"
|
||||
"ipykernel_launcher"
|
||||
"-f"
|
||||
"{connection_file}"
|
||||
];
|
||||
language = "python";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# to generate pdfs and such
|
||||
environment.systemPackages = [ pkgs.pandoc ];
|
||||
|
||||
backup.dirs = [ "/var/lib/jupyter" ];
|
||||
backup.exclude =
|
||||
[ "/var/lib/jupyter/.local" "/var/lib/jupyter/.ipynb_checkpoints" ];
|
||||
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
statusPage = true;
|
||||
virtualHosts = {
|
||||
"python.${config.networking.hostName}.private" = {
|
||||
serverAliases = [ "jupyter.${config.networking.hostName}.private" ];
|
||||
locations."/" = {
|
||||
proxyWebsockets = true;
|
||||
proxyPass = "http://${config.networking.hostName}.private:${
|
||||
toString config.services.jupyter.port
|
||||
}";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
24
configs/workhorse/metabase.nix
Normal file
24
configs/workhorse/metabase.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{ pkgs, lib, config, ... }: {
|
||||
|
||||
services.metabase = {
|
||||
listen.port = 3040;
|
||||
enable = true;
|
||||
};
|
||||
|
||||
backup.dirs = [ "/var/lib/metabase" ];
|
||||
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
statusPage = true;
|
||||
virtualHosts = {
|
||||
"metabase.${config.networking.hostName}.private" = {
|
||||
locations."/" = {
|
||||
proxyPass = "http://${config.networking.hostName}.private:${
|
||||
toString config.services.metabase.listen.port
|
||||
}";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
12
configs/workhorse/mysql.nix
Normal file
12
configs/workhorse/mysql.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{ pkgs, lib, ... }: {
|
||||
|
||||
services.mysql = {
|
||||
enable = true;
|
||||
package = pkgs.mysql;
|
||||
initialScript = pkgs.writeText "initScript" ''
|
||||
CREATE USER 'admin'@'%' IDENTIFIED BY 'admin';
|
||||
GRANT ALL PRIVILEGES ON * . * TO 'admin'@'%';
|
||||
'';
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in a new issue