nixos-test-pixelfed-wip #22
27
fediversity/default.nix
Normal file
27
fediversity/default.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{ lib, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkOption;
|
||||
inherit (lib.types) types;
|
||||
|
||||
in {
|
||||
imports = [
|
||||
./garage.nix
|
||||
./mastodon.nix
|
||||
./pixelfed.nix
|
||||
./peertube.nix
|
||||
];
|
||||
|
||||
options = {
|
||||
fediversity = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
};
|
||||
|
||||
mastodon.enable = mkOption { type = types.bool; default = false; };
|
||||
pixelfed.enable = mkOption { type = types.bool; default = false; };
|
||||
peertube.enable = mkOption { type = types.bool; default = false; };
|
||||
};
|
||||
};
|
||||
}
|
|
@ -6,8 +6,10 @@ let
|
|||
secret = "82b2b4cbef27bf8917b350d5b10a87c92fa9c8b13a415aeeea49726cf335d74e";
|
||||
};
|
||||
in
|
||||
|
||||
# TODO: expand to a multi-machine setup
|
||||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) types mkOption mkEnableOption optionalString concatStringsSep;
|
||||
inherit (lib.strings) escapeShellArg;
|
||||
|
@ -53,7 +55,9 @@ let
|
|||
${concatMapAttrs (ensureAccessScriptFn key) ensureAccess}
|
||||
'';
|
||||
ensureKeysScript = concatMapAttrs ensureKeyScriptFn cfg.ensureKeys;
|
||||
in {
|
||||
in
|
||||
|
||||
{
|
||||
# add in options to ensure creation of buckets and keys
|
||||
options = {
|
||||
services.garage = {
|
||||
|
@ -126,7 +130,7 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
config = lib.mkIf config.fediversity.enable {
|
||||
virtualisation.diskSize = 2048;
|
||||
virtualisation.forwardPorts = [
|
||||
{
|
||||
|
|
|
@ -4,7 +4,10 @@ let
|
|||
secret = "7d37d093435a41f2aab8f13c19ba067d9776c90215f56614adad6ece597dbb34";
|
||||
};
|
||||
in
|
||||
{ config, lib, pkgs, ... }: {
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
lib.mkIf (config.fediversity.enable && config.fediversity.mastodon.enable) {
|
||||
#### garage setup
|
||||
services.garage = {
|
||||
ensureBuckets = {
|
||||
|
|
|
@ -4,7 +4,10 @@ let
|
|||
secret = "7295c4201966a02c2c3d25b5cea4a5ff782966a2415e3a196f91924631191395";
|
||||
};
|
||||
in
|
||||
{ config, lib, pkgs, ... }: {
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
lib.mkIf (config.fediversity.enable && config.fediversity.peertube.enable) {
|
||||
networking.firewall.allowedTCPPorts = [ 80 9000 ];
|
||||
|
||||
services.garage = {
|
||||
|
|
|
@ -4,7 +4,10 @@ let
|
|||
secret = "5be6799a88ca9b9d813d1a806b64f15efa49482dbe15339ddfaf7f19cf434987";
|
||||
};
|
||||
in
|
||||
{ config, lib, pkgs, ... }: {
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
lib.mkIf (config.fediversity.enable && config.fediversity.pixelfed.enable) {
|
||||
services.garage = {
|
||||
ensureBuckets = {
|
||||
pixelfed = {
|
||||
|
|
21
flake.nix
21
flake.nix
|
@ -5,7 +5,7 @@
|
|||
nixpkgs.url = "github:radvendii/nixpkgs/nixos_rebuild_tests";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
|
@ -13,10 +13,7 @@
|
|||
|
||||
nixosModules = {
|
||||
## Fediversity modules
|
||||
garage = import ./fediversity/garage.nix;
|
||||
mastodon = import ./fediversity/mastodon.nix;
|
||||
peertube = import ./fediversity/peertube.nix;
|
||||
pixelfed = import ./fediversity/pixelfed.nix;
|
||||
fediversity = import ./fediversity;
|
||||
|
||||
## VM-specific modules
|
||||
interactive-vm = import ./vm/interactive-vm.nix;
|
||||
|
@ -28,27 +25,27 @@
|
|||
nixosConfigurations = {
|
||||
mastodon = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = with self.nixosModules; [ interactive-vm mastodon mastodon-vm garage ];
|
||||
modules = with self.nixosModules; [ fediversity interactive-vm mastodon-vm ];
|
||||
};
|
||||
|
||||
peertube = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = with self.nixosModules; [ interactive-vm peertube peertube-vm garage ];
|
||||
modules = with self.nixosModules; [ fediversity interactive-vm peertube-vm ];
|
||||
};
|
||||
|
||||
pixelfed = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = with self.nixosModules; [ interactive-vm pixelfed pixelfed-vm garage ];
|
||||
modules = with self.nixosModules; [ fediversity interactive-vm pixelfed-vm ];
|
||||
};
|
||||
|
||||
all = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = with self.nixosModules; [
|
||||
fediversity
|
||||
interactive-vm
|
||||
peertube peertube-vm
|
||||
pixelfed pixelfed-vm
|
||||
mastodon mastodon-vm
|
||||
garage
|
||||
peertube-vm
|
||||
pixelfed-vm
|
||||
mastodon-vm
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
@ -37,7 +37,7 @@ pkgs.nixosTest {
|
|||
nodes = {
|
||||
server = { config, ... }: {
|
||||
virtualisation.memorySize = lib.mkVMOverride 4096;
|
||||
imports = with self.nixosModules; [ garage mastodon mastodon-vm ];
|
||||
imports = with self.nixosModules; [ mastodon-vm ];
|
||||
# TODO: pair down
|
||||
environment.systemPackages = with pkgs; [
|
||||
python3
|
||||
|
|
|
@ -136,11 +136,7 @@ pkgs.nixosTest {
|
|||
memorySize = lib.mkVMOverride 8192;
|
||||
cores = 8;
|
||||
};
|
||||
imports = with self.nixosModules; [
|
||||
garage
|
||||
pixelfed
|
||||
pixelfed-vm
|
||||
];
|
||||
imports = with self.nixosModules; [ pixelfed-vm ];
|
||||
# TODO: pair down
|
||||
environment.systemPackages = with pkgs; [
|
||||
python3
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
{ modulesPath, lib, config, ... }: {
|
||||
|
||||
imports = [ (modulesPath + "/virtualisation/qemu-vm.nix") ];
|
||||
imports = [
|
||||
../fediversity
|
||||
(modulesPath + "/virtualisation/qemu-vm.nix")
|
||||
];
|
||||
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
fediversity = {
|
||||
enable = true;
|
||||
mastodon.enable = true;
|
||||
};
|
||||
|
||||
services.mastodon = {
|
||||
# redirects to localhost, but allows it to have a proper domain name
|
||||
localDomain = "mastodon.localhost";
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
{ pkgs, modulesPath, ... }: {
|
||||
imports = [ (modulesPath + "/virtualisation/qemu-vm.nix") ];
|
||||
|
||||
imports = [
|
||||
../fediversity
|
||||
(modulesPath + "/virtualisation/qemu-vm.nix")
|
||||
];
|
||||
|
||||
fediversity = {
|
||||
enable = true;
|
||||
pixelfed.enable = true;
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||
services.pixelfed = {
|
||||
domain = "pixelfed.localhost";
|
||||
|
|
Reference in a new issue