Commit Graph

8 Commits

Author SHA1 Message Date
Maximilian Bosch
9a62a46874
fetchNextcloudApp: remove backwards compat for old interface
The `name` & `version` attributes only existed in a previous form of
the API before it was switched over to using `fetchzip` &
`applyPatches`[1]. The attributes existed to be able to throw an
evaluation error with upgrade instructions when this was used. However,
this was before 22.11, so this shouldn't be in use anymore (and if
somebody is doing a migration from a very old NixOS, this is still
documented in the 22.11 release-notes[2]).

Anyways, this simplifies the code a little bit and also having both
`appName`/`appVersion` and `name`/`version` in there is quite confusing. But
still, I figured it's less confusing to not re-use attributes that were
deprecated in the past, hence the alternative naming.

[1] 3ca9b9a8ad
[2] d41b381310
2023-08-20 13:41:43 +02:00
Maximilian Bosch
c317dcec0d
nextcloud*Packages: expose proper license information
This change makes sure that each Nextcloud plugin installed provides a
`meta` section with proper license information.

Unfortunately, the metadata from the appstore is useless for this
purpose since it doesn't differentiate between e.g. AGPL 3.x and AGPL
3.x or any later version. In fact, this isn't consistent between their
software, e.g. `bookmarks` has `agpl3Plus` according to the files'
headers[1] whereas `twofactor_nextcloud_notification` is AGPL 3 only[2].

I don't think there's any trivial and reasonable way to retrieve this
information programatically, so I decided to change the format of
`nextcloud-apps.json`[3] to also contain the license in the form of the
license attribute we have in `lib/licenses.nix`, i.e. GNU AGPL 3 or
later is `agpl3Plus`.

I retrieved the information using the following approach:

* go to the source code of $app at the revision we currently have
  packaged
* check for a license identifier (does it specify the license only or
  the license "or any later version")?
  * first in `src/main.js` because most apps from Nextcloud itself used
    actual spdx identifiers in the frontend's source-code.
  * then in `lib/AppInfo/Application.php` which each Nextcloud app has.

License changes should be updated accordingly when updating the apps. As
with any other package in nixpkgs as well, this currently needs to be
done manually (or as part of the review process)[4].

Also, I decided to change the `name` of the `applyPatches` derivation
from `source-patched` to `nextcloud-app-${appName}-${appVersion}`. When
deploying a lot of apps (and probably displaying the diff using
`nix store diff-closures` on deploy), the current output isn't very
helpful. This is purely optional because I didn't want to break the
interface of `fetchNextcloudApp` again.

[1] https://github.com/nextcloud/bookmarks/blob/v13.1.0/lib/AppInfo/Application.php#L6
[2] https://github.com/nextcloud/twofactor_nextcloud_notification/blob/v3.7.0/lib/AppInfo/Application.php
[3] This isn't really well-defined since it's preprocessed with `jq(1)`
    before passing the apps to nc4nix.
[4] Though notable license changes (e.g. agpl -> gpl) would also pop up
    in the diff of <nextcloudversion>.json, so this is pretty easy to
    catch.
2023-08-20 13:39:44 +02:00
Raito Bezarius
b4b1ce2443
fetchNextcloudApp: meta propagation for licenses, etc.
This improves the metadata propgation for nc4nix-generated packages.

Adds:

- licenses (best effort given spdxId doesn't seem guaranteed here)
- homepage
- longDescription
2023-08-20 11:49:15 +02:00
Maximilian Bosch
3ca9b9a8ad
fetchNextcloudApp: rewrite with fetchzip & applyPatches
There are the following issues with the current implementation:

* `fetchurl` with a tarball from GitHub appears to break occasionally
  because the tarballs are not necessarily reproducible. Because of
  that, `fetchFromGitHub` unpacks the tarball already because the
  contents are actually reproducible in contrast to the tarball. To have
  the same behavior here, we use `fetchzip` now (and `applyPatches` on
  top to apply additional patches if needed).

* Fixes the way how patches are applied. Previously, when having patches
  for a git checkout of the app, these wouldn't apply because the
  `appname-version` prefix is missing.

* Because all old hashes are broken with this, I added an evaluation
  check that breaks evaluation when using the old API (i.e. with
  `name`/`version` which are not needed anymore).
2022-09-26 20:32:33 +02:00
ajs124
0ce971e5d2 fetchnextcloudapp: name -> pname
this way name and the storepath contain the version, which can be useful
sometimes
2022-07-26 10:58:06 +02:00
Ben Siraphob
259fa13d53 treewide: remove nativeBuildInputs that are in stdenv 2022-04-16 21:46:46 +03:00
Maximilian Bosch
1ee008fcb5
nixos/nextcloud: fixup #119638
A few minor changes to get #119638 - nextcloud: add option to set
datadir and extensions - ready:

* `cfg.datadir` now gets `cfg.home` as default to make the type
  non-nullable.
* Enhanced the `basic` test to check the behavior with a custom datadir
  that's not `/var/lib/nextcloud`.
* Fix hashes for apps in option example.
* Simplify if/else for `appstoreenable` in override config.
* Simplify a few `mapAttrsToList`-expressions in
  `nextcloud-setup.service`.
2021-10-09 22:45:31 +02:00
Robbert Gurdeep Singh
18b18929d7
nixos/nextcloud: add settings to manage nextcloud apps
Note the appstoreEnable which will prevent nextcloud form updating
nix-managed apps. This is needed because nextcloud will store an other
version of the app in /var/lib/nextcloud/store-apps and it will
no longer be manageable.
2021-10-09 20:33:16 +02:00