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
duplicati: init at 2.0.3.3 #38533
Conversation
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.
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 { |
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.
You can use fetchzip
instead, then the sourceRoot
and unzip
as build input isn't needed.
''; | ||
|
||
serviceConfig = { | ||
Type = "simple"; |
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 the default, you can omit this
} | ||
chown -R duplicati:duplicati /var/lib/duplicati/ | ||
chmod 0700 /var/lib/duplicati/ | ||
''; |
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.
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, ... }: |
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.
mono argument unused
@@ -0,0 +1,34 @@ | |||
{ stdenv, fetchurl, mono, sqlite, makeWrapper, unzip }: | |||
|
|||
stdenv.mkDerivation rec { |
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.
Could you try building it from source?
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.
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.
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.
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 ?)
4cbe6d7
to
6bd4604
Compare
@infinisil I think I completed all your requests ! |
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.
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; |
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.
Nitpick: Spaces around =
|
||
installPhase = '' | ||
mkdir -p $out/{bin,share/${name}} | ||
cp -r * $out/share/${name}/. |
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.
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 \ |
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.
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).
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 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"; |
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.
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.
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.
Yes I wanted to do it once the package is working
6bd4604
to
059330c
Compare
@infinisil I just pushed the fixes |
059330c
to
f5330af
Compare
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: Otherwise this looks good and ready for merging :) |
f5330af
to
b3aa9ec
Compare
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
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)