diff --git a/frontend/src/Page/Packages.elm b/frontend/src/Page/Packages.elm index fe9b17e4..9e91d010 100644 --- a/frontend/src/Page/Packages.elm +++ b/frontend/src/Page/Packages.elm @@ -595,6 +595,20 @@ viewResultItem nixosChannels channel showInstallDetails show item = ] [ text "nix-shell" ] ] + , li + [ classList + [ ( "active", showInstallDetails == Search.ViaFlakeNix ) + , ( "pull-right", True ) + ] + ] + [ a + [ href "#" + , Search.onClickStop <| + SearchMsg <| + Search.ShowInstallDetails Search.ViaFlakeNix + ] + [ text "flake.nix" ] + ] , li [ classList [ ( "active", showInstallDetails == Search.ViaNixOS ) @@ -715,6 +729,50 @@ viewResultItem nixosChannels channel showInstallDetails show item = , strong [] [ text item.source.attr_name ] ] ] + , div + [ classList + [ ( "tab-pane", True ) + , ( "active", showInstallDetails == Search.ViaFlakeNix ) + ] + ] + [ p [] + [ text "Add the following to your " + , strong [] [ text "flake.nix" ] + , text ":" + ] + ] + , div + [ classList + [ ( "active", showInstallDetails == Search.ViaFlakeNix ) + ] + , class "tab-pane" + , id "package-details-flake" + ] + [ pre [ class "code-block" ] + [ text <| "{\n inputs.nixpkgs.url = \"github:NixOS/nixpkgs/nixos-" ++ channel ++ "\";\n outputs = { nixpkgs, ... }: {\n packages.x86_64-linux.default = nixpkgs.legacyPackages.x86_64-linux." + , strong [] [ text item.source.attr_name ] + , text <| ";\n devShells.x86_64-linux.default = nixpkgs.legacyPackages.x86_64-linux.mkShell {\n packages = [ nixpkgs.legacyPackages.x86_64-linux." + , strong [] [ text item.source.attr_name ] + , text <| " ];\n };\n };\n}" + ] + ] + , div [] [ p [] [] ] + , div + [ classList + [ ( "active", showInstallDetails == Search.ViaFlakeNix ) + ] + , class "tab-pane" + ] + [ p [] + [ text "Then run " + , code [] [ text "nix build" ] + , text " to build the package, " + , code [] [ text "nix run" ] + , text " to run it directly, or " + , code [] [ text "nix develop" ] + , text " to enter a shell with the package available." + ] + ] , div [ classList [ ( "tab-pane", True ) diff --git a/frontend/src/Search.elm b/frontend/src/Search.elm index b05d8a3b..d4256e15 100644 --- a/frontend/src/Search.elm +++ b/frontend/src/Search.elm @@ -388,6 +388,7 @@ type Msg a b type Details = ViaNixShell + | ViaFlakeNix | ViaNixOS | ViaNixEnv | FromFlake