From f8765b410ad0496a82cc294c68aec701e6d391be Mon Sep 17 00:00:00 2001 From: emily Date: Thu, 14 Nov 2024 19:11:10 +0100 Subject: [PATCH] Fix eval --- flake.nix | 24 +++++++------- florp.nix | 10 +++--- module.nix | 91 +++++++++++++++++++++++++++++------------------------- 3 files changed, 67 insertions(+), 58 deletions(-) diff --git a/flake.nix b/flake.nix index 51e423b..8ceb207 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,6 @@ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; outputs = { self, nixpkgs, ... }: let inherit (nixpkgs) lib; - eachSystem = lib.genAttrs [ "x86_64-linux" "aarch64-linux" ]; in { nixosModules = { default = import ./module.nix; @@ -11,23 +10,24 @@ }; }; - nixosConfigurations = eachSystem (system: lib.nixosSystem { - inherit system; + nixosConfigurations.testEval = lib.nixosSystem { + system = "x86_64-linux"; modules = [ { system.stateVersion = "24.11"; + networking.hostName = "hostName"; + networking.domain = "domain"; fileSystems."/".device = "nodev"; boot.loader.grub.enable = false; services.akkoma.enable = true; - services.akkoma.config.":pleroma".":instance" = { - name = "test"; - description = "test"; - email = "test@test.test"; + services.akkoma.config.":pleroma" = { + "Pleroma.Upload".base_url = "nonEmptyStr"; + ":instance" = { + name = "test"; + description = "test"; + email = "test@test.test"; + }; }; } ] ++ (with self.nixosModules; [ default florp ]); - }); - - checks = eachSystem (system: { - default = self.nixosConfigurations.${system}.config.system.build.toplevel; - }); + }; }; } diff --git a/florp.nix b/florp.nix index 33961d3..b93af0f 100644 --- a/florp.nix +++ b/florp.nix @@ -1,4 +1,6 @@ -{ lib, ... }: { +{ lib, ... }: let + genAction = instances: action: lib.genAttrs instances (_: action); +in { instances = { "kiwifarms.*" = { reason = "Targeted harassment."; @@ -31,7 +33,7 @@ }; } # Right‐wing extremism - // lib.genAttrs [ + // genAction [ "brighteon.social" "detroitriotcity.com" "freeatlantis.com" @@ -45,7 +47,7 @@ media = "mark"; } # Lolicon, shotacon - // lib.genAttrs [ + // genAction [ "inumimi.love" "filly.love" "loli.church" @@ -56,7 +58,7 @@ media = "strip"; } # CSAM suspects - // lib.genAttrs [ + // genAction [ "eepy.express" "megasugki.xyz" "minor.cafe" diff --git a/module.nix b/module.nix index fba8b52..ffe8ae0 100644 --- a/module.nix +++ b/module.nix @@ -11,29 +11,31 @@ in { options.services.akkoma.moderation = { instances = lib.mkOption { type = with lib.types; attrsOf (submodule { - inherit reason; + options = { + inherit reason; - activities = lib.mkOption { - type = with lib.types; (nullOr enum [ "unlist" "restrict" "reject" ]); - default = null; - description = '' - Activity moderation: + activities = lib.mkOption { + type = with lib.types; (nullOr (enum [ "unlist" "restrict" "reject" "followersOnly" ])); + default = null; + description = '' + Activity moderation: - - `unlist`: Remove activities from federated timeline. - - `restrict`: Force activities to be visible to followers only. - - `reject`: Reject all activities except deletes. - ''; - }; + - `unlist`: Remove activities from federated timeline. + - `restrict`: Force activities to be visible to followers only. + - `reject`: Reject all activities except deletes. + ''; + }; - media = lib.mkOption { - type = with lib.types; (nullOr enum [ "mark" "strip" ]); - default = null; - description = '' - Media attachment moderation: + media = lib.mkOption { + type = with lib.types; (nullOr (enum [ "mark" "strip" ])); + default = null; + description = '' + Media attachment moderation: - - `mark`: Mark media attachments as sensitive. - - `strip`: Strip all media attachments. - ''; + - `mark`: Mark media attachments as sensitive. + - `strip`: Strip all media attachments. + ''; + }; }; }); @@ -58,22 +60,25 @@ in { hashtags = lib.mkOption { type = with lib.types; attrsOf (submodule { - inherit reason; + options = { + inherit reason; - sensitive = lib.mkOption { - type = lib.types.bool; - default = false; - description = '' - Mark tagged activities as sensitive. - ''; - }; + sensitive = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Mark tagged activities as sensitive. + ''; + }; - unlisted = lib.mkOption { - type = lib.types.bool; - default = false; - description = '' - Remove tagged activities from federated timeline. - ''; + unlisted = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Remove tagged activities from federated timeline. + ''; + }; + }; }); @@ -92,17 +97,19 @@ in { }; keywords = lib.mkOption { - type = with lib.types; attrsOf (submodule { - inherit reason; + type = with lib.types; attrsOf (submodule { + options = { + inherit reason; - action = lib.mkOption { - type = lib.types.bool; - description = '' - Activity moderation: + action = lib.mkOption { + type = lib.types.bool; + description = '' + Activity moderation: - - `unlist`: Remove matching activities from federated timelines. - - `reject`: Reject matching activities. - ''; + - `unlist`: Remove matching activities from federated timelines. + - `reject`: Reject matching activities. + ''; + }; }; });