Display deprecated channels (#489)

This commit is contained in:
Naïm Camille Favier 2022-06-08 01:55:26 +02:00 committed by GitHub
parent 75e8457105
commit 74ed61a915
Failed to generate hash of commit
2 changed files with 27 additions and 13 deletions

View file

@ -12,7 +12,7 @@
outputs = { self
, nixpkgs
, flake-utils
, nixos-org-configurations
, nixos-org-configurations
}:
flake-utils.lib.eachDefaultSystem
(system:
@ -27,7 +27,7 @@
filteredChannels =
lib.filterAttrs
(n: v:
builtins.elem v.status ["beta" "stable" "rolling"] &&
builtins.elem v.status ["rolling" "beta" "stable" "deprecated"] &&
lib.hasPrefix "nixos-" n &&
v ? variant && v.variant == "primary"
)
@ -63,7 +63,7 @@
echo '${builtins.toJSON (builtins.map (c: c.id) nixosChannels.channels)}' > $out
'';
mkDevShell = { inputsFrom ? [], extraPackages ? [], extraShellHook ? "" }:
mkDevShell = { inputsFrom ? [], extraPackages ? [], extraShellHook ? "" }:
pkgs.mkShell {
inherit inputsFrom;
packages = extraPackages;

View file

@ -170,15 +170,27 @@ type alias NixOSChannel =
type NixOSChannelStatus
= Rolling
| Stable
| Beta
| Stable
| Deprecated
channelTitle : NixOSChannel -> String
channelTitle channel =
if channel.status == Beta
then channel.id ++ " (Beta)"
else channel.id
channelBadge : NixOSChannelStatus -> List (Html msg)
channelBadge status =
case status of
Rolling ->
-- [ span [ class "label label-success" ] [ text "Rolling" ] ]
[]
Beta ->
[ span [ class "label label-info" ] [ text "Beta" ] ]
Stable ->
-- [ span [ class "label label-success" ] [ text "Stable" ] ]
[]
Deprecated ->
[ span [ class "label label-warning" ] [ text "Deprecated" ] ]
decodeNixOSChannels : Json.Decode.Decoder NixOSChannels
@ -188,7 +200,6 @@ decodeNixOSChannels =
(Json.Decode.field "channels" (Json.Decode.list decodeNixOSChannel))
decodeNixOSChannel : Json.Decode.Decoder NixOSChannel
decodeNixOSChannel =
Json.Decode.map4 NixOSChannel
@ -201,11 +212,14 @@ decodeNixOSChannel =
"rolling" ->
Json.Decode.succeed Rolling
"beta" ->
Json.Decode.succeed Beta
"stable" ->
Json.Decode.succeed Stable
"beta" ->
Json.Decode.succeed Beta
"deprecated" ->
Json.Decode.succeed Deprecated
_ ->
Json.Decode.fail ("Unknown status: " ++ status)
@ -983,7 +997,7 @@ viewChannels nixosChannels outMsg selectedChannel =
]
, onClick <| outMsg (ChannelChange channel.id)
]
[ text <| channelTitle channel ]
(List.intersperse (text " ") ([ text channel.id ] ++ channelBadge channel.status))
)
nixosChannels
)