diff --git a/modules/home-manager/profiles/editors.nix b/modules/home-manager/profiles/editors.nix index f69579d9..d630985e 100644 --- a/modules/home-manager/profiles/editors.nix +++ b/modules/home-manager/profiles/editors.nix @@ -28,9 +28,7 @@ in { (lib.mkIf cfg.emacs.enable { # Doom Emacs dependencies. home.packages = with pkgs; [ - ((emacsPackagesFor emacs).emacsWithPackages (epkgs: [ - epkgs.vterm - ])) + ((emacsPackagesFor emacs).emacsWithPackages (epkgs: [ epkgs.vterm ])) # Required dependencies. ripgrep diff --git a/modules/home-manager/services/archivebox.nix b/modules/home-manager/services/archivebox.nix index 65d8adca..020503c0 100644 --- a/modules/home-manager/services/archivebox.nix +++ b/modules/home-manager/services/archivebox.nix @@ -9,13 +9,13 @@ let description = "List of links to archive."; example = lib.literalExpression '' [ - "https://guix.gnu.org/feeds/blog.atom" - "https://nixos.org/blog/announcements-rss.xml" + "https://guix.gnu.org/feeds/blog.atom" + "https://nixos.org/blog/announcements-rss.xml" ] ''; }; - extraOptions = lib.mkOption { + extraArgs = lib.mkOption { type = with lib.types; listOf str; description = '' Additional arguments for adding links (i.e., <literal>archivebox add @@ -69,7 +69,7 @@ in { "https://arxiv.org/rss/cs" "https://distill.pub/" ]; - extraOptions = [ "--depth 1" ]; + extraArgs = [ "--depth 1" ]; startAt = "daily"; }; } @@ -91,34 +91,37 @@ in { }; }; - config = lib.mkIf cfg.enable { + config = let + pkgSet = [ pkgs.archivebox ] ++ (lib.optionals cfg.withDependencies + (with pkgs; [ chromium nodejs_latest wget curl youtube-dl ])); + in lib.mkIf cfg.enable { assertions = [ (lib.hm.assertions.assertPlatform "services.archivebox" pkgs lib.platforms.linux) ]; - home.packages = [ pkgs.archivebox ] ++ (lib.optionals cfg.withDependencies - (with pkgs; [ chromium nodejs_latest wget curl youtube-dl ])); + home.packages = pkgSet; systemd.user.services = lib.mkMerge [ (lib.mapAttrs' (name: value: lib.nameValuePair "archivebox-add-${name}" { Unit = { - Description = "Archivebox archive group '${name}' for ${cfg.archivePath}"; + Description = + "Archivebox archive group '${name}' for ${cfg.archivePath}"; After = "network.target"; Documentation = [ "https://docs.archivebox.io/" ]; }; - Install.WantedBy = [ "default.target" ]; - Service = let scriptName = "archivebox-job-${config.home.username}-${name}"; - script = pkgs.writeShellApplication { + script = pkgs.writeShellApplication { name = scriptName; - runtimeInputs = with pkgs; [ coreutils archivebox ]; + runtimeInputs = with pkgs; + [ ripgrep coreutils ] ++ pkgSet + ++ [ config.programs.git.package ]; text = '' echo "${lib.concatStringsSep "\n" value.links}" \ - | archivebox add ${lib.concatStringsSep " " value.extraOptions} + | archivebox add ${lib.concatStringsSep " " value.extraArgs} ''; }; in { diff --git a/modules/home-manager/services/bleachbit.nix b/modules/home-manager/services/bleachbit.nix index bd1a99eb..c08f1e95 100644 --- a/modules/home-manager/services/bleachbit.nix +++ b/modules/home-manager/services/bleachbit.nix @@ -105,7 +105,7 @@ in { Restart = "on-failure"; ExecStart = "${pkgs.bleachbit}/bin/bleachbit --clean ${ lib.concatStringsSep " " cleaners - }"; + }"; }; }; }; diff --git a/modules/home-manager/services/gallery-dl.nix b/modules/home-manager/services/gallery-dl.nix index bdbcdda3..6c408462 100644 --- a/modules/home-manager/services/gallery-dl.nix +++ b/modules/home-manager/services/gallery-dl.nix @@ -5,7 +5,8 @@ let settingsFormat = pkgs.formats.json { }; settingsFormatFile = - settingsFormat.generate "gallery-dl-service-config-${config.home.username}" cfg.settings; + settingsFormat.generate "gallery-dl-service-config-${config.home.username}" + cfg.settings; jobType = { name, config, options, ... }: { options = { diff --git a/modules/home-manager/services/mopidy.nix b/modules/home-manager/services/mopidy.nix index b801e867..72be5849 100644 --- a/modules/home-manager/services/mopidy.nix +++ b/modules/home-manager/services/mopidy.nix @@ -7,13 +7,16 @@ let # The configuration format of Mopidy. It seems to use configparser with # some quirky handling of its types. You can see how they're handled in # `mopidy/config/types.py` from the source code. - toMopidyConf = with lib; generators.toINI { - mkKeyValue = generators.mkKeyValueDefault { - mkValueString = v: - if isList v then "\n " + concatStringsSep "\n " v - else generators.mkValueStringDefault {} v; - } " = "; - }; + toMopidyConf = with lib; + generators.toINI { + mkKeyValue = generators.mkKeyValueDefault { + mkValueString = v: + if isList v then + "\n " + concatStringsSep "\n " v + else + generators.mkValueStringDefault { } v; + } " = "; + }; mopidyEnv = pkgs.buildEnv { name = "mopidy-with-extensions-${pkgs.mopidy.version}"; @@ -25,18 +28,19 @@ let ''; }; - mopidyConfFormat = {}: { + mopidyConfFormat = { }: { type = with lib.types; let - valueType = nullOr (oneOf [ bool int float str (listOf valueType) ]) // { - description = "Mopidy config value"; - }; + valueType = nullOr (oneOf [ bool int float str (listOf valueType) ]) + // { + description = "Mopidy config value"; + }; in attrsOf (attrsOf valueType); generate = name: value: pkgs.writeText name (toMopidyConf value); }; - settingsFormat = mopidyConfFormat {}; + settingsFormat = mopidyConfFormat { }; in { options.services.mopidy = { enable = lib.mkEnableOption "Mopidy music player daemon"; @@ -53,7 +57,7 @@ in { }; configuration = lib.mkOption { - default = {}; + default = { }; type = settingsFormat.type; description = '' The Mopidy configuration to be written in the appropriate file in the @@ -94,7 +98,8 @@ in { ]; xdg.configFile."mopidy/mopidy.conf".source = - settingsFormat.generate "mopidy-conf-${config.home.username}" cfg.configuration; + settingsFormat.generate "mopidy-conf-${config.home.username}" + cfg.configuration; systemd.user.services.mopidy = { Unit = { @@ -103,9 +108,7 @@ in { Documentation = [ "https://mopidy.com/" ]; }; - Service = { - ExecStart = "${mopidyEnv}/bin/mopidy"; - }; + Service = { ExecStart = "${mopidyEnv}/bin/mopidy"; }; Install.WantedBy = [ "default.target" ]; }; diff --git a/modules/home-manager/services/plover.nix b/modules/home-manager/services/plover.nix index 5e981039..737ef2c3 100644 --- a/modules/home-manager/services/plover.nix +++ b/modules/home-manager/services/plover.nix @@ -80,6 +80,7 @@ in { Unit = { Description = "Plover stenography engine"; Documentation = [ "https://github.com/openstenoproject/plover/wiki/" ]; + PartOf = "default.target"; }; Service = { diff --git a/modules/home-manager/services/recoll.nix b/modules/home-manager/services/recoll.nix index 985c814d..48886312 100644 --- a/modules/home-manager/services/recoll.nix +++ b/modules/home-manager/services/recoll.nix @@ -95,7 +95,7 @@ in { configDir = lib.mkOption { type = lib.types.str; default = "${config.home.homeDirectory}/.recoll"; - example = "\${xdg.configHome.\"recoll\"}"; + example = ''''${xdg.configHome."recoll"}''; description = "The directory to contain Recoll configuration files."; }; }; diff --git a/modules/home-manager/services/yt-dlp.nix b/modules/home-manager/services/yt-dlp.nix index ef857ecb..26bb97f8 100644 --- a/modules/home-manager/services/yt-dlp.nix +++ b/modules/home-manager/services/yt-dlp.nix @@ -67,7 +67,10 @@ in { to be created at the time of running the service. Must be an absolute path. ''; - default = "${lib.replaceStrings ["$HOME"] [config.home.homeDirectory] config.xdg.userDirs.videos}/yt-dlp-service"; + default = "${ + lib.replaceStrings [ "$HOME" ] [ config.home.homeDirectory ] + config.xdg.userDirs.videos + }/yt-dlp-service"; example = lib.literalExpression "\${config.xdg.userDirs.download}/archiving-service/videos"; }; @@ -126,14 +129,19 @@ in { Service = { WorkingDirectory = cfg.archivePath; ExecStartPre = '' - ${pkgs.bash}/bin/bash -c "${pkgs.coreutils}/bin/mkdir -p ${lib.escapeShellArg cfg.archivePath}" + ${pkgs.bash}/bin/bash -c "${pkgs.coreutils}/bin/mkdir -p ${ + lib.escapeShellArg cfg.archivePath + }" ''; ExecStart = let - scriptName = "yt-dlp-archive-service-${config.home.username}-${name}"; + scriptName = + "yt-dlp-archive-service-${config.home.username}-${name}"; archiveScript = pkgs.writeShellScriptBin scriptName '' - ${cfg.package}/bin/yt-dlp ${lib.concatStringsSep " " cfg.extraArgs} ${ - lib.concatStringsSep " " value.extraArgs - } ${lib.escapeShellArgs value.urls} + ${cfg.package}/bin/yt-dlp ${ + lib.concatStringsSep " " cfg.extraArgs + } ${lib.concatStringsSep " " value.extraArgs} ${ + lib.escapeShellArgs value.urls + } ''; in "${archiveScript}/bin/${scriptName}"; }; diff --git a/modules/nixos/profiles/users.nix b/modules/nixos/profiles/users.nix index 5b34a843..43a5041a 100644 --- a/modules/nixos/profiles/users.nix +++ b/modules/nixos/profiles/users.nix @@ -19,8 +19,10 @@ let options = { settings = lib.mkOption { type = lib.types.attrs; - description = - "Configuration to be merged in <literal>users.users.<name></literal> from NixOS configuration."; + description = '' + Configuration to be merged in <literal>users.users.<name></literal> + from NixOS configuration. + ''; default = { }; example = { uid = 1234; @@ -37,8 +39,11 @@ in { users = lib.mkOption { default = { }; description = '' - A set of users from the `./users/home-manager` directory to be included in the NixOS config. - This will also create the appropriate user settings in <literal>users.users</literal> in the NixOS configuration.''; + A set of users from the <filename>./users/home-manager</filename> + directory to be included in the NixOS config. This will also create the + appropriate user settings in <literal>users.users</literal> in the + NixOS configuration. + ''; example = { foo-dogsquared.settings = { extraGroups = [ "wheel" "audio" "libvirtd" ]; diff --git a/modules/nixos/services/gallery-dl.nix b/modules/nixos/services/gallery-dl.nix index 87daea3c..15aa08d7 100644 --- a/modules/nixos/services/gallery-dl.nix +++ b/modules/nixos/services/gallery-dl.nix @@ -140,12 +140,14 @@ in { path = [ cfg.package ] ++ (with pkgs; [ coreutils ffmpeg ]); script = '' mkdir -p ${lib.escapeShellArg cfg.archivePath} \ - && gallery-dl ${ - lib.concatStringsSep " " cfg.extraArgs - } ${lib.concatStringsSep " " value.extraArgs} ${ + && gallery-dl ${lib.concatStringsSep " " cfg.extraArgs} ${ + lib.concatStringsSep " " value.extraArgs + } ${ lib.optionalString (cfg.settings != null) "--config ${settingsFormatFile}" - } --directory ${lib.escapeShellArg cfg.archivePath} ${lib.escapeShellArgs value.urls} + } --directory ${lib.escapeShellArg cfg.archivePath} ${ + lib.escapeShellArgs value.urls + } ''; startAt = value.startAt; }) cfg.jobs;