From b643a6a235b0c1c9902b97421f24eff2b0d0a5ac Mon Sep 17 00:00:00 2001 From: seth Date: Fri, 9 Aug 2024 23:35:41 -0400 Subject: tree-wide: end of summer cleanup (#214) * api: refactor & rename module to http * client: split from main.rs * tree-wide: use eyre::Report as error * nix: alejandra -> nixfmt * nix: start using treefmt-nix * nix: simplify flake * nix: refactor derivation & docker image * nix: remove overlay * ci: update & cleanup workflows * commands: assign all commands automatically * commands/copypasta: remove * http/teawie: update response struct for upstream rust rewrite * handlers: rename modules to events; flatten * crates: rename self to teawie-bot * nix: fenix -> rust-overlay i want a specific rust version grrrrrrr * ci: pin rust to 1.79 this is what our nix dev shell uses and what we can compile on. it seems the time crate doesn't like v1.80 of the compiler :( * ci: always run release gates * nix: fix static toolchain * nix: rust-overlay -> nixpkgs * ci: adopt actions-rust-lang actions * nix: use docker arch names for containers * crates/time: 0.3.30 -> 0.3.36 fixes building on rust 1.80.0 --- nix/module.nix | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) (limited to 'nix/module.nix') diff --git a/nix/module.nix b/nix/module.nix index c129e68..4e3b683 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -1,14 +1,15 @@ -self: { +self: +{ config, lib, pkgs, ... -}: let +}: +let cfg = config.services.teawiebot; defaultUser = "teawiebot"; - inherit - (lib) + inherit (lib) getExe literalExpression mdDoc @@ -21,18 +22,18 @@ self: { ; inherit (pkgs.stdenv.hostPlatform) system; -in { +in +{ options.services.teawiebot = { - enable = mkEnableOption "teawiebot"; - package = mkPackageOption ( - self.packages.${system} or (builtins.throw "${system} is not supported!") - ) "teawiebot" {}; + enable = mkEnableOption "teawieBot"; + package = mkPackageOption (self.packages.${system} or (builtins.throw "${system} is not supported!") + ) "teawie-bot" { }; user = mkOption { description = mdDoc '' User under which the service should run. If this is the default value, - the user will be created, with the specified group as the primary - group. + the user will be created, with the specified group as the primary + group. ''; type = types.str; default = defaultUser; @@ -88,10 +89,8 @@ in { systemd.services."teawiebot" = { enable = true; - wantedBy = ["multi-user.target"]; - after = - ["network.target"] - ++ optionals (cfg.redisUrl == "local") ["redis-teawiebot.service"]; + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ] ++ optionals (cfg.redisUrl == "local") [ "redis-teawiebot.service" ]; script = '' ${getExe cfg.package} @@ -99,9 +98,10 @@ in { environment = { REDIS_URL = - if cfg.redisUrl == "local" - then "unix:${config.services.redis.servers.teawiebot.unixSocket}" - else cfg.redisUrl; + if cfg.redisUrl == "local" then + "unix:${config.services.redis.servers.teawiebot.unixSocket}" + else + cfg.redisUrl; }; serviceConfig = { @@ -140,9 +140,7 @@ in { }; }; - groups = mkIf (cfg.group == defaultUser) { - ${defaultUser} = {}; - }; + groups = mkIf (cfg.group == defaultUser) { ${defaultUser} = { }; }; }; }; } -- cgit v1.2.3