Skip to content
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

duplicati: init at 2.0.3.3 #38533

Merged
merged 2 commits into from Apr 9, 2018
Merged

Conversation

nyanloutre
Copy link
Member

@nyanloutre nyanloutre commented Apr 6, 2018

Motivation for this change

Creation of a Duplicati package, a very nice backup tool that I use regularly.
This is my first package pull request so I might have forgotten some things.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice first PR, well done!

In addition to my review comments, something you should do is split this change up into 2 commits: One for the package, and one for the service.

channel = "beta";
build_date = "2018-04-02";

src = fetchurl {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use fetchzip instead, then the sourceRoot and unzip as build input isn't needed.

'';

serviceConfig = {
Type = "simple";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the default, you can omit this

}
chown -R duplicati:duplicati /var/lib/duplicati/
chmod 0700 /var/lib/duplicati/
'';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add createHome = true to the user declaration, then all of this is done automatically for you and you can omit preStart and PermissionsStartOnly.

@@ -0,0 +1,48 @@
{ config, pkgs, lib, mono, ... }:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mono argument unused

@@ -0,0 +1,34 @@
{ stdenv, fetchurl, mono, sqlite, makeWrapper, unzip }:

stdenv.mkDerivation rec {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you try building it from source?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I want to do this in a following update to the package. Since it is my first attempt to create a package I wanted to start simple and improve later on.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default Makefile is using nuget to fetch dependencies, and it seems that it is not possible for a Nix build to fetch things from the internet during the build. I don't know enough about C# builds to know how this could work, so someone with more knowledge on this subject could help (maybe I should create an issue ?)

@nyanloutre nyanloutre force-pushed the duplicati-package branch 5 times, most recently from 4cbe6d7 to 6bd4604 Compare April 7, 2018 10:48
@nyanloutre
Copy link
Member Author

@infinisil I think I completed all your requests !

Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple minor things

Now I enabled this service on my machine, but how do you actually use it? Going to http://localhost:8200 doesn't give me anything.

src = fetchzip {
url = "https://github.com/duplicati/duplicati/releases/download/v${version}-${version}_${channel}_${build_date}/duplicati-${version}_${channel}_${build_date}.zip";
sha256 = "0hwdpsgrvm3gq648mg9g0z0rk49g71dd8r5i1a8w83pwdqv0hn9c";
stripRoot=false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Spaces around =


installPhase = ''
mkdir -p $out/{bin,share/${name}}
cp -r * $out/share/${name}/.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another nitpick: I don't think the /. at the end is needed

installPhase = ''
mkdir -p $out/{bin,share/${name}}
cp -r * $out/share/${name}/.
makeWrapper "${mono}/bin/mono" $out/bin/Duplicati \
Copy link
Member

@infinisil infinisil Apr 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the manual I see that the normal command name is duplicati-cli, I don't really care about the -cli suffix, but it would be nice for it to be lowercased. (I just struggled trying to run it for 5 minutes before realizing it's upper case in the current version).

Copy link
Member Author

@nyanloutre nyanloutre Apr 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea was to make it work like the AUR package, which means a service run in a systemd unit and listen on port 8200. All the configuration is then made in the web UI.

But you are right, I should add the duplicati-cli

serviceConfig = {
User = "duplicati";
Group = "duplicati";
ExecStart = "${pkgs.duplicati}/bin/Duplicati --webservice-interface=any --webservice-port=8200 --server-datafolder=/var/lib/duplicati";
Copy link
Member

@infinisil infinisil Apr 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using these defaults (bind to any interface, listen on 8200 and this data directory) is probably fine for now, the module could be extended to have options for these later on if people need it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I wanted to do it once the package is working

@nyanloutre
Copy link
Member Author

@infinisil I just pushed the fixes

@infinisil
Copy link
Member

Ah nice, I'm still not exactly sure how it's supposed to be used, but having duplicati-cli and -server makes much more sense, and the binaries don't segfault so that's good. One last thing from my side: The duplicati package probably should be installed when you have the service enabled: environment.systemPackages = [ pkgs.duplicati ];

Otherwise this looks good and ready for merging :)

@matthewbauer matthewbauer merged commit 1381606 into NixOS:master Apr 9, 2018
@nyanloutre nyanloutre deleted the duplicati-package branch June 9, 2018 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants