|
62 | 62 |
|
63 | 63 | configFile = pkgsStable.writeText "config.json" (builtins.toJSON webcordConfig);
|
64 | 64 |
|
| 65 | + profileNames = [ "personal" "business" ]; |
| 66 | + |
65 | 67 | mkNixPak = inputs.nixpak.lib.nixpak { lib = stableLib; pkgs = pkgsStable; };
|
66 | 68 | systemConfigOptionals = stableLib.optionals (systemConfig != null);
|
67 |
| - wrappedWebcord = mkNixPak { |
| 69 | + wrappedWebcords = builtins.map (profileName: mkNixPak { |
68 | 70 | config = { sloth, ... }: {
|
69 |
| - app.package = pkgsUnstable.webcord; |
| 71 | + app.package = (pkgsStable.symlinkJoin { |
| 72 | + name = "webcord-${profileName}"; |
| 73 | + paths = [ (pkgsUnstable.webcord.overrideAttrs { |
| 74 | + desktopItems = []; |
| 75 | + }) ]; |
| 76 | + buildInputs = [ pkgsStable.makeWrapper ]; |
| 77 | + postBuild = /* bash */ '' |
| 78 | + makeWrapper '${stableLib.getExe pkgsUnstable.webcord}' $out/bin/webcord-${profileName} |
| 79 | + ''; |
| 80 | + meta.mainProgram = "webcord-${profileName}"; |
| 81 | + }).overrideAttrs { desktopItems = []; }; |
70 | 82 | dbus.policies = {
|
71 | 83 | "org.freedesktop.portal.*" = "talk";
|
72 | 84 | "ca.desrt.dconf" = "talk";
|
73 | 85 | "org.a11y.Bus" = "talk";
|
74 | 86 | "org.freedesktop.Notifications" = "talk";
|
75 | 87 | };
|
76 |
| - flatpak = { |
77 |
| - appId = "org.discord.webcord"; |
78 |
| - desktopFile = "webcord.desktop"; |
79 |
| - }; |
| 88 | + flatpak.appId = "org.discord.webcord.${profileName}"; |
80 | 89 | locale.enable = true;
|
81 | 90 | etc.sslCertificates.enable = true;
|
82 | 91 | bubblewrap = {
|
83 | 92 | bindEntireStore = false;
|
84 | 93 | bind.rw = [
|
85 |
| - (sloth.concat' sloth.xdgConfigHome "/WebCord") |
| 94 | + [(sloth.concat' sloth.xdgConfigHome "/webcord-${profileName}") (sloth.concat' sloth.xdgConfigHome "/WebCord")] |
86 | 95 | (sloth.concat' sloth.runtimeDir "/doc") # For the Document portal
|
87 | 96 | [(sloth.concat' sloth.xdgCacheHome "/webcord/tmp") "/tmp"]
|
88 | 97 | ];
|
@@ -112,17 +121,15 @@ let
|
112 | 121 | monitor = true;
|
113 | 122 | };
|
114 | 123 | };
|
115 |
| - }; |
| 124 | + }) profileNames; |
116 | 125 | in
|
117 | 126 |
|
118 | 127 | {
|
119 |
| - home.persistence."${persistenceHomePath}/${name}".directories = stableLib.mkIf useImpermanence [ |
120 |
| - ".config/WebCord" |
121 |
| - ]; |
| 128 | + home.persistence."${persistenceHomePath}/${name}".directories = stableLib.mkIf useImpermanence (stableLib.map (name: ".config/webcord-${name}")profileNames); |
122 | 129 |
|
123 |
| - home.activation.webcordConfig = lib.hm.dag.entryAfter ["writeBoundary"] '' |
124 |
| - $DRY_RUN_CMD ${stableLib.getExe' pkgsUnstable.coreutils "install"} -m=644 ${configFile} ${config.xdg.configHome}/WebCord/config.json |
125 |
| - ''; |
| 130 | + home.activation.webcordConfig = lib.hm.dag.entryAfter ["writeBoundary"] (stableLib.strings.concatMapStringsSep "\n" (name: '' |
| 131 | + $DRY_RUN_CMD ${stableLib.getExe' pkgsUnstable.coreutils "install"} -m=644 ${configFile} ${config.xdg.configHome}/webcord-${name}/config.json |
| 132 | + '') profileNames); |
126 | 133 |
|
127 | 134 | xdg.configFile."WebCord/Themes/style.css".text = /* css */ ''
|
128 | 135 | @import "file://${inputs.discord-css}/style.css";
|
|
135 | 142 | '';
|
136 | 143 |
|
137 | 144 |
|
138 |
| - home.packages = [ wrappedWebcord.config.env ]; |
| 145 | + home.packages = builtins.map (webcord: webcord.config.env) wrappedWebcords; |
139 | 146 | }
|
0 commit comments