├── .github └── workflows │ └── autoupdate.yml ├── .gitignore ├── LICENSE ├── README.md ├── default.nix ├── drvs ├── discord.nix ├── powercord-unwrapped.nix └── powercord.nix ├── flake.lock ├── flake.nix ├── misc ├── powercord.patch └── yarn.lock ├── overlay.nix ├── plugs ├── index.js └── package.json └── update.sh /.github/workflows/autoupdate.yml: -------------------------------------------------------------------------------- 1 | name: Auto update 2 | on: 3 | workflow_dispatch: 4 | schedule: 5 | - cron: "0 0 * * *" 6 | 7 | jobs: 8 | update: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout 12 | uses: actions/checkout@v3 13 | 14 | - name: Check for updates 15 | id: check 16 | run: | 17 | local=$(cat flake.lock | jq ".nodes.powercord.locked.rev") 18 | remote=$(curl "https://api.github.com/repos/powercord-org/powercord/commits?per_page=1" | jq ".[0].sha") 19 | if [[ $local == $remote ]]; then 20 | echo "::set-output name=skip::1" 21 | else 22 | echo "::set-output name=skip::0" 23 | fi 24 | 25 | - name: Install nix 26 | if: steps.check.outputs.skip == 0 27 | uses: cachix/install-nix-action@v13 28 | with: 29 | install_url: https://github.com/numtide/nix-unstable-installer/releases/download/nix-2.5pre20211026_5667822/install 30 | extra_nix_config: experimental-features = nix-command flakes 31 | 32 | - name: Update 33 | if: steps.check.outputs.skip == 0 34 | run: ./update.sh 35 | 36 | - name: Build check 37 | if: steps.check.outputs.skip == 0 38 | run: nix build -L .#discord-plugged 39 | 40 | - name: Commit 41 | if: steps.check.outputs.skip == 0 42 | run: | 43 | git config --local user.email "action@github.com" 44 | git config --local user.name "GitHub Actions" 45 | git add . 46 | git commit -m "chore(flake): bump inputs" 47 | 48 | - name: Push 49 | if: steps.check.outputs.skip == 0 50 | uses: ad-m/github-push-action@master 51 | with: 52 | github_token: ${{ secrets.GITHUB_TOKEN }} 53 | branch: ${{ github.ref }} 54 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | result 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021 LavaDesu 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Deprecation notice 2 | 3 | This overlay is no longer being maintained. Powercord is EOL and Discord has released breaking changes affecting most client mods. 4 | 5 | See https://github.com/LunNova/replugged-nix-flake for a flake for [Replugged](https://replugged.dev), the community fork/successor of Powercord. 6 | As of 2022/09/30, it is [yet to support](https://github.com/replugged-org/replugged/issues/205) the breaking changes, but has plans to do so. 7 | 8 | # powercord-overlay 9 | An overlay to easily install Discord with [Powercord](https://powercord.dev) 10 | 11 | ## Installation 12 | ### With flakes 13 | ```nix 14 | # flake.nix 15 | { 16 | inputs.powercord-overlay.url = "github:LavaDesu/powercord-overlay"; 17 | } 18 | ``` 19 | ```nix 20 | # system config 21 | { 22 | nixpkgs.overlays = [ inputs.powercord-overlay.overlay ]; 23 | } 24 | ``` 25 | 26 | ### Without flakes 27 | ```nix 28 | let 29 | powercord-overlay = import (builtins.fetchTarball "https://github.com/LavaDesu/powercord-overlay/archive/master.tar.gz"); 30 | in 31 | { 32 | nixpkgs.overlays = [ powercord-overlay.overlay ]; 33 | } 34 | ``` 35 | 36 | ## Usage 37 | ### Install discord-plugged 38 | ```nix 39 | { 40 | # or home.packages 41 | environment.systemPackages = [ 42 | ... 43 | pkgs.discord-plugged 44 | ]; 45 | } 46 | ``` 47 | 48 | ### Plugins/Themes 49 | For plugins and/or themes, override `discord-plugged` 50 | 51 | Example: 52 | ```nix 53 | # where you put your packages 54 | discord-plugged.override { 55 | plugins = [ 56 | (builtins.fetchTarball "https://github.com/NurMarvin/discord-tweaks/archive/master.tar.gz") 57 | ]; 58 | themes = [ 59 | (builtins.fetchTarball "https://github.com/Dyzean/Tokyo-Night/archive/master.tar.gz") 60 | ]; 61 | } 62 | ``` 63 | 64 | If you're using flakes, you can instead use inputs to fetch them 65 | ```nix 66 | # flake.nix 67 | { 68 | inputs = { 69 | discord-tweaks = { url = "github:NurMarvin/discord-tweaks"; flake = false; }; 70 | discord-tokyonight = { url = "github:Dyzean/Tokyo-Night"; flake = false; }; 71 | }; 72 | } 73 | ``` 74 | ```nix 75 | # where you put your packages 76 | discord-plugged.override { 77 | plugins = [ 78 | inputs.discord-tweaks 79 | ]; 80 | themes = [ 81 | inputs.discord-tokyonight 82 | ]; 83 | } 84 | ``` 85 | 86 | ## Additional notes 87 | - The updater should be disabled, it doesn't work for obvious reasons :) 88 | - Settings are stored imperatively in `$XDG_CONFIG_HOME/powercord` 89 | (and cache in `$XDG_CACHE_HOME/powercord`) 90 | - This unforunately is not perfect. If you notice some plugin's settings just disappear 91 | after a restart (as it tried to write to the store), please open an issue here about it 92 | 93 | ## Some disclaimers 94 | Powercord *is* against Discord's Terms of Service. However, at the time of writing, Discord isn't 95 | currently hunting down modded client users and punishing them or anything. 96 | 97 | While you *should* be safe, **you are at your own risk** when using this overlay, and I am not 98 | responsible for any damages that may happen as a result of using Powercord. 99 | -------------------------------------------------------------------------------- /default.nix: -------------------------------------------------------------------------------- 1 | ( 2 | import ( 3 | builtins.fetchTarball { 4 | url = "https://github.com/edolstra/flake-compat/archive/12c64ca55c1014cdc1b16ed5a804aa8576601ff2.tar.gz"; 5 | sha256 = "0jm6nzb83wa6ai17ly9fzpqc40wg1viib8klq8lby54agpl213w5"; 6 | } 7 | ) { src = ./.; } 8 | ).defaultNix 9 | -------------------------------------------------------------------------------- /drvs/discord.nix: -------------------------------------------------------------------------------- 1 | { symlinkJoin 2 | , discord-canary 3 | , inputs 4 | , powercord 5 | , plugins 6 | , themes 7 | }: 8 | let 9 | powercordWithAddons = powercord.override { 10 | inherit plugins themes; 11 | }; 12 | in 13 | symlinkJoin { 14 | name = "discord-plugged"; 15 | paths = [ discord-canary.out ]; 16 | 17 | postBuild = '' 18 | cp -r ${inputs.self}/plugs $out/opt/DiscordCanary/resources/app 19 | substituteInPlace $out/opt/DiscordCanary/resources/app/index.js --replace 'POWERCORD_SRC' '${powercordWithAddons}' 20 | 21 | cp -a --remove-destination $(readlink "$out/opt/DiscordCanary/.DiscordCanary-wrapped") "$out/opt/DiscordCanary/.DiscordCanary-wrapped" 22 | cp -a --remove-destination $(readlink "$out/opt/DiscordCanary/DiscordCanary") "$out/opt/DiscordCanary/DiscordCanary" 23 | substituteInPlace $out/opt/DiscordCanary/DiscordCanary --replace '${discord-canary.out}' "$out" 24 | ''; 25 | } 26 | -------------------------------------------------------------------------------- /drvs/powercord-unwrapped.nix: -------------------------------------------------------------------------------- 1 | { inputs 2 | , lib 3 | , mkYarnPackage 4 | }: 5 | (mkYarnPackage { 6 | name = "powercord-unwrapped"; 7 | src = inputs.powercord; 8 | yarnLock = "${inputs.self}/misc/yarn.lock"; 9 | 10 | patches = [ ../misc/powercord.patch ]; 11 | 12 | installPhase = '' 13 | runHook preInstall 14 | 15 | mv deps/powercord $out 16 | rm $out/node_modules 17 | 18 | runHook postInstall 19 | ''; 20 | 21 | meta = { 22 | homepage = "https://powercord.dev"; 23 | license = lib.licenses.mit; 24 | description = "A lightweight discord mod focused on simplicity and performance"; 25 | }; 26 | }).overrideAttrs (_: { 27 | doDist = false; 28 | }) 29 | -------------------------------------------------------------------------------- /drvs/powercord.nix: -------------------------------------------------------------------------------- 1 | { lib 2 | , powercord-unwrapped 3 | , runCommandLocal 4 | , plugins 5 | , themes 6 | }: 7 | let 8 | readName = file: lib.strings.sanitizeDerivationName (builtins.fromJSON (builtins.readFile file)).name; 9 | 10 | intoAddons = list: manifestName: builtins.map (element: 11 | let 12 | # We're relying on nix to coerce this into something we can use 13 | path = "${element}"; 14 | in { 15 | inherit path; 16 | name = readName "${path}/${manifestName}"; 17 | }) list; 18 | 19 | map = type: addons: lib.concatMapStringsSep "\n" (addon: ''cp -a "${addon.path}" "./${type}/${addon.name}"'') addons; 20 | 21 | mappedPlugins = map "plugins" (intoAddons plugins "manifest.json"); 22 | mappedThemes = map "themes" (intoAddons themes "powercord_manifest.json"); 23 | in 24 | runCommandLocal "powercord" { 25 | passthru.unwrapped = powercord-unwrapped; 26 | meta = powercord-unwrapped.meta // { 27 | priority = (powercord-unwrapped.meta.priority or 0) - 1; 28 | }; 29 | } '' 30 | cp -a "${powercord-unwrapped}" "$out" 31 | chmod u+w "$out" 32 | ln -s "${powercord-unwrapped.deps}/node_modules" "$out/node_modules" 33 | 34 | cd "$out/src/Powercord" 35 | chmod u+w ./plugins ./themes 36 | ${mappedPlugins} 37 | ${mappedThemes} 38 | '' 39 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "nixpkgs": { 4 | "locked": { 5 | "lastModified": 1658737577, 6 | "narHash": "sha256-xosJ5nJT9HX+b6UWsSX6R+ap4AdZOCrl/r+IKFp2ASQ=", 7 | "owner": "NixOS", 8 | "repo": "nixpkgs", 9 | "rev": "5a0e0d73b944157328d54c4ded1cf2f0146a86a5", 10 | "type": "github" 11 | }, 12 | "original": { 13 | "owner": "NixOS", 14 | "ref": "nixos-unstable", 15 | "repo": "nixpkgs", 16 | "type": "github" 17 | } 18 | }, 19 | "powercord": { 20 | "flake": false, 21 | "locked": { 22 | "lastModified": 1658712501, 23 | "narHash": "sha256-oApii3bNoJAmCDtELoo98XfDk4qHqjMRQJcIto2qbso=", 24 | "owner": "powercord-org", 25 | "repo": "powercord", 26 | "rev": "bb30f25898f0ad3cae91fb43cc83b12247056e8e", 27 | "type": "github" 28 | }, 29 | "original": { 30 | "owner": "powercord-org", 31 | "repo": "powercord", 32 | "type": "github" 33 | } 34 | }, 35 | "root": { 36 | "inputs": { 37 | "nixpkgs": "nixpkgs", 38 | "powercord": "powercord" 39 | } 40 | } 41 | }, 42 | "root": "root", 43 | "version": 7 44 | } 45 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "A nix overlay to install Discord Canary with Powercord"; 3 | 4 | inputs = { 5 | nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 6 | powercord.url = "github:powercord-org/powercord"; 7 | powercord.flake = false; 8 | }; 9 | 10 | outputs = { self, nixpkgs, ... } @ inputs: 11 | let 12 | system = "x86_64-linux"; 13 | overlay = import ./overlay.nix inputs; 14 | pkgs = import nixpkgs { 15 | inherit system; 16 | config.allowUnfree = true; 17 | overlays = [ overlay ]; 18 | }; 19 | in { 20 | inherit overlay; 21 | packages.${system} = { inherit (pkgs) powercord-unwrapped powercord discord-plugged; }; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /misc/powercord.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/Powercord/plugins/pc-moduleManager/index.js b/src/Powercord/plugins/pc-moduleManager/index.js 2 | index 0cd00cd..657396c 100644 3 | --- a/src/Powercord/plugins/pc-moduleManager/index.js 4 | +++ b/src/Powercord/plugins/pc-moduleManager/index.js 5 | @@ -5,7 +5,7 @@ const { PopoutWindow } = require('powercord/components'); 6 | const { inject, uninject } = require('powercord/injector'); 7 | const { findInReactTree } = require('powercord/util'); 8 | const { Plugin } = require('powercord/entities'); 9 | -const { SpecialChannels: { CSS_SNIPPETS } } = require('powercord/constants'); 10 | +const { SETTINGS_FOLDER, SpecialChannels: { CSS_SNIPPETS } } = require('powercord/constants'); 11 | const { join } = require('path'); 12 | 13 | const commands = require('./commands'); 14 | @@ -48,7 +48,7 @@ module.exports = class ModuleManager extends Plugin { 15 | }); 16 | 17 | this._quickCSS = ''; 18 | - this._quickCSSFile = join(__dirname, 'quickcss.css'); 19 | + this._quickCSSFile = join(SETTINGS_FOLDER, 'quickcss.css'); 20 | this._loadQuickCSS(); 21 | this._injectSnippets(); 22 | this.loadStylesheet('scss/style.scss'); 23 | diff --git a/src/browserWindow.js b/src/browserWindow.js 24 | index 27e87cb..eb7171f 100644 25 | --- a/src/browserWindow.js 26 | +++ b/src/browserWindow.js 27 | @@ -1,11 +1,12 @@ 28 | const { join } = require('path'); 29 | const { BrowserWindow } = require('electron'); 30 | +const { SETTINGS_FOLDER } = require('./fake_node_modules/powercord/constants'); 31 | 32 | let settings = {}; 33 | let transparency = false; 34 | let ewp = false; 35 | try { 36 | - settings = require(join(__dirname, '../settings/pc-general.json')); 37 | + settings = require(join(SETTINGS_FOLDER, 'pc-general.json')); 38 | transparency = settings.transparentWindow; 39 | ewp = settings.experimentalWebPlatform; 40 | } catch (e) {} 41 | diff --git a/src/fake_node_modules/powercord/constants.js b/src/fake_node_modules/powercord/constants.js 42 | index dc25a15..80d8b24 100644 43 | --- a/src/fake_node_modules/powercord/constants.js 44 | +++ b/src/fake_node_modules/powercord/constants.js 45 | @@ -13,9 +13,9 @@ module.exports = Object.freeze({ 46 | REPO_URL: 'powercord-org/powercord', 47 | 48 | // Runtime 49 | - SETTINGS_FOLDER: join(__dirname, '..', '..', '..', 'settings'), 50 | - CACHE_FOLDER: join(__dirname, '..', '..', '..', '.cache'), 51 | - LOGS_FOLDER: join(__dirname, '..', '..', '..', '.logs'), 52 | + SETTINGS_FOLDER: join(process.env.XDG_CONFIG_HOME ?? join(process.env.HOME, '.config'), 'powercord'), 53 | + CACHE_FOLDER: join(process.env.XDG_CACHE_HOME ?? join(process.env.HOME, '.cache'), 'powercord'), 54 | + LOGS_FOLDER: join(process.env.XDG_CACHE_HOME ?? join(process.env.HOME, '.cache'), 'powercord', 'logs'), 55 | 56 | // Discord Server 57 | DISCORD_INVITE: 'gs4ZMbBfCh', 58 | -------------------------------------------------------------------------------- /overlay.nix: -------------------------------------------------------------------------------- 1 | inputs: final: prev: rec { 2 | powercord-unwrapped = prev.callPackage ./drvs/powercord-unwrapped.nix { inherit inputs; }; 3 | 4 | powercord = final.lib.warn "[powercord-overlay] Powercord is EOL and no longer works. See README.md for more information." (prev.callPackage ./drvs/powercord.nix { 5 | inherit powercord-unwrapped; 6 | plugins = [ ]; 7 | themes = [ ]; 8 | }); 9 | 10 | discord-plugged = prev.callPackage ./drvs/discord.nix { 11 | inherit inputs powercord; 12 | plugins = [ ]; 13 | themes = [ ]; 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /plugs/index.js: -------------------------------------------------------------------------------- 1 | require("POWERCORD_SRC/src/patcher.js"); 2 | -------------------------------------------------------------------------------- /plugs/package.json: -------------------------------------------------------------------------------- 1 | {"main":"index.js","name":"discord"} 2 | -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S nix shell 'nixpkgs#git' 'nixpkgs#nodejs' 'nixpkgs#yarn' -c bash 2 | 3 | nix flake update 4 | 5 | CWD=$(pwd) 6 | TMPFOLDER=$(mktemp -d) 7 | 8 | echo "using $TMPFOLDER" 9 | cd $TMPFOLDER 10 | git clone https://github.com/powercord-org/powercord 11 | cd powercord 12 | 13 | npm install --package-lock-only 14 | yarn import 15 | cp yarn.lock $CWD/misc 16 | 17 | cd $CWD 18 | rm -rf $TMPFOLDER 19 | --------------------------------------------------------------------------------