-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
103 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ jobs: | |
with: | ||
name: tek | ||
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' | ||
- run: rm -rf /opt/hostedtoolcache | ||
- run: git config --global user.name hix | ||
- run: git config --global user.email [email protected] | ||
- run: nix run .#test-basic-1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ jobs: | |
with: | ||
name: tek | ||
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' | ||
- run: rm -rf /opt/hostedtoolcache | ||
- run: git config --global user.name hix | ||
- run: git config --global user.email [email protected] | ||
- run: nix run .#test-basic-2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ jobs: | |
with: | ||
name: tek | ||
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' | ||
- run: rm -rf /opt/hostedtoolcache | ||
- run: git config --global user.name hix | ||
- run: git config --global user.email [email protected] | ||
- run: nix run .#test-basic-3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ jobs: | |
with: | ||
name: tek | ||
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' | ||
- run: rm -rf /opt/hostedtoolcache | ||
- run: git config --global user.name hix | ||
- run: git config --global user.email [email protected] | ||
- run: nix run .#test-managed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{util}: let | ||
|
||
inherit (util) config lib; | ||
inherit (util.console) chevrons bold; | ||
inherit (util.console.s) colors; | ||
|
||
inherit (config.ui.warnings) all keys; | ||
|
||
enabled = key: keys.${key} or all; | ||
|
||
warnWith = handler: key: message: | ||
handler (enabled key) '' | ||
${message} | ||
Disable this warning by setting ${bold (colors.yellow ''ui.warnings.keys."${key}" = false;'')} | ||
''; | ||
|
||
deprecatedWith = handler: key: desc: replacement: let | ||
suggestion = if replacement == null then "" else " in favor of ${colors.blue replacement}"; | ||
message = "${desc} is deprecated${suggestion}."; | ||
in warnWith handler "deprecated.${key}" message; | ||
|
||
appHandler = exe: isEnabled: message: let | ||
warning = config.pkgs.writeText "hix-warning" '' | ||
${chevrons} Warning: ${message} | ||
''; | ||
wrapped = | ||
if isEnabled | ||
then util.script "hix-warn-wrapper" '' | ||
echo -e "$(cat ${warning})" | ||
exec ${exe} | ||
'' | ||
else exe | ||
; | ||
in util.app wrapped; | ||
|
||
warnEval = warnWith lib.warnIf; | ||
|
||
deprecatedOutput = category: name: | ||
warnEval "${category}.${name}" "The ${category} .#${name}"; | ||
|
||
deprecatedApp = name: replacement: exe: | ||
deprecatedWith (appHandler exe) "app.${name}" "The app ${colors.blue ".#${name}"}" replacement; | ||
|
||
in { | ||
inherit | ||
warnWith | ||
deprecatedWith | ||
deprecatedOutput | ||
deprecatedApp | ||
; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
{util}: let | ||
|
||
inherit (util) config; | ||
inherit (util) config internal; | ||
|
||
in { | ||
|
||
legacyApps = { | ||
hpack = config.hpack.script; | ||
hpack-quiet = config.hpack.scriptQuiet; | ||
hpack = internal.warn.deprecatedApp "hpack" ".#gen-cabal" config.hpack.script; | ||
hpack-quiet = internal.warn.deprecatedApp "hpack-quiet" ".#gen-cabal-quiet" config.hpack.scriptQuiet; | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ let | |
./hackage.nix | ||
./cli.nix | ||
./managed.nix | ||
./ui.nix | ||
inputsConfig | ||
]; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ lib, ... }: let | ||
|
||
inherit (lib) types; | ||
|
||
in { | ||
|
||
options = { | ||
|
||
ui.warnings = { | ||
|
||
all = lib.mkOption { | ||
description = '' | ||
Whether to enable all warnings. | ||
Set this to `false` to suppress all warnings and use [](#opt-ui-ui.warnings.keys) to enable them | ||
selectively. | ||
''; | ||
type = types.bool; | ||
default = true; | ||
}; | ||
|
||
keys = lib.mkOption { | ||
description = '' | ||
The set of warnings that should be enabled or disabled individually. | ||
Keys are warning IDs and values are booleans, where `true` enables a warning and `false` disables it. | ||
If a key is not present in this set, the warning is printed if [](#opt-ui-ui.warnings.all) is `true`. | ||
''; | ||
type = types.attrsOf types.bool; | ||
default = {}; | ||
}; | ||
}; | ||
|
||
}; | ||
|
||
} |