diff --git a/local/lock/flake.lock b/local/lock/flake.lock index a2e3115..840b4bc 100644 --- a/local/lock/flake.lock +++ b/local/lock/flake.lock @@ -794,6 +794,22 @@ "type": "github" } }, + "navi-tldr-pages": { + "flake": false, + "locked": { + "lastModified": 1699749908, + "narHash": "sha256-8bmxJzYDgpxMHdJdPbnDhPi4DK2sQVl/lvezO1KgGTA=", + "owner": "denisidoro", + "repo": "navi-tldr-pages", + "rev": "ec4acfe4a0c7498b57d2e0278204aa09ddfb4b6f", + "type": "github" + }, + "original": { + "owner": "denisidoro", + "repo": "navi-tldr-pages", + "type": "github" + } + }, "nickel": { "inputs": { "crane": "crane", @@ -1372,6 +1388,7 @@ "home-manager": "home-manager_2", "makesSrc": "makesSrc", "microvm": "microvm", + "navi-tldr-pages": "navi-tldr-pages", "nickel": "nickel", "nil": "nil", "nix-fast-build": "nix-fast-build", diff --git a/local/lock/flake.nix b/local/lock/flake.nix index 028c5a2..432c594 100644 --- a/local/lock/flake.nix +++ b/local/lock/flake.nix @@ -73,6 +73,9 @@ nix-fast-build.url = "github:Mic92/nix-fast-build"; nix-fast-build.inputs.nixpkgs.follows = "nixpkgs"; nix-fast-build.inputs.treefmt-nix.follows = ""; + + navi-tldr-pages.url = "github:denisidoro/navi-tldr-pages"; + navi-tldr-pages.flake = false; }; outputs = _: { }; } diff --git a/src/pops/_exportsOmnibusProfiles.nix b/src/pops/_exportsOmnibusProfiles.nix index b11a634..00465d0 100644 --- a/src/pops/_exportsOmnibusProfiles.nix +++ b/src/pops/_exportsOmnibusProfiles.nix @@ -1,19 +1,20 @@ { lib }: self: -(self.addLoadExtender { - load = { - transformer = [ - ( - cursor: mod: - let - trace = x: lib.trace x x; - toplevel = cursor == [ ]; - in - if toplevel then - lib.mapAttrs (n: v: (if lib.isAttrs v then v else v { })) mod - else - mod - ) - ]; - }; -}).exports.default +lib.mapAttrs (n: v: (if lib.isAttrs v then v else v { })) self +# (self.addLoadExtender { +# load = { +# transformer = [ +# ( +# cursor: mod: +# let +# trace = x: lib.trace x x; +# toplevel = cursor == [ ]; +# in +# if toplevel then +# lib.mapAttrs (n: v: (if lib.isAttrs v then v else v { })) mod +# else +# mod +# ) +# ]; +# }; +# }).exports.default diff --git a/src/pops/homeProfiles.nix b/src/pops/homeProfiles.nix index ec0a7a0..24ea3a7 100644 --- a/src/pops/homeProfiles.nix +++ b/src/pops/homeProfiles.nix @@ -7,9 +7,9 @@ }).addExporters [ (POP.extendPop flops.haumea.pops.exporter ( - _self: _super: { + selfPop: _super: { exports = { - omnibus = super.exportsOmnibusProfiles self; + omnibus = super.exportsOmnibusProfiles selfPop.layouts.default; }; } )) diff --git a/tests/nixos/__fixture/pops/homeProfiles.nix b/tests/nixos/__fixture/pops/homeProfiles.nix index 75771c0..7710e65 100644 --- a/tests/nixos/__fixture/pops/homeProfiles.nix +++ b/tests/nixos/__fixture/pops/homeProfiles.nix @@ -7,7 +7,7 @@ in homeModules = super.homeModules.layouts.nixosModules; }; inputs = { - inherit (omnibus.flake.inputs) nur; + inherit (omnibus.flake.inputs) nur nix-filter navi-tldr-pages; }; }; }).addExporters diff --git a/tests/nixos/expr.nix b/tests/nixos/expr.nix index 0767593..ce853d0 100644 --- a/tests/nixos/expr.nix +++ b/tests/nixos/expr.nix @@ -46,9 +46,9 @@ in homeConfiguration = (out.nixosConfiguration [ out.outputs.nixosProfiles.default.presets.boot - # (extraHomeModule [ - # out.outputs.homeProfiles.customProfiles.presets.hyprland.default - # out.outputs.homeProfiles.default.presets.firefox - # ]) + (extraHomeModule [ + out.outputs.homeProfiles.customProfiles.presets.hyprland.default + out.outputs.homeProfiles.default.presets.firefox + ]) ]).config.home-manager.users.admin; } diff --git a/units/nixos/homeModules/programs/navi.nix b/units/nixos/homeModules/programs/navi.nix index 2eafa83..d88a315 100644 --- a/units/nixos/homeModules/programs/navi.nix +++ b/units/nixos/homeModules/programs/navi.nix @@ -1,11 +1,35 @@ -{ lib }: +{ + lib, + inputs, + cfg, +}: { options = with lib; { __profiles__ = { navi-tldr-pages = { enable = mkEnableOption (mdDoc "navi-tldr-pages"); - package = pkgs.tldr; + src = mkOption { + type = types.either types.path types.str; + default = inputs.navi-tldr-pages; + description = "The paths to use for navi-tldr-pages"; + }; + paths = mkOption { + default = + (src: (map (x: src + "/${x}") (lib.attrNames (builtins.readDir src)))) + cfg.__profiles__.navi-tldr-pages.src; + }; }; }; }; + config = + with lib; + mkMerge [ + { + settings = { + cheats = { + paths = config.programs.navi.__profiles__.navi-tldr-pages.paths; + }; + }; + } + ]; } diff --git a/units/nixos/homeProfiles/presets/navi.nix b/units/nixos/homeProfiles/presets/navi.nix index 1014713..34bae97 100644 --- a/units/nixos/homeProfiles/presets/navi.nix +++ b/units/nixos/homeProfiles/presets/navi.nix @@ -1,14 +1,53 @@ -{ config, lib, ... }: { + config, + lib, + omnibus, + inputs, + pkgs, +}: +let + inherit (pkgs.stdenv) isLinux isDarwin; + inherit + (omnibus.errors.requiredInputs inputs "omnibus.pops.homeProfiles" [ "nur" ]) + navi-tldr-pages + nix-filter + ; + + navi-tldr-pages-filtered = + with nix-filter.lib; + filter { + root = navi-tldr-pages + "/pages"; + exclude = + [ + "android" + "windows" + "sunos" + (if isLinux then "osx" else "linux") + ( + root: path: type: + if + (builtins.match "[^/]*(rpm|yum|apt).*.cheat" (builtins.baseNameOf path)) == null + then + false + else + true + ) + ] + ++ lib.optionals isDarwin + [ + # (root: path: type: if (l.match "[^/]*brew.*\.cheat" (l.baseNameOf path)) == null then false else true) + ]; + }; +in +{ + imports = [ omnibus.homeModules.programs.navi ]; programs.navi = { enable = true; enableZshIntegration = lib.mkIf config.programs.zsh.enable true; - settings = { - cheats = { - # paths = - # []; - # (src: (map (x: src + "/${x}") (l.attrNames (l.readDir src)))) - # inputs.cells.nixos.data.navi-tldr-pages; + __profiles__ = { + navi-tldr-pages = { + enable = true; + src = navi-tldr-pages-filtered; }; }; }; diff --git a/units/nixos/homeProfiles/shell.nix b/units/nixos/homeProfiles/shell.nix index 22269f5..6ea3aed 100644 --- a/units/nixos/homeProfiles/shell.nix +++ b/units/nixos/homeProfiles/shell.nix @@ -24,6 +24,7 @@ with presets; { atuin carapace fzf + navi starship.default dircolors.default ];