Skip to content

Commit

Permalink
docs: add flake
Browse files Browse the repository at this point in the history
Signed-off-by: Burgess Chang <[email protected]>
  • Loading branch information
brsvh committed May 25, 2024
1 parent 4bba0a7 commit 8f29bfc
Show file tree
Hide file tree
Showing 25 changed files with 1,299 additions and 1,197 deletions.
49 changes: 1 addition & 48 deletions doc/apps/overlays/unfree.md
Original file line number Diff line number Diff line change
@@ -1,48 +1 @@
# overlays.unfree

## Usage

Simply use this overlay `brsvh.overlays.unfree` when import `nixpkgs`, and then install packages this overlay provided.

``` nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/unstable";
brsvh.url = "github:brsvh/nixing";
brsvh.inputs.nixpkgs.follows = "nixpkgs";
};
# OPTIONAL use my cachix binary cache.
nixConfig = {
extra-substituters = [ "https://brsvh.cachix.org" ];
extra-trusted-public-keys = [ "brsvh.cachix.org-1:DqtlvqnpP9g39l8Eo74AXRftGx1KJLid/ViADTNgDNE=" ];
};
outputs =
{ nixpkgs, ... }@inputs:
{
nixosConfiguraitons.YOUR-CONFIGURATION = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
(
{ pkgs, ... }:
{
nixpkgs = {
config.allowUnfree = true;
overlays = [ brsvh.overlays.unfree ];
};
environment.systemPackageswith = with pkgs; [ wemeet ];
}
)
];
};
};
}
```

## Packages

### `pkgs.wemeet`

Tencent meeting.
# unfree
14 changes: 14 additions & 0 deletions doc/book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[book]
authors = ["Burgess Chang"]
description = "Burgess Chang's Nix collections"
language = "en"
multilingual = false
title = "nixing"

[build]
extra-watch-dirs = ["."]

[output.html]
edit-url-template = "https://github.com/brsvh/nixing/edit/main/doc/{path}"
git-repository-url = "https://github.com/brshv/nixing"
site-url = "/nixing/"
27 changes: 27 additions & 0 deletions doc/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions doc/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};

outputs =
{ self, nixpkgs }:
let
inherit (nixpkgs.lib) genAttrs;

eachSystem =
f:
genAttrs [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
] (system: f nixpkgs.legacyPackages.${system});
in
{
devShells = eachSystem (pkgs: {
default = pkgs.mkShell {
packages = [ pkgs.mdbook ];
shellHook = ''
toplevel=$(git rev-parse --show-toplevel) || exit
cd "$toplevel" || exit
mkdir -p doc/theme
ln -sf ${pkgs.documentation-highlighter}/highlight.pack.js doc/theme/highlight.js
mdbook serve doc
'';
};
});

packages = eachSystem (pkgs: {
default = pkgs.stdenv.mkDerivation {
pname = "nixing-doc";
version = self.shortRev or "0000000";

src = ../.;

nativeBuildInputs = [ pkgs.mdbook ];

buildPhase = ''
cd doc
mkdir theme
ln -s ${pkgs.documentation-highlighter}/highlight.pack.js theme/highlight.js
mdbook build -d $out
'';
};
});
};
}
126 changes: 1 addition & 125 deletions doc/fonts/home-manager-modules/fonts.md
Original file line number Diff line number Diff line change
@@ -1,125 +1 @@
# homeModules.fonts

## Usage

```nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/unstable";
home-manager.url = "github:nix-community/home-manager/master";
brsvh.url = "github:brsvh/nixing";
brsvh.inputs.nixpkgs.follows = "nixpkgs";
};
# OPTIONAL use my cachix binary cache.
nixConfig = {
extra-substituters = [ "https://brsvh.cachix.org" ];
extra-trusted-public-keys = [ "brsvh.cachix.org-1:DqtlvqnpP9g39l8Eo74AXRftGx1KJLid/ViADTNgDNE=" ];
};
outputs =
{ home-manager, ... }@inputs:
{
homeConfiguraitons.YOUR-CONFIGURATION = home-manager.lib.homeManagerConfiguration {
system = "x86_64-linux";
modules = [
brsvh.homeModules.fonts
(
{ pkgs, ... }:
{
fonts = {
fontconfig = {
enable = true;
english.enable = true;
chinese = {
enable = true;
defaultFont = {
sansSerif = "Source Han Sans SC";
serif = "Source Han Serif SC";
monospace = "Source Han Mono SC";
};
defaultFonts = {
sansSerif = [
"Source Han Sans SC"
"Source Han Sans HC"
"Source Han Sans TC"
];
serif = [
"Source Han Serif SC"
"Source Han Serif HC"
"Source Han Serif TC"
];
monospace = [
"Source Han Mono SC"
"Source Han Mono HC"
"Source Han Mono TC"
];
};
fonts = with pkgs; [
source-han-sans
source-han-serif
source-han-mono
];
};
};
};
}
)
];
};
};
}
```

## Options

Supported `<lanuage>` includes:

- `english`, for `en` language code.
- `chinese`, for `zh` language code.
- `japanese`, for `ja` language code.
- `korean`, for `ko` language code.

### `config.fonts.fontconfig.<language>.configText`

The content of the fontconfig configuration file for the `<language>` code.

### `config.fonts.fontconfig.<language>.defaultFont.sansSerif`

The default sans serif font for the `<language>` code.

### `config.fonts.fontconfig.<language>.defaultFont.serif`

The default serif font for the `<language>` code.

### `config.fonts.fontconfig.<language>.defaultFont.monospace`

The default monospace font for the `<language>` code.

### `config.fonts.fontconfig.<language>.defaultFonts.sansSerif`

The list of sans serif fonts used for the `<language>` code, with
display priority corresponding to their position in the list.

### `config.fonts.fontconfig.<language>.defaultFonts.serif`

The list of serif fonts used for the `<language>` code, with display
priority corresponding to their position in the list.

### `config.fonts.fontconfig.<language>.defaultFonts.monospace`

The list of monospace fonts used for the `<language>` code, with display
priority corresponding to their position in the list.

### `config.fonts.fontconfig.<language>.enable`

Generate and install the fontconfig configuration file for the `<language>` code.

### `config.fonts.fontconfig.<language>.fonts`

Fonts depended on by `<lanuage>`.
# fonts
77 changes: 1 addition & 76 deletions doc/fonts/home-manager-modules/tsangertype-fonts.md
Original file line number Diff line number Diff line change
@@ -1,76 +1 @@
# homeModules.tsangertype-fonts

## Usage

```nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/unstable";
home-manager.url = "github:nix-community/home-manager/master";
brsvh.url = "github:brsvh/nixing";
brsvh.inputs.nixpkgs.follows = "nixpkgs";
};
# OPTIONAL use my cachix binary cache.
nixConfig = {
extra-substituters = [ "https://brsvh.cachix.org" ];
extra-trusted-public-keys = [ "brsvh.cachix.org-1:DqtlvqnpP9g39l8Eo74AXRftGx1KJLid/ViADTNgDNE=" ];
};
outputs =
{ home-manager, ... }@inputs:
{
homeConfiguraitons.YOUR-CONFIGURATION = home-manager.lib.homeManagerConfiguration {
system = "x86_64-linux";
modules = [
brsvh.homeModules.tsangertype-fonts
(
{ pkgs, ... }:
{
nixpkgs = {
config.allowUnfree = true;
overlays = [ brsvh.overlays.proprius-fonts ];
};
fonts = {
tsangertype-fonts = {
enable = true;
# OPTIONAL customize font set, e.g., filtering all jinkai fonts.
fonts =
with lib;
with pkgs.tsangertypeFonts;
let
pname = drv: attrByPath [ "pname" ] "unknown" drv;
cond = drv: hasPrefix "tsangertype-jinkai" (pname drv);
in
(listOfFontsWithCond gratisProPersona cond);
# OPTIONAL exclude some fonts, e.g., exclude two jinkai fonts.
excludedFonts = with pkgs.tsangertypeFonts; [
tsangertype-jinkai-02-w01-font
tsangertype-jinkai-02-w02-font
];
};
};
}
)
];
};
};
}
```

## Options

### `config.fonts.tsangertype-fonts.enable`

Enable TsangerType fonts.

### `config.fonts.tsangertype-fonts.excludedFonts`

A list of fonts to be excluded.

### `config.fonts.tsangertype-fonts.fonts`

List of desired fonts. You can use the scaffolds provided by the [proprius-fonts overlay] to generate this list. By default, it includes all gratis propria persona fonts.

[proprius-fonts overlay]: ../overlays/proprius-fonts.md
# tsangertype-fonts
Loading

0 comments on commit 8f29bfc

Please sign in to comment.