From 04407a5726d081cad236cb1d969b6b842a762d83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 22 Nov 2024 19:47:22 +0100 Subject: [PATCH] feat: add offline search --- flake.lock | 108 +++++++++++++++++++++++++++-- flake.nix | 25 ++++++- hosts/nixos-laptop/default.nix | 1 - modules/config/terminal.nix | 1 + modules/programs/python.nix | 2 +- modules/programs/river/default.nix | 4 +- 6 files changed, 130 insertions(+), 11 deletions(-) diff --git a/flake.lock b/flake.lock index 85637e2..b8cda3e 100644 --- a/flake.lock +++ b/flake.lock @@ -339,6 +339,24 @@ "type": "github" } }, + "flake-utils_4": { + "inputs": { + "systems": "systems_6" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "ghostty": { "inputs": { "nixpkgs-stable": "nixpkgs-stable", @@ -789,6 +807,32 @@ "type": "github" } }, + "ixx_2": { + "inputs": { + "flake-utils": [ + "search", + "flake-utils" + ], + "nixpkgs": [ + "search", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1729958008, + "narHash": "sha256-EiOq8jF4Z/zQe0QYVc3+qSKxRK//CFHMB84aYrYGwEs=", + "owner": "NuschtOS", + "repo": "ixx", + "rev": "9fd01aad037f345350eab2cd45e1946cc66da4eb", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "ref": "v0.0.6", + "repo": "ixx", + "type": "github" + } + }, "master": { "locked": { "lastModified": 1729839280, @@ -1033,6 +1077,22 @@ "type": "github" } }, + "nixpkgs_10": { + "locked": { + "lastModified": 1692934111, + "narHash": "sha256-9EEE59v/esKNMR5zKbLRV9NoRPYvERw5jHQOnfr47bk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1e44a037bbf4fcaba041436e65e87be88f3f495b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1725194671, @@ -1147,16 +1207,16 @@ }, "nixpkgs_9": { "locked": { - "lastModified": 1692934111, - "narHash": "sha256-9EEE59v/esKNMR5zKbLRV9NoRPYvERw5jHQOnfr47bk=", + "lastModified": 1731676054, + "narHash": "sha256-OZiZ3m8SCMfh3B6bfGC/Bm4x3qc1m2SVEAlkV6iY7Yg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1e44a037bbf4fcaba041436e65e87be88f3f495b", + "rev": "5e4fbfb6b3de1aa2872b76d49fafc942626e2add", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-unstable", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -1318,10 +1378,31 @@ "nur": "nur", "pre-commit-hooks": "pre-commit-hooks_2", "river": "river", + "search": "search", "stable": "stable", "timers": "timers" } }, + "search": { + "inputs": { + "flake-utils": "flake-utils_4", + "ixx": "ixx_2", + "nixpkgs": "nixpkgs_9" + }, + "locked": { + "lastModified": 1731874326, + "narHash": "sha256-FVodEap6GQT/1DSG5KOcpsrKXfG9gMNObQxW+HNJnW8=", + "owner": "NuschtOS", + "repo": "search", + "rev": "64832c4cf885350ad0e63a27fd7055bcfc7955f6", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "repo": "search", + "type": "github" + } + }, "stable": { "locked": { "lastModified": 1729691686, @@ -1428,10 +1509,25 @@ "type": "github" } }, + "systems_7": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "timers": { "inputs": { "naersk": "naersk", - "nixpkgs": "nixpkgs_9", + "nixpkgs": "nixpkgs_10", "utils": "utils" }, "locked": { @@ -1471,7 +1567,7 @@ }, "utils": { "inputs": { - "systems": "systems_6" + "systems": "systems_7" }, "locked": { "lastModified": 1692799911, diff --git a/flake.nix b/flake.nix index 72baa12..2b1d3bc 100644 --- a/flake.nix +++ b/flake.nix @@ -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 = { diff --git a/hosts/nixos-laptop/default.nix b/hosts/nixos-laptop/default.nix index ddb2858..072bab7 100644 --- a/hosts/nixos-laptop/default.nix +++ b/hosts/nixos-laptop/default.nix @@ -21,7 +21,6 @@ webis.enable = true; impermanence.enable = true; }; - terminal.package = pkgs.kitty; programs.exercism.enable = true; services.mullvad.enable = true; }; diff --git a/modules/config/terminal.nix b/modules/config/terminal.nix index dbae99b..871e9bd 100644 --- a/modules/config/terminal.nix +++ b/modules/config/terminal.nix @@ -6,6 +6,7 @@ with lib; { options.my.terminal = { package = mkOption { + description = "Terminal emulator package to use. Gets converted to path of bin automatically."; type = types.package; apply = lib.getExe; }; diff --git a/modules/programs/python.nix b/modules/programs/python.nix index 41c4959..9fbfb26 100644 --- a/modules/programs/python.nix +++ b/modules/programs/python.nix @@ -10,7 +10,7 @@ let cfg = config.my.programs.python; - pythonVersions = map (version: "3${toString version}") (range 8 13); + pythonVersions = map (version: "3${toString version}") (range 9 13); enabledVersions = filterAttrs (_: value: value.enable) cfg.versions; pythonPackages = version: attrNames pkgs."python${version}Packages"; diff --git a/modules/programs/river/default.nix b/modules/programs/river/default.nix index a1e5033..5436ea1 100644 --- a/modules/programs/river/default.nix +++ b/modules/programs/river/default.nix @@ -15,10 +15,10 @@ in enable = mkEnableOption "river"; keyboardLayouts = mkOption { type = types.listOf types.str; - description = "list of keyboard layouts"; + description = "List of keyboard layouts."; default = [ "us" "de" ]; }; - nvidiaSupport = mkEnableOption "nvidiaSupport"; + nvidiaSupport = mkEnableOption "nvidia gpu support"; }; config = mkIf cfg.enable {