Some work on OOYE module, updates

This commit is contained in:
Rory& 2024-11-22 21:17:40 +01:00
parent f1737ab050
commit 72e888ca97
23 changed files with 235 additions and 121 deletions

3
.gitignore vendored
View file

@ -3,4 +3,5 @@ hardware-configuration.nix
matrix-user-tokens.txt
nixpkgs/
result
wg/
wg/
*.qcow2

13
.idea/.gitignore vendored Normal file
View file

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/modules.xml
/projectSettingsUpdater.xml
/contentModel.xml
/.idea.Litenet-Nix-Infra.iml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View file

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/.idea.Litenet-Nix-Infra.iml
/modules.xml
/contentModel.xml
/projectSettingsUpdater.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes>
<Path>modules/packages/ooye/packages/result</Path>
<Path>result</Path>
</explicitExcludes>
</component>
</project>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/modules/packages/ooye/packages/ooye-src" vcs="Git" />
</component>
</project>

8
.idea/indexLayout.xml Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

7
.idea/vcs.xml Normal file
View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/modules/packages/ooye/packages/ooye-src" vcs="Git" />
</component>
</project>

View file

@ -7,21 +7,28 @@ if [ $# -ne 2 ]; then
cat flake.nix | grep '.lib.nixosSystem' | sed 's/ =.*//' | sed 's/^[ \t]*//;s/[ \t]*$//' | while read cfg; do echo " - $cfg"; done
exit 1
fi
if [ "$1" = "/" ]; then
[ -f "host/${2}/pre-rebuild.sh" ] && host/$2/pre-rebuild.sh
nixos-generate-config --show-hardware-config > hardware-configuration.nix
ROOT=$1
CONFIG=$2
DERIVATION=".#nixosConfigurations.${CONFIG}.config.system.build.toplevel"
EXTRA_NIX_FLAGS="-L --accept-flake-config"
if [ "${ROOT}" = "/" ]; then
[ -f "host/${CONFIG}/hooks/pre-rebuild.sh" ] && host/${CONFIG}/hooks/pre-rebuild.sh
[ ! -f "hardware-configuration.nix" ] && nixos-generate-config --show-hardware-config > hardware-configuration.nix
git add -f hardware-configuration.nix
nom build .#nixosConfigurations.${2}.config.system.build.toplevel && sudo nixos-rebuild switch --flake .#${HOSTNAME} || exit 1
nixos-rebuild switch --flake ".#${2}" -j`nproc` --upgrade-all -L || exit 1
[ -f "host/${2}/post-rebuild.sh" ] && host/$2/post-rebuild.sh
nom build $DERIVATION $EXTRA_NIX_FLAGS && nixos-rebuild switch --flake .#${CONFIG} --upgrade-all $EXTRA_NIX_FLAGS --use-remote-sudo || exit 1
#nixos-rebuild switch --flake ".#${CONFIG}" -j`nproc` --upgrade-all -L || exit 1
[ -f "host/${CONFIG}/hooks/post-rebuild.sh" ] && host/${CONFIG}/hooks/post-rebuild.sh
git rm --cached hardware-configuration.nix
exit
else
nixos-generate-config --show-hardware-config --root "${1}" > hardware-configuration.nix
nixos-generate-config --show-hardware-config --root "${ROOT}" > hardware-configuration.nix
git add -f hardware-configuration.nix
nix build .#nixosConfigurations.${2}.config.system.build.toplevel --extra-experimental-features nix-command --extra-experimental-features flakes || exit 1
nixos-install --root "${1}" --flake ".#${2}"
nom build $DERIVATION $EXTRA_NIX_FLAGS || exit 1
nixos-install --root "${ROOT}" --flake ".#${CONFIG}" --no-channel-copy
git rm --cached hardware-configuration.nix
cp . "${1}/Litenet-Nix-Infra" -r
cp . "${ROOT}/Litenet-Nix-Infra" -r
exit
fi
fi

Binary file not shown.

View file

@ -4,8 +4,16 @@
inputs = {
nixpkgs = {
url = "github:NixOS/nixpkgs/nixos-unstable";
#url="path:/Rory-Open-Architecture/nixpkgs";
};
nixpkgs-master = {
url = "github:NixOS/nixpkgs/master";
};
nixpkgs-Draupnir = { # Draupnir module/package
url = "github:TheArcaneBrony/nixpkgs/master";
};
home-manager = {
url = "github:nix-community/home-manager/master";
};
@ -25,7 +33,8 @@
./host/matrix/configuration.nix
./hardware-configuration.nix
./modules/packages/ooye/module/main.nix
#./modules/packages/ooye/packages/module.nix
./host/matrix/unstable-overlay.nix
home-manager.nixosModules.home-manager
@ -38,9 +47,7 @@
) # Fix for home-manager failing to deploy
(Rory-Open-Architecture + "/modules/users/Rory.nix")
];
specialArgs = {
inherit home-manager;
};
specialArgs = inputs;
};
};
};

View file

@ -24,7 +24,7 @@
defaultGateway.interface = "ens18";
};
services.ooye.enable = false;
# services.matrix-ooye.enable = false;
system.stateVersion = "22.11"; # DO NOT EDIT!
}

View file

@ -6,21 +6,14 @@
}:
{
# Alicia - doesnt work yet... until in nixpkgs...
services.draupnir = {
enable = true;
pantalaimon = {
enable = true;
username = "draupnir";
passwordFile = "/etc/draupnir-password";
options = {
homeserver = "http://localhost:8008";
ssl = false;
};
};
homeserverUrl = "http://matrix.localhost";
accessTokenFile = "/var/lib/draupnir/access-token";
settings = {
managementRoom = "#draupnir-mgmt:rory.gay";
managementRoom = "#draupnir:litenet.tel";
verboseLogging = false;
recordIgnoredInvites = true; # Let's log ignored invites, just incase
autojoinOnlyIfManager = true; # Let's not open ourselves up to DoS attacks
@ -51,9 +44,4 @@
};
};
# services.pantalaimon-headless.instances.draupnir = {
# homeserver = "http://localhost:8008";
# ssl = false;
# };
}

View file

@ -10,7 +10,7 @@
imports = [
./synapse.nix
# ./coturn.nix
# ./draupnir.nix
./draupnir.nix
];
}

View file

@ -0,0 +1,16 @@
{ pkgs, nixpkgs-master, nixpkgs-Draupnir, ... }:
{
disabledModules = [
"services/matrix/synapse.nix"
];
imports = [
"${nixpkgs-master}/nixos/modules/services/matrix/synapse.nix"
"${nixpkgs-Draupnir}/nixos/modules/services/matrix/draupnir.nix"
];
nixpkgs.overlays = [
(final: prev: {
matrix-synapse-unwrapped = nixpkgs-master.legacyPackages.${pkgs.stdenv.hostPlatform.system}.matrix-synapse-unwrapped;
draupnir = nixpkgs-Draupnir.legacyPackages.${pkgs.stdenv.hostPlatform.system}.draupnir;
})
];
}

View file

@ -6,7 +6,9 @@
}:
{
imports = [ ./packages/vim.nix ];
imports = [
./packages/vim.nix
];
boot = {
initrd.systemd.enable = true;
@ -46,7 +48,6 @@
loader = {
grub = {
enable = true;
version = 2;
};
timeout = 1;
};
@ -141,4 +142,15 @@
sudo.wheelNeedsPassword = false;
};
virtualisation.vmVariant = {
users = {
mutableUsers = false;
users = {
root.password = "root";
Rory.password = "password";
};
};
networking.useDHCP = lib.mkForce true;
};
}

View file

@ -1,53 +0,0 @@
{
config,
lib,
pkgs,
...
}:
{
options.services.ooye = {
enable = lib.mkEnableOption "Enable the Ooye service";
package = lib.mkOption {
type = lib.types.package;
default = pkgs.callPackage ../packages/package.nix { };
description = ''
The Ooye package.
'';
};
#discordAccessTokenFile = lib.mkOption {
# type = lib.types.path;
# default = "/etc/ooye/discord-access-token";
# description = ''
# The path to the file containing the Discord access token.
# '';
#};
##yaml
#matrixHomeserverConfig = lib.mkOption {
# types = lib.types.submodule;
# homeserverTokenFile = lib.mkOption {
# type = lib.types.path;
# default = "/etc/matrix/homeserver-token";
# description = ''
# The path to the file containing the Matrix homeserver token.
# '';
# };
# appserviceTokenFile = lib.mkOption {
# type = lib.types.path;
# default = "/etc/matrix/appservice-token";
# description = ''
# The path to the file containing the Matrix appservice token.
# '';
# };
#
#};
};
config = lib.mkIf (config.services.ooye.enable) {
systemd.services."ooye.service" = {
enable = true;
serviceConfig = {
ExecStart = "${config.services.ooye.package}/bin/ooye";
};
};
};
}

View file

@ -0,0 +1,46 @@
{
lib,
fetchgit,
makeWrapper,
nodejs,
buildNpmPackage,
}:
buildNpmPackage rec {
pname = "out-of-your-element";
version = "0";
src = fetchgit {
url = "https://gitdab.com/cadence/out-of-your-element.git";
rev = "2c3b653b540e6eea37e130104aece48c1f094d71";
sha256 = "SU6Mt3JEgEnkQUzU7Nw/BbeIHocWHqxZFEAeLYoFB4g=";
};
# src = ./ooye-src;
npmDepsHash = "sha256-561i7rUw+Pkq3k44PE6pglm7Kd4t3AjkcKbIZchJ29M=";
# "sha256-1STam+Sjy2MQcK5TmRacoxmgErd2sNqw0yIFX2M+iZk=";
makeCacheWritable = true; # Something tries to write there, idk why - Emma [it/its] @ Rory&
dontNpmBuild = true;
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
runHook preInstall
mkdir -p $out/share
cp -a . $out/share/ooye
makeWrapper ${nodejs}/bin/node $out/bin/matrix-ooye --add-flags $out/share/ooye/start.js
makeWrapper ${nodejs}/bin/node $out/bin/matrix-ooye-addbot --add-flags $out/share/ooye/addbot.js
runHook postInstall
'';
meta = with lib; {
description = "A Matrix Discord bridge";
homepage = "https://gitdab.com/cadence/out-of-your-element";
longDescription = ''
Cool.
'';
#license = licenses.agpl3;
#maintainers = with maintainers; [ RorySys ];
mainProgram = "null";
};
}

Binary file not shown.

View file

@ -0,0 +1,12 @@
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
outputs = { self, nixpkgs }: {
packages.x86_64-linux.default = nixpkgs.legacyPackages.x86_64-linux.callPackage ./default.nix { };
};
}

View file

@ -0,0 +1,45 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.matrix-ooye;
in
{
options = {
services.matrix-ooye = {
enable = lib.mkEnableOption "Enable OOYE service";
package = lib.mkOption {
type = lib.types.package;
default = pkgs.callPackage ./default.nix { };
};
appserviceId = lib.mkOption {
type = lib.types.string;
description = "The appservice ID to use, will be used as the localpart for the bridge.";
default = "ooye";
};
homeserver = lib.mkOption {
type = lib.types.string;
description = "The homeserver to connect to.";
default = "http://localhost:8006";
};
};
};
config = lib.mkIf cfg.enable {
systemd.services."matrix-ooye-pre-start.service" = {
enable = true;
script = ''
'';
};
systemd.services."matrix-ooye.service" = {
enable = true;
serviceConfig = {
ExecStart = "${config.services.matrix-ooye.package}/bin/ooye";
};
};
};
}

@ -0,0 +1 @@
Subproject commit af7cc1bdb5a94a3083193552fd7ed49bd7f439e6

View file

@ -1,31 +0,0 @@
{
lib,
fetchgit,
makeWrapper,
nodejs,
buildNpmPackage,
}:
buildNpmPackage rec {
pname = "out-of-your-element";
version = "0";
src = fetchgit {
url = "https://gitdab.com/cadence/out-of-your-element.git";
sha256 = "K9myaHmCTRQEHmOUmRj0f/51GgQyPl7mNBtBhe3rUMw=";
};
npmDepsHash = "sha256-Ujo+qz3HiHMNUhbiYiSp5Z6khVqzXL4ayvxXERwdsG4=";
makeCacheWritable = true; # Something tries to write there, idk why - Emma [it/its] @ Rory&
nativeBuildInputs = [ makeWrapper ];
meta = with lib; {
description = "A Matrix Discord bridge";
homepage = "https://gitdab.com/cadence/out-of-your-element";
longDescription = ''
Cool.
'';
#license = licenses.agpl3;
#maintainers = with maintainers; [ RorySys ];
mainProgram = "null";
};
}