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

Draupnir: init at 2.0.0-beta.6 #274052

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

TheArcaneBrony
Copy link
Contributor

Description of changes

NOTE: This PR is a successor of #222939. The previous PR was closed by accident during a rebase operation.

Original description:

Draupnir is a hardfork of Mjolnir. Mjolnir package has been unmaintained due to upstream bugs. This package is mostly a drop-in replacement. This package also uses newer methods of handling dependencies.

Repository can be found at:
https://github.com/the-draupnir-project/Draupnir

Note on testing: package and module were (and still are) tested in our production environment, works fine as far as it's been used.
Note on replacing Mjolnir: Not sure whether this is appropriate, due to general usage of the bot changing. You can however fully automatically migrate from mjolnir to draupnir.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 6.topic: lib The Nixpkgs function library labels Dec 13, 2023
@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 11.by: package-maintainer This PR was created by the maintainer of the package it changes 10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 1-10 labels Dec 13, 2023
@gaykitty
Copy link
Contributor

Result of nixpkgs-review pr 274052 run on x86_64-linux 1

2 packages blacklisted:
  • nixos-install-tools
  • tests.nixos-functions.nixos-test
1 package built:
  • draupnir

@h7x4 h7x4 added 8.has: documentation This PR adds or changes documentation 8.has: module (new) This PR adds a module in `nixos/` labels Dec 26, 2023
Copy link
Member

@mweinelt mweinelt left a comment

Choose a reason for hiding this comment

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

I see a lot of potential to improve the module and to bring it in line with today's standards.

I can see that it is a copy of the mjolnir module, but I'm not willing to accept a new module of similar quality, because it is hard to maintain.

This is especially relevant with RFC42 (settings & formatters) in mind

pkgs/servers/draupnir/default.nix Outdated Show resolved Hide resolved
pkgs/servers/draupnir/default.nix Outdated Show resolved Hide resolved
pkgs/servers/draupnir/default.nix Outdated Show resolved Hide resolved
pkgs/servers/draupnir/default.nix Outdated Show resolved Hide resolved
pkgs/servers/draupnir/default.nix Outdated Show resolved Hide resolved
nixos/modules/services/matrix/draupnir.nix Outdated Show resolved Hide resolved
nixos/modules/services/matrix/draupnir.nix Outdated Show resolved Hide resolved
nixos/modules/services/matrix/draupnir.nix Outdated Show resolved Hide resolved
nixos/modules/services/matrix/draupnir.nix Outdated Show resolved Hide resolved
nixos/modules/services/matrix/draupnir.nix Outdated Show resolved Hide resolved
@github-actions github-actions bot removed the 8.has: documentation This PR adds or changes documentation label Jan 5, 2024
@TheArcaneBrony TheArcaneBrony changed the title Draupnir: init at 1.85.1 Draupnir: init at 1.86.0 Jan 20, 2024
@github-actions github-actions bot removed the 6.topic: lib The Nixpkgs function library label Jan 20, 2024
@ofborg ofborg bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jan 20, 2024
@TheArcaneBrony
Copy link
Contributor Author

Time for the almighty rebase on nixos:master... Please don't close the PR again...

@TheArcaneBrony
Copy link
Contributor Author

🎊 It didn't close as merged!

@TheArcaneBrony
Copy link
Contributor Author

(Renamed the package init commit)

@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Jan 20, 2024
@TheArcaneBrony
Copy link
Contributor Author

(^ master rebase)

@teutat3s
Copy link
Member

This now looks good to go for me. A co-authored-by on the test commit would be nice, but is not a requirement for me. Thanks for continuing to push this forward.

Copy link
Member

@mweinelt mweinelt left a comment

Choose a reason for hiding this comment

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

Went over everything except the test.

maintainers/maintainer-list.nix Show resolved Hide resolved
preBuild = ''
# copy built modules to package...
echo "Copying built matrix-sdk-crypto-nodejs modules to package..."
cp -a ${matrix-sdk-crypto-nodejs}/lib/node_modules/* node_modules/
Copy link
Member

Choose a reason for hiding this comment

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

This could probably just be a symlink.

pkgs/by-name/dr/draupnir/package.nix Outdated Show resolved Hide resolved
pkgs/by-name/dr/draupnir/package.nix Outdated Show resolved Hide resolved
Comment on lines 50 to 61
{
services.draupnir = {
enable = true;
pantalaimon = {
enable = true;
username = "draupnir";
passwordFile = "/run/secrets/draupnir-password";
options = {
homeserver = "http://localhost:8008";
ssl = false;
};
};
settings = {
managementRoom = "!yyy:domain.tld";
protectedRooms = [
"https://matrix.to/#/!xxx:domain.tld"
];
};
};
}
Copy link
Member

Choose a reason for hiding this comment

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

Make sure to format this with nixfmt-rfc-style.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

can nixfmt-rfc-style handle markdown files, or should i extract this nix excerpt into a separate file to process?

Copy link
Member

@mweinelt mweinelt Jul 23, 2024

Choose a reason for hiding this comment

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

Extract, format, reinsert.

nixos/modules/services/matrix/draupnir.nix Outdated Show resolved Hide resolved
nixos/modules/services/matrix/draupnir.nix Outdated Show resolved Hide resolved
nixos/modules/services/matrix/draupnir.nix Outdated Show resolved Hide resolved
nixos/modules/services/matrix/draupnir.nix Outdated Show resolved Hide resolved
nixos/modules/services/matrix/draupnir.nix Outdated Show resolved Hide resolved
@TheArcaneBrony
Copy link
Contributor Author

^ just renamed the maintainers commit and added the co author to the tests pr :)

Copy link
Member

@teutat3s teutat3s left a comment

Choose a reason for hiding this comment

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

What's the intention behind moving homeserverUrl? This now needs changing in the docs to fix the manual.

nixos/modules/services/matrix/draupnir.md Outdated Show resolved Hide resolved
pkgs/by-name/dr/draupnir/package.nix Outdated Show resolved Hide resolved
tests = {
inherit (nixosTests) draupnir;
};
updateScript = ./update.sh;
Copy link
Member

Choose a reason for hiding this comment

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

Is there anything special here, that nix-update-script couldn't handle? It can also deal with updating the Yarn cache hash in the derivation.

Suggested change
updateScript = ./update.sh;
updateScript = nix-update-script { };

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hashes are stored in a separate file, I think the reason was that nix-update-script couldn't handle the Yarn cache hash? I'd have to test this once a new Draupnir version comes out.

@wegank wegank removed the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Sep 8, 2024
mkdir -p deps/draupnir/
echo "${version}-nix" > deps/draupnir/version.txt

sed -i 's/corepack //g' deps/draupnir/package.json
Copy link
Contributor Author

Choose a reason for hiding this comment

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

(Copy paste from commit description)
fixup! draupnir: init at 2.0.0-beta.6 - ugly sed hack to drop corepack

Fixes build with corepack upstream introduced by the-draupnir-project/Draupnir#472
Upstream may move to yarn v4, need to investigate options. (the-draupnir-project/Draupnir#475)
Looks like the recommended option is to use a fixed-output derivation?

Sources:

Any suggestions? I'm sure this is an ugly, unnecessary hack, but I couldn't find any documentation on the topic.

Copy link
Contributor

Choose a reason for hiding this comment

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

@TheArcaneBrony This already uses a fixed-output derivation(the offlineCache part), AFAICT if upstream moves to Yarn v4, this package will either need to convert the lockfile to the old version like pgadmin4 or wait until fetchYarnDeps to get v2 lockfile support.

@TheArcaneBrony TheArcaneBrony changed the title Draupnir: init at 2.0.0-beta.4 Draupnir: init at 2.0.0-beta.6 Sep 15, 2024
@winterqt winterqt mentioned this pull request Sep 18, 2024
13 tasks
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Sep 27, 2024
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 1, 2024
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 1, 2024
@TheArcaneBrony
Copy link
Contributor Author

(^ squashed in order to rebase)

@TheArcaneBrony TheArcaneBrony force-pushed the master branch 2 times, most recently from 3d0ec28 to 3667c8c Compare November 1, 2024 19:35
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 2, 2024
@FliegendeWurst
Copy link
Member

Darwin build fails, please mark as broken or fix:

       > gyp ERR! stack at ChildProcess.<anonymous> (/nix/store/m1ymz3alwqc71yrmzl8sas2m8ksqhhsh-nodejs-20.18.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
       > gyp ERR! System Darwin 22.2.0
       > gyp ERR! command "/nix/store/m1ymz3alwqc71yrmzl8sas2m8ksqhhsh-nodejs-20.18.0/bin/node" "/nix/store/m1ymz3alwqc71yrmzl8sas2m8ksqhhsh-nodejs-20.18.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
       > gyp ERR! cwd /private/tmp/nix-build-draupnir-modules-2.0.0-beta.8.drv-0/node_modules/better-sqlite3
       > gyp ERR! node -v v20.18.0
       > gyp ERR! node-gyp -v v10.1.0
       > gyp ERR! not ok

(unfortunately the useful part of the log is gone)

@Scrumplex
Copy link
Member

gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/private/tmp/nix-build-draupnir-modules-2.0.0-beta.8.drv-0/node_modules/better-sqlite3/build'
  TOUCH ba23eeee118cd63e16015df367567cb043fed872.intermediate
  ACTION deps_sqlite3_gyp_locate_sqlite3_target_copy_builtin_sqlite3 ba23eeee118cd63e16015df367567cb043fed872.intermediate
  TOUCH Release/obj.target/deps/locate_sqlite3.stamp
  CC(target) Release/obj.target/sqlite3/gen/sqlite3/sqlite3.o
  LIBTOOL-STATIC Release/sqlite3.a
Traceback (most recent call last):
  File "/private/tmp/nix-build-draupnir-modules-2.0.0-beta.8.drv-0/node_modules/better-sqlite3/build/gyp-mac-tool", line 772, in <module>
    sys.exit(main(sys.argv[1:]))
             ^^^^^^^^^^^^^^^^^^
  File "/private/tmp/nix-build-draupnir-modules-2.0.0-beta.8.drv-0/node_modules/better-sqlite3/build/gyp-mac-tool", line 29, in main
    exit_code = executor.Dispatch(args)
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "/private/tmp/nix-build-draupnir-modules-2.0.0-beta.8.drv-0/node_modules/better-sqlite3/build/gyp-mac-tool", line 44, in Dispatch
    return getattr(self, method)(*args[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/private/tmp/nix-build-draupnir-modules-2.0.0-beta.8.drv-0/node_modules/better-sqlite3/build/gyp-mac-tool", line 278, in ExecFilterLibtool
    libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE, env=env)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/2djmffykchgm4q4j7ylv7xgkg441mp2j-python3-3.12.7/lib/python3.12/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/nix/store/2djmffykchgm4q4j7ylv7xgkg441mp2j-python3-3.12.7/lib/python3.12/subprocess.py", line 1955, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'libtool'
make: *** [deps/sqlite3.target.mk:242: Release/sqlite3.a] Error 1
rm ba23eeee118cd63e16015df367567cb043fed872.intermediate
make: Leaving directory '/private/tmp/nix-build-draupnir-modules-2.0.0-beta.8.drv-0/node_modules/better-sqlite3/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.<anonymous> (/nix/store/n3yy2py144i01235yqq6ps3ah5dkynx2-nodejs-20.18.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
gyp ERR! System Darwin 24.0.0
gyp ERR! command "/nix/store/n3yy2py144i01235yqq6ps3ah5dkynx2-nodejs-20.18.0/bin/node" "/nix/store/n3yy2py144i01235yqq6ps3ah5dkynx2-nodejs-20.18.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /private/tmp/nix-build-draupnir-modules-2.0.0-beta.8.drv-0/node_modules/better-sqlite3
gyp ERR! node -v v20.18.0
gyp ERR! node-gyp -v v10.1.0
gyp ERR! not ok 

After adding libtool to nativeBuildInputs of better-sqlite3 it failed with a different error saying that -static is an unrecognized parameter. It seems like -static only exists in Apple's toolchain? nodejs/node#2341

TheArcaneBrony and others added 4 commits December 19, 2024 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` 8.has: module (new) This PR adds a module in `nixos/` 8.has: module (update) This PR changes an existing module in `nixos/` 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 1-10 11.by: package-maintainer This PR was created by the maintainer of the package it changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.