New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shiny Server package, module and test #31872
Conversation
Anyone willing to review this pull request? |
@GrahamcOfBorg test shiny-server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failure for system: x86_64-linux
cannot build derivation ‘/nix/store/lbnrr6f9710irwszbszzzhmzvmrkz0ds-unit-shiny-server.service.drv’: 2 dependencies couldn't be built
cannot build derivation ‘/nix/store/iqh26djgpq1znlxk7xzqdwc1hp00bc1k-system-units.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/kcb619x4ffmwvamkvw7y1hr119c1fk4z-etc.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/jn41z2jx2kmkzr8sdc5dp1zjkwyhrhg9-nixos-system-machine-18.03.git.4719831.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/m0y2ncm70rpfsn6qfqj3ghybnvlv9zx8-closure-info.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/avihzg7142kz6kpaba1lhbaq020rhsb0-run-nixos-vm.drv’: 2 dependencies couldn't be built
cannot build derivation ‘/nix/store/jah9ckzs348r5rifsnqjxk73aj1q8yhs-nixos-vm.drv’: 2 dependencies couldn't be built
cannot build derivation ‘/nix/store/gwmbnwfhh0rk5pbar7ms5cav9x48lhd1-nixos-test-driver-shiny-server.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/9al9fwh8qga8q5csy2bayii9v9a2vkb4-vm-test-run-shiny-server.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/9al9fwh8qga8q5csy2bayii9v9a2vkb4-vm-test-run-shiny-server.drv’ failed
@GrahamcOfBorg test shiny-server I rebased onto master, and the test succeeded locally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Success for system: x86_64-linux
machine: exit status 1
syncing
machine: running command: sync
machine: exit status 0
test script finished in 24.38s
cleaning up
killing machine (pid 149)
vde_switch: EOF on stdin, cleaning up and exiting
vde_switch: Could not remove ctl dir '/tmp/nix-build-vm-test-run-shiny-server.drv-0/vde1.ctl': Directory not empty
/nix/store/2wzq2d8qmcs1ji2ywiin88059drqx30s-vm-test-run-shiny-server
site_dir ${cfg.siteDir}; | ||
log_dir ${cfg.logDir}; | ||
bookmark_state_dir ${cfg.stateDir}; | ||
directory_index ${boolToString cfg.directoryIndex}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there other configuration options that might be applicable here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some, but I have a hard time imagining when they would be useful. Added another config variable to inject more options.
|
||
extraPackages = mkOption { | ||
default = []; | ||
example = ''with pkgs.rPackages; [ ggplot2 data_table ];''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want example = literalExample " ...
siteDir = mkOption { | ||
type = types.path; | ||
default = "${cfg.package}/shiny-server/samples"; | ||
defaultText = ''''${cfg.package}/shiny-server/samples''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's just use "
s here instead of the unneeded ''
s.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
group = cfg.user; | ||
description = "Shiny Server user"; | ||
}); | ||
users.extraGroups = optionalAttrs (cfg.user == "shiny") (singleton { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extraUsers is now users, and extraGroups is just groups now. Also isn't this doing:
users.users = [ { name = "shiny" ... } ];
?
I'm surprised that works, as we should end up with: users.users.shiny = { ... }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. Changed it and it looks like what you expect now:
nix-repl> :a (import ./nixos/default.nix { configuration = { config.services.shiny-server.enable = true; }; })
Added 5 variables.
nix-repl> config.users.users.shiny
{ _module = { ... }; createHome = false; cryptHomeLuks = null; description = "Shiny Server user"; extraGroups = [ ... ]; group = "shiny"; hashedPassword = null; home = "/var/empty"; initialHashedPassword = null; initialPassword = null; isNormalUser = false; isSystemUser = false; name = "shiny"; openssh = { ... }; packages = [ ... ]; password = null; passwordFile = null; shell = «derivation /nix/store/v5qiscz1ypclkak40awlr50a01bzwdjm-shadow-4.5.drv»; subGidRanges = [ ... ]; subUidRanges = [ ... ]; uid = 285; useDefaultShell = false; }
''; | ||
|
||
serviceConfig = { | ||
ExecStart = "${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c '${cfg.package}/bin/shiny-server ${cfg.configFile}'"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The su
and sh
bits can be replaced by setting:
User = cfg.user;
Group = cfg.group;
inside the serviceConfig.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Didn't know about PermissionsStartOnly.
@@ -0,0 +1,1878 @@ | |||
# This file has been generated by node2nix 1.4.0. Do not edit! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a tough part about this PR. This is quite large for a single package -- 2,200 lines! Other than this, this seems okay. @svanderburg what is the feeling on these being in nixpkgs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that this may be an issue. For what it's worth, there are other instances of the same problem:
orbekk@aji ~/b/nixpkgs (shiny)> find pkgs -name node-packages.nix | xargs ls -lh
-rw-r--r-- 1 orbekk users 27K Nov 24 17:43 pkgs/applications/editors/zed/node-packages.nix
-rw-r--r-- 1 orbekk users 111K Nov 24 17:43 pkgs/development/web/remarkjs/node-packages.nix
-rw-r--r-- 1 orbekk users 444 Nov 24 17:43 pkgs/misc/base16-builder/node-packages.nix
-rw-r--r-- 1 orbekk users 154K May 19 2017 pkgs/servers/web-apps/pump.io/node-packages.nix
-rw-r--r-- 1 orbekk users 60K Dec 7 19:59 pkgs/servers/web-apps/shiny-server/node-packages.nix
-rw-r--r-- 1 orbekk users 28K Nov 24 17:43 pkgs/tools/networking/airfield/node-packages.nix
-rw-r--r-- 1 orbekk users 3.0K May 19 2017 pkgs/tools/package-management/nixui/node-packages.nix
@grahamc Addressed your comments except the size issue. If you have any suggestions for dealing with the large auto generated file, let me know. |
I'm closing this request as it's pretty outdated at this point. |
Motivation for this change
introduces the Shiny Server in NixOS. This pull request includes a packaged version of shiny-server, a nixos module and a simple test for the module.
Reviewers: These files are generated: composition.nix, node-packages.nix. This file contains node.js dependencies: package.json.
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)