summary refs log tree commit diff
path: root/flake.nix
blob: 1940892cfe2ff8e37c1ec017e0852ae801c8bc7b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
{
  description = "Rory&'s services flake";

  nixConfig = {
    extra-substituters = [ "https://attic.computer.surgery/grapevine" ];
    extra-trusted-public-keys = [ "grapevine:nYiZ0Qz9nT7Y7kNC/2NdoS3+J9gwTyWxOvlwZnFgceA=" ];
  };

  inputs = {
    # Different nixpkgs versions
    nixpkgs = {
      url = "github:NixOS/nixpkgs/nixos-unstable";
    };

    nixpkgs-master = {
      url = "github:NixOS/nixpkgs/master";
    };

    nixpkgs-RoryNix = {
      #url = "github:NixOS/nixpkgs/nixos-23.05";
      url = "github:NixOS/nixpkgs/nixos-23.11";
    };

    # Draupnir module/package
    nixpkgs-Draupnir.url = "github:TheArcaneBrony/nixpkgs/master";
    nixpkgs-keydb.url = "github:nixos/nixpkgs?rev=e0464e47880a69896f0fb1810f00e0de469f770a";
    #MatrixContentFilter.url = "git+file:/home/Rory/git/matrix/MatrixContentFilter?submodules=1";

    # Base modules
    home-manager.url = "github:nix-community/home-manager/master";
    sops-nix.url = "github:Mic92/sops-nix";
    flake-utils.url = "github:numtide/flake-utils";

    # Packages
    grapevine.url = "gitlab:matrix/grapevine-fork?host=gitlab.computer.surgery"; # &ref=benjamin/debug-emma-kde-room";
    conduit.url = "gitlab:famedly/conduit/next";
    #conduwuit.url = "github:girlbossceo/conduwuit";
    nixos-wsl.url = "github:nix-community/NixOS-WSL";

    # Own projects
    botcore-v4 = {
      url = "gitlab:BotCore-Devs/BotCore-v4/staging";
      inputs.nixpkgs.follows = "nixpkgs"; # We need this to avoid a LIBC error.
    };

    # Packages built from git
    nhekoSrc = {
      url = "github:Nheko-reborn/nheko/master";
      flake = false;
    };
    mtxclientSrc = {
      url = "github:Nheko-reborn/mtxclient/master";
      flake = false;
    };

    draupnirSrc = {
      url = "github:the-draupnir-project/Draupnir/main";
      flake = false;
    };
  };

  outputs =
    inputs:
    with inputs;
    {
      nixosConfigurations = {
        micro = nixpkgs.lib.nixosSystem {
          system = "x86_64-linux";
          modules = [
            ./hardware-configuration.nix
            #MatrixContentFilter.modules.default

            (
              { ... }:
              {
                boot.isContainer = true;
                system.stateVersion = "0";
                #services.MatrixContentFilter = {
                #  enable = true;
                #  accessTokenPath = "/";
                #  appSettings = {
                #    "Logging" = {
                #      "LogLevel" = {
                #        "Default" = "Debug";
                #        "System" = "Information";
                #        "Microsoft" = "Information";
                #      };
                #    };
                #    "LibMatrixBot" = {
                #      "Homeserver" = "rory.gay";
                #      "Prefixes" = [
                #        "!mcf "
                #      ];
                #      "MentionPrefix" = false;
                #    };
                #    "MatrixContentFilter" = {
                #      Admins = [ "@emma:rory.gay" ];
                #    };
                #  };
                #};
              }
            )
          ];
          #specialArgs = {
          #  inherit home-manager;
          #};
        };
        Rory-nginx = nixpkgs.lib.nixosSystem {
          system = "x86_64-linux";
          modules = [
            ./host/Rory-nginx/configuration.nix
            ./hardware-configuration.nix
            home-manager.nixosModules.home-manager
            grapevine.nixosModules.default
            #MatrixContentFilter.modules.default

            # these arent really modules...
            botcore-v4.modules.bots
            botcore-v4.modules.frontend
            botcore-v4.modules.dataupdater
            botcore-v4.modules.users

            (
              { pkgs, ... }:
              {
                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 = inputs.nixpkgs-master.legacyPackages.${pkgs.stdenv.hostPlatform.system}.matrix-synapse-unwrapped;
                    draupnir = inputs.nixpkgs-Draupnir.legacyPackages.${pkgs.stdenv.hostPlatform.system}.draupnir;
                    keydb = inputs.nixpkgs-keydb.legacyPackages.${pkgs.stdenv.hostPlatform.system}.keydb;
                  })
                ];
              }
            )
          ];
          specialArgs = {
            inherit botcore-v4;
            inherit home-manager;
            inherit grapevine;
            inherit conduit;
            inherit nixpkgs-Draupnir;
            #inherit conduwuit;

            inherit (inputs) draupnirSrc;
          };
        };

        #UNSTABLE
        #Rory-devenv = nixpkgs.lib.nixosSystem {
        #  system = "x86_64-linux";
        #  modules = [
        #    ./host/Rory-devenv/configuration.nix
        #    ./hardware-configuration.nix
        #    home-manager.nixosModules.home-manager
        #  ];
        #  specialArgs = {
        #    inherit home-manager;
        #  };
        #};

        Rory-desktop = nixpkgs.lib.nixosSystem {
          system = "x86_64-linux";
          modules = [
            ./host/Rory-desktop/configuration.nix
            ./hardware-configuration.nix
            home-manager.nixosModules.home-manager
            sops-nix.nixosModules.sops
            (
              { ... }:
              {
                nix = {
                  registry.nixpkgs.flake = nixpkgs;
                  nixPath = [ "nixpkgs=${nixpkgs.outPath}" ];
                };
              }
            )
          ];
          specialArgs = {
            inherit home-manager;
            inherit (inputs) mtxclientSrc;
            inherit (inputs) nhekoSrc;
          };
        };

        Rory-portable = nixpkgs.lib.nixosSystem {
          system = "x86_64-linux";
          modules = [
            ./host/Rory-portable/configuration.nix
            ./hardware-configuration.nix
            home-manager.nixosModules.home-manager
            (
              { ... }:
              {
                nix = {
                  registry.nixpkgs.flake = nixpkgs;
                  nixPath = [ "nixpkgs=${nixpkgs.outPath}" ];
                };
              }
            )
            # ... add this line to the rest of your configuration modules
            #nix-ld.nixosModules.nix-ld

            # The module in this repository defines a new module under (programs.nix-ld.dev) instead of (programs.nix-ld) 
            # to not collide with the nixpkgs version.
            #{ programs.nix-ld.dev.enable = true; }
          ];
          specialArgs = {
            inherit home-manager;
            inherit (inputs) mtxclientSrc;
            inherit (inputs) nhekoSrc;
          };
        };

        #STABLE
        RoryNix = nixpkgs-RoryNix.lib.nixosSystem {
          system = "i686-linux";
          modules = [
            ./host/RoryNix/configuration.nix
            ./hardware-configuration.nix
            (
              { ... }:
              {
                nix.registry.nixpkgs.flake = nixpkgs-RoryNix;
              }
            )
          ];
        };

        #WSL
        Rory-wsl = nixpkgs.lib.nixosSystem {
          system = "x86_64-linux";
          modules = [
            nixos-wsl.nixosModules.default
            ./host/Rory-wsl/configuration.nix
            #          ./hardware-configuration.nix
            home-manager.nixosModules.home-manager
            #nur.nixosModules.nur
          ];
          specialArgs = {
            inherit (inputs) mtxclientSrc;
            inherit (inputs) nhekoSrc;
          };
        };
      };
    }
    // flake-utils.lib.eachSystem flake-utils.lib.allSystems (
      system:
      let
        pkgs = import nixpkgs { inherit system; };
      in
      {
        packages.nheko-git = (
          pkgs.callPackage ./modules/packages/nheko-git.nix {
            inherit nhekoSrc;
            inherit mtxclientSrc;
            voipSupport = false;
          }
        );

        packages.mtxclient-git = (pkgs.callPackage ./modules/packages/mtxclient-git.nix { inherit mtxclientSrc; });

        # untested
        packages.draupnir-main = pkgs.draupnir.overrideAttrs (oldAttrs: {
          src = draupnirSrc;
          version = draupnirSrc.rev;
        });
      }
    );
}