feat: add offline search

This commit is contained in:
Moritz Böhme 2024-11-22 19:47:22 +01:00
parent 707cbcca9e
commit 04407a5726
No known key found for this signature in database
GPG key ID: 970C6E89EB0547A9
6 changed files with 130 additions and 11 deletions

View file

@ -65,6 +65,8 @@
arkenfox-userjs.url = "github:arkenfox/user.js";
arkenfox-userjs.flake = false;
search.url = "github:NuschtOS/search";
ghostty.url = "git+ssh://git@github.com/ghostty-org/ghostty";
};
@ -115,7 +117,28 @@
};
legacyPackages = pkgs;
packages =
let
modules = [
{ name = "My stuff"; }
];
mkName = name: "${name} Search";
mkSearch = name: value: inputs'.search.packages.mkSearch {
urlPrefix = "file://${self}/flake.nix";
title = mkName name;
optionsJSON = "${(pkgs.nixosOptionsDoc { inherit (value) options; warningsAreErrors = false; }).optionsJSON}/share/doc/nixos/options.json";
};
serveSearch = name: value:
pkgs.writeShellApplication {
name = mkName name;
text = ''
xdg-open http://127.0.0.1:8080
static-web-server -p 8080 -d ${mkSearch name value}
'';
runtimeInputs = with pkgs; [ static-web-server xdg-utils ];
};
in
pkgs.lib.mapAttrs serveSearch self.nixosConfigurations;
};
flake = {