-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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
etesync-web: init at 0.6.1, nixos/etesync-web: init module and test #130680
Draft
Pacman99
wants to merge
3
commits into
NixOS:master
Choose a base branch
from
Pacman99:etesync-web
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ lib, config, pkgs, ... }: | ||
with lib; | ||
let | ||
cfg = config.services.etesync-web; | ||
etebaseHost = config.services.etebase-server.settings.allowed_hosts.allowed_host1; | ||
pkg = pkgs.etesync-web.override { inherit (cfg) defaultServer; }; | ||
webRoot = "${pkg}/libexec/${pkg.pname}/deps/${pkg.pname}/build/"; | ||
in | ||
{ | ||
meta.maintainers = with maintainers; [ pacman99 ]; | ||
options = { | ||
services.etesync-web = { | ||
enable = mkEnableOption "host etesync web interface with nginx"; | ||
hostName = mkOption { | ||
type = types.str; | ||
description = '' | ||
The hostName to serve etesync-web from | ||
''; | ||
}; | ||
defaultServer = mkOption { | ||
type = with types; nullOr str; | ||
default = if etebaseHost != "0.0.0.0" then etebaseHost else null; | ||
defaultText = '' | ||
if set ''${config.services.etebase-server.settings.allowed_hosts.allowed_host1}, otherwise https://etebase.com" | ||
''; | ||
description = '' | ||
The default etebase server to login to | ||
''; | ||
}; | ||
}; | ||
}; | ||
config = lib.mkIf cfg.enable { | ||
services.nginx = { | ||
enable = true; | ||
virtualHosts.${cfg.hostName} = { | ||
locations."/" = { | ||
root = webRoot; | ||
tryFiles = "\$uri \$uri/ /index.html =404"; | ||
extraConfig = '' | ||
autoindex on; | ||
''; | ||
}; | ||
locations."= /50x.html".root = webRoot; | ||
extraConfig = '' | ||
error_page 500 502 503 504 /50x.html; | ||
''; | ||
}; | ||
}; | ||
}; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import ./make-test-python.nix ({ pkgs, ... }: { | ||
name = "etesync-web"; | ||
meta = with pkgs.lib; { | ||
maintainers = with maintainers; [ pacman99 ]; | ||
}; | ||
machine = { ... }: { | ||
services.etesync-web = { | ||
enable = true; | ||
hostName = "localhost"; | ||
}; | ||
}; | ||
testScript = '' | ||
machine.wait_for_unit("nginx.service") | ||
machine.wait_for_unit("multi-user.target") | ||
assert "EteSync - Secure Data Sync" in machine.succeed("curl http://localhost") | ||
''; | ||
}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ lib | ||
, mkYarnPackage | ||
, fetchFromGitHub | ||
, defaultServer ? null | ||
}: | ||
|
||
mkYarnPackage rec { | ||
pname = "etesync-web"; | ||
version = "0.6.1"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "etesync"; | ||
repo = "etesync-web"; | ||
rev = "v${version}"; | ||
sha256 = "iUNJbY0ImgGPSzcUnUv0yJccBeuaNaBwDwenEqjXyYs="; | ||
}; | ||
|
||
packageJSON = ./package.json; | ||
yarnLock = ./yarn.lock; | ||
yarnNix = ./yarn.nix; | ||
|
||
dontStrip = true; | ||
|
||
buildPhase = lib.optionalString (defaultServer != null) '' | ||
REACT_APP_DEFAULT_API_PATH="${defaultServer}" \ | ||
'' + '' | ||
yarn build | ||
''; | ||
|
||
meta = with lib; { | ||
homepage = "https://www.etesync.com/"; | ||
description = "The EteSync Web App - Use EteSync from the browser!"; | ||
maintainers = with maintainers; [ pacman99 ]; | ||
license = licenses.agpl3Only; | ||
}; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{ | ||
"name": "etesync-web", | ||
"version": "0.6.0", | ||
"private": true, | ||
"dependencies": { | ||
"@date-io/moment": "^1.x", | ||
"@material-ui/core": "^4.11.0", | ||
"@material-ui/icons": "^4.9.1", | ||
"@material-ui/lab": "^4.0.0-alpha.56", | ||
"@material-ui/pickers": "^3.2.10", | ||
"@material-ui/styles": "^4.10.0", | ||
"etebase": "^0.41.0", | ||
"fuse.js": "^5.0.9-beta", | ||
"ical.js": "^1.4.0", | ||
"immutable": "^4.0.0-rc.12", | ||
"localforage": "^1.9.0", | ||
"memoizee": "^0.4.14", | ||
"moment": "^2.27.0", | ||
"react": "^16.13.1", | ||
"react-big-calendar": "^0.26.0", | ||
"react-dom": "^16.13.1", | ||
"react-dropzone": "^10.0.4", | ||
"react-redux": "^7.2.1", | ||
"react-router": "^5.2.0", | ||
"react-router-dom": "^5.2.0", | ||
"react-scripts": "^3.4.1", | ||
"react-transition-group": "^4.3.0", | ||
"react-virtualized": "^9.21.2", | ||
"redux": "^4.0.5", | ||
"redux-actions": "^2.6.5", | ||
"redux-logger": "^3.0.6", | ||
"redux-persist": "^6.0.0", | ||
"redux-thunk": "^2.3.0", | ||
"reselect": "^4.0.0", | ||
"uuid": "^3.1.0" | ||
}, | ||
"scripts": { | ||
"start": "react-scripts start", | ||
"build": "react-scripts build", | ||
"test": "react-scripts test --env=jsdom", | ||
"lint": "eslint --ext .js,.jsx,.ts,.tsx src", | ||
"eject": "react-scripts eject" | ||
}, | ||
"devDependencies": { | ||
"@testing-library/jest-dom": "^4.2.4", | ||
"@testing-library/react": "^9.3.2", | ||
"@testing-library/user-event": "^7.1.2", | ||
"@types/color": "^3.0.1", | ||
"@types/jest": "^24.0.4", | ||
"@types/memoizee": "^0.4.4", | ||
"@types/node": "^11.9.3", | ||
"@types/react": "^16.9.0", | ||
"@types/react-big-calendar": "^0.22.3", | ||
"@types/react-dom": "^16.9.0", | ||
"@types/react-redux": "^7.1.9", | ||
"@types/react-router": "^5.1.8", | ||
"@types/react-router-dom": "^5.1.5", | ||
"@types/react-virtualized": "^9.21.8", | ||
"@types/redux-actions": "^2.6.1", | ||
"@types/redux-logger": "^3.0.8", | ||
"@types/urijs": "^1.15.38", | ||
"@types/uuid": "^3.4.3", | ||
"typescript": "~3.9.7" | ||
}, | ||
"browserslist": [ | ||
">0.2%", | ||
"not dead", | ||
"not ie <= 11", | ||
"not op_mini all" | ||
] | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can you explain this line? Why is 0.0.0.0 not a valid value?
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'll clarify with a comment. But the idea is that etebase-server's default allowed_host1 is 0.0.0.0, so I'm only setting the etebase host if its not the default.
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 this is actually useful, since it won't cause
etesync-web
to be rebuilt for the default setup.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 suggest
default = "0.0.0.0"
. The resulting package will be cached anyway due to the test.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.
Thats not a working or sane default. If you enable etesync-web without an etebase server then the best default is the official etebase server instance(etesync.com). That way etesync-web will actually work without setting a server. 0.0.0.0 doesn't really mean anything.