Compare commits

...
Sign in to create a new pull request.

8 commits

11 changed files with 207 additions and 96 deletions

View file

@ -31,14 +31,28 @@ module has options, they can be found in the `options.nix` file inside the
module directory. More general options used by multiple modules are documented
in `modules/options.nix`.
### Module Checklist
### Modules
Modules listed here may be unimplemented or unfinished.
#### Basic
- [x] `basic` - Basic Internet support
- [x] `ssh` - SSH support
- [ ] `site` - Static site hosting
- [x] `fail2ban` - IP moderation
#### Public Sites
- [ ] `site` - Static site hosting
- [x] `forgejo` - Code forge
#### Social
- [x] `mastodon` - Mastodon server instance
- [ ] `mail` - Mail server
#### Storage
- [ ] `cachix` - Nix build caching
- [ ] `backup` - Automated backup system

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, aether, forgejo-tokyo-night, ... }:
{ pkgs, aether, forgejo-tokyo-night, ... }:
{
networking.hostName = "toki-aether";
time.timeZone = "America/New_York";
@ -23,13 +23,19 @@
# Aether modules
imports = [
aether.all
aether.deploy-rpi5
aether.basic
aether.fail2ban
aether.forgejo
aether.ssh
];
aether.domain = "tokinanpa.dev";
aether.acmeEmail = "kiana.a.sheibani@gmail.com";
# Forgejo
aether.forgejo.theme = "${forgejo-tokyo-night}/public/assets";
aether.forgejo.templates = ./forgejo-templates;
services.forgejo.settings = {
@ -65,5 +71,16 @@
federation.ENABLED = true;
};
# Mastodon
# aether.mastodon.subdomain = "social";
# services.mastodon = {
# package = pkgs.mastodon.override {
# patches = [ ./mastodon/increase_limits.patch ];
# };
# extraConfig.SINGLE_USER_MODE = "true";
# streamingProcesses = 3;
# };
system.stateVersion = "24.05";
}

View file

@ -0,0 +1,41 @@
diff --git a/app/javascript/mastodon/features/compose/containers/compose_form_container.js b/app/javascript/mastodon/features/compose/containers/compose_form_container.js
index bda2edb..1be1ce2 100644
--- a/app/javascript/mastodon/features/compose/containers/compose_form_container.js
+++ b/app/javascript/mastodon/features/compose/containers/compose_form_container.js
@@ -28,7 +28,7 @@ const mapStateToProps = state => ({
anyMedia: state.getIn(['compose', 'media_attachments']).size > 0,
isInReply: state.getIn(['compose', 'in_reply_to']) !== null,
lang: state.getIn(['compose', 'language']),
- maxChars: state.getIn(['server', 'server', 'configuration', 'statuses', 'max_characters'], 500),
+ maxChars: state.getIn(['server', 'server', 'configuration', 'statuses', 'max_characters'], 1000000),
});
const mapDispatchToProps = (dispatch) => ({
diff --git a/app/validators/poll_options_validator.rb b/app/validators/poll_options_validator.rb
index 0ac84f9..9393de8 100644
--- a/app/validators/poll_options_validator.rb
+++ b/app/validators/poll_options_validator.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
class PollOptionsValidator < ActiveModel::Validator
- MAX_OPTIONS = 4
- MAX_OPTION_CHARS = 50
+ MAX_OPTIONS = 100
+ MAX_OPTION_CHARS = 500
def validate(poll)
poll.errors.add(:options, I18n.t('polls.errors.too_few_options')) unless poll.options.size > 1
diff --git a/app/validators/status_length_validator.rb b/app/validators/status_length_validator.rb
index dc841de..f0f1b25 100644
--- a/app/validators/status_length_validator.rb
+++ b/app/validators/status_length_validator.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
class StatusLengthValidator < ActiveModel::Validator
- MAX_CHARS = 500
+ MAX_CHARS = 1000000
URL_PLACEHOLDER_CHARS = 23
URL_PLACEHOLDER = 'x' * 23

View file

@ -9,14 +9,14 @@ let
"EtbDcTMZ8qF0JKgVjir6X1hPxodDEiXy4XTGqqDKpyqwhMSPmTdgQFCeJEOrPhSc85vB6SJ" +
"dVSC7YVRqIDpebiWFelen1PwsAMdL09bQKA2R3GMqJN/n6XlapKf8U= kiana@toki-earth";
fire-key =
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDemOeWGP40M495KAuylZfRHXKKr9av0QH" +
"YjQwuG5EKzoy+KH0EAtBM3MbDLX5+bCd4O4oB9H/ZWxDZFfaitTPf1nrBMA89GWAxiGwVT3" +
"U2kQL2KUIP9rXjH/KLwocqnqsljRka1McF0mijtpMhNR0jpXAOfZboHFWRE07kRacvXmhkl" +
"tcJhXiCGMYmUfFT/HroxSgV+1BM9csYItzHlHFhoB2laEQOoTE5jLxkTkqZ55W0V9QUlM1N" +
"830fvhv9z/I6PQcIPXttB4nm+339r2qA3qncRkF7j0+JIXbUkIxK7nQhv25EyFUS8WplnI7" +
"mbb2T9JWVeLsAO24WrAApbPxmu+ItKq003Qi4a/0+v6D2PCXm+YoxJlM5aHh8FZdXoIhMv7" +
"6j3lk0P0sN9Sr09gjoWkV+/rSN+3ZLCJBGS5a3LpBk3HC2ZP/mvfsd1LTDhYQBJSW0LiBZO" +
"5aRuKZrTbyY9+i75cTWjnJuvZyBDn3giSYMiVhIAcZg5dU0ySG4M28= kiana@toki-fire";
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDpUgBuz7ti5ZVhkfr3s3EDWnPsZTplntF" +
"D1rEudrs1RnJV/XtG9iIiI9L0BSyyMcAMNLVhw+IJmBzTH5PS8ZWZ6vTDXMgu+6FYohyGhI" +
"nLtqNxAnrAJj/j6RrIWqNVTk6cPW6R7WJ+DHiV0Vvin5yTBT0liBq6OcI0gnmgMD2mVMEYc" +
"lgaWdGscJxpm5Kk6sCOMjTqxgQD2S6aUM27JhO2ESKj/iXmwoXWOnVN11ULP+4zcKPJ2rE/" +
"c/V6l/vIIvrXhKlhWpAl7m7+mhsvUVlfBAJwf2zqFVENNt48pAdchCzU9BOdvUabEyLtHkt" +
"GzygZi8oYYjlnjShf+CwfKBk4Zu1GVKs50V9jnpnNjUwkcddky4B72BgMs88XCgx0sVdfod" +
"fU7ngMnv/UV4YrzJ4vItLJ5hxq+pnytG33/y3JCOe8/xSk3za83S5dVr5cML7H1Hn0V1g0e" +
"apeWJD+iTHMQ6DnwLC8rCCt9wof0b+IB6IOlTUD6XzgaLcjLOxWMcE= kiana@toki-fire";
keys = [ earth-key fire-key ];
in {
inherit keys;

View file

@ -1,20 +1,6 @@
{ config, lib, ... }:
{
options.aether.deploy.rpi5 = {
_internal.kernelPackages = lib.mkOption {
type = lib.types.raw;
description = ''
Kernel package to use for Raspberry Pi 5 support.
'';
};
};
config =
let cfg = config.aether.deploy.rpi5;
in {
nixpkgs.system = "aarch64-linux";
boot.kernelPackages = cfg._internal.kernelPackages;
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = false;
};
nixpkgs.system = "aarch64-linux";
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = false;
}

72
flake.lock generated
View file

@ -10,11 +10,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1723293904,
"narHash": "sha256-b+uqzj+Wa6xgMS9aNbX4I+sXeb5biPDi39VgvSFqFvU=",
"lastModified": 1754433428,
"narHash": "sha256-NA/FT2hVhKDftbHSwVnoRTFhes62+7dxZbxj5Gxvghs=",
"owner": "ryantm",
"repo": "agenix",
"rev": "f6291c5935fdc4e0bef208cfc0dcab7e3f7a1c41",
"rev": "9edb1787864c4f59ae5074ad498b6272b3ec308d",
"type": "github"
},
"original": {
@ -23,20 +23,6 @@
"type": "github"
}
},
"flake-compat": {
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"revCount": 57,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
}
},
"forgejo-tokyo-night": {
"flake": false,
"locked": {
@ -59,11 +45,11 @@
]
},
"locked": {
"lastModified": 1703113217,
"narHash": "sha256-7ulcXOk63TIT2lVDSExj7XzFx09LpdSAPtvgtM7yQPE=",
"lastModified": 1745494811,
"narHash": "sha256-YZCh2o9Ua1n9uCvrvi5pRxtuVNml8X2a03qIFfRKpFs=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "3bfaacf46133c037bb356193bd2f1765d9dc82c1",
"rev": "abfad3d2958c9e6300a883bd443512c55dfeb1be",
"type": "github"
},
"original": {
@ -72,13 +58,28 @@
"type": "github"
}
},
"nixos-hardware": {
"locked": {
"lastModified": 1759582739,
"narHash": "sha256-spZegilADH0q5OngM86u6NmXxduCNv5eX9vCiUPhOYc=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "3441b5242af7577230a78ffb03542add264179ab",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixos-hardware",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1736344531,
"narHash": "sha256-8YVQ9ZbSfuUk2bUf2KRj60NRraLPKPS0Q4QFTbc+c2c=",
"lastModified": 1759831965,
"narHash": "sha256-vgPm2xjOmKdZ0xKA6yLXPJpjOtQPHfaZDRtH+47XEBo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bffc22eb12172e6db3c5dde9e3e5628f8e3e7912",
"rev": "c9b6fb798541223bbb396d287d16f43520250518",
"type": "github"
},
"original": {
@ -92,29 +93,8 @@
"inputs": {
"agenix": "agenix",
"forgejo-tokyo-night": "forgejo-tokyo-night",
"nixpkgs": "nixpkgs",
"rpi5-kernel": "rpi5-kernel"
}
},
"rpi5-kernel": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1704485878,
"narHash": "sha256-i7UH31IZyil99EUB5qnQJAiszFkea1B1yZf5pQEDIYg=",
"owner": "vriska",
"repo": "nix-rpi5",
"rev": "ac9942532e1dc2f825ad2aa3a6d31bfbd3b42eed",
"type": "gitlab"
},
"original": {
"owner": "vriska",
"repo": "nix-rpi5",
"type": "gitlab"
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs"
}
},
"systems": {

View file

@ -3,9 +3,7 @@ description = "Aether - web server configuration";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rpi5-kernel.url = "gitlab:vriska/nix-rpi5";
rpi5-kernel.inputs.nixpkgs.follows = "nixpkgs";
nixos-hardware.url = "github:NixOS/nixos-hardware";
agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs";
@ -15,7 +13,7 @@ inputs = {
forgejo-tokyo-night.flake = false;
};
outputs = inputs@{ self, nixpkgs, agenix, rpi5-kernel, ... }:
outputs = inputs@{ self, nixpkgs, nixos-hardware, agenix, ... }:
let
inherit (nixpkgs) lib;
@ -23,8 +21,7 @@ outputs = inputs@{ self, nixpkgs, agenix, rpi5-kernel, ... }:
# (Mostly used for injecting flake inputs)
extraConfig = {
deploy-rpi5 = {
aether.deploy.rpi5._internal.kernelPackages = lib.mkDefault
rpi5-kernel.legacyPackages.aarch64-linux.linuxPackages_rpi5;
imports = [ nixos-hardware.nixosModules.raspberry-pi-5 ];
};
};
@ -47,11 +44,11 @@ outputs = inputs@{ self, nixpkgs, agenix, rpi5-kernel, ... }:
(name: ./deploy/${lib.removePrefix "deploy-" name});
modulesWithCfg = builtins.mapAttrs (k: v: {
imports = [ v ];
} // extraConfig.${k} or {}) modules;
imports = [ v (extraConfig.${k} or {}) ];
}) modules;
deploymentsWithCfg = builtins.mapAttrs (k: v: {
imports = [ v ];
} // extraConfig.${k} or {}) deployments;
imports = [ v (extraConfig.${k} or {}) ];
}) deployments;
in {
nixosModules =
modulesWithCfg // deploymentsWithCfg // {

View file

@ -1,4 +1,4 @@
args@{ config, lib, ... }:
{ config, lib, ... }:
{
imports = [ ../options.nix ];
@ -49,11 +49,4 @@ args@{ config, lib, ... }:
};
};
};
config.assertions = lib.mkIf config.aether.https [
{
assertion = !(builtins.isNull config.aether.acmeEmail);
message = "HTTPS support requires providing a contact email";
}
];
}

View file

@ -0,0 +1,37 @@
{ config, lib, ... }:
let
cfg = config.aether.mastodon;
mastodon = config.services.mastodon;
useSubdomain = !(builtins.isNull cfg.subdomain);
domain = lib.optionalString useSubdomain "${cfg.subdomain}."
+ config.aether.domain;
in {
imports = [ ./options.nix ];
services.mastodon = {
enable = true;
user = cfg.user;
group = mastodon.user;
localDomain = domain;
configureNginx = true;
smtp.fromAddress = cfg.email;
};
security.acme.acceptTerms = true;
security.acme.defaults.email = config.aether.acmeEmail;
networking.firewall.allowedTCPPorts = [ 80 443 ];
users.users = lib.mkIf (cfg.createUser && mastodon.user != "mastodon") {
${mastodon.user} = {
home = mastodon.package;
useDefaultShell = true;
group = mastodon.group;
isSystemUser = true;
};
};
users.groups = lib.mkIf (cfg.createUser && mastodon.group != "mastodon") {
${mastodon.group} = {};
};
}

View file

@ -0,0 +1,42 @@
{ config, lib, ... }:
{
imports = [ ../options.nix ];
options.aether = {
mastodon = {
subdomain = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = "mastodon";
description = ''
The subdomain to host Mastodon under.
If null, then Mastodon is hosted at the domain itself.
'';
};
user = lib.mkOption {
type = lib.types.str;
default = "mastodon";
description = ''
The user to run Mastodon with.
'';
};
createUser = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Whether to create the Mastodon user automatically.
'';
};
email = lib.mkOption {
type = lib.types.str;
default = config.aether.acmeEmail;
description = ''
The email address used by Mastodon to send emails from.
'';
};
};
};
}

View file

@ -9,13 +9,17 @@
https = lib.mkOption {
type = lib.types.boolByOr;
default = true;
description = "Whether to force HTTPS connections for websites.";
description = ''
Whether to force HTTPS connections for websites.
This option is ignored if the service strictly requires HTTPS.
'';
};
acmeEmail = lib.mkOption {
type = lib.types.nullOr lib.types.str;
type = lib.types.str;
default = null;
description = "Email address for ACME.";
description = "Email address to provide to the ACME service.";
};
};
}