mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 21:19:45 +01:00
format: update and remove exceptions (#3029)
Switches to nixfmt 0.5.0 and removes exceptions for files without open PRs.
This commit is contained in:
parent
504d6de6a0
commit
1de492f6f8
5 changed files with 51 additions and 67 deletions
5
format
5
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 \
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
{ pkgs ? import <nixpkgs> {}
|
||||
, confPath
|
||||
, confAttr ? null
|
||||
, check ? true
|
||||
, newsReadIdsFile ? null
|
||||
}:
|
||||
{ pkgs ? import <nixpkgs> { }, 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;
|
||||
}
|
||||
|
|
|
@ -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 <literal>crontab(5)</literal>. 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 = { };
|
||||
}
|
||||
|
|
|
@ -8,9 +8,7 @@ let
|
|||
|
||||
docs = import ../docs { inherit lib pkgs; };
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
in {
|
||||
options = {
|
||||
manual.html.enable = mkOption {
|
||||
type = types.bool;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
${
|
||||
pkgs.writeText "expected" ''
|
||||
xwayland disable
|
||||
''
|
||||
''
|
||||
}
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue