diff --git a/README.md b/README.md index 4cee462..d6779d2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,28 @@ +# MINIFEDI IS NOT DONE. It's like 80% of the way there, but the docs below remain slightly aspirational for the moment. + # Minifedi Minifedi is a tool to quickly spin up a bunch of ActivityPub servers for local testing. -Minifedi should run on any macOS or Linux system with [Nix](https://nixos.org) installed. (Nix itself works fine on any Linux distribution; you don't need to be using NixOS.) Windows isn't natively supported, but WSL should work. Besides Nix, it is entirely self-contained and needs no changes to your system configuration; you can install it with a git clone, delete it with `rm -rf`, and your system will be exactly the way it was before. +Minifedi should run on any macOS or Linux system with [Nix](https://nixos.org) installed. (Nix itself works fine on any Linux distribution; you don't need to be using NixOS.) Windows isn't natively supported, but WSL should work. Minifedi is entirely self-contained and needs no changes to your system configuration besides installing Nix; you can install it with a git clone, delete it with `rm -rf`, and your system will be exactly the way it was before. + +Minifedi's goal is to "just work" on every machine. If the instructions below fail for you, please file an issue; I'll fix it if at all possible. + +## Getting Started + +``` +git clone https://github.com/Gaelan/minifedi.git +cd minifedi +vi nix/services.nix # if you'd like, edit the list of instances - by default, we run one of each +nix run +``` + +Give it some time, and you should see + +## Supported Software + +Minifedi currently supports: + +- Mastodon (and forks) +- Akkoma +- GoToSocial diff --git a/TODO b/TODO index 75c5768..fca5f91 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,5 @@ - fix flake.nix to handle arbitrary arches -- rip out or fix GtS (need to handle certs somehow) - figure out how to support local clones, and document this - data generation? - separate out config into separate file, and document this +- license diff --git a/flake.lock b/flake.lock index 777504d..c8a0c8e 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,23 @@ { "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1688221086, @@ -16,8 +34,24 @@ }, "root": { "inputs": { + "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index b274b93..0975a92 100644 --- a/flake.nix +++ b/flake.nix @@ -1,89 +1,58 @@ { - outputs = { self, nixpkgs }: { - # nixosModules.base = {pkgs, ...}: { - # system.stateVersion = "22.05"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + outputs = { self, flake-utils, nixpkgs }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + apps.default = let + s6 = (import ./nix/s6.nix { + inherit pkgs; + services = pkgs.lib.attrsets.mapAttrs (_: v: v.service) + (import ./nix/services.nix { inherit pkgs; }); + path = "service"; + }); + in { + type = "app"; + program = let + script = pkgs.writeShellScript "minifedi" '' + export PATH=${pkgs.gnugrep}/bin:${pkgs.gnused}/bin:${pkgs.coreutils}/bin - # # Configure networking - # networking.useDHCP = false; - # networking.interfaces.eth0.useDHCP = true; + if ! [[ -e .is-minifedi ]]; then + echo "please run this from the minifedi directory" + exit 1 + fi + mkdir -p data + mkdir -p cert + rm -rf data/run + mkdir data/run + export MINIFEDI_CERT=$(pwd)/cert + export MINIFEDI_DATA=$(pwd)/data + export MINIFEDI_RUN=$(pwd)/data/run + exec ${s6.start} + ''; + in "${script}"; + }; + apps.install-cert = { + type = "app"; + program = let + script = pkgs.writeShellScript "minifedi-install-cert" '' + if ! [[ -e .is-minifedi ]]; then + echo "please run this from the minifedi directory" + exit 1 + fi - # # Create user "test" - # services.getty.autologinUser = "test"; - # users.users.test.isNormalUser = true; + mkdir -p cert + export MINIFEDI_CERT=$(pwd)/cert - # # Enable passwordless ‘sudo’ for the "test" user - # users.users.test.extraGroups = ["wheel"]; - # security.sudo.wheelNeedsPassword = false; - # }; - # nixosModules.vm = {...}: { - # # Make VM output to the terminal instead of a separate window - # virtualisation.vmVariant.virtualisation.graphics = false; - # }; - # nixosConfigurations.darwinVM = nixpkgs.lib.nixosSystem { - # system = "x86_64-linux"; - # modules = [ - # (builtins.trace (builtins.attrNames self) self.nixosModules.base) - # self.nixosModules.vm - # { - # virtualisation.vmVariant.virtualisation.host.pkgs = nixpkgs.legacyPackages.x86_64-darwin; - # } - # ]; - # }; - # packages.x86_64-darwin.darwinVM = self.nixosConfigurations.darwinVM.config.system.build.vm; - apps.x86_64-darwin.default = let - pkgs = nixpkgs.legacyPackages.x86_64-darwin; - s6 = (import ./nix/s6.nix { - inherit pkgs; - services = pkgs.lib.attrsets.mapAttrs (_: v: v.service) - (import ./nix/services.nix { inherit pkgs; }); - path = "service"; + CAROOT=$MINIFEDI_CERT ${pkgs.mkcert}/bin/mkcert -install + ''; + in "${script}"; + }; + apps.x86_64-darwin.mastodon-mk-version = { + type = "app"; + program = "${ + import ./nix/fedi/mastodon/mk-version { inherit pkgs; } + }/bin/mastodon-mk-version"; + }; }); - in { - type = "app"; - program = let - script = pkgs.writeShellScript "minifedi" '' - export PATH=${pkgs.gnugrep}/bin:${pkgs.gnused}/bin:${pkgs.coreutils}/bin - - if ! [[ -e .is-minifedi ]]; then - echo "please run this from the minifedi directory" - exit 1 - fi - mkdir -p data - mkdir -p cert - rm -rf data/run - mkdir data/run - export MINIFEDI_CERT=$(pwd)/cert - export MINIFEDI_DATA=$(pwd)/data - export MINIFEDI_RUN=$(pwd)/data/run - exec ${s6.start} - ''; - in "${script}"; - }; - apps.x86_64-darwin.install-cert = - let pkgs = nixpkgs.legacyPackages.x86_64-darwin; - in { - type = "app"; - program = let - script = pkgs.writeShellScript "minifedi-install-cert" '' - if ! [[ -e .is-minifedi ]]; then - echo "please run this from the minifedi directory" - exit 1 - fi - - mkdir -p cert - export MINIFEDI_CERT=$(pwd)/cert - - CAROOT=$MINIFEDI_CERT ${pkgs.mkcert}/bin/mkcert -install - ''; - in "${script}"; - }; - apps.x86_64-darwin.mastodon-mk-version = - let pkgs = nixpkgs.legacyPackages.x86_64-darwin; - in { - type = "app"; - program = "${ - import ./nix/fedi/mastodon/mk-version { inherit pkgs; } - }/bin/mastodon-mk-version"; - }; - }; }