diff --git a/format b/format index b875c6b7..68751a3f 100755 --- a/format +++ b/format @@ -1,5 +1,5 @@ #! /usr/bin/env nix-shell -#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/5edf5b60c3d8f82b5fc5e73e822b6f7460584945.tar.gz -i bash -p findutils nixfmt +#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/6616de389ed55fba6eeba60377fc04732d5a207c.tar.gz -i bash -p findutils nixfmt CHECK_ARG= @@ -15,14 +15,11 @@ esac # The excludes are for files touched by open pull requests and we want # to avoid merge conflicts. find . -name '*.nix' \ - ! -path ./home-manager/home-manager.nix \ ! -path ./modules/default.nix \ ! -path ./modules/files.nix \ ! -path ./modules/home-environment.nix \ - ! -path ./modules/launchd/launchd.nix \ ! -path ./modules/lib/default.nix \ ! -path ./modules/lib/file-type.nix \ - ! -path ./modules/manual.nix \ ! -path ./modules/misc/news.nix \ ! -path ./modules/programs/bash.nix \ ! -path ./modules/programs/ssh.nix \ diff --git a/home-manager/home-manager.nix b/home-manager/home-manager.nix index a113d1d8..6f2f4b66 100644 --- a/home-manager/home-manager.nix +++ b/home-manager/home-manager.nix @@ -1,9 +1,5 @@ -{ pkgs ? import {} -, confPath -, confAttr ? null -, check ? true -, newsReadIdsFile ? null -}: +{ pkgs ? import { }, confPath, confAttr ? null, check ? true +, newsReadIdsFile ? null }: let inherit (pkgs.lib) @@ -11,68 +7,58 @@ let replaceStrings splitString; env = import ../modules { - configuration = - if confAttr == "" || confAttr == null - then confPath - else (import confPath).${confAttr}; + configuration = if confAttr == "" || confAttr == null then + confPath + else + (import confPath).${confAttr}; pkgs = pkgs; check = check; }; - newsReadIds = - if newsReadIdsFile == null - then {} - else - let - ids = splitString "\n" (fileContents newsReadIdsFile); - in - builtins.listToAttrs (map (id: { name = id; value = null; }) ids); + newsReadIds = if newsReadIdsFile == null then + { } + else + let ids = splitString "\n" (fileContents newsReadIdsFile); + in builtins.listToAttrs (map (id: { + name = id; + value = null; + }) ids); newsIsRead = entry: builtins.hasAttr entry.id newsReadIds; - newsFiltered = - let - pred = entry: entry.condition && ! newsIsRead entry; - in - filter pred env.newsEntries; + newsFiltered = let pred = entry: entry.condition && !newsIsRead entry; + in filter pred env.newsEntries; newsNumUnread = length newsFiltered; - newsFileUnread = pkgs.writeText "news-unread.txt" ( - concatMapStringsSep "\n\n" (entry: + newsFileUnread = pkgs.writeText "news-unread.txt" (concatMapStringsSep "\n\n" + (entry: let - time = replaceStrings ["T"] [" "] (removeSuffix "+00:00" entry.time); - in - '' - * ${time} + time = + replaceStrings [ "T" ] [ " " ] (removeSuffix "+00:00" entry.time); + in '' + * ${time} - ${replaceStrings ["\n"] ["\n "] entry.message} - '' - ) newsFiltered - ); + ${replaceStrings [ "\n" ] [ "\n " ] entry.message} + '') newsFiltered); - newsFileAll = pkgs.writeText "news-all.txt" ( - concatMapStringsSep "\n\n" (entry: + newsFileAll = pkgs.writeText "news-all.txt" (concatMapStringsSep "\n\n" + (entry: let flag = if newsIsRead entry then "read" else "unread"; - time = replaceStrings ["T"] [" "] (removeSuffix "+00:00" entry.time); - in - '' - * ${time} [${flag}] + time = + replaceStrings [ "T" ] [ " " ] (removeSuffix "+00:00" entry.time); + in '' + * ${time} [${flag}] - ${replaceStrings ["\n"] ["\n "] entry.message} - '' - ) env.newsEntries - ); + ${replaceStrings [ "\n" ] [ "\n " ] entry.message} + '') env.newsEntries); # File where each line corresponds to an unread news entry # identifier. If non-empty then the file ends in "\n". - newsUnreadIdsFile = pkgs.writeText "news-unread-ids" ( - let - text = concatMapStringsSep "\n" (entry: entry.id) newsFiltered; - in - text + optionalString (text != "") "\n" - ); + newsUnreadIdsFile = pkgs.writeText "news-unread-ids" + (let text = concatMapStringsSep "\n" (entry: entry.id) newsFiltered; + in text + optionalString (text != "") "\n"); newsInfo = pkgs.writeText "news-info.sh" '' local newsNumUnread=${toString newsNumUnread} @@ -82,8 +68,7 @@ let local newsUnreadIdsFile="${newsUnreadIdsFile}" ''; -in - { - inherit (env) activationPackage; - inherit newsInfo; - } +in { + inherit (env) activationPackage; + inherit newsInfo; +} diff --git a/modules/launchd/launchd.nix b/modules/launchd/launchd.nix index e25c005b..b54345b7 100644 --- a/modules/launchd/launchd.nix +++ b/modules/launchd/launchd.nix @@ -364,7 +364,10 @@ with lib; StartCalendarInterval = mkOption { default = null; - example = { Hour = 2; Minute = 30; }; + example = { + Hour = 2; + Minute = 30; + }; description = '' This optional key causes the job to be started every calendar interval as specified. Missing arguments are considered to be wildcard. The semantics are much like crontab(5). Unlike cron which skips job @@ -652,7 +655,8 @@ with lib; }; ProcessType = mkOption { - type = types.nullOr (types.enum [ "Background" "Standard" "Adaptive" "Interactive" ]); + type = types.nullOr + (types.enum [ "Background" "Standard" "Adaptive" "Interactive" ]); default = null; example = "Background"; description = '' @@ -840,7 +844,8 @@ with lib; }; Bonjour = mkOption { - type = types.nullOr (types.either types.bool (types.listOf types.str)); + type = + types.nullOr (types.either types.bool (types.listOf types.str)); default = null; description = '' This optional key can be used to request that the service be registered with the @@ -864,6 +869,5 @@ with lib; }; }; - config = { - }; + config = { }; } diff --git a/modules/manual.nix b/modules/manual.nix index a5c02051..356f311a 100644 --- a/modules/manual.nix +++ b/modules/manual.nix @@ -8,9 +8,7 @@ let docs = import ../docs { inherit lib pkgs; }; -in - -{ +in { options = { manual.html.enable = mkOption { type = types.bool; diff --git a/tests/modules/services/window-managers/sway/sway-no-xwayland.nix b/tests/modules/services/window-managers/sway/sway-no-xwayland.nix index f19b88eb..f9111089 100644 --- a/tests/modules/services/window-managers/sway/sway-no-xwayland.nix +++ b/tests/modules/services/window-managers/sway/sway-no-xwayland.nix @@ -17,7 +17,7 @@ ${ pkgs.writeText "expected" '' xwayland disable - '' + '' } ''; }