nextcloud: Fetch apps using nvfetcher

This commit is contained in:
Tristan Daniël Maat 2022-10-17 11:00:02 +01:00
parent c4fa991b62
commit 61d3008bc3
Signed by: tlater
GPG key ID: 49670FD774E43268
9 changed files with 318 additions and 66 deletions

View file

@ -20,6 +20,7 @@
(final: prev: {
local = import ../pkgs {
pkgs = prev;
lib = prev.lib;
};
})
];

View file

@ -33,54 +33,8 @@ in {
#
# Adopt whatever upstream does with this:
# https://github.com/nextcloud/server/issues/4917
apporder = pkgs.fetchNextcloudApp {
name = "apporder";
url = "https://github.com/juliushaertl/apporder/releases/download/v0.15.0/apporder.tar.gz";
version = "0.15.0";
sha256 = "sha256-p3VWxTYDCO2NePq6oLM8tBVqYkvoB7itqxp7IZwGDnE=";
};
bookmarks = pkgs.fetchNextcloudApp {
name = "bookmarks";
url = "https://github.com/nextcloud/bookmarks/releases/download/v11.0.4/bookmarks-11.0.4.tar.gz";
version = "11.0.4";
sha256 = "sha256-URqtzaCx8FEZHCDP1wSBUFNs+x50jesRtWi+xOU1oXM=";
};
calendar = pkgs.fetchNextcloudApp {
name = "calendar";
url = "https://github.com/nextcloud-releases/calendar/releases/download/v3.5.0/calendar-v3.5.0.tar.gz";
version = "3.5.0";
sha256 = "sha256-+LRGl9h40AQdWN9SW+NqGwTafAGwV07Af8nVs3pUCm0=";
};
contacts = pkgs.fetchNextcloudApp {
name = "contacts";
url = "https://github.com/nextcloud-releases/contacts/releases/download/v4.2.2/contacts-v4.2.2.tar.gz";
version = "4.2.2";
sha256 = "sha256-GTiyZsUHBXPgQ17DHAihmt2W/ZnAjDwfgwnujkRwk6A=";
};
cookbook = pkgs.fetchNextcloudApp {
name = "cookbook";
url = "https://github.com/nextcloud/cookbook/releases/download/v0.9.15/Cookbook-0.9.15.tar.gz";
version = "0.9.15";
sha256 = "sha256-v64rLGyMQOdStyivpJsKrNxwumVQvyK3CnHtZ+K+elE=";
};
news = pkgs.fetchNextcloudApp {
name = "news";
url = "https://github.com/nextcloud/news/releases/download/18.2.0/news.tar.gz";
version = "18.2.0";
sha256 = "sha256-eS0cFwJmYfGGJmA02AOWO/OXfqfyI71u2GataDj18DE=";
};
notes = pkgs.fetchNextcloudApp {
name = "notes";
url = "https://github.com/nextcloud/notes/releases/download/v4.5.1/notes.tar.gz";
version = "4.5.1";
sha256 = "sha256-rd3uVkVtARX4enRAWm1ivV468lboYZnYe7/zsqaHYpk=";
};
inherit (pkgs.local) apporder;
inherit (pkgs.local) bookmarks calendar contacts cookbook news notes;
};
# TODO(tlater): Add redis config. This will be much easier

View file

@ -164,6 +164,37 @@
"type": "github"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils-pre-commit": {
"locked": {
"lastModified": 1644229661,
@ -289,6 +320,28 @@
"type": "indirect"
}
},
"nvfetcher": {
"inputs": {
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1664550666,
"narHash": "sha256-eXfMRd9uItEp3PsYI31FSVGPG9dVC6yF++65ZrGwW8A=",
"owner": "berberman",
"repo": "nvfetcher",
"rev": "9763ad40d59a044e90726653d9253efaeeb053b2",
"type": "github"
},
"original": {
"owner": "berberman",
"repo": "nvfetcher",
"type": "github"
}
},
"poetry2nix": {
"flake": false,
"locked": {
@ -337,6 +390,7 @@
"inputs": {
"deploy-rs": "deploy-rs",
"nixpkgs": "nixpkgs_2",
"nvfetcher": "nvfetcher",
"sops-nix": "sops-nix",
"tlaternet-webserver": "tlaternet-webserver"
}

View file

@ -8,6 +8,10 @@
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
nvfetcher = {
url = "github:berberman/nvfetcher";
inputs.nixpkgs.follows = "nixpkgs";
};
tlaternet-webserver = {
url = "git+https://gitea.tlater.net/tlaternet/tlaternet.git";
inputs.nixpkgs.follows = "nixpkgs";
@ -18,6 +22,7 @@
self,
nixpkgs,
sops-nix,
nvfetcher,
deploy-rs,
tlaternet-webserver,
}: let
@ -89,22 +94,35 @@
####################
# VM launch script #
####################
apps.${system}.default = let
inherit (self.nixosConfigurations.vm.config.system.build) vm;
apps.${system} = let
inherit (nixpkgs.legacyPackages.${system}) writeShellScript;
qemuNetOpts = self.lib.makeQemuNetOpts {
"2222" = "2222";
"3080" = "80";
"3443" = "443";
"21025" = "21025"; # Starbound
};
in {
type = "app";
program = builtins.toString (writeShellScript "run-vm" ''
export QEMU_OPTS="-m 3941 -smp 2 -display curses"
export QEMU_NET_OPTS="${qemuNetOpts}"
"${vm}/bin/run-tlaternet-vm"
'');
default = let
inherit (self.nixosConfigurations.vm.config.system.build) vm;
qemuNetOpts = self.lib.makeQemuNetOpts {
"2222" = "2222";
"3080" = "80";
"3443" = "443";
"21025" = "21025"; # Starbound
};
in {
type = "app";
program = builtins.toString (writeShellScript "run-vm" ''
export QEMU_OPTS="-m 3941 -smp 2 -display curses"
export QEMU_NET_OPTS="${qemuNetOpts}"
"${vm}/bin/run-tlaternet-vm"
'');
};
update-nextcloud-apps = let
nvfetcher-bin = "${nvfetcher.defaultPackage.${system}}/bin/nvfetcher";
in {
type = "app";
program = builtins.toString (writeShellScript "update-nextcloud-apps" ''
cd "$(git rev-parse --show-toplevel)/pkgs"
${nvfetcher-bin} -o _sources_nextcloud -c nextcloud-apps.toml
'');
};
};
###########################

View file

@ -0,0 +1,107 @@
{
"apporder": {
"cargoLocks": null,
"date": null,
"extract": null,
"name": "apporder",
"passthru": null,
"pinned": false,
"src": {
"name": null,
"sha256": "sha256-2y2FHxli9mqlPvw9mABi09Z96OfB1AFD+XmuV5aOCxY=",
"type": "url",
"url": "https://github.com/juliushaertl/apporder/archive/v0.15.0.tar.gz"
},
"version": "v0.15.0"
},
"bookmarks": {
"cargoLocks": null,
"date": null,
"extract": null,
"name": "bookmarks",
"passthru": null,
"pinned": false,
"src": {
"name": null,
"sha256": "sha256-X6Mg0jQ8EYPctiZ3tDtG4LUPwXRnDj9CJrJZrUs3Z/8=",
"type": "url",
"url": "https://github.com/nextcloud/bookmarks/archive/v11.0.4.tar.gz"
},
"version": "v11.0.4"
},
"calendar": {
"cargoLocks": null,
"date": null,
"extract": null,
"name": "calendar",
"passthru": null,
"pinned": false,
"src": {
"name": null,
"sha256": "sha256-keeWi/o+mOV7z5QNATJKwrd0olbCNdrK7YpGHg9qolk=",
"type": "url",
"url": "https://github.com/nextcloud-releases/calendar/archive/v3.5.0.tar.gz"
},
"version": "v3.5.0"
},
"contacts": {
"cargoLocks": null,
"date": null,
"extract": null,
"name": "contacts",
"passthru": null,
"pinned": false,
"src": {
"name": null,
"sha256": "sha256-4dEEy8zSjZYsClO6u+oWfvIlPYJq9+m1+a/mHTQRlaY=",
"type": "url",
"url": "https://github.com/nextcloud-releases/contacts/archive/v4.2.2.tar.gz"
},
"version": "v4.2.2"
},
"cookbook": {
"cargoLocks": null,
"date": null,
"extract": null,
"name": "cookbook",
"passthru": null,
"pinned": false,
"src": {
"name": null,
"sha256": "sha256-TkUCCa7wP6leQbTsxKgD21Tf9CONVnbmvXCFhVBITZw=",
"type": "url",
"url": "https://github.com/nextcloud/cookbook/archive/v0.9.15.tar.gz"
},
"version": "v0.9.15"
},
"news": {
"cargoLocks": null,
"date": null,
"extract": null,
"name": "news",
"passthru": null,
"pinned": false,
"src": {
"name": null,
"sha256": "sha256-eS0cFwJmYfGGJmA02AOWO/OXfqfyI71u2GataDj18DE=",
"type": "url",
"url": "https://github.com/nextcloud/news/releases/download/18.2.0/news.tar.gz"
},
"version": "18.2.0"
},
"notes": {
"cargoLocks": null,
"date": null,
"extract": null,
"name": "notes",
"passthru": null,
"pinned": false,
"src": {
"name": null,
"sha256": "sha256-qhhaQyb9LgLza4CAcNZbl97xa271M7Wqmw8TtBEFpXk=",
"type": "url",
"url": "https://github.com/nextcloud/notes/archive/v4.5.1.tar.gz"
},
"version": "v4.5.1"
}
}

View file

@ -0,0 +1,60 @@
# This file was generated by nvfetcher, please do not modify it manually.
{ fetchgit, fetchurl, fetchFromGitHub }:
{
apporder = {
pname = "apporder";
version = "v0.15.0";
src = fetchurl {
url = "https://github.com/juliushaertl/apporder/archive/v0.15.0.tar.gz";
sha256 = "sha256-2y2FHxli9mqlPvw9mABi09Z96OfB1AFD+XmuV5aOCxY=";
};
};
bookmarks = {
pname = "bookmarks";
version = "v11.0.4";
src = fetchurl {
url = "https://github.com/nextcloud/bookmarks/archive/v11.0.4.tar.gz";
sha256 = "sha256-X6Mg0jQ8EYPctiZ3tDtG4LUPwXRnDj9CJrJZrUs3Z/8=";
};
};
calendar = {
pname = "calendar";
version = "v3.5.0";
src = fetchurl {
url = "https://github.com/nextcloud-releases/calendar/archive/v3.5.0.tar.gz";
sha256 = "sha256-keeWi/o+mOV7z5QNATJKwrd0olbCNdrK7YpGHg9qolk=";
};
};
contacts = {
pname = "contacts";
version = "v4.2.2";
src = fetchurl {
url = "https://github.com/nextcloud-releases/contacts/archive/v4.2.2.tar.gz";
sha256 = "sha256-4dEEy8zSjZYsClO6u+oWfvIlPYJq9+m1+a/mHTQRlaY=";
};
};
cookbook = {
pname = "cookbook";
version = "v0.9.15";
src = fetchurl {
url = "https://github.com/nextcloud/cookbook/archive/v0.9.15.tar.gz";
sha256 = "sha256-TkUCCa7wP6leQbTsxKgD21Tf9CONVnbmvXCFhVBITZw=";
};
};
news = {
pname = "news";
version = "18.2.0";
src = fetchurl {
url = "https://github.com/nextcloud/news/releases/download/18.2.0/news.tar.gz";
sha256 = "sha256-eS0cFwJmYfGGJmA02AOWO/OXfqfyI71u2GataDj18DE=";
};
};
notes = {
pname = "notes";
version = "v4.5.1";
src = fetchurl {
url = "https://github.com/nextcloud/notes/archive/v4.5.1.tar.gz";
sha256 = "sha256-qhhaQyb9LgLza4CAcNZbl97xa271M7Wqmw8TtBEFpXk=";
};
};
}

View file

@ -1,5 +1,18 @@
{pkgs, ...}: let
{
pkgs,
lib,
}: let
inherit (builtins) listToAttrs mapAttrs;
inherit (pkgs) callPackage;
in {
starbound = callPackage ./starbound {};
}
in
{
starbound = callPackage ./starbound {};
}
// (
# Add nextcloud apps
let
mkNextcloudApp = pkgs.callPackage ./mkNextcloudApp.nix {};
sources = pkgs.callPackage ./_sources_nextcloud/generated.nix {};
in
mapAttrs (_: source: mkNextcloudApp source) sources
)

13
pkgs/mkNextcloudApp.nix Normal file
View file

@ -0,0 +1,13 @@
{
fetchNextcloudApp,
lib,
}: let
inherit (lib) removePrefix;
in
source:
fetchNextcloudApp {
name = source.pname;
version = removePrefix "v" source.version;
url = source.src.url;
sha256 = source.src.outputHash;
}

32
pkgs/nextcloud-apps.toml Normal file
View file

@ -0,0 +1,32 @@
[apporder]
src.github = "juliushaertl/apporder"
fetch.url = "https://github.com/juliushaertl/apporder/archive/$ver.tar.gz"
[bookmarks]
src.github = "nextcloud/bookmarks"
fetch.url = "https://github.com/nextcloud/bookmarks/archive/$ver.tar.gz"
[calendar]
src.manual = "v3.5.0" # Pinned until we update to nextcloud 25
# src.github = "nextcloud-releases/calendar"
fetch.url = "https://github.com/nextcloud-releases/calendar/archive/$ver.tar.gz"
[contacts]
src.manual = "v4.2.2" # Pinned until we update to nextcloud 25
# src.github = "nextcloud-releases/contacts"
fetch.url = "https://github.com/nextcloud-releases/contacts/archive/$ver.tar.gz"
[cookbook]
src.github = "nextcloud/cookbook"
fetch.url = "https://github.com/nextcloud/cookbook/archive/$ver.tar.gz"
[news]
src.github = "nextcloud/news"
# Sadly, the news app vendors things, and those are only included in
# their tarball.
fetch.url = "https://github.com/nextcloud/news/releases/download/$ver/news.tar.gz"
[notes]
src.manual = "v4.5.1" # Pinned until we update to nextcloud 25
# src.github = "nextcloud/notes"
fetch.url = "https://github.com/nextcloud/notes/archive/$ver.tar.gz"