Compare commits

...

9 Commits

Author SHA1 Message Date
Pim Snel
ba81f25588 fix typo 2024-04-26 20:25:24 +02:00
Pim Snel
c8b8a9495d update js version 2024-04-26 20:12:52 +02:00
Pim Snel
b0de003864 last stuff 2024-04-26 19:57:42 +02:00
Pim Snel
96340352f8 make stuff configurable 2024-04-26 19:46:13 +02:00
Pim Snel
c05bda03b7 fix workflow 2024-04-26 18:41:58 +02:00
Pim Snel
b52c17e487 fix workflow 2024-04-26 18:40:50 +02:00
Pim Snel
34c5bcc623 update publish script for hugofication 2024-04-26 18:39:07 +02:00
Pim Snel
77f0b8d041 add stuff to ignore 2024-04-26 18:24:19 +02:00
Pim Snel
31f60b125a moved to hugo theme structure 2024-04-26 18:22:39 +02:00
81 changed files with 121 additions and 63 deletions

View File

@ -26,9 +26,12 @@ jobs:
HM_RELEASE: release-23.11
run: ./scripts/build_hm_options.sh
- name: Build Hugo
run: nix run nixpkgs#hugo -- --minify
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: pages-${{ github.ref_name }}
publish_dir: .
publish_dir: ./public

5
.gitignore vendored
View File

@ -2,5 +2,6 @@
.nix-gems
.bundle
result
data/hm-options-release-23.11.json
data/hm-options-master.json
data/options-release-23.11.json
data/options-master.json
.hugo_build.lock

View File

@ -2,6 +2,7 @@
## Next version
- hugofication
- keyboard (tab) navigation (thanks to github.com/hallundbaek)
- better result sorting (thanks to github.com/hallundbaek)
- style improvements

View File

@ -8,7 +8,7 @@ The new location is <a href="https://home-manager-options.extranix.com/">HOME-MA
Find [home manager](https://github.com/nix-community/home-manager) options quickly.
![](images/homemanageroptionsearch.gif)
![](static/images/homemanageroptionsearch.gif)
## Contribute

54
config.yaml Normal file
View File

@ -0,0 +1,54 @@
baseURL: https://home-manager-options.extranix.com/
languageCode: en-us
title: Home Manager - Option Search
theme: extranix-options-search
params:
release_switch_title: Home Manager Release
releases:
- name: unstable
value: master
- name: 23.11
value: release-23.11
- name: 23.05
value: release-23.05
- name: 22.11
value: release-22.11
custom_head_scripts: |
<script async src="https://umami.pimsnel.com/script.js" data-website-id="8e970d59-b517-4ba6-9b92-207e7dbdb4b1"></script>
<script async src="https://media.ethicalads.io/media/client/ethicalads.min.js"></script>
custom_header_tags: <div id="eadiv" data-ea-publisher="extranixcom" data-ea-type="text"></div>
footer_credits_line: |
Powered by the <a href="https://nix-community.org/">Nix Community</a> |
<a href="https://github.com/mipmip/home-manager-option-search#credits">Credits</a> |
<a href="https://nix-community.github.io/home-manager/">Home Manager Documentation</a>
footer_copyright_line: |
Made with ❤️ by <a href="https://github.com/mipmip">Pim Snel</a> - © 2022-2024
logo: images/home-manager-option-search2.png
github:
repo: home-manager-option-search
user: mipmip
show_count: true
show_text: true
main_menu:
- name: HM&nbsp;Documentation
url: https://nix-community.github.io/home-manager/
icon_class: fa fa-book
- name: Source
url: https://github.com/mipmip/home-manager-option-search
icon_class: fa fa-github
markup:
goldmark:
renderer:
unsafe: true

View File

@ -1,6 +1,6 @@
#!/usr/bin/env sh
# Copyright 2024 Pim Snel <post@pimsnel.com
# Copyright 2024 Pim Snel <post@pimsnel.com>
# License: MIT
if [ -z $HM_RELEASE ]; then
@ -10,6 +10,6 @@ fi
echo "building Home Manager options from ${HM_RELEASE}"
rm -Rf result
nix build github:nix-community/home-manager/${HM_RELEASE}#docs-json --no-write-lock-file
rm -f ./data/hm-options-${HM_RELEASE}.json
nix build github:nix-community/home-manager/${HM_RELEASE}#docs-json --no-write-lock-file
rm -f ./data/options-${HM_RELEASE}.json
ruby ./scripts/parse_options-json.rb

View File

@ -1,4 +1,4 @@
# Copyright 2024 Pim Snel <post@pimsnel.com
# Copyright 2024 Pim Snel <post@pimsnel.com>
# License: MIT
require 'json'
@ -54,7 +54,7 @@ time = Time.new
outobj["last_update"] = time.utc.strftime("%B %d, %Y at %k:%M UTC")
outobj["options"] = options_arr
filename = "data/hm-options-#{ENV['HM_RELEASE']}.json"
filename = "static/data/options-#{ENV['HM_RELEASE']}.json"
File.open(filename,"w") do |f|
f.write(outobj.to_json)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 796 KiB

After

Width:  |  Height:  |  Size: 796 KiB

View File

@ -2,46 +2,53 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Home Manager - Option Search</title>
<title>{{ .Site.Title }}</title>
<link rel="shortcut icon" href="images/favicon.png" type="image/x-icon">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<link rel="search" type="application/opensearchdescription+xml" title="Home Manager - Option Search" href="opensearch.xml" />
<meta name="description" content="{{ with .Params.Description }}{{ . }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}">
<meta name="keywords" content="{{ with .Params.keywords }}{{ . }}{{ end }}">
<link rel="search" type="application/opensearchdescription+xml" title="{{ .Site.Title}}" href="opensearch.xml" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script async src="https://umami.pimsnel.com/script.js" data-website-id="8e970d59-b517-4ba6-9b92-207e7dbdb4b1"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<link href="css/nucleus.css" rel="stylesheet">
<link href="css/style-nix.css" rel="stylesheet">
<link rel="stylesheet" href="css/style-q2.css">
<script async src="https://media.ethicalads.io/media/client/ethicalads.min.js"></script>
{{ with .Site.Params.custom_head_scripts }}{{ . | safeHTML }}{{ end }}
</head>
<body>
<div id="eadiv" data-ea-publisher="extranixcom" data-ea-type="text"></div>
{{ with .Site.Params.custom_header_tags }}{{ . | safeHTML }}{{ end }}
<header>
<div id="lastUpdateElement" style="position:absolute; line-height: 11px; right: 37px;top:59px;"></div>
<div class="logo">
<a class="baselink" href="./"> <img src="images/home-manager-option-search2.png"></a>
<a class="baselink" href="./">
{{with .Site.Params.logo}}<img src="{{.}}">{{else}}{{.Site.Title}} {{end}}</a>
</div>
<nav class="shortcuts">
<li style="padding-top:10px;">
<a href="https://nix-community.github.io/home-manager/" rel="noopener">
<i class="fa fa-book"></i>&nbsp;<label>HM&nbsp;Documentation</label>
</a>
</li>
<li style="padding-top:10px;">
<a href="https://github.com/mipmip/home-manager-option-search" rel="noopener">
<i class="fa fa-github"></i> <label>Source</label>
</a>
</li>
{{ range .Site.Params.main_menu }}
<li style="padding-top:10px;"><a href="{{ .url }}" ><i class="{{ .icon_class }}"></i> <label>{{ .name | safeHTML }}</label></a></li>
{{ end }}
{{with .Site.Params.github }}
<li style="margin-left:9px;padding-top:14px;">
<iframe style="width:51px;" src="https://ghbtns.com/github-btn.html?user=mipmip&repo=home-manager-option-search&type=star&count=false&text=true" frameborder="0" scrolling="0" width="150" height="20" title="GitHub"></iframe>
<iframe
src="https://ghbtns.com/github-btn.html?user={{ .user}}&repo={{.repo}}&type=star&count=false&text=true"
style="width:101px;"
frameborder="0" scrolling="0" width="150" height="20" title="GitHub"></iframe>
</li>
{{end}}
</nav>
</header>
@ -81,19 +88,13 @@
</div>
<div class="form-group">
<label for="release">
Home Manager release
{{ .Site.Params.release_switch_title }}
</label>
<select id="releaseSelect">
<option value="master">unstable</option>
<option value="release-23.11">23.11</option>
<option value="release-23.05">23.05</option>
<option value="release-22.11">22.11</option>
{{ range .Site.Params.releases }}
<option value="{{.value}}">{{.name}}</option>
{{end}}
</select>
<!--
<label for="advcheck">
search options
<input id="advcheck" type="checkbox" data-toggle="collapse" data-target="#advanced" />
-->
</div>
</form>
@ -156,19 +157,15 @@
<footer class=" navbar-fixed-bottom" >
<div >
<p>
Powered by the <a href="https://nix-community.org/">Nix Community</a> |
<a href="https://github.com/mipmip/home-manager-option-search#credits">Credits</a> |
<a href="https://nix-community.github.io/home-manager/">Home Manager Documentation</a>
{{ with .Site.Params.footer_credits_line }}{{ . | safeHTML }}{{ end }}
</p>
<p>
Made with ❤️ by <a href="https://github.com/mipmip">Pim Snel</a>
{{ with .Site.Params.footer_copyright_line }}{{ . | safeHTML }}{{ end }}
</p>
</div>
</footer>
<!--<script type="text/javascript" src="https://rawgit.com/kristopolous/Porter-Stemmer/master/PorterStemmer1980.min.js"></script>-->
<!--<script type="text/javascript" src="https://unpkg.com/js-search@1.3.7/dist/umd/js-search.min.js"></script>-->
<script type="text/javascript" src="https://unpkg.com/js-search@2.0.1/dist/umd/js-search.min.js"></script>
<script type="text/javascript" src="js/script.js?version=2024-03-23"></script>
<script type="text/javascript" src="js/script.js?version=2024-04-26"></script>
</body>
</html>

View File

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -56,9 +56,18 @@ header {
text-decoration: none; }
header .logo {
min-width: 295px;
font-size: 100%; }
font-size: 100%;
}
header .logo a,
header .logo a:visited {
color:white;
font-size: 120%;
font-weight: bold;
}
header .logo * {
vertical-align: middle; }
vertical-align: middle;
}
header .logo img {
height: 32px;
margin-right: 0.5rem; }
@ -192,7 +201,7 @@ article > aside {
html,
body {
height: 100%;
height: 100%;
}
html {
@ -770,7 +779,7 @@ table.nur-stats tr td{
table {
text-align: left;
position: relative;
border-collapse: collapse;
border-collapse: collapse;
}
th {
background: white;

View File

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

View File

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 101 KiB

View File

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

View File

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View File

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

Before

Width:  |  Height:  |  Size: 434 KiB

After

Width:  |  Height:  |  Size: 434 KiB

View File

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 106 KiB

View File

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

View File

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

Before

Width:  |  Height:  |  Size: 607 B

After

Width:  |  Height:  |  Size: 607 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -21,7 +21,6 @@ var docOnload = function(){
searchOptions(query);
$("#advcheck").prop("checked", false);
// $("#advcheck").removeAttr("checked");
}
indexOnDescriptionCheckbox.onchange = rebuildAndRerunSearch;
@ -193,8 +192,8 @@ var searchOptions = function(query) {
// No reason to index beyond result of lastIndex +aIndex + term.length,
// as a would come first in that case.
const bIndex = bConcat
.slice(lastIndex, lastIndex + aIndex + term.length)
.indexOf(term);
.slice(lastIndex, lastIndex + aIndex + term.length)
.indexOf(term);
// Not found in b, a must come first
if (bIndex == -1) return -1;
@ -237,20 +236,12 @@ searchInput.oninput = function() {
releaseSelect.onchange = function(){
const query = searchInput.value;
const release = releaseSelect.selectedOptions[0].value;
const query = searchInput.value;
const release = releaseSelect.selectedOptions[0].value;
setSearchQueryToUrlParam(query, release);
setSearchQueryToUrlParam(query, release);
//window.location.reload(false);
window.location.replace(newUrl);
//newSearch();
//var release = releaseSelect.selectedOptions[0].value;
//xmlhttp.open('GET', 'data/hm-options-'+release+'.json', true);
//xmlhttp.send();
window.location.replace(newUrl);
}
var updateOptionCount = function(numOptions) {
@ -291,5 +282,5 @@ const urlParams = new URLSearchParams(window.location.search);
const release = urlParams.get('release') ?? 'master';
document.getElementById('releaseSelect').value = release;
xmlhttp.open('GET', 'data/hm-options-'+release+'.json', true);
xmlhttp.open('GET', 'data/options-'+release+'.json', true);
xmlhttp.send();