From 5643441a768e8a199846ebc3921a74423122f17a Mon Sep 17 00:00:00 2001 From: sxyazi Date: Tue, 19 Mar 2024 08:52:06 +0800 Subject: [PATCH] feat: add `nix` language highlighting --- docs/installation.md | 80 +++++++++++++++++++++----------------------- docusaurus.config.ts | 2 +- 2 files changed, 40 insertions(+), 42 deletions(-) diff --git a/docs/installation.md b/docs/installation.md index c4c9f848..650d9d56 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -80,48 +80,47 @@ environment.systemPackages = with pkgs; [ You can also manage Yazi's configuration using [home-manager](https://nix-community.github.io/home-manager/options.xhtml#opt-programs.yazi.enable). -## Flake +## Nix flakes The upstream repository provides a flake so that Nix users can easily keep up with the bleeding edge. A basic `flake.nix` setup to get you started: ```nix { - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; - - home-manager = { - url = "github:nix-community/home-manager/release-23.11"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - yazi.url = "github:sxyazi/yazi"; - }; - - outputs = { nixpkgs, home-manager, yazi, ... }: { - # To install yazi system-wide: - nixosConfigurations = { - nixos = nixpkgs.lib.nixosSystem { - modules = [ - ({ pkgs, ... }: { - environment.systemPackages = - [ yazi.packages.${pkgs.system}.default ]; - }) - ]; - }; - }; - - # To install it for a specific user: - homeConfigurations = { - "alice@nixos" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; - modules = [ - ({ pkgs, ... }: { - home.packages = [ yazi.packages.${pkgs.system}.default ]; - }) - ]; - }; - }; - }; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; + + home-manager = { + url = "github:nix-community/home-manager/release-23.11"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + yazi.url = "github:sxyazi/yazi"; + }; + + outputs = { nixpkgs, home-manager, yazi, ... }: { + # To install Yazi system-wide: + nixosConfigurations = { + nixos = nixpkgs.lib.nixosSystem { + modules = [ + ({ pkgs, ... }: { + environment.systemPackages = [ yazi.packages.${pkgs.system}.default ]; + }) + ]; + }; + }; + + # To install it for a specific user: + homeConfigurations = { + "alice@nixos" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + modules = [ + ({ pkgs, ... }: { + home.packages = [ yazi.packages.${pkgs.system}.default ]; + }) + ]; + }; + }; + }; } ``` @@ -135,8 +134,8 @@ A module is also available for both NixOS and home-manager: ```nix programs.yazi = { - enable = true; - package = yazi.packages.${pkgs.system}.default; # if you use overlays, you can omit this + enable = true; + package = yazi.packages.${pkgs.system}.default; # if you use overlays, you can omit this }; ``` @@ -147,8 +146,7 @@ You can make use of it by adding the following options to `nix.settings`, either ```nix extra-substituters = [ "https://yazi.cachix.org" ]; -extra-trusted-public-keys = - [ "yazi.cachix.org-1:Dcdz63NZKfvUCbDGngQDAZq6kOroIrFoyO064uvLh8k=" ]; +extra-trusted-public-keys = [ "yazi.cachix.org-1:Dcdz63NZKfvUCbDGngQDAZq6kOroIrFoyO064uvLh8k=" ]; ``` Note that the cache will only be applied _after_ you rebuild your Nix config. If you want to ensure that the cache gets applied right away, add the options above to your flake's `nixConfig` attribute. diff --git a/docusaurus.config.ts b/docusaurus.config.ts index cd791a39..df52d034 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -117,7 +117,7 @@ const config: Config = { prism: { theme: prismThemes.github, darkTheme: prismThemes.dracula, - additionalLanguages: ["lua", "toml", "diff", "bash", "powershell"], + additionalLanguages: ["bash", "diff", "lua", "nix", "powershell", "toml"], }, algolia: { appId: "MS4XF9Z1OE",