Jupyer Nixos Module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, lib, pkgs, ... }: | |
with lib; | |
let | |
cfg = config.services.jupyter; | |
in | |
{ | |
###### interface | |
options = { | |
services.jupyter = { | |
enable = mkOption { | |
type = types.bool; | |
default = false; | |
description = '' | |
Whether to enable the jupyter notebook server. | |
''; | |
}; | |
localUser = mkOption { | |
description = '' | |
Local user to execute as. | |
''; | |
}; | |
}; | |
}; | |
###### implementation | |
config = mkIf cfg.enable { | |
environment.systemPackages = with pkgs.python34Packages; [ | |
jupyter_core | |
jupyter_client | |
notebook | |
ipywidgets | |
]; | |
systemd.services.jupyter = { | |
description = '' | |
Jupyter notebook web server service | |
''; | |
wantedBy = [ "multi-user.target" ]; | |
serviceConfig = with cfg; { | |
User = cfg.localUser; | |
ExecStart = "${pkgs.python34Packages.notebook}/bin/jupyter-notebook"; | |
RestartSec = 10; | |
Restart = "on-failure"; | |
}; | |
}; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This would be imported by /etc/nixos/configuration.nix | |
{ config, ... }: | |
{ | |
import [ ./jupyter.nix ]; | |
services.jupyter = { | |
enable = true; | |
localUser = "nekroze"; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment