Skip to content

Commit

Permalink
feat: add nix language highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi committed Mar 19, 2024
1 parent 73cc537 commit 5643441
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 42 deletions.
80 changes: 39 additions & 41 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];
})
];
};
};
};
}
```

Expand All @@ -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
};
```

Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 5643441

Please sign in to comment.