From 72e888ca9763f411a18fe457995482fc676d9f4a Mon Sep 17 00:00:00 2001 From: Rory& Date: Fri, 22 Nov 2024 21:17:40 +0100 Subject: [PATCH] Some work on OOYE module, updates --- .gitignore | 3 +- .idea/.gitignore | 13 +++++ .../.idea/.gitignore | 13 +++++ .../.idea/encodings.xml | 4 ++ .../.idea/indexLayout.xml | 11 ++++ .../.idea.Litenet-Nix-Infra.dir/.idea/vcs.xml | 7 +++ .idea/indexLayout.xml | 8 +++ .idea/vcs.xml | 7 +++ build.sh | 29 ++++++---- flake.lock | Bin 2148 -> 3132 bytes flake.nix | 17 ++++-- host/matrix/configuration.nix | 2 +- host/matrix/matrix/draupnir.nix | 20 ++----- host/matrix/matrix/root.nix | 2 +- host/matrix/unstable-overlay.nix | 16 ++++++ modules/base.nix | 16 +++++- modules/packages/ooye/module/main.nix | 53 ------------------ modules/packages/ooye/packages/default.nix | 46 +++++++++++++++ modules/packages/ooye/packages/flake.lock | Bin 0 -> 567 bytes modules/packages/ooye/packages/flake.nix | 12 ++++ modules/packages/ooye/packages/module.nix | 45 +++++++++++++++ modules/packages/ooye/packages/ooye-src | 1 + modules/packages/ooye/packages/package.nix | 31 ---------- 23 files changed, 235 insertions(+), 121 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/.idea.Litenet-Nix-Infra.dir/.idea/.gitignore create mode 100644 .idea/.idea.Litenet-Nix-Infra.dir/.idea/encodings.xml create mode 100644 .idea/.idea.Litenet-Nix-Infra.dir/.idea/indexLayout.xml create mode 100644 .idea/.idea.Litenet-Nix-Infra.dir/.idea/vcs.xml create mode 100644 .idea/indexLayout.xml create mode 100644 .idea/vcs.xml create mode 100644 host/matrix/unstable-overlay.nix delete mode 100644 modules/packages/ooye/module/main.nix create mode 100644 modules/packages/ooye/packages/default.nix create mode 100644 modules/packages/ooye/packages/flake.lock create mode 100644 modules/packages/ooye/packages/flake.nix create mode 100644 modules/packages/ooye/packages/module.nix create mode 160000 modules/packages/ooye/packages/ooye-src delete mode 100644 modules/packages/ooye/packages/package.nix diff --git a/.gitignore b/.gitignore index fddba6b..463cc17 100755 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ hardware-configuration.nix matrix-user-tokens.txt nixpkgs/ result -wg/ \ No newline at end of file +wg/ +*.qcow2 diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..6581187 --- /dev/null +++ b/.idea/.gitignore @@ -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 diff --git a/.idea/.idea.Litenet-Nix-Infra.dir/.idea/.gitignore b/.idea/.idea.Litenet-Nix-Infra.dir/.idea/.gitignore new file mode 100644 index 0000000..aa22311 --- /dev/null +++ b/.idea/.idea.Litenet-Nix-Infra.dir/.idea/.gitignore @@ -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 diff --git a/.idea/.idea.Litenet-Nix-Infra.dir/.idea/encodings.xml b/.idea/.idea.Litenet-Nix-Infra.dir/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/.idea/.idea.Litenet-Nix-Infra.dir/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.Litenet-Nix-Infra.dir/.idea/indexLayout.xml b/.idea/.idea.Litenet-Nix-Infra.dir/.idea/indexLayout.xml new file mode 100644 index 0000000..3865cf7 --- /dev/null +++ b/.idea/.idea.Litenet-Nix-Infra.dir/.idea/indexLayout.xml @@ -0,0 +1,11 @@ + + + + + + + modules/packages/ooye/packages/result + result + + + \ No newline at end of file diff --git a/.idea/.idea.Litenet-Nix-Infra.dir/.idea/vcs.xml b/.idea/.idea.Litenet-Nix-Infra.dir/.idea/vcs.xml new file mode 100644 index 0000000..2e05957 --- /dev/null +++ b/.idea/.idea.Litenet-Nix-Infra.dir/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/indexLayout.xml b/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..2e05957 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/build.sh b/build.sh index 9ad76bd..b6672c9 100755 --- a/build.sh +++ b/build.sh @@ -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 \ No newline at end of file diff --git a/flake.lock b/flake.lock index 3d04c555056349cf030d9f350466f8e0e86fe8b7..ab88836aa169c4e78b308c00befc17e0cc0967d3 100644 GIT binary patch delta 897 zcmZva%TAL)7={A{izXTq6Er3oL`|9$=$vPM5)*m?$|2Z;Eyay9^Ut(D^Z+fTEeo#! zGb^JcUVz~Oj2l<(+#9!EgiC+0Bp99Lkdaq8Kjaqy;mCtmC$)M3=nAe`o&bfDy1vede8WY-jS|MY&kP;%#P$duo5K~DZ zlt>vwi3ZxeiavHrlQDM|Ih(?eaRw+k7mjc31UtAXis?;T$0?@lN;;8hk^w%@u!)N0 zY_hReW z_ynB7fC!Iy@LYRKCWfh%RNqtiW|o!GTLz^?9a$R03l&(*uObV!(}nb*?}PB@8#ALf z+wQkaXLfOBwp2ICj+QNx>a<%!_xjpG3^T^H(3(Nv3uvtLtg%`t0jPx(Yb}icA(=}e zH~-q&`c2_t1>&hnZ18E;5UE(?uR;o>1-hCZ?-s!^@j| zX4^Cf3^G|8^m0K7?U-D}WG~P`>Z>rE^PYHCaSIU;%twY2r8rTXTNai^!jZKl_bqb& z(v15)xfsP^vILQfrVbOE*gL|382Kng0Xt>huWb H+?4nY8Q%<( delta 479 zcmXZYyK)jy00!V8OcY}ZtLRL;jFrr6bFO>NDG3`c8wfDSAUhVGYm{9ekSqZ!A3^7| zQuqRS0vjt!U&4p5bj?`()j!|-|Mw@qAAMd{5QGA9Li}#;S)hikUeexf^6glG>nU0^ zvvU9yxmolZd23JXH3}hzA#jLcVu_a23LrRE(h>i% z^tem_@q>dS|FhKbyV9S3Fs6d?JGey&UtRXQS93%=(b*jK>y24|GaG01ERLJ=wfWed zwbJD@pLkF?^0(z<|LfqMe_DP~mChi5pt8m}WUN5OX$vf(OkxADv?0|Yz{Y>8oE62} z`%rMgIrCrlo(C-)oYtwHp34OgouaV-WrCnT!5;C0m4u5aq+wE}Ke0WcgG zh&cpCIV-tT#2N^IP(Tz>yum{yd4XyFY5$#n`v4bHF%u!hcT;(Hbn(HZG0W2A3g<$M zqNIC5Qq|k6yQgmk35Jax9xg5uP>As>BQ(-NVauQr)`lTA5Nc|W;0!S%wdDpg@*kY| L!-qS+f5`pvNc@u#F>$my zF71pUJzo+=w$&uaIAvf!iWC=N?gwECaf#xXBsmIv4^>{CCWT)m5T&I}Ro^|CdTXkh zAqR`4%L)fv(3&#b>6-c5jNe--t3@Q2n}JD%^N!d9Z`k-pi_x?w0)lg8X#te=gR*z{ eXR+5EufArMJ`HcB&G+OPj6_JvnH~{47v~4E&yITl literal 0 HcmV?d00001 diff --git a/modules/packages/ooye/packages/flake.nix b/modules/packages/ooye/packages/flake.nix new file mode 100644 index 0000000..36e621b --- /dev/null +++ b/modules/packages/ooye/packages/flake.nix @@ -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 { }; + + }; +} diff --git a/modules/packages/ooye/packages/module.nix b/modules/packages/ooye/packages/module.nix new file mode 100644 index 0000000..2a363a5 --- /dev/null +++ b/modules/packages/ooye/packages/module.nix @@ -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"; + }; + }; + }; +} diff --git a/modules/packages/ooye/packages/ooye-src b/modules/packages/ooye/packages/ooye-src new file mode 160000 index 0000000..af7cc1b --- /dev/null +++ b/modules/packages/ooye/packages/ooye-src @@ -0,0 +1 @@ +Subproject commit af7cc1bdb5a94a3083193552fd7ed49bd7f439e6 diff --git a/modules/packages/ooye/packages/package.nix b/modules/packages/ooye/packages/package.nix deleted file mode 100644 index 4c0ac6f..0000000 --- a/modules/packages/ooye/packages/package.nix +++ /dev/null @@ -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"; - }; -}