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 3d04c55..ab88836 100644
Binary files a/flake.lock and b/flake.lock differ
diff --git a/flake.nix b/flake.nix
index 9377a5b..d2e7d6c 100755
--- a/flake.nix
+++ b/flake.nix
@@ -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;
};
};
};
diff --git a/host/matrix/configuration.nix b/host/matrix/configuration.nix
index f3e39b3..f297b7c 100755
--- a/host/matrix/configuration.nix
+++ b/host/matrix/configuration.nix
@@ -24,7 +24,7 @@
defaultGateway.interface = "ens18";
};
- services.ooye.enable = false;
+# services.matrix-ooye.enable = false;
system.stateVersion = "22.11"; # DO NOT EDIT!
}
diff --git a/host/matrix/matrix/draupnir.nix b/host/matrix/matrix/draupnir.nix
index b62cc28..ac12dbe 100755
--- a/host/matrix/matrix/draupnir.nix
+++ b/host/matrix/matrix/draupnir.nix
@@ -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;
- # };
-
}
diff --git a/host/matrix/matrix/root.nix b/host/matrix/matrix/root.nix
index 32550be..2b91a91 100755
--- a/host/matrix/matrix/root.nix
+++ b/host/matrix/matrix/root.nix
@@ -10,7 +10,7 @@
imports = [
./synapse.nix
# ./coturn.nix
- # ./draupnir.nix
+ ./draupnir.nix
];
}
diff --git a/host/matrix/unstable-overlay.nix b/host/matrix/unstable-overlay.nix
new file mode 100644
index 0000000..7bfc0a0
--- /dev/null
+++ b/host/matrix/unstable-overlay.nix
@@ -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;
+ })
+ ];
+}
diff --git a/modules/base.nix b/modules/base.nix
index 16d77d7..cab51fd 100755
--- a/modules/base.nix
+++ b/modules/base.nix
@@ -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;
+ };
}
diff --git a/modules/packages/ooye/module/main.nix b/modules/packages/ooye/module/main.nix
deleted file mode 100644
index 7796ce4..0000000
--- a/modules/packages/ooye/module/main.nix
+++ /dev/null
@@ -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";
- };
- };
- };
-}
diff --git a/modules/packages/ooye/packages/default.nix b/modules/packages/ooye/packages/default.nix
new file mode 100644
index 0000000..1b080a5
--- /dev/null
+++ b/modules/packages/ooye/packages/default.nix
@@ -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";
+ };
+}
diff --git a/modules/packages/ooye/packages/flake.lock b/modules/packages/ooye/packages/flake.lock
new file mode 100644
index 0000000..7adbffd
Binary files /dev/null and b/modules/packages/ooye/packages/flake.lock differ
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";
- };
-}