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

Implement Nix Flake #424

Merged
merged 3 commits into from
Oct 24, 2021
Merged

Implement Nix Flake #424

merged 3 commits into from
Oct 24, 2021

Conversation

ysndr
Copy link
Contributor

@ysndr ysndr commented Oct 22, 2021

This PR makes transfer.sh available to the nix works by providing a nixos Module and standalone executable (on non-nixos machines) as well as a default configuration and basic container image definition.

@aspacca
Copy link
Collaborator

aspacca commented Oct 22, 2021

thanks @ysndr , much appreciated

flake.nix Outdated
enable = mkEnableOption "Transfer.sh service";
listener = mkOption { default = 80; type = types.int; description = "port to use for http (:80)"; };
profile-listener = mkOption { default = 6060; type = types.int; description = "port to use for profiler (:6060)"; };
force-https = mkOption { default = null; type = types.nullOr types.bool; description = "redirect to https"; };

Choose a reason for hiding this comment

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

mkOption argument default is null by default.
Also, consider formatting all this with new lines and if you are really against it - define a function's like this:

mkNullOrStrOption = description: mkOption { type = types.nullOr types.str; inherit description; }

flake.nix Outdated
Comment on lines 66 to 68
provider_options =

{

Choose a reason for hiding this comment

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

Suggested change
provider_options =
{
provider_options = {

flake.nix Outdated
else if !cfg.provider.aws.enable && cfg.provider.storj.enable && !cfg.provider.gdrive.enable && !cfg.provider.local.enable then storj-config
else if !cfg.provider.aws.enable && !cfg.provider.storj.enable && cfg.provider.gdrive.enable && !cfg.provider.local.enable then gdrive-config
else if !cfg.provider.aws.enable && !cfg.provider.storj.enable && !cfg.provider.gdrive.enable && cfg.provider.local.enable then local-config
else throw "transfer.sh requires exactly one provider (aws, storj, gdrive)"

Choose a reason for hiding this comment

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

Suggested change
else throw "transfer.sh requires exactly one provider (aws, storj, gdrive)"
else throw "transfer.sh requires exactly one provider (aws, storj, drive, local)"

@aspacca aspacca merged commit 694b3ce into dutchcoders:main Oct 24, 2021
@aspacca
Copy link
Collaborator

aspacca commented Oct 24, 2021

@ysndr could you explain how to keep the flake update when we bump version? (if it's needed)

thanks

@ysndr
Copy link
Contributor Author

ysndr commented Oct 24, 2021

@aspacca The flake defines the build for the entire repository, as long as you do not introduce non-go dependencies its all good.
If you add new flags to the binary you can try adding them yourself or ping me to add them.

@aspacca
Copy link
Collaborator

aspacca commented Oct 24, 2021

all clear, thanks

@aspacca
Copy link
Collaborator

aspacca commented Oct 31, 2021

@ysndr
I bumped a dependency and I have a doubt about https://github.com/dutchcoders/transfer.sh/blob/main/flake.nix#L11
From nix documentation:

vendorSha256: is the hash of the output of the intermediate fetcher derivation. vendorSha256 can also take null as an input. When null is used as a value, rather than fetching the dependencies and vendoring them, we use the vendoring included within the source repo. If you’d like to not have to update this field on dependency changes, run go mod vendor in your source repo and set vendorSha256 = null;

If I got it right it's the sh256 of the vendor directory, bumping the version of one dependency should have changed it, so the value should be updated.

What's the cons of setting vendorSha256 = null and run go mod vendor?

GanZhiXiong added a commit to GanZhiXiong/transfer.sh that referenced this pull request Nov 10, 2021
…ch-1

* 'patch-1' of github.com:GanZhiXiong/transfer.sh:
  issue dutchcoders#420 added MaxDate.IsZero() check (dutchcoders#427)
  fix go1.16, add go1.17
  bump bluemonday
  Revert "issue dutchcoders#420 return 400 response when Max-Days is too big (dutchcoders#422)" (dutchcoders#426)
  issue dutchcoders#420 return 400 response when Max-Days is too big (dutchcoders#422)
  Implement Nix Flake (dutchcoders#424)
  fix missed errors (dutchcoders#417)
  Fix path (dutchcoders#416)
  Edited code of condunct for more information and corrected a grammatical error (dutchcoders#421)
  Update README.md (dutchcoders#415)
  Update README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants