From f8d9c2ccfa3a157d580148ff3c7d4956b37ddaa6 Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Wed, 3 Sep 2025 10:55:25 +0200 Subject: [PATCH 1/2] frontend: make `nix-env` install option less prominent I've seen people complain that `nix-env` is a weird "default" option to install packages with, particularly because of its weird ergonomics: - Install packages with `nix-env -iA nixos.hello` - Uninstall without the `nixos` prefix I think the community consensus has been to avoid the `nix-env` command altogether, but at first glance, to a newcomer, since the `nix-env` tab is currently the leftmost option (although not the one selected by default), `nix-env` might look like the way to go... To make the install instruction page slightly more ergonomic (and hopefully nudge people to the correct option when they start out), I've ordered them from left-to-right (read: reversed), and greyed out the `nix-env` option, making it the least prominent from now on visually. Now this might entail the fact that some screenreaders and other structured consumers of the markup will see the options the wrong way around, but I guess that's just a flaw of the design, where `pull-right` is used to right-align the tabs, incidentally reversing the order.... Disclaimer: I don't have any experience with Elm so forgive me if I struggle to follow-up further review comments or requests. --- frontend/src/Page/Packages.elm | 13 +++++++------ frontend/src/index.scss | 4 ++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/frontend/src/Page/Packages.elm b/frontend/src/Page/Packages.elm index 58c97ebd..a3f0360d 100644 --- a/frontend/src/Page/Packages.elm +++ b/frontend/src/Page/Packages.elm @@ -639,17 +639,18 @@ viewResultItem nixosChannels channel showInstallDetails show item = , ul [ class "nav nav-tabs" ] <| [ li [ classList - [ ( "active", List.member showInstallDetails [ Search.Unset, Search.ViaNixShell, Search.FromFlake ] ) + [ ( "active", showInstallDetails == Search.ViaNixEnv ) , ( "pull-right", True ) ] ] [ a [ href "#" + , class "deprecated" , Search.onClickStop <| SearchMsg <| - Search.ShowInstallDetails Search.ViaNixShell + Search.ShowInstallDetails Search.ViaNixEnv ] - [ text "nix-shell" ] + [ text "nix-env" ] ] , li [ classList @@ -667,7 +668,7 @@ viewResultItem nixosChannels channel showInstallDetails show item = ] , li [ classList - [ ( "active", showInstallDetails == Search.ViaNixEnv ) + [ ( "active", List.member showInstallDetails [ Search.Unset, Search.ViaNixShell, Search.FromFlake ] ) , ( "pull-right", True ) ] ] @@ -675,9 +676,9 @@ viewResultItem nixosChannels channel showInstallDetails show item = [ href "#" , Search.onClickStop <| SearchMsg <| - Search.ShowInstallDetails Search.ViaNixEnv + Search.ShowInstallDetails Search.ViaNixShell ] - [ text "nix-env" ] + [ text "nix-shell" ] ] ] , div diff --git a/frontend/src/index.scss b/frontend/src/index.scss index 83e6ba6f..6d77897b 100644 --- a/frontend/src/index.scss +++ b/frontend/src/index.scss @@ -766,6 +766,10 @@ header .navbar.navbar-static-top { & > li > a { margin-right: 0; } + + .deprecated { + color: var(--text-color-light); + } } div.tab-content { From 31639919dbf104c012015060b9861803b164838d Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Wed, 3 Sep 2025 11:11:28 +0200 Subject: [PATCH 2/2] frontend: add `nix profile` install option --- frontend/src/Page/Packages.elm | 26 ++++++++++++++++++++++++++ frontend/src/Search.elm | 1 + 2 files changed, 27 insertions(+) diff --git a/frontend/src/Page/Packages.elm b/frontend/src/Page/Packages.elm index a3f0360d..fb134ef6 100644 --- a/frontend/src/Page/Packages.elm +++ b/frontend/src/Page/Packages.elm @@ -652,6 +652,20 @@ viewResultItem nixosChannels channel showInstallDetails show item = ] [ text "nix-env" ] ] + , li + [ classList + [ ( "active", showInstallDetails == Search.ViaNixProfile ) + , ( "pull-right", True ) + ] + ] + [ a + [ href "#" + , Search.onClickStop <| + SearchMsg <| + Search.ShowInstallDetails Search.ViaNixProfile + ] + [ text "nix profile" ] + ] , li [ classList [ ( "active", showInstallDetails == Search.ViaNixOS ) @@ -801,6 +815,18 @@ viewResultItem nixosChannels channel showInstallDetails show item = , strong [] [ text item.source.attr_name ] ] ] + , div + [ classList + [ ( "active", showInstallDetails == Search.ViaNixProfile ) + ] + , class "tab-pane" + , id "package-details-nixpkgs" + ] + [ pre [ class "code-block shell-command" ] + [ text "nix profile install nixpkgs#" + , strong [] [ text item.source.attr_name ] + ] + ] ] ] , programs diff --git a/frontend/src/Search.elm b/frontend/src/Search.elm index e39eb6f8..622005ff 100644 --- a/frontend/src/Search.elm +++ b/frontend/src/Search.elm @@ -405,6 +405,7 @@ type Msg a b type Details = ViaNixShell | ViaNixOS + | ViaNixProfile | ViaNixEnv | FromFlake | Unset