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

gogs: init at v0.9.97 #19361

Merged
merged 5 commits into from Jan 20, 2017
Merged

gogs: init at v0.9.97 #19361

merged 5 commits into from Jan 20, 2017

Conversation

schneefux
Copy link
Contributor

@schneefux schneefux commented Oct 8, 2016

I updated #13566 to the latest release and improved the code a bit.

Tested:

  • repository mirroring
  • SSH authentication
  • .tar.gz downloads
  • PAM disabled
  • MySQL/Postgres setup
  • fresh install

cc @valeriangalliat @kamilchm @yorickvP

@schneefux schneefux mentioned this pull request Oct 8, 2016

buildGoPackage rec {
name = "gogs-${version}";
version = "v0.9.97";
Copy link
Member

Choose a reason for hiding this comment

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

The version part of the name attribute must start with a digit (following a dash) — e.g., "hello-0.3.1rc2". nixpkgs manual - 10.2. Package naming

I made the same mistake a few days ago...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@primeos @groxxda v is removed.

src = fetchFromGitHub {
owner = "gogits";
repo = "gogs";
rev = "${version}";
Copy link
Member

Choose a reason for hiding this comment

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

You could use rev = "v${version}"; 😉

};
}
{
goPackagePath = "github.com/mattn/go-sqlite3";
Copy link
Member

Choose a reason for hiding this comment

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

this probably needs the sqlite package

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It works fine without.
Other packages (1, 2) that depend on go-sqlite3 also don't include it.


patchPhase = ''
substituteInPlace models/repo.go \
--replace '#!/usr/bin/env %s\n' "#!${bash}/bin/bash\\n#%s\\n"
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't look right, you probably want to use ${coreutils}/bin/env here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

# ++ stdenv.lib.optional pamSupport pam
;

buildFlags = "-tags"
Copy link
Member

Choose a reason for hiding this comment

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

buildFlags should be a list if you specify multiple arguments, then you don't have to worry about the space prefix.

@schneefux
Copy link
Contributor Author

After updating and garbage collection, pushing fails with an error like remote: hooks/update: line 3: /nix/store/53skjfhn19djc5mljp6vhr5mjm1gznnj-go1.7-gogs-v0.9.97-bin/bin/gogs: No such file or directory
As stated in Gogs' troubleshooting section the admin needs to rewrite all hooks via the admin panel when the Gogs binary path changes. How to deal with this or how do you notify the user?

@Mic92
Copy link
Member

Mic92 commented Oct 15, 2016

@schneefux this will happen after every upgrade, right?

@schneefux
Copy link
Contributor Author

@Mic92 Yes/No. After an update, the hooks will use the old Gogs version until the user does nix-collect-garbage, and then it will fail.

@Mic92
Copy link
Member

Mic92 commented Oct 22, 2016

@schneefux could be those hooks fixed in the module on service restart?

@schneefux
Copy link
Contributor Author

@Mic92 not as far as I know. I just opened an issue here.

@Mic92
Copy link
Member

Mic92 commented Oct 22, 2016

@schneefux the alternative would be sed regexp.

@schneefux
Copy link
Contributor Author

schneefux commented Oct 22, 2016

@Mic92

the alternative would be sed regexp.

What do you think about

HOOKS=$(find ${cfg.repositoryRoot} -mindepth 4 -maxdepth 4 -type f -wholename "*git/hooks/*")
sed -i 's,"/nix/store/[a-z0-9.-]+/bin/gogs,${pkgs.gogs.bin}/bin/gogs,g' $HOOKS
sed -i 's,"/nix/store/[a-z0-9.-]+/bin/env,${pkgs.coreutils.bin}/bin/env,g' $HOOKS
sed -i 's,"/nix/store/[a-z0-9.-]+/bin/perl,${pkgs.perl.bin}/bin/perl,g' $HOOKS
sed -i 's,"/nix/store/[a-z0-9.-]+/bin/bash,${pkgs.bash.bin}/bin/bash,g' $HOOKS

?

@Mic92
Copy link
Member

Mic92 commented Oct 22, 2016

@schneefux by default only the update hook containing gogs should by affected, right?

@Mic92 Mic92 mentioned this pull request Oct 22, 2016
3 tasks
@schneefux
Copy link
Contributor Author

by default only the update hook containing gogs should by affected, right?

Yes, but I think it's better to update all hooks - for example if a user copies the post-update.sample hook.
I added the sed expressions to the module's preStart: #19363

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Jan 20, 2017

What's the status on this? Is there something needed to be done? I'd love to see this merged.

@schneefux
Copy link
Contributor Author

Updated to latest release
It's been running fine for months on my server, together with the module (#19363).

@fpletz fpletz added this to the 17.03 milestone Jan 20, 2017
@LnL7
Copy link
Member

LnL7 commented Jan 20, 2017

I lost track of this, I'll test this after my other stuff is done building.

@LnL7 LnL7 merged commit 66c0b9d into NixOS:master Jan 20, 2017
@rnhmjoj
Copy link
Contributor

rnhmjoj commented Jan 21, 2017

Thank you!

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

8 participants