Compare commits
18 Commits
main
...
d763b06675
| Author | SHA1 | Date | |
|---|---|---|---|
| d763b06675 | |||
| 2504662bbd | |||
| f273a49cf6 | |||
| 7394deae26 | |||
| e949a1cf6e | |||
| 9f1f96500b | |||
| 3dca6ba75d | |||
| cdedfb482a | |||
| 80c45ce80b | |||
| 3a0b4da44a | |||
| 687d91d3d2 | |||
| d6fa6a497a | |||
| c8c049fa5d | |||
| fb70f490de | |||
| 857fe04865 | |||
| 07595e717a | |||
| 524355076f | |||
| 8a3ece91d0 |
@@ -1,133 +0,0 @@
|
||||
---
|
||||
name: find-skills
|
||||
description: Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
|
||||
---
|
||||
|
||||
# Find Skills
|
||||
|
||||
This skill helps you discover and install skills from the open agent skills ecosystem.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
Use this skill when the user:
|
||||
|
||||
- Asks "how do I do X" where X might be a common task with an existing skill
|
||||
- Says "find a skill for X" or "is there a skill for X"
|
||||
- Asks "can you do X" where X is a specialized capability
|
||||
- Expresses interest in extending agent capabilities
|
||||
- Wants to search for tools, templates, or workflows
|
||||
- Mentions they wish they had help with a specific domain (design, testing, deployment, etc.)
|
||||
|
||||
## What is the Skills CLI?
|
||||
|
||||
The Skills CLI (`npx skills`) is the package manager for the open agent skills ecosystem. Skills are modular packages that extend agent capabilities with specialized knowledge, workflows, and tools.
|
||||
|
||||
**Key commands:**
|
||||
|
||||
- `npx skills find [query]` - Search for skills interactively or by keyword
|
||||
- `npx skills add <package>` - Install a skill from GitHub or other sources
|
||||
- `npx skills check` - Check for skill updates
|
||||
- `npx skills update` - Update all installed skills
|
||||
|
||||
**Browse skills at:** https://skills.sh/
|
||||
|
||||
## How to Help Users Find Skills
|
||||
|
||||
### Step 1: Understand What They Need
|
||||
|
||||
When a user asks for help with something, identify:
|
||||
|
||||
1. The domain (e.g., React, testing, design, deployment)
|
||||
2. The specific task (e.g., writing tests, creating animations, reviewing PRs)
|
||||
3. Whether this is a common enough task that a skill likely exists
|
||||
|
||||
### Step 2: Search for Skills
|
||||
|
||||
Run the find command with a relevant query:
|
||||
|
||||
```bash
|
||||
npx skills find [query]
|
||||
```
|
||||
|
||||
For example:
|
||||
|
||||
- User asks "how do I make my React app faster?" → `npx skills find react performance`
|
||||
- User asks "can you help me with PR reviews?" → `npx skills find pr review`
|
||||
- User asks "I need to create a changelog" → `npx skills find changelog`
|
||||
|
||||
The command will return results like:
|
||||
|
||||
```
|
||||
Install with npx skills add <owner/repo@skill>
|
||||
|
||||
vercel-labs/agent-skills@vercel-react-best-practices
|
||||
└ https://skills.sh/vercel-labs/agent-skills/vercel-react-best-practices
|
||||
```
|
||||
|
||||
### Step 3: Present Options to the User
|
||||
|
||||
When you find relevant skills, present them to the user with:
|
||||
|
||||
1. The skill name and what it does
|
||||
2. The install command they can run
|
||||
3. A link to learn more at skills.sh
|
||||
|
||||
Example response:
|
||||
|
||||
```
|
||||
I found a skill that might help! The "vercel-react-best-practices" skill provides
|
||||
React and Next.js performance optimization guidelines from Vercel Engineering.
|
||||
|
||||
To install it:
|
||||
npx skills add vercel-labs/agent-skills@vercel-react-best-practices
|
||||
|
||||
Learn more: https://skills.sh/vercel-labs/agent-skills/vercel-react-best-practices
|
||||
```
|
||||
|
||||
### Step 4: Offer to Install
|
||||
|
||||
If the user wants to proceed, you can install the skill for them:
|
||||
|
||||
```bash
|
||||
npx skills add <owner/repo@skill> -g -y
|
||||
```
|
||||
|
||||
The `-g` flag installs globally (user-level) and `-y` skips confirmation prompts.
|
||||
|
||||
## Common Skill Categories
|
||||
|
||||
When searching, consider these common categories:
|
||||
|
||||
| Category | Example Queries |
|
||||
| --------------- | ---------------------------------------- |
|
||||
| Web Development | react, nextjs, typescript, css, tailwind |
|
||||
| Testing | testing, jest, playwright, e2e |
|
||||
| DevOps | deploy, docker, kubernetes, ci-cd |
|
||||
| Documentation | docs, readme, changelog, api-docs |
|
||||
| Code Quality | review, lint, refactor, best-practices |
|
||||
| Design | ui, ux, design-system, accessibility |
|
||||
| Productivity | workflow, automation, git |
|
||||
|
||||
## Tips for Effective Searches
|
||||
|
||||
1. **Use specific keywords**: "react testing" is better than just "testing"
|
||||
2. **Try alternative terms**: If "deploy" doesn't work, try "deployment" or "ci-cd"
|
||||
3. **Check popular sources**: Many skills come from `vercel-labs/agent-skills` or `ComposioHQ/awesome-claude-skills`
|
||||
|
||||
## When No Skills Are Found
|
||||
|
||||
If no relevant skills exist:
|
||||
|
||||
1. Acknowledge that no existing skill was found
|
||||
2. Offer to help with the task directly using your general capabilities
|
||||
3. Suggest the user could create their own skill with `npx skills init`
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
I searched for skills related to "xyz" but didn't find any matches.
|
||||
I can still help you with this task directly! Would you like me to proceed?
|
||||
|
||||
If this is something you do often, you could create your own skill:
|
||||
npx skills init my-xyz-skill
|
||||
```
|
||||
@@ -1,349 +0,0 @@
|
||||
---
|
||||
name: nix-best-practices
|
||||
description: Nix patterns for flakes, overlays, unfree handling, and binary overlays. Use when working with flake.nix or shell.nix.
|
||||
---
|
||||
|
||||
# Nix Best Practices
|
||||
|
||||
## Flake Structure
|
||||
|
||||
Standard flake.nix structure:
|
||||
|
||||
```nix
|
||||
{
|
||||
description = "Project description";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
};
|
||||
in {
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
# packages here
|
||||
];
|
||||
};
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
## Follows Pattern (Avoid Duplicate Nixpkgs)
|
||||
|
||||
When adding overlay inputs, use `follows` to share the parent nixpkgs and avoid downloading multiple versions:
|
||||
|
||||
```nix
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
# Overlay follows parent nixpkgs
|
||||
some-overlay.url = "github:owner/some-overlay";
|
||||
some-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
# Chain follows through intermediate inputs
|
||||
another-overlay.url = "github:owner/another-overlay";
|
||||
another-overlay.inputs.nixpkgs.follows = "some-overlay";
|
||||
};
|
||||
```
|
||||
|
||||
All inputs must be listed in outputs function even if not directly used:
|
||||
|
||||
```nix
|
||||
outputs = { self, nixpkgs, some-overlay, another-overlay, ... }:
|
||||
```
|
||||
|
||||
## Applying Overlays
|
||||
|
||||
Overlays modify or add packages to nixpkgs:
|
||||
|
||||
```nix
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [
|
||||
overlay1.overlays.default
|
||||
overlay2.overlays.default
|
||||
# Inline overlay
|
||||
(final: prev: {
|
||||
myPackage = prev.myPackage.override { ... };
|
||||
})
|
||||
];
|
||||
};
|
||||
in
|
||||
```
|
||||
|
||||
## Handling Unfree Packages
|
||||
|
||||
### Option 1: nixpkgs-unfree (Recommended for Teams)
|
||||
|
||||
Use numtide/nixpkgs-unfree for EULA-licensed packages without requiring user config:
|
||||
|
||||
```nix
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nixpkgs-unfree.url = "github:numtide/nixpkgs-unfree/nixos-unstable";
|
||||
nixpkgs-unfree.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
# Unfree overlay follows nixpkgs-unfree
|
||||
proprietary-tool.url = "github:owner/proprietary-tool-overlay";
|
||||
proprietary-tool.inputs.nixpkgs.follows = "nixpkgs-unfree";
|
||||
};
|
||||
```
|
||||
|
||||
This chains: `proprietary-tool` → `nixpkgs-unfree` → `nixpkgs`
|
||||
|
||||
### Option 2: User Config
|
||||
|
||||
Users add to `~/.config/nixpkgs/config.nix`:
|
||||
|
||||
```nix
|
||||
{ allowUnfree = true; }
|
||||
```
|
||||
|
||||
### Option 3: Specific Packages (Flake)
|
||||
|
||||
```nix
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
|
||||
"specific-package"
|
||||
];
|
||||
};
|
||||
in
|
||||
```
|
||||
|
||||
Note: `config.allowUnfree` in flake.nix doesn't work with `nix develop` - use nixpkgs-unfree or user config.
|
||||
|
||||
## Creating Binary Overlay Repos
|
||||
|
||||
When nixpkgs builds a community version lacking features (common with open-core tools), create an overlay that fetches official binaries.
|
||||
|
||||
### Pattern (see 0xBigBoss/atlas-overlay, 0xBigBoss/bun-overlay)
|
||||
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
|
||||
version = "1.0.0";
|
||||
|
||||
# Platform-specific binaries
|
||||
sources = {
|
||||
"x86_64-linux" = {
|
||||
url = "https://example.com/tool-linux-amd64-v${version}";
|
||||
sha256 = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||
};
|
||||
"aarch64-linux" = {
|
||||
url = "https://example.com/tool-linux-arm64-v${version}";
|
||||
sha256 = "sha256-BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB=";
|
||||
};
|
||||
"x86_64-darwin" = {
|
||||
url = "https://example.com/tool-darwin-amd64-v${version}";
|
||||
sha256 = "sha256-CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC=";
|
||||
};
|
||||
"aarch64-darwin" = {
|
||||
url = "https://example.com/tool-darwin-arm64-v${version}";
|
||||
sha256 = "sha256-DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD=";
|
||||
};
|
||||
};
|
||||
|
||||
source = sources.${system} or (throw "Unsupported system: ${system}");
|
||||
|
||||
toolPackage = pkgs.stdenv.mkDerivation {
|
||||
pname = "tool";
|
||||
inherit version;
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
inherit (source) url sha256;
|
||||
};
|
||||
|
||||
sourceRoot = ".";
|
||||
dontUnpack = true;
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp $src $out/bin/tool
|
||||
chmod +x $out/bin/tool
|
||||
'';
|
||||
|
||||
meta = with pkgs.lib; {
|
||||
description = "Tool description";
|
||||
homepage = "https://example.com";
|
||||
license = licenses.unfree; # or appropriate license
|
||||
platforms = builtins.attrNames sources;
|
||||
};
|
||||
};
|
||||
in {
|
||||
packages.default = toolPackage;
|
||||
packages.tool = toolPackage;
|
||||
|
||||
overlays.default = final: prev: {
|
||||
tool = toolPackage;
|
||||
};
|
||||
})
|
||||
// {
|
||||
overlays.default = final: prev: {
|
||||
tool = self.packages.${prev.system}.tool;
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### Getting SHA256 Hashes
|
||||
|
||||
```bash
|
||||
nix-prefetch-url https://example.com/tool-linux-amd64-v1.0.0
|
||||
# Returns hash in base32, convert to SRI format:
|
||||
nix hash to-sri --type sha256 <base32-hash>
|
||||
```
|
||||
|
||||
Or use SRI directly:
|
||||
```bash
|
||||
nix-prefetch-url --type sha256 https://example.com/tool-linux-amd64-v1.0.0
|
||||
```
|
||||
|
||||
## Dev Shell Patterns
|
||||
|
||||
### Basic Shell
|
||||
|
||||
```nix
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
nodejs
|
||||
python3
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
echo "Dev environment ready"
|
||||
'';
|
||||
};
|
||||
```
|
||||
|
||||
### With Environment Variables
|
||||
|
||||
```nix
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [ postgresql ];
|
||||
|
||||
# Set at shell entry
|
||||
DATABASE_URL = "postgres://localhost/dev";
|
||||
|
||||
# Or in shellHook for dynamic values
|
||||
shellHook = ''
|
||||
export PROJECT_ROOT="$(pwd)"
|
||||
'';
|
||||
};
|
||||
```
|
||||
|
||||
### Native Dependencies (C Libraries)
|
||||
|
||||
```nix
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
openssl
|
||||
postgresql
|
||||
];
|
||||
|
||||
# Expose headers and libraries
|
||||
shellHook = ''
|
||||
export C_INCLUDE_PATH="${pkgs.openssl.dev}/include:$C_INCLUDE_PATH"
|
||||
export LIBRARY_PATH="${pkgs.openssl.out}/lib:$LIBRARY_PATH"
|
||||
export PKG_CONFIG_PATH="${pkgs.openssl.dev}/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||
'';
|
||||
};
|
||||
```
|
||||
|
||||
## Direnv Integration
|
||||
|
||||
`.envrc` for flake projects:
|
||||
|
||||
```bash
|
||||
use flake
|
||||
```
|
||||
|
||||
For unfree packages without nixpkgs-unfree:
|
||||
|
||||
```bash
|
||||
export NIXPKGS_ALLOW_UNFREE=1
|
||||
use flake --impure
|
||||
```
|
||||
|
||||
## Common Commands
|
||||
|
||||
```bash
|
||||
# Update all inputs
|
||||
nix flake update
|
||||
|
||||
# Update specific input
|
||||
nix flake update some-input
|
||||
|
||||
# Check flake validity
|
||||
nix flake check
|
||||
|
||||
# Show flake metadata
|
||||
nix flake metadata
|
||||
|
||||
# Enter dev shell
|
||||
nix develop
|
||||
|
||||
# Run command in dev shell
|
||||
nix develop -c <command>
|
||||
|
||||
# Build package
|
||||
nix build .#packageName
|
||||
|
||||
# Run package
|
||||
nix run .#packageName
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### "unexpected argument" Error
|
||||
|
||||
All inputs must be listed in outputs function:
|
||||
```nix
|
||||
# Wrong
|
||||
outputs = { self, nixpkgs }: ...
|
||||
|
||||
# Right (if you have more inputs)
|
||||
outputs = { self, nixpkgs, other-input, ... }: ...
|
||||
```
|
||||
|
||||
### Unfree Package Errors with nix develop
|
||||
|
||||
`config.allowUnfree` in flake.nix doesn't propagate to `nix develop`. Use:
|
||||
1. nixpkgs-unfree input (recommended)
|
||||
2. User's `~/.config/nixpkgs/config.nix`
|
||||
3. `NIXPKGS_ALLOW_UNFREE=1 nix develop --impure`
|
||||
|
||||
### Duplicate Nixpkgs Downloads
|
||||
|
||||
Use `follows` to chain inputs to a single nixpkgs source.
|
||||
|
||||
### Overlay Not Applied
|
||||
|
||||
Ensure overlay is in the `overlays` list when importing nixpkgs:
|
||||
```nix
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ my-overlay.overlays.default ];
|
||||
};
|
||||
```
|
||||
|
||||
### Hash Mismatch
|
||||
|
||||
Re-fetch with `nix-prefetch-url` and update the hash. Hashes change when upstream updates binaries at the same URL.
|
||||
@@ -1,533 +0,0 @@
|
||||
# NixOS Configuration Best Practices
|
||||
|
||||
Complete guide for configuring NixOS systems with flakes, managing overlays, and structuring configurations.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Overview](#overview)
|
||||
- [When to Use](#when-to-use)
|
||||
- [Essential Pattern](#essential-pattern-overlay-scope-and-useglobalpkgs)
|
||||
- [Flakes Structure](#flakes-configuration-structure)
|
||||
- [Host Organization](#host-configuration-organization)
|
||||
- [Package Installation](#package-installation-best-practices)
|
||||
- [Common Mistakes](#common-configuration-mistakes)
|
||||
- [Troubleshooting](#troubleshooting-configuration-issues)
|
||||
- [Real-World Impact](#real-world-impact)
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
**Core principle:** Understand the interaction between NixOS system configuration and Home Manager overlays.
|
||||
|
||||
When `useGlobalPkgs = true`, overlays must be defined at the NixOS configuration level, not in Home Manager configuration files.
|
||||
|
||||
---
|
||||
|
||||
## When to Use
|
||||
|
||||
**Use when:**
|
||||
- Configuring NixOS with flakes and Home Manager
|
||||
- Adding overlays that don't seem to apply
|
||||
- Using `useGlobalPkgs = true` with custom overlays
|
||||
- Structuring NixOS configurations across multiple hosts
|
||||
- Package changes not appearing after rebuild
|
||||
- Confused about where to define overlays
|
||||
|
||||
**Don't use for:**
|
||||
- Packaging new software (use nix-packaging-best-practices)
|
||||
- Simple package installation without overlays
|
||||
- NixOS module development (see NixOS module documentation)
|
||||
|
||||
---
|
||||
|
||||
## Essential Pattern: Overlay Scope and useGlobalPkgs
|
||||
|
||||
### Why This Matters
|
||||
|
||||
When using Home Manager with NixOS, the `useGlobalPkgs` setting determines where overlay definitions must be placed. Defining overlays in the wrong location means they simply don't apply, leading to "package not found" errors even when the overlay syntax is correct.
|
||||
|
||||
### The Problem
|
||||
|
||||
When `useGlobalPkgs = true`, Home Manager uses NixOS's global `pkgs` instance. Overlays defined in `home.nix` are ignored because Home Manager isn't creating its own `pkgs` - it's using the system one.
|
||||
|
||||
### Incorrect: Overlay in home.nix with useGlobalPkgs=true
|
||||
|
||||
```nix
|
||||
# hosts/home/default.nix
|
||||
{
|
||||
home-manager.useGlobalPkgs = true; # Using system pkgs
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.chumeng = import ./home.nix;
|
||||
}
|
||||
|
||||
# home-manager/home.nix
|
||||
{ config, pkgs, inputs, ... }:
|
||||
{
|
||||
# ❌ This overlay is IGNORED when useGlobalPkgs = true!
|
||||
nixpkgs.overlays = [ inputs.claude-code.overlays.default ];
|
||||
|
||||
home.packages = with pkgs; [
|
||||
claude-code # Error: attribute 'claude-code' not found
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
**Why it fails:** When `useGlobalPkgs = true`, the `nixpkgs.overlays` line in `home.nix` has no effect. Home Manager isn't creating its own `pkgs`, so it can't apply overlays to one.
|
||||
|
||||
### Correct: Overlay in host home-manager block
|
||||
|
||||
```nix
|
||||
# hosts/home/default.nix
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.chumeng = import ./home.nix;
|
||||
home-manager.extraSpecialArgs = { inherit inputs pkgs-stable system; };
|
||||
# ✅ Overlay defined HERE affects the global pkgs
|
||||
nixpkgs.overlays = [ inputs.claude-code.overlays.default ];
|
||||
}
|
||||
|
||||
# home-manager/home.nix
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
# No overlay definition needed here
|
||||
home.packages = with pkgs; [
|
||||
claude-code # ✅ Works! Found via overlay
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
**Why it works:** The overlay is defined where Home Manager configures the `pkgs` instance it will use. When `useGlobalPkgs = true`, this means the overlay is applied to the system's package set.
|
||||
|
||||
### Alternative: Set useGlobalPkgs=false
|
||||
|
||||
If you want to define overlays in `home.nix`, set `useGlobalPkgs = false`:
|
||||
|
||||
```nix
|
||||
# hosts/home/default.nix
|
||||
{
|
||||
home-manager.useGlobalPkgs = false; # Home Manager creates own pkgs
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.chumeng = import ./home.nix;
|
||||
}
|
||||
|
||||
# home-manager/home.nix
|
||||
{ pkgs, inputs, ... }:
|
||||
{
|
||||
# ✅ This works when useGlobalPkgs = false
|
||||
nixpkgs.overlays = [ inputs.claude-code.overlays.default ];
|
||||
|
||||
home.packages = with pkgs; [
|
||||
claude-code # ✅ Works! Found via overlay
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
**Trade-off:** This creates a separate package set for Home Manager, which means packages are built twice (once for system, once for Home Manager). Only use this when you truly need separate package sets.
|
||||
|
||||
### Decision Matrix
|
||||
|
||||
| Your Need | useGlobalPkgs | Overlay Location |
|
||||
|-----------|---------------|------------------|
|
||||
| Single-user system, efficiency | `true` | Host home-manager block |
|
||||
| Multi-user, different packages per user | `false` | User's home.nix |
|
||||
| Custom packages system-wide | `true` | System nixpkgs.overlays |
|
||||
| Quick prototype | `false` | User's home.nix |
|
||||
|
||||
---
|
||||
|
||||
## Flakes Configuration Structure
|
||||
|
||||
### Core Structure
|
||||
|
||||
```nix
|
||||
{
|
||||
description = "My NixOS configuration";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
home-manager.url = "github:nix-community/home-manager/release-25.05";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
# Add other flake inputs here
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, home-manager, ... }@inputs: {
|
||||
nixosConfigurations.hostname = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [ ./hosts/hostname ];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### Special Args Pattern
|
||||
|
||||
Pass `inputs` via `specialArgs` to make flake inputs available in modules:
|
||||
|
||||
```nix
|
||||
# ❌ WRONG: Forgetting specialArgs
|
||||
outputs = { self, nixpkgs, home-manager }:
|
||||
{
|
||||
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
|
||||
modules = [ ./hosts/myhost ]; # inputs not available!
|
||||
};
|
||||
}
|
||||
|
||||
# ✅ CORRECT: Using specialArgs
|
||||
outputs = { self, nixpkgs, home-manager, ... }@inputs:
|
||||
{
|
||||
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [ ./hosts/myhost ]; # inputs available!
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### Input Following
|
||||
|
||||
Set `inputs.nixpkgs.follows` to avoid duplicate nixpkgs instances:
|
||||
|
||||
```nix
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
# ❌ WRONG: Doesn't follow, creates duplicate nixpkgs
|
||||
home-manager.url = "github:nix-community/home-manager/release-25.05";
|
||||
|
||||
# ✅ CORRECT: Follows nixpkgs, uses same instance
|
||||
home-manager.url = "github:nix-community/home-manager/release-25.05";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Host Configuration Organization
|
||||
|
||||
### Directory Structure
|
||||
|
||||
```
|
||||
nixos-config/
|
||||
├── flake.nix # Top-level flake
|
||||
├── hosts/
|
||||
│ ├── laptop/
|
||||
│ │ ├── default.nix # Host-specific config
|
||||
│ │ ├── hardware-configuration.nix # Generated (don't edit)
|
||||
│ │ └── home.nix # Home Manager config
|
||||
│ ├── desktop/
|
||||
│ │ ├── default.nix
|
||||
│ │ ├── hardware-configuration.nix
|
||||
│ │ └── home.nix
|
||||
│ └── base.nix # Shared by all hosts (optional)
|
||||
├── modules/ # Reusable NixOS modules
|
||||
├── overlays/ # Custom overlays
|
||||
├── home-manager/ # Shared Home Manager configs
|
||||
│ ├── shell/
|
||||
│ ├── applications/
|
||||
│ └── common.nix
|
||||
└── secrets/ # Age-encrypted secrets
|
||||
```
|
||||
|
||||
### Host Configuration Pattern
|
||||
|
||||
```nix
|
||||
# hosts/laptop/default.nix
|
||||
{ inputs, pkgs, pkgs-stable, system, ... }:
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix # Import hardware config
|
||||
../base.nix # Import shared config
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.john = import ./home.nix;
|
||||
home-manager.extraSpecialArgs = {
|
||||
inherit inputs pkgs-stable system;
|
||||
};
|
||||
nixpkgs.overlays = [ inputs.some-overlay.overlays.default ];
|
||||
}
|
||||
];
|
||||
|
||||
# Host-specific config only
|
||||
networking.hostName = "laptop";
|
||||
}
|
||||
```
|
||||
|
||||
### Shared Base Configuration
|
||||
|
||||
```nix
|
||||
# hosts/base.nix
|
||||
{ config, pkgs, inputs, ... }:
|
||||
{
|
||||
# Network
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
# Time and locale
|
||||
time.timeZone = "America/New_York";
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
# Users (shared across all hosts)
|
||||
users.users.john = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "wheel" "networkmanager" ];
|
||||
};
|
||||
|
||||
# Common packages
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim
|
||||
git
|
||||
wget
|
||||
tmux
|
||||
];
|
||||
|
||||
# Common services
|
||||
services.openssh.enable = true;
|
||||
|
||||
# Nix settings
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
}
|
||||
```
|
||||
|
||||
**Important:** Don't edit `hardware-configuration.nix` manually. It's generated by `nixos-generate-config` and should be replaced when hardware changes.
|
||||
|
||||
---
|
||||
|
||||
## Package Installation Best Practices
|
||||
|
||||
### System vs User Packages
|
||||
|
||||
**System Packages (NixOS)** - Use for:
|
||||
- System services (servers, daemons)
|
||||
- Packages needed by all users
|
||||
- Hardware-related packages (drivers, firmware)
|
||||
|
||||
```nix
|
||||
# hosts/base.nix or host-specific default.nix
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim # Available to all users
|
||||
git
|
||||
wget
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
**User Packages (Home Manager)** - Use for:
|
||||
- User-specific applications
|
||||
- Desktop applications
|
||||
- Development tools (user-specific)
|
||||
|
||||
```nix
|
||||
# home-manager/home.nix or sub-configs
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
vscode # User-specific
|
||||
chrome
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
### Installing from Different Nixpkgs Channels
|
||||
|
||||
```nix
|
||||
# flake.nix - default is unstable
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-25.05";
|
||||
};
|
||||
|
||||
# Host config
|
||||
{ pkgs, pkgs-stable, ... }:
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim # From unstable (default)
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs-stable; [
|
||||
vim # From stable
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Common Configuration Mistakes
|
||||
|
||||
### Mistake 1: Overlay in Wrong Location
|
||||
|
||||
**Symptom:** Package not found even though overlay is defined.
|
||||
|
||||
**Solution:** Move overlay to host's home-manager configuration block.
|
||||
|
||||
```nix
|
||||
# ❌ WRONG: home-manager/home.nix
|
||||
{
|
||||
nixpkgs.overlays = [ inputs.overlay.overlays.default ];
|
||||
}
|
||||
|
||||
# ✅ CORRECT: hosts/home/default.nix
|
||||
{
|
||||
home-manager.nixpkgs.overlays = [ inputs.overlay.overlays.default ];
|
||||
}
|
||||
```
|
||||
|
||||
### Mistake 2: Forgetting specialArgs
|
||||
|
||||
**Symptom:** `undefined variable 'inputs'` error.
|
||||
|
||||
**Solution:** Add `specialArgs = { inherit inputs; }`.
|
||||
|
||||
```nix
|
||||
# ❌ WRONG
|
||||
outputs = { self, nixpkgs, home-manager }:
|
||||
{
|
||||
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
|
||||
modules = [ ./hosts/myhost ];
|
||||
};
|
||||
}
|
||||
|
||||
# ✅ CORRECT
|
||||
outputs = { self, nixpkgs, home-manager, ... }@inputs:
|
||||
{
|
||||
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [ ./hosts/myhost ];
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### Mistake 3: Editing hardware-configuration.nix
|
||||
|
||||
**Symptom:** Hardware changes lost after running `nixos-generate-config`.
|
||||
|
||||
**Solution:** Put custom config in `default.nix`, not `hardware-configuration.nix`.
|
||||
|
||||
### Mistake 4: Duplicate Package Declarations
|
||||
|
||||
**Symptom:** Same package in both system and Home Manager config.
|
||||
|
||||
**Solution:** Install in appropriate location only.
|
||||
|
||||
```nix
|
||||
# ❌ WRONG
|
||||
# hosts/base.nix
|
||||
environment.systemPackages = with pkgs; [ firefox ];
|
||||
|
||||
# home-manager/home.nix
|
||||
home.packages = with pkgs; [ firefox ]; # Duplicate!
|
||||
|
||||
# ✅ CORRECT: Choose one location
|
||||
home.packages = with pkgs; [ firefox ];
|
||||
```
|
||||
|
||||
### Mistake 5: Not Following nixpkgs
|
||||
|
||||
**Symptom:** Slow builds, inconsistent packages.
|
||||
|
||||
**Solution:** Use `.follows` for dependency inputs.
|
||||
|
||||
```nix
|
||||
# ❌ WRONG
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
home-manager.url = "github:nix-community/home-manager/release-25.05";
|
||||
};
|
||||
|
||||
# ✅ CORRECT
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
home-manager.url = "github:nix-community/home-manager/release-25.05";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting Configuration Issues
|
||||
|
||||
### General Approach
|
||||
|
||||
1. **Read error messages completely** - They usually tell you exactly what's wrong
|
||||
2. **Verify syntax** - Check for missing brackets, quotes, commas
|
||||
3. **Validate config** - Use `nixos-rebuild test` first
|
||||
4. **Check scope** - Is overlay/module in correct location?
|
||||
5. **Trace dependencies** - Are required inputs/imports present?
|
||||
|
||||
### Common Error Patterns
|
||||
|
||||
**"undefined variable 'inputs'"**
|
||||
|
||||
Add to flake.nix:
|
||||
```nix
|
||||
specialArgs = { inherit inputs; };
|
||||
```
|
||||
|
||||
**"attribute 'package-name' not found"**
|
||||
|
||||
Check if overlay is defined in correct location based on `useGlobalPkgs` setting.
|
||||
|
||||
**"error: The option 'some.option' does not exist"**
|
||||
|
||||
Search for option:
|
||||
```bash
|
||||
nixos-options | grep some-option
|
||||
```
|
||||
|
||||
**"infinite recursion"**
|
||||
|
||||
Use --show-trace:
|
||||
```bash
|
||||
nixos-rebuild build --flake .#hostname --show-trace
|
||||
```
|
||||
|
||||
### Configuration Changes Not Applying
|
||||
|
||||
```bash
|
||||
# Verify rebuild succeeded
|
||||
sudo nixos-rebuild switch --flake .#hostname
|
||||
|
||||
# Check current generation
|
||||
sudo nix-env --list-generations --profile /nix/var/nix/profiles/system
|
||||
|
||||
# Verify new generation is active
|
||||
nixos-version
|
||||
```
|
||||
|
||||
### Useful Verification Commands
|
||||
|
||||
```bash
|
||||
# Check configuration without building
|
||||
nix flake check
|
||||
nixos-rebuild build --flake .#hostname --dry-run
|
||||
|
||||
# Evaluate specific option
|
||||
nix eval .#nixosConfigurations.myhost.config.environment.systemPackages
|
||||
|
||||
# Test configuration safely
|
||||
nixos-rebuild test --flake .#hostname # Rollback on reboot
|
||||
nixos-rebuild switch --flake .#hostname # Persistent
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Real-World Impact
|
||||
|
||||
Following these best practices prevents the most common NixOS configuration issues:
|
||||
|
||||
**Before:**
|
||||
- Users spend hours debugging why overlays don't apply
|
||||
- Configuration is duplicated across hosts
|
||||
- Changes don't apply after editing files
|
||||
- Confusion about where to define overlays
|
||||
|
||||
**After:**
|
||||
- Clear understanding of overlay scope
|
||||
- Modular, maintainable configuration structure
|
||||
- Predictable behavior
|
||||
- Easy debugging when issues arise
|
||||
|
||||
The overlay scope issue alone accounts for ~80% of NixOS + Home Manager configuration problems encountered by users.
|
||||
@@ -1,134 +0,0 @@
|
||||
---
|
||||
name: nixos-best-practices
|
||||
description: Use when configuring NixOS with flakes, managing overlays with home-manager useGlobalPkgs, structuring NixOS configurations, or facing issues where configuration changes don't apply
|
||||
license: MIT
|
||||
metadata:
|
||||
author: chumeng
|
||||
version: "1.0.0"
|
||||
---
|
||||
|
||||
# Configuring NixOS Systems with Flakes
|
||||
|
||||
Configure NixOS systems with flakes, manage overlays properly, and structure configurations for maintainability.
|
||||
|
||||
## Core Principle
|
||||
|
||||
**Understand the interaction between NixOS system configuration and Home Manager overlays.**
|
||||
|
||||
When `useGlobalPkgs = true`, overlays must be defined at the NixOS configuration level, not in Home Manager configuration files.
|
||||
|
||||
## When to Use
|
||||
|
||||
- Configuring NixOS with flakes and Home Manager
|
||||
- Adding overlays that don't seem to apply
|
||||
- Using `useGlobalPkgs = true` with custom overlays
|
||||
- Structuring NixOS configurations across multiple hosts
|
||||
- Package changes not appearing after rebuild
|
||||
- Confused about where to define overlays
|
||||
|
||||
**Don't use for:**
|
||||
- Packaging new software (use nix-packaging-best-practices)
|
||||
- Simple package installation without overlays
|
||||
- NixOS module development (see NixOS module documentation)
|
||||
|
||||
## Quick Reference
|
||||
|
||||
| Topic | Rule File |
|
||||
|-------|-----------|
|
||||
| Overlay scope and useGlobalPkgs | [overlay-scope](rules/overlay-scope.md) |
|
||||
| Flakes configuration structure | [flakes-structure](rules/flakes-structure.md) |
|
||||
| Host configuration organization | [host-organization](rules/host-organization.md) |
|
||||
| Package installation best practices | [package-installation](rules/package-installation.md) |
|
||||
| Common configuration mistakes | [common-mistakes](rules/common-mistakes.md) |
|
||||
| Debugging configuration issues | [troubleshooting](rules/troubleshooting.md) |
|
||||
|
||||
## Essential Pattern: Overlay with useGlobalPkgs
|
||||
|
||||
```nix
|
||||
# ❌ WRONG: Overlay in home.nix (doesn't apply)
|
||||
# home-manager/home.nix
|
||||
{
|
||||
nixpkgs.overlays = [ inputs.claude-code.overlays.default ]; # Ignored!
|
||||
home.packages = with pkgs; [ claude-code ]; # Not found!
|
||||
}
|
||||
|
||||
# ✅ CORRECT: Overlay in NixOS home-manager block
|
||||
# hosts/home/default.nix
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.chumeng = import ./home.nix;
|
||||
home-manager.extraSpecialArgs = { inherit inputs pkgs-stable system; };
|
||||
# Overlay must be HERE when useGlobalPkgs = true
|
||||
nixpkgs.overlays = [ inputs.claude-code.overlays.default ];
|
||||
}
|
||||
```
|
||||
|
||||
## Common Tasks
|
||||
|
||||
| Task | Solution |
|
||||
|------|----------|
|
||||
| Add flake input | Add to `inputs` in flake.nix |
|
||||
| Add overlay for system packages | Define in `nixpkgs.overlays` in system configuration |
|
||||
| Add overlay for home-manager (useGlobalPkgs=true) | Define in `home-manager.nixpkgs.overlays` in host config |
|
||||
| Add overlay for home-manager (useGlobalPkgs=false) | Define in `home.nix` with `nixpkgs.overlays` |
|
||||
| Pass inputs to modules | Use `specialArgs` in nixosSystem or home-manager |
|
||||
| Multiple host configurations | Create separate host files in `hosts/` |
|
||||
| Shared configuration modules | Create modules in `modules/` and import in each host |
|
||||
| Package not found after overlay | Check overlay scope vs useGlobalPkgs setting |
|
||||
|
||||
## Overlay Scope Decision Matrix
|
||||
|
||||
| useGlobalPkgs | Overlay Definition Location | Affects |
|
||||
|---------------|---------------------------|---------|
|
||||
| `true` | `home-manager.nixpkgs.overlays` | System + Home Manager packages |
|
||||
| `true` | `home.nix` with `nixpkgs.overlays` | **Nothing** (ignored!) |
|
||||
| `false` | `home.nix` with `nixpkgs.overlays` | Home Manager packages only |
|
||||
| `false` | `home-manager.nixpkgs.overlays` | Home Manager packages only |
|
||||
| Any | System `nixpkgs.overlays` | System packages only |
|
||||
|
||||
## Configuration Layers (Bottom to Top)
|
||||
|
||||
1. **System configuration** (`/etc/nixos/configuration.nix` or host files)
|
||||
- System-wide services
|
||||
- System packages
|
||||
- System overlays only affect this layer
|
||||
|
||||
2. **Home Manager (useGlobalPkgs=true)**
|
||||
- Uses system pkgs (includes system overlays)
|
||||
- Home Manager overlays affect both system and user packages
|
||||
- Most efficient for single-user systems
|
||||
|
||||
3. **Home Manager (useGlobalPkgs=false)**
|
||||
- Creates separate pkgs instance
|
||||
- Home Manager overlays affect user packages only
|
||||
- Useful for multi-user systems with different needs
|
||||
|
||||
## Red Flags - STOP
|
||||
|
||||
- "Overlay in home.nix isn't working" → Check if useGlobalPkgs=true, move to host config
|
||||
- "I'll just add overlays everywhere" → Define once at appropriate scope
|
||||
- "Package works in nix repl but not installed" → Check overlay scope
|
||||
- "Changes don't apply after rebuild" → Verify overlay is in correct location
|
||||
- "useGlobalPkgs=false for no reason" → Use true unless you need separate package sets
|
||||
|
||||
## How to Use
|
||||
|
||||
Read individual rule files for detailed explanations and code examples:
|
||||
|
||||
```
|
||||
rules/overlay-scope.md # The core overlay scope issue
|
||||
rules/flakes-structure.md # How to organize flake.nix
|
||||
rules/host-organization.md # How to structure host configs
|
||||
rules/common-mistakes.md # Pitfalls and how to avoid them
|
||||
```
|
||||
|
||||
Each rule file contains:
|
||||
- Brief explanation of why it matters
|
||||
- Incorrect code example with explanation
|
||||
- Correct code example with explanation
|
||||
- Additional context and references
|
||||
|
||||
## Full Compiled Document
|
||||
|
||||
For the complete guide with all rules expanded: `AGENTS.md`
|
||||
@@ -1,323 +0,0 @@
|
||||
---
|
||||
title: Common Configuration Mistakes
|
||||
impact: HIGH
|
||||
impactDescription: Prevents the most frequently made configuration errors
|
||||
tags: mistakes,pitfalls,errors,checklist
|
||||
---
|
||||
|
||||
|
||||
## Why This Matters
|
||||
|
||||
Understanding common mistakes helps avoid them, saving time and preventing configuration errors.
|
||||
|
||||
## Mistake 1: Overlay in Wrong Location
|
||||
|
||||
### Symptom
|
||||
Package not found even though overlay is defined.
|
||||
|
||||
### Cause
|
||||
Overlay defined in `home.nix` when `useGlobalPkgs = true`.
|
||||
|
||||
### Solution
|
||||
Move overlay to host's home-manager configuration block.
|
||||
|
||||
```nix
|
||||
# ❌ WRONG
|
||||
# home-manager/home.nix
|
||||
{
|
||||
nixpkgs.overlays = [ inputs.overlay.overlays.default ];
|
||||
}
|
||||
|
||||
# ✅ CORRECT
|
||||
# hosts/home/default.nix
|
||||
{
|
||||
home-manager.nixpkgs.overlays = [ inputs.overlay.overlays.default ];
|
||||
}
|
||||
```
|
||||
|
||||
**See:** [overlay-scope.md](overlay-scope.md)
|
||||
|
||||
## Mistake 2: Forgetting specialArgs
|
||||
|
||||
### Symptom
|
||||
`undefined variable 'inputs'` error.
|
||||
|
||||
### Cause
|
||||
Not passing `inputs` via `specialArgs`.
|
||||
|
||||
### Solution
|
||||
Add `specialArgs = { inherit inputs; }`.
|
||||
|
||||
```nix
|
||||
# ❌ WRONG
|
||||
outputs = { self, nixpkgs, home-manager }:
|
||||
{
|
||||
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
|
||||
modules = [ ./hosts/myhost ];
|
||||
};
|
||||
}
|
||||
|
||||
# ✅ CORRECT
|
||||
outputs = { self, nixpkgs, home-manager, ... }@inputs:
|
||||
{
|
||||
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [ ./hosts/myhost ];
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
**See:** [flakes-structure.md](flakes-structure.md)
|
||||
|
||||
## Mistake 3: Editing hardware-configuration.nix
|
||||
|
||||
### Symptom
|
||||
Hardware changes lost after running `nixos-generate-config`.
|
||||
|
||||
### Cause
|
||||
Manually editing generated file.
|
||||
|
||||
### Solution
|
||||
Put custom config in `default.nix`, not `hardware-configuration.nix`.
|
||||
|
||||
```nix
|
||||
# ❌ WRONG: Editing hardware-configuration.nix
|
||||
# hosts/laptop/hardware-configuration.nix
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
{
|
||||
# My custom kernel parameters (will be lost!)
|
||||
boot.kernelParams = [ "intel_iommu=on" ];
|
||||
|
||||
# Generated hardware config...
|
||||
}
|
||||
|
||||
# ✅ CORRECT: Custom config in default.nix
|
||||
# hosts/laptop/default.nix
|
||||
{
|
||||
imports = [ ./hardware-configuration.nix ];
|
||||
|
||||
# Custom kernel parameters (safe!)
|
||||
boot.kernelParams = [ "intel_iommu=on" ];
|
||||
}
|
||||
```
|
||||
|
||||
**See:** [host-organization.md](host-organization.md)
|
||||
|
||||
## Mistake 4: Duplicate Package Declarations
|
||||
|
||||
### Symptom
|
||||
Package installed multiple times or conflicts.
|
||||
|
||||
### Cause
|
||||
Same package in both system and Home Manager config.
|
||||
|
||||
### Solution
|
||||
Install in appropriate location only.
|
||||
|
||||
```nix
|
||||
# ❌ WRONG: Same package in both places
|
||||
# hosts/base.nix
|
||||
environment.systemPackages = with pkgs; [ firefox ];
|
||||
|
||||
# home-manager/home.nix
|
||||
home.packages = with pkgs; [ firefox ]; # Duplicate!
|
||||
|
||||
# ✅ CORRECT: Choose one location
|
||||
# User apps in Home Manager
|
||||
home.packages = with pkgs; [ firefox ];
|
||||
```
|
||||
|
||||
**See:** [package-installation.md](package-installation.md)
|
||||
|
||||
## Mistake 5: Not Following nixpkgs
|
||||
|
||||
### Symptom
|
||||
Slow builds, inconsistent packages.
|
||||
|
||||
### Cause
|
||||
Multiple independent nixpkgs instances.
|
||||
|
||||
### Solution
|
||||
Use `.follows` for dependency inputs.
|
||||
|
||||
```nix
|
||||
# ❌ WRONG: Independent nixpkgs
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
home-manager.url = "github:nix-community/home-manager/release-25.05";
|
||||
# home-manager will use its own nixpkgs!
|
||||
};
|
||||
|
||||
# ✅ CORRECT: Follow nixpkgs
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
home-manager.url = "github:nix-community/home-manager/release-25.05";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
```
|
||||
|
||||
**See:** [flakes-structure.md](flakes-structure.md)
|
||||
|
||||
## Mistake 6: Mixing System and User Concerns
|
||||
|
||||
### Symptom
|
||||
User-specific config in system files or vice versa.
|
||||
|
||||
### Cause
|
||||
Not understanding NixOS vs Home Manager responsibilities.
|
||||
|
||||
### Solution
|
||||
System config in NixOS, user config in Home Manager.
|
||||
|
||||
```nix
|
||||
# ❌ WRONG: User config in system
|
||||
# hosts/base.nix
|
||||
{
|
||||
# User's git config (should be in Home Manager)
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = "john";
|
||||
userEmail = "john@example.com";
|
||||
};
|
||||
}
|
||||
|
||||
# ✅ CORRECT: User config in Home Manager
|
||||
# home-manager/home.nix
|
||||
{
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = "john";
|
||||
userEmail = "john@example.com";
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
**See:** [package-installation.md](package-installation.md)
|
||||
|
||||
## Mistake 7: Forgetting to Rebuild
|
||||
|
||||
### Symptom
|
||||
Changes don't appear after editing config.
|
||||
|
||||
### Cause
|
||||
Editing config but not running rebuild.
|
||||
|
||||
### Solution
|
||||
Always rebuild after config changes.
|
||||
|
||||
```bash
|
||||
# After editing NixOS config
|
||||
sudo nixos-rebuild switch --flake .#hostname
|
||||
|
||||
# After editing Home Manager config (standalone)
|
||||
home-manager switch --flake .#hostname
|
||||
|
||||
# When using NixOS-integrated Home Manager
|
||||
sudo nixos-rebuild switch --flake .#hostname
|
||||
```
|
||||
|
||||
## Mistake 8: Overriding systemPackages Multiple Times
|
||||
|
||||
### Symptom
|
||||
Some packages disappear after adding others.
|
||||
|
||||
### Cause
|
||||
Multiple `environment.systemPackages` assignments.
|
||||
|
||||
### Solution
|
||||
Use single list or mkBefore/mkAfter.
|
||||
|
||||
```nix
|
||||
# ❌ WRONG: Multiple assignments
|
||||
environment.systemPackages = with pkgs; [ vim git ];
|
||||
environment.systemPackages = with pkgs; [ htop ]; # Overwrites!
|
||||
|
||||
# ✅ CORRECT: Single list
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim
|
||||
git
|
||||
htop
|
||||
];
|
||||
|
||||
# ✅ ALSO CORRECT: Use mkBefore/mkAfter
|
||||
environment.systemPackages = with pkgs; [ vim git ];
|
||||
environment.systemPackages = mkAfter [ pkgs.htop ];
|
||||
```
|
||||
|
||||
## Mistake 9: Hardcoding Paths
|
||||
|
||||
### Symptom
|
||||
Config breaks on different machines.
|
||||
|
||||
### Cause
|
||||
Using absolute paths instead of Nix paths.
|
||||
|
||||
### Solution
|
||||
Use relative paths or Nix constructs.
|
||||
|
||||
```nix
|
||||
# ❌ WRONG: Absolute path
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = [
|
||||
"/home/john/my-app/bin/my-app" # Only works for john!
|
||||
];
|
||||
}
|
||||
|
||||
# ✅ CORRECT: Use Nix package
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = [ pkgs.my-app ];
|
||||
}
|
||||
|
||||
# ✅ OR: Use path from flake
|
||||
{ ... }:
|
||||
{
|
||||
environment.systemPackages = [
|
||||
(pkgs.callPackage ./local-packages/my-app { })
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
## Mistake 10: Not Using Flake References
|
||||
|
||||
### Symptom
|
||||
Can't use packages from flake inputs.
|
||||
|
||||
### Cause
|
||||
Not passing inputs or using wrong reference.
|
||||
|
||||
### Solution
|
||||
Use `inputs.*` syntax.
|
||||
|
||||
```nix
|
||||
# ❌ WRONG: Trying to use input package
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = [
|
||||
unfire-overlay # Where does this come from?
|
||||
];
|
||||
}
|
||||
|
||||
# ✅ CORRECT: Use input reference
|
||||
{ pkgs, inputs, ... }:
|
||||
{
|
||||
environment.systemPackages = [
|
||||
inputs.unfire-overlay.packages.${pkgs.system}.default
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
## Quick Checklist
|
||||
|
||||
Before committing config changes:
|
||||
|
||||
- [ ] Overlay in correct location for useGlobalPkgs setting
|
||||
- [ ] inputs passed via specialArgs if needed
|
||||
- [ ] Not editing hardware-configuration.nix
|
||||
- [ ] No duplicate package declarations
|
||||
- [ ] Following nixpkgs for dependency inputs
|
||||
- [ ] System config separate from user config
|
||||
- [ ] Tested with rebuild
|
||||
- [ ] Using Nix paths, not absolute paths
|
||||
- [ ] Correct input references for flake packages
|
||||
@@ -1,188 +0,0 @@
|
||||
---
|
||||
title: Flakes Configuration Structure
|
||||
impact: CRITICAL
|
||||
impactDescription: Foundation of flake-based NixOS configurations
|
||||
tags: flakes,special-args,inputs,multiple-hosts
|
||||
---
|
||||
|
||||
|
||||
## Why This Matters
|
||||
|
||||
A well-structured flake.nix makes it easy to manage multiple hosts, share common configurations, and maintain the codebase. Poor structure leads to duplication and confusion.
|
||||
|
||||
## Core Structure
|
||||
|
||||
```nix
|
||||
{
|
||||
description = "My NixOS configuration";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
home-manager.url = "github:nix-community/home-manager/release-25.05";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
# Add other flake inputs here
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, home-manager, ... }@inputs: {
|
||||
nixosConfigurations.hostname = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [ ./hosts/hostname ];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Special Args Pattern
|
||||
|
||||
Pass `inputs` via `specialArgs` to make flake inputs available in modules:
|
||||
|
||||
```nix
|
||||
# ❌ WRONG: Forgetting specialArgs
|
||||
outputs = { self, nixpkgs, home-manager }:
|
||||
{
|
||||
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
|
||||
modules = [ ./hosts/myhost ]; # inputs not available!
|
||||
};
|
||||
}
|
||||
|
||||
# ✅ CORRECT: Using specialArgs
|
||||
outputs = { self, nixpkgs, home-manager, ... }@inputs:
|
||||
{
|
||||
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [ ./hosts/myhost ]; # inputs available!
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Then use in modules:
|
||||
|
||||
```nix
|
||||
# hosts/myhost/default.nix
|
||||
{ inputs, pkgs, ... }:
|
||||
{
|
||||
# Can now use inputs.*
|
||||
imports = [
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
## Input Following
|
||||
|
||||
Set `inputs.nixpkgs.follows` to avoid duplicate nixpkgs instances:
|
||||
|
||||
```nix
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
# ❌ WRONG: Doesn't follow, creates duplicate nixpkgs
|
||||
home-manager.url = "github:nix-community/home-manager/release-25.05";
|
||||
|
||||
# ✅ CORRECT: Follows nixpkgs, uses same instance
|
||||
home-manager.url = "github:nix-community/home-manager/release-25.05";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
```
|
||||
|
||||
## Multiple Hosts Pattern
|
||||
|
||||
```nix
|
||||
outputs = { self, nixpkgs, home-manager, ... }@inputs: {
|
||||
# Define multiple hosts
|
||||
nixosConfigurations.laptop = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [ ./hosts/laptop ];
|
||||
};
|
||||
|
||||
nixosConfigurations.desktop = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [ ./hosts/desktop ];
|
||||
};
|
||||
|
||||
nixosConfigurations.server = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [ ./hosts/server ];
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
## System-Specific Packages
|
||||
|
||||
Pass system-specific args like `pkgs-stable`:
|
||||
|
||||
```nix
|
||||
outputs = { self, nixpkgs, nixpkgs-stable, home-manager, ... }@inputs:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
in
|
||||
{
|
||||
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {
|
||||
inherit inputs system;
|
||||
pkgs-stable = import inputs.nixpkgs-stable {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
};
|
||||
modules = [ ./hosts/myhost ];
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
Usage in host config:
|
||||
|
||||
```nix
|
||||
# hosts/myhost/default.nix
|
||||
{ inputs, pkgs, pkgs-stable, system, ... }:
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
unstable-package # From nixos-unstable
|
||||
];
|
||||
|
||||
# Or use stable version
|
||||
environment.systemPackages = with pkgs-stable; [
|
||||
stable-package
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
## Common Mistakes
|
||||
|
||||
1. **Not using @inputs pattern**: Forgetting to capture all inputs in a set makes it impossible to reference new inputs without updating the function signature.
|
||||
|
||||
2. **Missing specialArgs**: Inputs won't be available in modules without `specialArgs = { inherit inputs; }`.
|
||||
|
||||
3. **Hardcoded system**: Avoid hardcoding `x86_64-linux` multiple times. Define once and reuse.
|
||||
|
||||
4. **Not following nixpkgs**: Leads to multiple nixpkgs evaluations, slower builds, and potential inconsistencies.
|
||||
|
||||
## Quick Template
|
||||
|
||||
```nix
|
||||
{
|
||||
description = "NixOS configuration";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-25.05";
|
||||
home-manager.url = "github:nix-community/home-manager/release-25.05";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
# Add more inputs here
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, home-manager, ... }@inputs: {
|
||||
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
system = "x86_64-linux";
|
||||
pkgs-stable = import inputs.nixpkgs-stable {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
};
|
||||
modules = [ ./hosts/myhost ];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
@@ -1,296 +0,0 @@
|
||||
---
|
||||
title: Host Configuration Organization
|
||||
impact: HIGH
|
||||
impactDescription: Prevents configuration chaos across multiple hosts
|
||||
tags: hosts,modules,base-config,directory-structure
|
||||
---
|
||||
|
||||
|
||||
## Why This Matters
|
||||
|
||||
Proper host configuration organization prevents duplication, makes maintenance easier, and ensures consistency across multiple machines.
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
nixos-config/
|
||||
├── flake.nix # Top-level flake
|
||||
├── hosts/
|
||||
│ ├── laptop/
|
||||
│ │ ├── default.nix # Host-specific config
|
||||
│ │ ├── hardware-configuration.nix # Generated (don't edit)
|
||||
│ │ └── home.nix # Home Manager config
|
||||
│ ├── desktop/
|
||||
│ │ ├── default.nix
|
||||
│ │ ├── hardware-configuration.nix
|
||||
│ │ └── home.nix
|
||||
│ └── base.nix # Shared by all hosts (optional)
|
||||
├── modules/ # Reusable NixOS modules
|
||||
├── overlays/ # Custom overlays
|
||||
├── home-manager/ # Shared Home Manager configs
|
||||
│ ├── shell/
|
||||
│ ├── applications/
|
||||
│ └── common.nix
|
||||
└── secrets/ # Age-encrypted secrets
|
||||
```
|
||||
|
||||
## Host Configuration Pattern
|
||||
|
||||
### Incorrect: Everything in one file
|
||||
|
||||
```nix
|
||||
# hosts/laptop/default.nix
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
# Hardware config (copied from hardware-configuration.nix)
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" ];
|
||||
# ... 50 lines of hardware config ...
|
||||
|
||||
# Network config
|
||||
networking.hostName = "laptop";
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
# User config
|
||||
users.users.john = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "wheel" "networkmanager" ];
|
||||
};
|
||||
|
||||
# Packages
|
||||
environment.systemPackages = with pkgs; [ vim git wget ];
|
||||
|
||||
# Services
|
||||
services.openssh.enable = true;
|
||||
|
||||
# Home Manager
|
||||
imports = [
|
||||
./home.nix # Or inline the entire home config
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
**Problems:**
|
||||
- Hardware config duplicated (should import hardware-configuration.nix)
|
||||
- User config duplicated across hosts
|
||||
- No shared configuration
|
||||
- Hard to maintain
|
||||
|
||||
### Correct: Modular structure
|
||||
|
||||
```nix
|
||||
# hosts/laptop/default.nix
|
||||
{ inputs, pkgs, pkgs-stable, system, ... }:
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix # Import hardware config
|
||||
../base.nix # Import shared config
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.john = import ./home.nix;
|
||||
home-manager.extraSpecialArgs = {
|
||||
inherit inputs pkgs-stable system;
|
||||
};
|
||||
nixpkgs.overlays = [ inputs.some-overlay.overlays.default ];
|
||||
}
|
||||
];
|
||||
|
||||
# Host-specific config only
|
||||
networking.hostName = "laptop";
|
||||
}
|
||||
```
|
||||
|
||||
## Shared Base Configuration
|
||||
|
||||
```nix
|
||||
# hosts/base.nix
|
||||
{ config, pkgs, inputs, ... }:
|
||||
{
|
||||
# Network
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
# Time and locale
|
||||
time.timeZone = "America/New_York";
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
# Users (shared across all hosts)
|
||||
users.users.john = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "wheel" "networkmanager" ];
|
||||
};
|
||||
|
||||
# Common packages
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim
|
||||
git
|
||||
wget
|
||||
tmux
|
||||
];
|
||||
|
||||
# Common services
|
||||
services.openssh.enable = true;
|
||||
|
||||
# Nix settings
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
}
|
||||
```
|
||||
|
||||
## Hardware Configuration
|
||||
|
||||
```nix
|
||||
# hosts/laptop/default.nix
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix # Generated by nixos-generate-config
|
||||
../base.nix
|
||||
# ...
|
||||
];
|
||||
|
||||
networking.hostName = "laptop";
|
||||
}
|
||||
```
|
||||
|
||||
**Important:** Don't edit `hardware-configuration.nix` manually. It's generated by `nixos-generate-config` and should be replaced when hardware changes.
|
||||
|
||||
## Home Manager Configuration
|
||||
|
||||
### Host-specific home.nix
|
||||
|
||||
```nix
|
||||
# hosts/laptop/home.nix
|
||||
{ config, pkgs, inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
../../home-manager/shell
|
||||
../../home-manager/applications
|
||||
../../home-manager/common.nix
|
||||
];
|
||||
|
||||
# Host-specific user config
|
||||
home.packages = with pkgs; [
|
||||
laptop-specific-package
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
### Shared Home Manager configs
|
||||
|
||||
```nix
|
||||
# home-manager/shell/default.nix
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
./fish
|
||||
./neovim
|
||||
./git
|
||||
];
|
||||
}
|
||||
|
||||
# home-manager/common.nix
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
jq
|
||||
ripgrep
|
||||
fzf
|
||||
];
|
||||
|
||||
programs.git.enable = true;
|
||||
programs.git.userName = "John Doe";
|
||||
programs.git.userEmail = "john@example.com";
|
||||
}
|
||||
```
|
||||
|
||||
## Multiple Hosts Example
|
||||
|
||||
```nix
|
||||
# flake.nix
|
||||
outputs = { self, nixpkgs, home-manager, ... }@inputs: {
|
||||
nixosConfigurations.laptop = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [ ./hosts/laptop ];
|
||||
};
|
||||
|
||||
nixosConfigurations.desktop = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [ ./hosts/desktop ];
|
||||
};
|
||||
|
||||
nixosConfigurations.server = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [ ./hosts/server ];
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
Each host uses the same `base.nix` but can override settings:
|
||||
|
||||
```nix
|
||||
# hosts/server/default.nix
|
||||
{ ... }:
|
||||
{
|
||||
imports = [ ../base.nix ./hardware-configuration.nix ];
|
||||
|
||||
# Override time zone for server
|
||||
time.timeZone = "UTC";
|
||||
|
||||
# Add server-specific packages
|
||||
environment.systemPackages = with pkgs; [
|
||||
htop
|
||||
iotop
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
## Module Pattern
|
||||
|
||||
For reusable functionality, create modules:
|
||||
|
||||
```nix
|
||||
# modules/docker.nix
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
virtualisation.docker = {
|
||||
enable = true;
|
||||
enableOnBoot = true;
|
||||
};
|
||||
|
||||
users.users.john.extraGroups = [ "docker" ];
|
||||
}
|
||||
```
|
||||
|
||||
Use in host config:
|
||||
|
||||
```nix
|
||||
# hosts/laptop/default.nix
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
../base.nix
|
||||
../../modules/docker # Import module
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
## Common Mistakes
|
||||
|
||||
1. **Editing hardware-configuration.nix**: Changes are lost when regenerating. Put host-specific config in `default.nix` instead.
|
||||
|
||||
2. **Duplicating config across hosts**: Use `base.nix` or modules for shared configuration.
|
||||
|
||||
3. **Not separating host-specific and user-specific**: Keep host config in `hosts/*/default.nix`, user config in `home.nix` or `home-manager/`.
|
||||
|
||||
4. **Mixing concerns**: Don't put shell config in system packages. Use Home Manager for user-level packages.
|
||||
|
||||
## Quick Checklist
|
||||
|
||||
- [ ] Each host imports hardware-configuration.nix
|
||||
- [ ] Shared config in base.nix or modules
|
||||
- [ ] Home Manager configured in host file
|
||||
- [ ] Host-specific settings only in host's default.nix
|
||||
- [ ] User config in home.nix or home-manager/
|
||||
- [ ] No duplication of hardware config
|
||||
- [ ] No duplication of user config
|
||||
@@ -1,132 +0,0 @@
|
||||
---
|
||||
title: Overlay Scope and useGlobalPkgs
|
||||
impact: CRITICAL
|
||||
impactDescription: The most common issue: overlays don't apply with useGlobalPkgs=true
|
||||
tags: overlay,useglobalpkgs,home-manager,scope
|
||||
---
|
||||
|
||||
|
||||
## Why This Matters
|
||||
|
||||
When using Home Manager with NixOS, the `useGlobalPkgs` setting determines where overlay definitions must be placed. Defining overlays in the wrong location means they simply don't apply, leading to "package not found" errors even when the overlay syntax is correct.
|
||||
|
||||
## The Problem
|
||||
|
||||
When `useGlobalPkgs = true`, Home Manager uses NixOS's global `pkgs` instance. Overlays defined in `home.nix` are ignored because Home Manager isn't creating its own `pkgs` - it's using the system one.
|
||||
|
||||
## Incorrect: Overlay in home.nix with useGlobalPkgs=true
|
||||
|
||||
```nix
|
||||
# hosts/home/default.nix
|
||||
{
|
||||
home-manager.useGlobalPkgs = true; # Using system pkgs
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.chumeng = import ./home.nix;
|
||||
}
|
||||
|
||||
# home-manager/home.nix
|
||||
{ config, pkgs, inputs, ... }:
|
||||
{
|
||||
# ❌ This overlay is IGNORED when useGlobalPkgs = true!
|
||||
nixpkgs.overlays = [ inputs.claude-code.overlays.default ];
|
||||
|
||||
home.packages = with pkgs; [
|
||||
claude-code # Error: attribute 'claude-code' not found
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
**Why it fails:** When `useGlobalPkgs = true`, the `nixpkgs.overlays` line in `home.nix` has no effect. Home Manager isn't creating its own `pkgs`, so it can't apply overlays to one.
|
||||
|
||||
## Correct: Overlay in host home-manager block
|
||||
|
||||
```nix
|
||||
# hosts/home/default.nix
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.chumeng = import ./home.nix;
|
||||
home-manager.extraSpecialArgs = { inherit inputs pkgs-stable system; };
|
||||
# ✅ Overlay defined HERE affects the global pkgs
|
||||
nixpkgs.overlays = [ inputs.claude-code.overlays.default ];
|
||||
}
|
||||
|
||||
# home-manager/home.nix
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
# No overlay definition needed here
|
||||
home.packages = with pkgs; [
|
||||
claude-code # ✅ Works! Found via overlay
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
**Why it works:** The overlay is defined where Home Manager configures the `pkgs` instance it will use. When `useGlobalPkgs = true`, this means the overlay is applied to the system's package set.
|
||||
|
||||
## Alternative: Set useGlobalPkgs=false
|
||||
|
||||
If you want to define overlays in `home.nix`, set `useGlobalPkgs = false`:
|
||||
|
||||
```nix
|
||||
# hosts/home/default.nix
|
||||
{
|
||||
home-manager.useGlobalPkgs = false; # Home Manager creates own pkgs
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.chumeng = import ./home.nix;
|
||||
}
|
||||
|
||||
# home-manager/home.nix
|
||||
{ pkgs, inputs, ... }:
|
||||
{
|
||||
# ✅ This works when useGlobalPkgs = false
|
||||
nixpkgs.overlays = [ inputs.claude-code.overlays.default ];
|
||||
|
||||
home.packages = with pkgs; [
|
||||
claude-code # ✅ Works! Found via overlay
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
**Trade-off:** This creates a separate package set for Home Manager, which means packages are built twice (once for system, once for Home Manager). Only use this when you truly need separate package sets.
|
||||
|
||||
## Decision Matrix
|
||||
|
||||
| Your Need | useGlobalPkgs | Overlay Location |
|
||||
|-----------|---------------|------------------|
|
||||
| Single-user system, efficiency | `true` | Host home-manager block |
|
||||
| Multi-user, different packages per user | `false` | User's home.nix |
|
||||
| Custom packages system-wide | `true` | System nixpkgs.overlays |
|
||||
| Quick prototype | `false` | User's home.nix |
|
||||
|
||||
## Verification
|
||||
|
||||
After adding an overlay, verify it works:
|
||||
|
||||
```bash
|
||||
# Build the configuration
|
||||
nixos-rebuild build --flake .#hostname
|
||||
|
||||
# Check if package is available
|
||||
./result/sw/bin/package-name --version
|
||||
|
||||
# Or use nix repl to verify
|
||||
nix repl
|
||||
nix-repl> :l flake.nix
|
||||
nix-repl> homeConfigs.hostname.config.home-manager.users.username.pkgs.package-name
|
||||
```
|
||||
|
||||
## Common Mistakes
|
||||
|
||||
1. **Adding overlay both places**: Don't define the same overlay in both host config AND home.nix. It will apply twice and may cause conflicts.
|
||||
|
||||
2. **Forgetting to pass inputs**: If your overlay needs `inputs.*`, ensure `inputs` is in `extraSpecialArgs`:
|
||||
```nix
|
||||
home-manager.extraSpecialArgs = { inherit inputs; };
|
||||
```
|
||||
|
||||
3. **Not rebuilding system**: Overlays defined in host config require full system rebuild, not just `home-manager switch`.
|
||||
|
||||
## References
|
||||
|
||||
- [Home Manager Manual - useGlobalPkgs](https://nix-community.github.io/home-manager/options.html#opt-home-manager.useGlobalPkgs)
|
||||
- [NixOS Manual - Overlays](https://nixos.org/manual/nixos/stable/options#opt-nixpkgs.overlays)
|
||||
@@ -1,264 +0,0 @@
|
||||
---
|
||||
title: Package Installation Best Practices
|
||||
impact: HIGH
|
||||
impactDescription: Avoids conflicts and confusion about where to install packages
|
||||
tags: packages,system,user,home-manager
|
||||
---
|
||||
|
||||
|
||||
## Why This Matters
|
||||
|
||||
Knowing where and how to install packages prevents conflicts, ensures proper updates, and maintains separation between system and user packages.
|
||||
|
||||
## System vs User Packages
|
||||
|
||||
### System Packages (NixOS)
|
||||
|
||||
Use for:
|
||||
- System services (servers, daemons)
|
||||
- Packages needed by all users
|
||||
- Hardware-related packages (drivers, firmware)
|
||||
- System-wide utilities
|
||||
|
||||
```nix
|
||||
# hosts/base.nix or host-specific default.nix
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim # Available to all users
|
||||
git
|
||||
wget
|
||||
tmux
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
### User Packages (Home Manager)
|
||||
|
||||
Use for:
|
||||
- User-specific applications
|
||||
- Desktop applications
|
||||
- Development tools (user-specific)
|
||||
- Shell configurations
|
||||
|
||||
```nix
|
||||
# home-manager/home.nix or sub-configs
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
vscode # User-specific
|
||||
chrome
|
||||
slack
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
## Installing from Different Nixpkgs Channels
|
||||
|
||||
### Using unstable packages
|
||||
|
||||
```nix
|
||||
# flake.nix - default is unstable
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-25.05";
|
||||
};
|
||||
|
||||
# Host config
|
||||
{ pkgs, pkgs-stable, ... }:
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim # From unstable (default)
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs-stable; [
|
||||
vim # From stable
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
### Using overlays for custom packages
|
||||
|
||||
```nix
|
||||
# hosts/home/default.nix
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
inputs.custom-overlay.overlays.default
|
||||
];
|
||||
}
|
||||
|
||||
# Now packages from overlay are available
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
custom-package # From overlay
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
## Conditional Package Installation
|
||||
|
||||
### Based on host
|
||||
|
||||
```nix
|
||||
# hosts/laptop/default.nix
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
powertop # Laptop-specific
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
### Based on GUI environment
|
||||
|
||||
```nix
|
||||
# hosts/base.nix
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = with pkgs;
|
||||
(if config.services.xserver.enable then [
|
||||
firefox
|
||||
dmenu
|
||||
] else [
|
||||
tmux
|
||||
htop
|
||||
]);
|
||||
}
|
||||
```
|
||||
|
||||
### Based on architecture
|
||||
|
||||
```nix
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = with pkgs;
|
||||
(if pkgs.system == "x86_64-linux" then [
|
||||
docker-compose
|
||||
] else [
|
||||
podman
|
||||
]);
|
||||
}
|
||||
```
|
||||
|
||||
## Wrapper Scripts
|
||||
|
||||
Modify package behavior with wrappers:
|
||||
|
||||
```nix
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
(symlinkJoin {
|
||||
name = "google-chrome-with-flags";
|
||||
paths = [ google-chrome ];
|
||||
buildInputs = [ makeWrapper ];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/google-chrome-stable \
|
||||
--add-flags "--disable-gpu" \
|
||||
--add-flags "--disable-features=UseChromeOSDirectVideoDecoder"
|
||||
'';
|
||||
})
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
## Common Mistakes
|
||||
|
||||
### Installing user packages system-wide
|
||||
|
||||
```nix
|
||||
# ❌ WRONG: User-specific package in system config
|
||||
environment.systemPackages = with pkgs; [
|
||||
vscode # Should be in Home Manager
|
||||
slack # Should be in Home Manager
|
||||
];
|
||||
|
||||
# ✅ CORRECT: User packages in Home Manager
|
||||
# home-manager/home.nix
|
||||
home.packages = with pkgs; [
|
||||
vscode
|
||||
slack
|
||||
];
|
||||
```
|
||||
|
||||
### Installing packages in wrong location
|
||||
|
||||
```nix
|
||||
# ❌ WRONG: System package in Home Manager
|
||||
# home-manager/home.nix
|
||||
home.packages = with pkgs; [
|
||||
docker # Should be system package (needs service)
|
||||
];
|
||||
|
||||
# ✅ CORRECT: System package in system config
|
||||
# hosts/base.nix
|
||||
environment.systemPackages = with pkgs; [
|
||||
docker
|
||||
];
|
||||
virtualisation.docker.enable = true;
|
||||
```
|
||||
|
||||
### Not using lists for multiple packages
|
||||
|
||||
```nix
|
||||
# ❌ WRONG: Individual statements
|
||||
environment.systemPackages = [ pkgs.vim ];
|
||||
environment.systemPackages = [ pkgs.git ]; # Overwrites previous!
|
||||
|
||||
# ✅ CORRECT: Single list
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim
|
||||
git
|
||||
];
|
||||
```
|
||||
|
||||
## Package Updates
|
||||
|
||||
### Update all packages
|
||||
|
||||
```bash
|
||||
nix flake update
|
||||
nixos-rebuild switch --flake .#hostname
|
||||
```
|
||||
|
||||
### Update specific input
|
||||
|
||||
```bash
|
||||
nix flake lock update-input nixpkgs
|
||||
nixos-rebuild switch --flake .#hostname
|
||||
```
|
||||
|
||||
### Pin to specific version
|
||||
|
||||
```nix
|
||||
# flake.nix
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05"; # Pinned to release
|
||||
# Or specific commit:
|
||||
# nixpkgs.url = "github:nixos/nixpkgs/a1b2c3d...";
|
||||
};
|
||||
```
|
||||
|
||||
## Finding Packages
|
||||
|
||||
```bash
|
||||
# Search for package
|
||||
nix search nixpkgs package-name
|
||||
|
||||
# Get package info
|
||||
nix eval nixpkgs#legacyPackages.x86_64-linux.package-name.meta.description
|
||||
|
||||
# Check what package provides a file
|
||||
nix-locate bin/vim
|
||||
```
|
||||
|
||||
## Quick Reference
|
||||
|
||||
| Package Type | Location | Example |
|
||||
|-------------|----------|---------|
|
||||
| System service | system config | `virtualisation.docker.enable = true` |
|
||||
| System utility | system config | `environment.systemPackages = [ vim ]` |
|
||||
| User app | Home Manager | `home.packages = [ vscode ]` |
|
||||
| Development tool | Either (user usually) | `home.packages = [ nodejs ]` |
|
||||
| Driver/firmware | system config | `hardware.graphics.enable = true` |
|
||||
@@ -1,326 +0,0 @@
|
||||
---
|
||||
title: Troubleshooting Configuration Issues
|
||||
impact: MEDIUM
|
||||
impactDescription: Systematic debugging approach for configuration issues
|
||||
tags: debugging,errors,troubleshooting,verification
|
||||
---
|
||||
|
||||
|
||||
## Why This Matters
|
||||
|
||||
Knowing how to systematically debug NixOS configurations saves hours of frustration and prevents making random changes hoping something works.
|
||||
|
||||
## General Approach
|
||||
|
||||
Follow this order when debugging:
|
||||
|
||||
1. **Read error messages completely** - They usually tell you exactly what's wrong
|
||||
2. **Verify syntax** - Check for missing brackets, quotes, commas
|
||||
3. **Validate config** - Use `nixos-rebuild test` first
|
||||
4. **Check scope** - Is overlay/module in correct location?
|
||||
5. **Trace dependencies** - Are required inputs/imports present?
|
||||
|
||||
## Common Error Patterns
|
||||
|
||||
### "undefined variable 'inputs'"
|
||||
|
||||
**Cause:** `inputs` not passed via `specialArgs`.
|
||||
|
||||
**Fix:**
|
||||
```nix
|
||||
# flake.nix
|
||||
outputs = { self, nixpkgs, ... }@inputs:
|
||||
{
|
||||
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs; }; # Add this
|
||||
modules = [ ./hosts/myhost ];
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
### "attribute 'package-name' not found"
|
||||
|
||||
**Cause:** Package doesn't exist, or overlay not applied.
|
||||
|
||||
**Debug:**
|
||||
```bash
|
||||
# Check if package exists in nixpkgs
|
||||
nix search nixpkgs package-name
|
||||
|
||||
# Check if overlay is defined
|
||||
nix eval .#nixosConfigurations.myhost.config.nixpkgs.overlays
|
||||
|
||||
# Verify package in your config's pkgs
|
||||
nix repl
|
||||
nix-repl> :l flake.nix
|
||||
nix-repl> myhost.config.environment.systemPackages
|
||||
```
|
||||
|
||||
**Fix:**
|
||||
- If overlay issue: Move to correct location (see [overlay-scope.md](overlay-scope.md))
|
||||
- If missing package: Use correct package name or add overlay
|
||||
|
||||
### "error: The option 'some.option' does not exist"
|
||||
|
||||
**Cause:** Typo in option name, or option not available in your nixpkgs version.
|
||||
|
||||
**Debug:**
|
||||
```bash
|
||||
# Search for option
|
||||
nixos-options | grep some-option
|
||||
|
||||
# Check option in current config
|
||||
nix eval .#nixosConfigurations.myhost.config.some.option
|
||||
```
|
||||
|
||||
**Fix:**
|
||||
- Check option name spelling
|
||||
- Verify nixpkgs version has this option
|
||||
- Read option documentation for correct usage
|
||||
|
||||
### "infinite recursion"
|
||||
|
||||
**Cause:** Circular dependency in config.
|
||||
|
||||
**Debug:**
|
||||
```bash
|
||||
# Use --show-trace to see where
|
||||
nixos-rebuild build --flake .#hostname --show-trace
|
||||
```
|
||||
|
||||
**Fix:**
|
||||
- Look for mutual dependencies
|
||||
- Use `mkBefore`/`mkAfter` for ordering
|
||||
- Break circular reference
|
||||
|
||||
### "hash mismatch" in flake.lock
|
||||
|
||||
**Cause:** Local changes or outdated lock file.
|
||||
|
||||
**Fix:**
|
||||
```bash
|
||||
# Update flake lock
|
||||
nix flake update
|
||||
|
||||
# Or update specific input
|
||||
nix flake lock update-input nixpkgs
|
||||
```
|
||||
|
||||
## Overlay Not Applied
|
||||
|
||||
**Symptom:** Package from overlay not found.
|
||||
|
||||
**Debug steps:**
|
||||
|
||||
1. Check overlay definition:
|
||||
```bash
|
||||
nix eval .#nixosConfigurations.myhost.config.nixpkgs.overlays
|
||||
```
|
||||
|
||||
2. Check overlay location:
|
||||
```bash
|
||||
# If useGlobalPkgs = true, overlay should be here:
|
||||
grep -r "nixpkgs.overlays" hosts/myhost/default.nix
|
||||
|
||||
# NOT here:
|
||||
grep -r "nixpkgs.overlays" home-manager/home.nix
|
||||
```
|
||||
|
||||
3. Verify overlay input:
|
||||
```bash
|
||||
nix flake metadata
|
||||
# Look for your overlay input
|
||||
```
|
||||
|
||||
**Fix:** See [overlay-scope.md](overlay-scope.md)
|
||||
|
||||
## Configuration Changes Not Applying
|
||||
|
||||
**Symptom:** Edit config, rebuild, but nothing changes.
|
||||
|
||||
**Debug steps:**
|
||||
|
||||
1. Verify rebuild ran successfully:
|
||||
```bash
|
||||
sudo nixos-rebuild switch --flake .#hostname
|
||||
# Look for "success" message
|
||||
```
|
||||
|
||||
2. Check current generation:
|
||||
```bash
|
||||
sudo nix-env --list-generations --profile /nix/var/nix/profiles/system
|
||||
```
|
||||
|
||||
3. Verify new generation is active:
|
||||
```bash
|
||||
sudo nixos-version
|
||||
# Should show timestamp of recent rebuild
|
||||
```
|
||||
|
||||
4. Check if option actually changed:
|
||||
```bash
|
||||
nix eval .#nixosConfigurations.myhost.config.some.option
|
||||
```
|
||||
|
||||
**Fix:**
|
||||
- Ensure rebuild succeeded
|
||||
- Check if service needs restart: `systemctl restart service-name`
|
||||
- For Home Manager: `home-manager switch` (or `sudo nixos-rebuild switch` if integrated)
|
||||
|
||||
## Build Fails with "store collision"
|
||||
|
||||
**Symptom:** Multiple packages trying to write to same path.
|
||||
|
||||
**Cause:** Usually duplicate package declarations or conflicting modules.
|
||||
|
||||
**Fix:**
|
||||
- Remove duplicate package declarations
|
||||
- Check for conflicting modules
|
||||
- Use `--show-trace` to identify conflicting packages
|
||||
|
||||
## Verification Commands
|
||||
|
||||
### Check configuration without building
|
||||
|
||||
```bash
|
||||
# Check syntax
|
||||
nix flake check
|
||||
|
||||
# Dry run build
|
||||
nixos-rebuild build --flake .#hostname --dry-run
|
||||
|
||||
# Evaluate specific option
|
||||
nix eval .#nixosConfigurations.myhost.config.environment.systemPackages
|
||||
```
|
||||
|
||||
### Test configuration safely
|
||||
|
||||
```bash
|
||||
# Build without activating
|
||||
nixos-rebuild build --flake .#hostname
|
||||
|
||||
# Test configuration (rollback on reboot)
|
||||
nixos-rebuild test --flake .#hostname
|
||||
|
||||
# Switch (persistent)
|
||||
nixos-rebuild switch --flake .#hostname
|
||||
```
|
||||
|
||||
### Compare generations
|
||||
|
||||
```bash
|
||||
# List system generations
|
||||
sudo nix-env --list-generations --profile /nix/var/nix/profiles/system
|
||||
|
||||
# List Home Manager generations
|
||||
home-manager generations
|
||||
|
||||
# Compare configurations
|
||||
sudo nix diff-closures /nix/var/nix/profiles/system-*-link
|
||||
```
|
||||
|
||||
## Useful Tools
|
||||
|
||||
### nix repl
|
||||
|
||||
```bash
|
||||
nix repl
|
||||
nix-repl> :l flake.nix # Load flake
|
||||
nix-repl> myhost.config.environment.systemPackages # Access config
|
||||
nix-repl> :b myhost.config.system.build.toplevel # Build
|
||||
```
|
||||
|
||||
### nixos-version
|
||||
|
||||
```bash
|
||||
# Check current system version
|
||||
nixos-version
|
||||
|
||||
# Should show something like:
|
||||
# 25.05.20250123.abc1234
|
||||
```
|
||||
|
||||
### journalctl
|
||||
|
||||
```bash
|
||||
# Check service logs for failures
|
||||
sudo journalctl -xe
|
||||
|
||||
# Check NixOS rebuild logs
|
||||
sudo journalctl -u nixos-rebuild
|
||||
```
|
||||
|
||||
## Getting Help
|
||||
|
||||
When asking for help, provide:
|
||||
|
||||
1. **Full error message** (not just "it doesn't work")
|
||||
2. **Minimal reproducible example**
|
||||
3. **NixOS version**: `nixos-version`
|
||||
4. **Relevant config files**
|
||||
5. **What you've tried**
|
||||
6. **Expected vs actual behavior**
|
||||
|
||||
Useful commands:
|
||||
```bash
|
||||
# Show system info
|
||||
nixos-version
|
||||
uname -a
|
||||
|
||||
# Show flake info
|
||||
nix flake metadata
|
||||
|
||||
# Export config for sharing
|
||||
nixos-rebuild build --flake .#hostname
|
||||
nix-store -qR result > system-closure
|
||||
```
|
||||
|
||||
## Common Debugging Workflows
|
||||
|
||||
### Package not found
|
||||
|
||||
```bash
|
||||
# 1. Search for package
|
||||
nix search nixpkgs package-name
|
||||
|
||||
# 2. Check if it's available for your system
|
||||
nix eval nixpkgs#legacyPackages.x86_64-linux.package-name
|
||||
|
||||
# 3. Check your overlays
|
||||
nix eval .#nixosConfigurations.myhost.config.nixpkgs.overlays
|
||||
|
||||
# 4. Check if overlay provides it
|
||||
nix eval .#packages.x86_64-linux.package-name
|
||||
```
|
||||
|
||||
### Overlay not applying
|
||||
|
||||
```bash
|
||||
# 1. Verify overlay is defined
|
||||
grep -r "overlays" hosts/myhost/
|
||||
|
||||
# 2. Check useGlobalPkgs setting
|
||||
grep "useGlobalPkgs" hosts/myhost/default.nix
|
||||
|
||||
# 3. Evaluate overlay
|
||||
nix eval .#nixosConfigurations.myhost.config.nixpkgs.overlays
|
||||
|
||||
# 4. Test package directly
|
||||
nix build .#packages.x86_64-linux.package-name
|
||||
```
|
||||
|
||||
### Service not starting
|
||||
|
||||
```bash
|
||||
# 1. Check service status
|
||||
systemctl status service-name
|
||||
|
||||
# 2. View service logs
|
||||
journalctl -xeu service-name
|
||||
|
||||
# 3. Check service config
|
||||
nixos-rebuild build --flake .#hostname --show-trace
|
||||
|
||||
# 4. Test service manually
|
||||
/path/to/service-binary --verbose
|
||||
```
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -7,5 +7,3 @@ BrewFile.lock.json
|
||||
/nix-shells/macos-vm/
|
||||
|
||||
logs/
|
||||
|
||||
openclaw/.npm-global/
|
||||
@@ -1 +0,0 @@
|
||||
../../.agents/skills/find-skills
|
||||
@@ -1 +0,0 @@
|
||||
../../.agents/skills/nix-best-practices
|
||||
@@ -1 +0,0 @@
|
||||
../../.agents/skills/nixos-best-practices
|
||||
11
AGENTS.md
11
AGENTS.md
@@ -1,11 +0,0 @@
|
||||
Use idiomatic nix.
|
||||
|
||||
If needed, read the appropriate entries of the following manuals:
|
||||
- man configuration.nix
|
||||
- man home-configuration.nix
|
||||
- ... among other resources
|
||||
|
||||
Do not read the entire manual at once, instead search only for what you need.
|
||||
|
||||
After editing nix configurations, always run `nix flake check nixos/` to check for errors.
|
||||
Do NOT attempt to rebuild the system, let the user handle that.
|
||||
@@ -1,7 +1,7 @@
|
||||
# Trude's Dotfiles
|
||||
|
||||
<p align="center">
|
||||
<img src="images/logo-circle.png" alt="Logo Circle" width="200" align="middle">
|
||||
<img src="images/dotfiles-logo.png" alt="Logo Circle" width="200" align="middle">
|
||||
</p>
|
||||
|
||||
|
||||
@@ -13,10 +13,5 @@ The 'main' branch is my current configuration, while others serve as an archive
|
||||
|
||||
To install my current configuration, run:
|
||||
```sh
|
||||
sudo nixos-rebuild switch --flake ./nixos#TrudePC
|
||||
```
|
||||
|
||||
Update NixOS:
|
||||
```sh
|
||||
sudo nix flake update --flake ./nixos
|
||||
sh <(curl -s https://git.trude.dev/trude/dotfiles/raw/branch/main/install.sh)
|
||||
```
|
||||
|
||||
123
dconf-settings.ini
Normal file
123
dconf-settings.ini
Normal file
@@ -0,0 +1,123 @@
|
||||
[org/gnome/desktop/background]
|
||||
color-shading-type='solid'
|
||||
picture-options='zoom'
|
||||
picture-uri='file:///usr/share/backgrounds/gnome/bg.png'
|
||||
picture-uri-dark='file:///usr/share/backgrounds/gnome/bg-dark.svg'
|
||||
primary-color='#000000'
|
||||
secondary-color='#000000'
|
||||
|
||||
[org/gnome/desktop/input-sources]
|
||||
show-all-sources=true
|
||||
sources=[('xkb', 'us+altgr-intl')]
|
||||
xkb-options=['terminate:ctrl_alt_bksp']
|
||||
|
||||
[org/gnome/desktop/interface]
|
||||
color-scheme='prefer-dark'
|
||||
cursor-size=22
|
||||
cursor-theme='GoogleDot-Black'
|
||||
enable-hot-corners=false
|
||||
font-name='Adwaita Sans 11'
|
||||
gtk-theme='Adwaita'
|
||||
document-font-name='Adwaita Sans 11'
|
||||
icon-theme='Adwaita'
|
||||
monospace-font-name='JetBrainsMono NF 13'
|
||||
clock-format = '12h'
|
||||
accent-color = 'teal'
|
||||
show-battery-percentage = true
|
||||
|
||||
[org/gnome/desktop/screensaver]
|
||||
color-shading-type='solid'
|
||||
picture-options='zoom'
|
||||
picture-uri='file:///usr/share/backgrounds/gnome/bg.png'
|
||||
primary-color='#000000'
|
||||
secondary-color='#000000'
|
||||
|
||||
[org/gnome/desktop/wm/preferences]
|
||||
button-layout=':minimize,close'
|
||||
resize-with-right-button=true
|
||||
|
||||
[org/gnome/mutter]
|
||||
edge-tiling=true
|
||||
dynamic-workspaces=true
|
||||
|
||||
[org/gnome/shell]
|
||||
disabled-extensions=['tiling-assistant@ubuntu.com', 'ubuntu-dock@ubuntu.com', 'ding@rastersoft.com']
|
||||
enabled-extensions=['gsconnect@andyholmes.github.io', 'appindicatorsupport@rgcjonas.gmail.com', 'caffeine@patapon.info', 'Vitals@CoreCoding.com']
|
||||
|
||||
[org/gnome/shell/extensions/dash-to-dock]
|
||||
dash-max-icon-size=32
|
||||
dock-fixed=false
|
||||
dock-position='BOTTOM'
|
||||
extend-height=false
|
||||
|
||||
[org/gnome/shell/extensions/ding]
|
||||
check-x11wayland=true
|
||||
icon-size='small'
|
||||
show-home=false
|
||||
|
||||
[org/gnome/shell/world-clocks]
|
||||
locations=@av []
|
||||
|
||||
[org/gnome/Console]
|
||||
use-system-font=false
|
||||
custom-font='JetBrainsMono Nerd Font 10'
|
||||
|
||||
[org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9]
|
||||
background-color='rgb(29,29,29)'
|
||||
cell-width-scale=1.0
|
||||
font='JetBrainsMono NF 10'
|
||||
foreground-color='rgb(208,207,204)'
|
||||
palette=['rgb(36,31,49)', 'rgb(192,28,40)', 'rgb(46,194,126)', 'rgb(245,194,17)', 'rgb(30,120,228)', 'rgb(152,65,187)', 'rgb(10,185,220)', 'rgb(192,191,188)', 'rgb(94,92,100)', 'rgb(237,51,59)', 'rgb(87,227,137)', 'rgb(248,228,92)', 'rgb(81,161,255)', 'rgb(192,97,203)', 'rgb(79,210,253)', 'rgb(246,245,244)']
|
||||
use-system-font=false
|
||||
use-theme-colors=false
|
||||
|
||||
[org/gnome/Ptyxis]
|
||||
cursor-shape='block'
|
||||
default-profile-uuid='e2f22120c44e38d269767ed967d0430c'
|
||||
font-name='JetBrainsMono Nerd Font 10'
|
||||
profile-uuids=['e2f22120c44e38d269767ed967d0430c']
|
||||
use-system-font=false
|
||||
|
||||
[org/gnome/Ptyxis/Profiles/e2f22120c44e38d269767ed967d0430c]
|
||||
bold-is-bright=false
|
||||
label='Trude'
|
||||
palette='Vs Code'
|
||||
|
||||
[org/gnome/settings-daemon/plugins/media-keys]
|
||||
mic-mute=['<Super>F9']
|
||||
next=['<Super>F8']
|
||||
play=['<Super>F7']
|
||||
previous=['<Super>F6']
|
||||
volume-down=['<Super>F10']
|
||||
volume-mute=['<Super>F11']
|
||||
volume-up=['<Super>F12']
|
||||
|
||||
[org/gnome/settings-daemon/plugins/color]
|
||||
night-light-enabled=true
|
||||
night-light-temperature=2700
|
||||
|
||||
[org/gnome/TextEditor]
|
||||
highlight-current-line=true
|
||||
show-map=true
|
||||
|
||||
[org/gnome/desktop/sound]
|
||||
event-sounds=true
|
||||
|
||||
[org/gnome/epiphany]
|
||||
use-google-search-suggestions=true
|
||||
default-search-engine='Google'
|
||||
|
||||
[org/gnome/epiphany/web]
|
||||
show-developer-actions=true
|
||||
remember-passwords=false
|
||||
|
||||
[org/gnome/shell/extensions/vitals]
|
||||
fixed-widths=false
|
||||
hot-sensors=['_memory_usage_', '_processor_usage_', '__temperature_max__']
|
||||
icon-style=1
|
||||
menu-centered=false
|
||||
position-in-panel=0
|
||||
show-battery=false
|
||||
show-gpu=true
|
||||
show-system=true
|
||||
use-higher-precision=false
|
||||
BIN
fonts/AdwaitaSans/AdwaitaSans-Italic.ttf
Normal file
BIN
fonts/AdwaitaSans/AdwaitaSans-Italic.ttf
Normal file
Binary file not shown.
BIN
fonts/AdwaitaSans/AdwaitaSans-Regular.ttf
Normal file
BIN
fonts/AdwaitaSans/AdwaitaSans-Regular.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-Bold.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-Bold.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-BoldItalic.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-BoldItalic.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-ExtraBold.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-ExtraBold.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-ExtraBoldItalic.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-ExtraBoldItalic.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-ExtraLight.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-ExtraLight.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-ExtraLightItalic.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-ExtraLightItalic.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-Italic.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-Italic.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-Light.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-Light.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-LightItalic.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-LightItalic.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-Medium.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-Medium.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-MediumItalic.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-MediumItalic.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-Regular.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-Regular.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-SemiBold.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-SemiBold.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-SemiBoldItalic.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-SemiBoldItalic.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-Thin.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-Thin.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-ThinItalic.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFont-ThinItalic.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-Bold.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-Bold.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-BoldItalic.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-BoldItalic.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-ExtraBold.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-ExtraBold.ttf
Normal file
Binary file not shown.
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-ExtraLight.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-ExtraLight.ttf
Normal file
Binary file not shown.
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-Italic.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-Italic.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-Light.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-Light.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-LightItalic.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-LightItalic.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-Medium.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-Medium.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-MediumItalic.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-MediumItalic.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-Regular.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-Regular.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-SemiBold.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-SemiBold.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-SemiBoldItalic.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-SemiBoldItalic.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-Thin.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-Thin.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-ThinItalic.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontMono-ThinItalic.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-Bold.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-Bold.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-BoldItalic.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-BoldItalic.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-ExtraBold.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-ExtraBold.ttf
Normal file
Binary file not shown.
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-ExtraLight.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-ExtraLight.ttf
Normal file
Binary file not shown.
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-Italic.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-Italic.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-Light.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-Light.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-LightItalic.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-LightItalic.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-Medium.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-Medium.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-MediumItalic.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-MediumItalic.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-Regular.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-Regular.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-SemiBold.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-SemiBold.ttf
Normal file
Binary file not shown.
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-Thin.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-Thin.ttf
Normal file
Binary file not shown.
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-ThinItalic.ttf
Normal file
BIN
fonts/JetBrainsMono/JetBrainsMonoNerdFontPropo-ThinItalic.ttf
Normal file
Binary file not shown.
35
home/.bashrc
Normal file
35
home/.bashrc
Normal file
@@ -0,0 +1,35 @@
|
||||
export EDITOR="gnome-text-editor"
|
||||
export PS1="\n[\[\e[37m\]\u\[\e[0m\]@\[\e[37;2m\]\h\[\e[0m\]] \[\e[1m\]\w \[\e[0;2m\]J:\[\e[0m\]\j\n\$ "
|
||||
|
||||
# Commands that should be applied only for interactive shells.
|
||||
[[ $- == *i* ]] || return
|
||||
|
||||
HISTFILESIZE=100000
|
||||
HISTSIZE=10000
|
||||
|
||||
shopt -s histappend
|
||||
shopt -s checkwinsize
|
||||
shopt -s extglob
|
||||
# shopt -s globstar
|
||||
# shopt -s checkjobs
|
||||
|
||||
alias l='ls -alh'
|
||||
alias ls='ls --color=auto'
|
||||
alias grep='grep --color=auto'
|
||||
alias ll='ls -lhi'
|
||||
alias ta='tmux attach'
|
||||
alias t='tmux'
|
||||
alias v='nvim'
|
||||
alias t='tmux'
|
||||
alias raid='sudo mdadm --detail /dev/md0'
|
||||
alias unp='unp -U' # Extract any file type
|
||||
|
||||
if command -v batcat 2>&1 >/dev/null; then
|
||||
alias bat=batcat
|
||||
fi
|
||||
|
||||
set completion-ignore-case On
|
||||
|
||||
export OFLAGS="--ozone-platform-hint=auto"
|
||||
|
||||
export PATH=$PATH:$HOME/.local/bin
|
||||
39
home/.config/tmux/tmux.conf
Normal file
39
home/.config/tmux/tmux.conf
Normal file
@@ -0,0 +1,39 @@
|
||||
bind-key C command-prompt -p "Name of new window: " "new-window -n '%%'"
|
||||
|
||||
set -g aggressive-resize on
|
||||
set -g base-index 1
|
||||
set -g pane-base-index 1
|
||||
set -g escape-time 250
|
||||
set-window-option -g mode-keys vi
|
||||
set -g mouse on
|
||||
set -g default-terminal "tmux-256color"
|
||||
|
||||
# hjkl pane traversal
|
||||
bind-key h select-pane -L
|
||||
bind-key j select-pane -D
|
||||
bind-key k select-pane -U
|
||||
bind-key l select-pane -R
|
||||
|
||||
# easy reload config
|
||||
bind-key r source-file ~/.config/tmux/tmux.conf \; display-message "Config reloaded."
|
||||
|
||||
# set window split
|
||||
bind-key v split-window -h -c "#{pane_current_path}"
|
||||
bind-key b split-window -v -c "#{pane_current_path}"
|
||||
|
||||
# Styling
|
||||
set-option -g status-position top
|
||||
set -g mode-style "fg=black,bg=orange"
|
||||
set-option -g pane-border-style fg=colour236
|
||||
set-option -g pane-active-border-style fg=orange
|
||||
set-window-option -g window-status-current-style fg=orange,bg=default,bright
|
||||
set-window-option -g window-status-style fg=colour244,bg=default
|
||||
set-window-option -g clock-mode-colour orange
|
||||
set-option -g status-style "bg=default,fg=white"
|
||||
set-option -g status-left ""
|
||||
set-option -g status-right '#[fg=orange]S:#[default]#S %d#[fg=orange]/#[default]%m#[fg=orange]/#[default]%Y %I:%M#[fg=orange]%P#[default]'
|
||||
set -g status-interval 1
|
||||
set -g status-right-length 60
|
||||
|
||||
set -g @cpu_high_fg_color "#[fg=#FF0000]"
|
||||
set -g @ram_high_fg_color "#[fg=#FF0000]"
|
||||
656
home/.config/vim/colors/codedark.vim
Normal file
656
home/.config/vim/colors/codedark.vim
Normal file
@@ -0,0 +1,656 @@
|
||||
" Vim Code Dark (color scheme)
|
||||
" https://github.com/tomasiser/vim-code-dark
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
set background=dark
|
||||
hi clear
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
let g:colors_name="codedark"
|
||||
|
||||
" Highlighting function (inspiration from https://github.com/chriskempson/base16-vim)
|
||||
if &t_Co >= 256
|
||||
let g:codedark_term256=1
|
||||
elseif !exists("g:codedark_term256")
|
||||
let g:codedark_term256=0
|
||||
endif
|
||||
fun! <sid>hi(group, fg, bg, attr, sp)
|
||||
if !empty(a:fg)
|
||||
exec "hi " . a:group . " guifg=" . a:fg.gui . " ctermfg=" . (g:codedark_term256 ? a:fg.cterm256 : a:fg.cterm)
|
||||
endif
|
||||
if !empty(a:bg)
|
||||
exec "hi " . a:group . " guibg=" . a:bg.gui . " ctermbg=" . (g:codedark_term256 ? a:bg.cterm256 : a:bg.cterm)
|
||||
endif
|
||||
if a:attr != ""
|
||||
exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr
|
||||
endif
|
||||
if !empty(a:sp)
|
||||
exec "hi " . a:group . " guisp=" . a:sp.gui
|
||||
endif
|
||||
endfun
|
||||
" Choose old or new name for Treesitter groups depending on Neovim version
|
||||
fun! <sid>hiTS(g_new, g_old, fg, bg, attr, sp)
|
||||
call <sid>hi(has("nvim-0.8.0") ? a:g_new : a:g_old, a:fg, a:bg, a:attr, a:sp)
|
||||
endfun
|
||||
|
||||
fun! <sid>hiTSlink(g_new, g_old, link)
|
||||
exec "hi! link " . (has("nvim-0.8.0") ? a:g_new : a:g_old) . " " . a:link
|
||||
endfun
|
||||
|
||||
" ------------------
|
||||
" Color definitions:
|
||||
" ------------------
|
||||
|
||||
" Terminal colors (base16):
|
||||
let s:cterm00 = "00"
|
||||
let s:cterm03 = "08"
|
||||
let s:cterm05 = "07"
|
||||
let s:cterm07 = "15"
|
||||
let s:cterm08 = "01"
|
||||
let s:cterm0A = "03"
|
||||
let s:cterm0B = "02"
|
||||
let s:cterm0C = "06"
|
||||
let s:cterm0D = "04"
|
||||
let s:cterm0E = "05"
|
||||
if exists('base16colorspace') && base16colorspace == "256"
|
||||
let s:cterm01 = "18"
|
||||
let s:cterm02 = "19"
|
||||
let s:cterm04 = "20"
|
||||
let s:cterm06 = "21"
|
||||
let s:cterm09 = "16"
|
||||
let s:cterm0F = "17"
|
||||
else
|
||||
let s:cterm01 = "00"
|
||||
let s:cterm02 = "08"
|
||||
let s:cterm04 = "07"
|
||||
let s:cterm06 = "07"
|
||||
let s:cterm09 = "06"
|
||||
let s:cterm0F = "03"
|
||||
endif
|
||||
|
||||
" General appearance colors:
|
||||
" (some of them may be unused)
|
||||
|
||||
" Transparent background
|
||||
if !exists("g:codedark_transparent")
|
||||
let g:codedark_transparent=0
|
||||
endif
|
||||
|
||||
if !exists("g:codedark_modern")
|
||||
let g:codedark_modern=0
|
||||
endif
|
||||
|
||||
let s:cdNone = {'gui': 'NONE', 'cterm': 'NONE', 'cterm256': 'NONE'}
|
||||
let s:cdFront = {'gui': '#D4D4D4', 'cterm': s:cterm05, 'cterm256': '188'}
|
||||
let s:cdBack = {'gui': '#1E1E1E', 'cterm': s:cterm00, 'cterm256': '234'}
|
||||
if g:codedark_modern | let s:cdBack = {'gui': '#1f1f1f', 'cterm': 'NONE', 'cterm256': '234'} | endif
|
||||
if g:codedark_transparent | let s:cdBack = {'gui': 'NONE', 'cterm': 'NONE', 'cterm256': 'NONE'} | endif
|
||||
|
||||
let s:cdTabCurrent = {'gui': '#1E1E1E', 'cterm': s:cterm00, 'cterm256': '234'}
|
||||
if g:codedark_modern | let s:cdTabCurrent = {'gui': '#1f1f1f', 'cterm': s:cterm00, 'cterm256': '234'} | endif
|
||||
let s:cdTabOther = {'gui': '#2D2D2D', 'cterm': s:cterm01, 'cterm256': '236'}
|
||||
if g:codedark_modern | let s:cdTabOther = {'gui': '#181818', 'cterm': s:cterm01, 'cterm256': '236'} | endif
|
||||
let s:cdTabOutside = {'gui': '#252526', 'cterm': s:cterm01, 'cterm256': '235'}
|
||||
if g:codedark_modern | let s:cdTabOutside = {'gui': '#181818', 'cterm': s:cterm01, 'cterm256': '236'} | endif
|
||||
|
||||
let s:cdLeftDark = {'gui': '#252526', 'cterm': s:cterm01, 'cterm256': '235'}
|
||||
let s:cdLeftMid = {'gui': '#373737', 'cterm': s:cterm03, 'cterm256': '237'}
|
||||
if g:codedark_modern | let s:cdLeftMid = {'gui': '#181818', 'cterm': 'NONE', 'cterm256': '237'} | endif
|
||||
let s:cdLeftLight = {'gui': '#3F3F46', 'cterm': s:cterm03, 'cterm256': '238'}
|
||||
|
||||
let s:cdPopupFront = {'gui': '#BBBBBB', 'cterm': s:cterm06, 'cterm256': '250'}
|
||||
let s:cdPopupBack = {'gui': '#2D2D30', 'cterm': s:cterm01, 'cterm256': '236'}
|
||||
let s:cdPopupHighlightBlue = {'gui': '#073655', 'cterm': s:cterm0D, 'cterm256': '24'}
|
||||
let s:cdPopupHighlightGray = {'gui': '#3D3D40', 'cterm': s:cterm03, 'cterm256': '237'}
|
||||
|
||||
let s:cdSplitLight = {'gui': '#898989', 'cterm': s:cterm04, 'cterm256': '245'}
|
||||
let s:cdSplitDark = {'gui': '#444444', 'cterm': s:cterm03, 'cterm256': '238'}
|
||||
let s:cdSplitThumb = {'gui': '#424242', 'cterm': s:cterm04, 'cterm256': '238'}
|
||||
|
||||
let s:cdCursorDarkDark = {'gui': '#222222', 'cterm': s:cterm01, 'cterm256': '235'}
|
||||
let s:cdCursorDark = {'gui': '#51504F', 'cterm': s:cterm03, 'cterm256': '239'}
|
||||
let s:cdCursorLight = {'gui': '#AEAFAD', 'cterm': s:cterm04, 'cterm256': '145'}
|
||||
let s:cdSelection = {'gui': '#264F78', 'cterm': s:cterm03, 'cterm256': '24'}
|
||||
let s:cdLineNumber = {'gui': '#5A5A5A', 'cterm': s:cterm04, 'cterm256': '240'}
|
||||
|
||||
let s:cdDiffRedDark = {'gui': '#4B1818', 'cterm': s:cterm08, 'cterm256': '52'}
|
||||
if g:codedark_modern | let s:cdDiffRedDark = {'gui': '#da3633', 'cterm': 'NONE', 'cterm256': '52'} | endif
|
||||
let s:cdDiffRedLight = {'gui': '#6F1313', 'cterm': s:cterm08, 'cterm256': '52'}
|
||||
let s:cdDiffRedLightLight = {'gui': '#FB0101', 'cterm': s:cterm08, 'cterm256': '09'}
|
||||
let s:cdDiffGreenDark = {'gui': '#373D29', 'cterm': s:cterm0B, 'cterm256': '237'}
|
||||
if g:codedark_modern | let s:cdDiffGreenDark = {'gui': '#238636', 'cterm': 'NONE', 'cterm256': '237'} | endif
|
||||
let s:cdDiffGreenLight = {'gui': '#4B5632', 'cterm': s:cterm09, 'cterm256': '58'}
|
||||
let s:cdDiffBlueLight = {'gui': '#87d7ff', 'cterm': s:cterm0C, 'cterm256': '117'}
|
||||
let s:cdDiffBlue = {'gui': '#005f87', 'cterm': s:cterm0D, 'cterm256': '24'}
|
||||
|
||||
let s:cdSearchCurrent = {'gui': '#4B5632', 'cterm': s:cterm09, 'cterm256': '58'}
|
||||
if g:codedark_modern | let s:cdSearchCurrent = {'gui': '#9e6a03', 'cterm': s:cterm09, 'cterm256': '58'} | endif
|
||||
let s:cdSearch = {'gui': '#773800', 'cterm': s:cterm03, 'cterm256': '94'}
|
||||
|
||||
" Syntax colors:
|
||||
|
||||
if !exists("g:codedark_conservative")
|
||||
let g:codedark_conservative=0
|
||||
endif
|
||||
|
||||
" Italicized comments
|
||||
if !exists("g:codedark_italics")
|
||||
let g:codedark_italics=0
|
||||
endif
|
||||
|
||||
let s:cdGray = {'gui': '#808080', 'cterm': s:cterm04, 'cterm256': '08'}
|
||||
let s:cdViolet = {'gui': '#646695', 'cterm': s:cterm04, 'cterm256': '60'}
|
||||
let s:cdBlue = {'gui': '#569CD6', 'cterm': s:cterm0D, 'cterm256': '75'}
|
||||
let s:cdDarkBlue = {'gui': '#223E55', 'cterm': s:cterm0D, 'cterm256': '73'}
|
||||
let s:cdLightBlue = {'gui': '#9CDCFE', 'cterm': s:cterm0C, 'cterm256': '117'}
|
||||
if g:codedark_conservative | let s:cdLightBlue = s:cdFront | endif
|
||||
let s:cdGreen = {'gui': '#6A9955', 'cterm': s:cterm0B, 'cterm256': '65'}
|
||||
let s:cdBlueGreen = {'gui': '#4EC9B0', 'cterm': s:cterm0F, 'cterm256': '43'}
|
||||
let s:cdLightGreen = {'gui': '#B5CEA8', 'cterm': s:cterm09, 'cterm256': '151'}
|
||||
let s:cdRed = {'gui': '#F44747', 'cterm': s:cterm08, 'cterm256': '203'}
|
||||
if g:codedark_modern | let s:cdRed = {'gui': '#f85149', 'cterm': s:cterm08, 'cterm256': '203'} | endif
|
||||
let s:cdOrange = {'gui': '#CE9178', 'cterm': s:cterm0F, 'cterm256': '173'}
|
||||
let s:cdLightRed = {'gui': '#D16969', 'cterm': s:cterm08, 'cterm256': '167'}
|
||||
if g:codedark_conservative | let s:cdLightRed = s:cdOrange | endif
|
||||
let s:cdYellowOrange = {'gui': '#D7BA7D', 'cterm': s:cterm0A, 'cterm256': '179'}
|
||||
let s:cdYellow = {'gui': '#DCDCAA', 'cterm': s:cterm0A, 'cterm256': '187'}
|
||||
if g:codedark_conservative | let s:cdYellow = s:cdFront | endif
|
||||
let s:cdPink = {'gui': '#C586C0', 'cterm': s:cterm0E, 'cterm256': '176'}
|
||||
if g:codedark_conservative | let s:cdPink = s:cdBlue | endif
|
||||
let s:cdSilver = {'gui': '#C0C0C0', 'cterm': s:cterm05, 'cterm256': '7'}
|
||||
|
||||
" UI (built-in)
|
||||
" <sid>hi(GROUP, FOREGROUND, BACKGROUND, ATTRIBUTE, SPECIAL)
|
||||
call <sid>hi('Normal', s:cdFront, s:cdBack, 'none', {})
|
||||
call <sid>hi('ColorColumn', {}, s:cdCursorDarkDark, 'none', {})
|
||||
call <sid>hi('Cursor', s:cdCursorDark, s:cdCursorLight, 'none', {})
|
||||
call <sid>hi('CursorLine', {}, s:cdCursorDarkDark, 'none', {})
|
||||
hi! link CursorColumn CursorLine
|
||||
call <sid>hi('Directory', s:cdBlue, s:cdNone, 'none', {})
|
||||
call <sid>hi('DiffAdd', s:cdFront, s:cdDiffGreenLight, 'none', {})
|
||||
call <sid>hi('DiffChange', s:cdFront, s:cdDiffBlue, 'none', {})
|
||||
call <sid>hi('DiffDelete', s:cdFront, s:cdDiffRedLight, 'none', {})
|
||||
call <sid>hi('DiffText', s:cdBack, s:cdDiffBlueLight, 'none', {})
|
||||
call <sid>hi('EndOfBuffer', s:cdLineNumber, s:cdBack, 'none', {})
|
||||
call <sid>hi('ErrorMsg', s:cdRed, s:cdBack, 'none', {})
|
||||
call <sid>hi('VertSplit', s:cdSplitDark, s:cdBack, 'none', {})
|
||||
call <sid>hi('Folded', s:cdLeftLight, s:cdLeftDark, 'underline', {})
|
||||
call <sid>hi('FoldColumn', s:cdLineNumber, s:cdBack, 'none', {})
|
||||
call <sid>hi('SignColumn', {}, s:cdBack, 'none', {})
|
||||
call <sid>hi('IncSearch', s:cdNone, s:cdSearchCurrent, 'none', {})
|
||||
call <sid>hi('LineNr', s:cdLineNumber, s:cdBack, 'none', {})
|
||||
call <sid>hi('CursorLineNr', s:cdPopupFront, s:cdBack, 'none', {})
|
||||
call <sid>hi('MatchParen', s:cdNone, s:cdCursorDark, 'none', {})
|
||||
call <sid>hi('ModeMsg', s:cdFront, s:cdLeftDark, 'none', {})
|
||||
hi! link MoreMsg ModeMsg
|
||||
call <sid>hi('NonText', s:cdLineNumber, s:cdNone, 'none', {})
|
||||
call <sid>hi('Pmenu', s:cdPopupFront, s:cdPopupBack, 'none', {})
|
||||
call <sid>hi('PmenuSel', s:cdPopupFront, s:cdPopupHighlightBlue, 'none', {})
|
||||
call <sid>hi('PmenuSbar', {}, s:cdPopupHighlightGray, 'none', {})
|
||||
call <sid>hi('PmenuThumb', {}, s:cdPopupFront, 'none', {})
|
||||
call <sid>hi('Question', s:cdBlue, s:cdBack, 'none', {})
|
||||
call <sid>hi('Search', s:cdNone, s:cdSearch, 'none', {})
|
||||
call <sid>hi('SpecialKey', s:cdLineNumber, s:cdNone, 'none', {})
|
||||
call <sid>hi('StatusLine', s:cdFront, s:cdLeftMid, 'none', {})
|
||||
call <sid>hi('StatusLineNC', s:cdFront, s:cdLeftDark, 'none', {})
|
||||
call <sid>hi('TabLine', s:cdFront, s:cdTabOther, 'none', {})
|
||||
call <sid>hi('TabLineFill', s:cdFront, s:cdTabOutside, 'none', {})
|
||||
call <sid>hi('TabLineSel', s:cdFront, s:cdTabCurrent, 'none', {})
|
||||
call <sid>hi('Title', s:cdNone, s:cdNone, 'bold', {})
|
||||
call <sid>hi('Visual', s:cdNone, s:cdSelection, 'none', {})
|
||||
hi! link VisualNOS Visual
|
||||
call <sid>hi('WarningMsg', s:cdOrange, s:cdBack, 'none', {})
|
||||
call <sid>hi('WildMenu', s:cdNone, s:cdSelection, 'none', {})
|
||||
call <sid>hi('netrwMarkFile', s:cdFront, s:cdSelection, 'none', {})
|
||||
|
||||
" Legacy groups for official git.vim and diff.vim syntax
|
||||
hi! link diffAdded DiffAdd
|
||||
hi! link diffChanged DiffChange
|
||||
hi! link diffRemoved DiffDelete
|
||||
|
||||
if g:codedark_italics | call <sid>hi('Comment', s:cdGreen, {}, 'italic', {}) | else | call <sid>hi('Comment', s:cdGreen, {}, 'none', {}) | endif
|
||||
|
||||
" SYNTAX HIGHLIGHT (built-in)
|
||||
call <sid>hi('Constant', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('String', s:cdOrange, {}, 'none', {})
|
||||
call <sid>hi('Character', s:cdOrange, {}, 'none', {})
|
||||
call <sid>hi('Number', s:cdLightGreen, {}, 'none', {})
|
||||
call <sid>hi('Boolean', s:cdBlue, {}, 'none', {})
|
||||
hi! link Float Number
|
||||
call <sid>hi('Identifier', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('Function', s:cdYellow, {}, 'none', {})
|
||||
call <sid>hi('Statement', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('Conditional', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('Repeat', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('Label', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('Operator', s:cdFront, {}, 'none', {})
|
||||
call <sid>hi('Keyword', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('Exception', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('PreProc', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('Include', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('Define', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('Macro', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('PreCondit', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('Type', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('StorageClass', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('Structure', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('Typedef', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('Special', s:cdYellowOrange, {}, 'none', {})
|
||||
call <sid>hi('SpecialChar', s:cdFront, {}, 'none', {})
|
||||
call <sid>hi('Tag', s:cdFront, {}, 'none', {})
|
||||
call <sid>hi('Delimiter', s:cdFront, {}, 'none', {})
|
||||
if g:codedark_italics | call <sid>hi('SpecialComment', s:cdGreen, {}, 'italic', {}) | else | call <sid>hi('SpecialComment', s:cdGreen, {}, 'none', {}) | endif
|
||||
call <sid>hi('Debug', s:cdFront, {}, 'none', {})
|
||||
call <sid>hi('Underlined', s:cdNone, {}, 'underline', {})
|
||||
call <sid>hi("Conceal", s:cdFront, s:cdBack, 'none', {})
|
||||
call <sid>hi('Ignore', s:cdBack, {}, 'none', {})
|
||||
call <sid>hi('Error', s:cdRed, s:cdBack, 'undercurl', s:cdRed)
|
||||
call <sid>hi('Todo', s:cdNone, s:cdLeftMid, 'none', {})
|
||||
call <sid>hi('SpellBad', s:cdRed, s:cdBack, 'undercurl', s:cdRed)
|
||||
call <sid>hi('SpellCap', s:cdRed, s:cdBack, 'undercurl', s:cdRed)
|
||||
call <sid>hi('SpellRare', s:cdRed, s:cdBack, 'undercurl', s:cdRed)
|
||||
call <sid>hi('SpellLocal', s:cdRed, s:cdBack, 'undercurl', s:cdRed)
|
||||
|
||||
" NEOVIM
|
||||
" Make neovim specific groups load only on Neovim
|
||||
if has("nvim")
|
||||
" nvim-treesitter/nvim-treesitter (github)
|
||||
call <sid>hiTSlink('@error', 'TSError', 'ErrorMsg')
|
||||
call <sid>hiTSlink('@punctuation.delimiter', 'TSPunctDelimiter', 'Delimiter')
|
||||
call <sid>hiTSlink('@punctuation.bracket', 'TSPunctBracket', 'Delimiter')
|
||||
call <sid>hiTSlink('@punctuation.special', 'TSPunctSpecial', 'Delimiter')
|
||||
" Constant
|
||||
call <sid>hiTS('@constant', 'TSConstant', s:cdYellow, {}, 'none', {})
|
||||
call <sid>hiTSlink('@constant.builtin', 'TSConstBuiltin', 'Constant')
|
||||
call <sid>hiTS('@constant.macro', 'TSConstMacro', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hiTSlink('@string', 'TSString', 'String')
|
||||
call <sid>hiTSlink('@string.regex', 'TSStringRegex', 'String')
|
||||
call <sid>hiTS('@string.escape', 'TSStringEscape', s:cdYellowOrange, {}, 'none', {})
|
||||
call <sid>hiTSlink('@character', 'TSCharacter', 'Character')
|
||||
call <sid>hiTSlink('@number', 'TSNumber', 'Number')
|
||||
call <sid>hiTS('@boolean', 'TSBoolean', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hiTSlink('@float', 'TSFloat', 'Float')
|
||||
call <sid>hiTS('@annotation', 'TSAnnotation', s:cdYellow, {}, 'none', {})
|
||||
call <sid>hiTS('@attribute', 'TSAttribute', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hiTS('@namespace', 'TSNamespace', s:cdBlueGreen, {}, 'none', {})
|
||||
" Functions
|
||||
call <sid>hiTSlink('@function.builtin', 'TSFuncBuiltin', 'Function')
|
||||
call <sid>hiTSlink('@function', 'TSFunction','Function')
|
||||
call <sid>hiTSlink('@function.macro', 'TSFuncMacro','Function')
|
||||
call <sid>hiTS('@parameter', 'TSParameter', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hiTS('@parameter.reference', 'TSParameterReference', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hiTS('@method', 'TSMethod', s:cdYellow, {}, 'none', {})
|
||||
call <sid>hiTS('@field', 'TSField', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hiTS('@property', 'TSProperty', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hiTS('@constructor', 'TSConstructor', s:cdBlueGreen, {}, 'none', {})
|
||||
" Keywords
|
||||
call <sid>hiTSlink('@conditional', 'TSConditional', 'Conditional')
|
||||
call <sid>hiTSlink('@repeat', 'TSRepeat', 'Repeat')
|
||||
call <sid>hiTS('@label', 'TSLabel', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hiTS('@keyword', 'TSKeyword', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hiTS('@keyword.function', 'TSKeywordFunction', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hiTS('@keyword.operator', 'TSKeywordOperator', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hiTS('@operator', 'TSOperator', s:cdFront, {}, 'none', {})
|
||||
call <sid>hiTS('@exception', 'TSException', s:cdPink, {}, 'none', {})
|
||||
call <sid>hiTS('@type', 'TSType', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hiTSlink('@type.builtin', 'TSTypeBuiltin', 'Type')
|
||||
call <sid>hi('TSStructure', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hiTSlink('@include', 'TSInclude', 'Include')
|
||||
" Variable
|
||||
call <sid>hiTS('@variable', 'TSVariable', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hiTS('@variable.builtin', 'TSVariableBuiltin', s:cdLightBlue, {}, 'none', {})
|
||||
" Text
|
||||
call <sid>hiTS('@text', 'TSText', s:cdFront, s:cdNone, 'bold', {})
|
||||
call <sid>hiTS('@text.strong', 'TSStrong', s:cdFront, s:cdNone, 'bold', {})
|
||||
call <sid>hiTS('@text.emphasis', 'TSEmphasis', s:cdYellowOrange, s:cdNone, 'italic', {})
|
||||
call <sid>hiTSlink('@text.underline', 'TSUnderline', 'Underlined')
|
||||
call <sid>hiTS('@text.title', 'TSTitle', s:cdBlue, {}, 'bold', {})
|
||||
call <sid>hiTS('@text.literal', 'TSLiteral', s:cdOrange, {}, 'none', {})
|
||||
call <sid>hiTS('@text.uri', 'TSURI', s:cdOrange, {}, 'none', {})
|
||||
" Tags
|
||||
call <sid>hiTS('@tag', 'TSTag', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hiTS('@tag.delimiter', 'TSTagDelimiter', s:cdGray, {}, 'none', {})
|
||||
|
||||
" hrsh7th/nvim-cmp (github)
|
||||
call <sid>hi('CmpItemAbbrDeprecated', s:cdGray, {}, 'none', {})
|
||||
call <sid>hi('CmpItemAbbrMatch', s:cdBlue, {}, 'none', {})
|
||||
hi! link CmpItemAbbrMatchFuzzy CmpItemAbbrMatch
|
||||
call <sid>hi('CmpItemKindVariable', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('CmpItemKindInterface', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('CmpItemKindText', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('CmpItemKindFunction', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('CmpItemKindMethod ', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('CmpItemKindKeyword', s:cdFront, {}, 'none', {})
|
||||
call <sid>hi('CmpItemKindProperty', s:cdFront, {}, 'none', {})
|
||||
call <sid>hi('CmpItemKindUnit', s:cdFront, {}, 'none', {})
|
||||
endif
|
||||
|
||||
" MARKDOWN (built-in)
|
||||
call <sid>hi('markdownH1', s:cdBlue, {}, 'bold', {})
|
||||
hi! link markdownH2 markdownH1
|
||||
hi! link markdownH3 markdownH1
|
||||
hi! link markdownH4 markdownH1
|
||||
hi! link markdownH5 markdownH1
|
||||
hi! link markdownH6 markdownH1
|
||||
call <sid>hi('markdownHeadingDelimiter', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('markdownBold', s:cdBlue, {}, 'bold', {})
|
||||
call <sid>hi('markdownRule', s:cdBlue, {}, 'bold', {})
|
||||
call <sid>hi('markdownCode', s:cdOrange, {}, 'none', {})
|
||||
hi! link markdownCodeDelimiter markdownCode
|
||||
call <sid>hi('markdownFootnote', s:cdOrange, {}, 'none', {})
|
||||
hi! link markdownFootnoteDefinition markdownFootnote
|
||||
call <sid>hi('markdownUrl', s:cdLightBlue, {}, 'underline', {})
|
||||
call <sid>hi('markdownLinkText', s:cdOrange, {}, 'none', {})
|
||||
call <sid>hi('markdownEscape', s:cdYellowOrange, {}, 'none', {})
|
||||
|
||||
" ASCIIDOC (built-in)
|
||||
call <sid>hi("asciidocAttributeEntry", s:cdYellowOrange, {}, 'none', {})
|
||||
call <sid>hi("asciidocAttributeList", s:cdPink, {}, 'none', {})
|
||||
call <sid>hi("asciidocAttributeRef", s:cdYellowOrange, {}, 'none', {})
|
||||
call <sid>hi("asciidocHLabel", s:cdBlue, {}, 'bold', {})
|
||||
call <sid>hi("asciidocListingBlock", s:cdOrange, {}, 'none', {})
|
||||
call <sid>hi("asciidocMacroAttributes", s:cdYellowOrange, {}, 'none', {})
|
||||
call <sid>hi("asciidocOneLineTitle", s:cdBlue, {}, 'bold', {})
|
||||
call <sid>hi("asciidocPassthroughBlock", s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi("asciidocQuotedMonospaced", s:cdOrange, {}, 'none', {})
|
||||
call <sid>hi("asciidocTriplePlusPassthrough", s:cdYellow, {}, 'none', {})
|
||||
call <sid>hi("asciidocMacro", s:cdPink, {}, 'none', {})
|
||||
call <sid>hi("asciidocAdmonition", s:cdOrange, {}, 'none', {})
|
||||
call <sid>hi("asciidocQuotedEmphasized", s:cdBlue, {}, 'italic', {})
|
||||
call <sid>hi("asciidocQuotedEmphasized2", s:cdBlue, {}, 'italic', {})
|
||||
call <sid>hi("asciidocQuotedEmphasizedItalic", s:cdBlue, {}, 'italic', {})
|
||||
hi! link asciidocBackslash Keyword
|
||||
hi! link asciidocQuotedBold markdownBold
|
||||
hi! link asciidocQuotedMonospaced2 asciidocQuotedMonospaced
|
||||
hi! link asciidocQuotedUnconstrainedBold asciidocQuotedBold
|
||||
hi! link asciidocQuotedUnconstrainedEmphasized asciidocQuotedEmphasized
|
||||
hi! link asciidocURL markdownUrl
|
||||
|
||||
" JSON (built-in)
|
||||
call <sid>hi('jsonKeyword', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('jsonEscape', s:cdYellowOrange, {}, 'none', {})
|
||||
call <sid>hi('jsonNull', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('jsonBoolean', s:cdBlue, {}, 'none', {})
|
||||
|
||||
" HTML (built-in)
|
||||
call <sid>hi('htmlTag', s:cdGray, {}, 'none', {})
|
||||
call <sid>hi('htmlEndTag', s:cdGray, {}, 'none', {})
|
||||
call <sid>hi('htmlTagName', s:cdBlue, {}, 'none', {})
|
||||
hi! link htmlSpecialTagName htmlTagName
|
||||
call <sid>hi('htmlArg', s:cdLightBlue, {}, 'none', {})
|
||||
|
||||
" PHP (built-in)
|
||||
call <sid>hi('phpClass', s:cdBlueGreen, {}, 'none', {})
|
||||
hi! link phpUseClass phpClass
|
||||
hi! link phpStaticClasses phpClass
|
||||
call <sid>hi('phpMethod', s:cdYellow, {}, 'none', {})
|
||||
call <sid>hi('phpFunction', s:cdYellow, {}, 'none', {})
|
||||
call <sid>hi('phpInclude', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('phpRegion', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('phpMethodsVar', s:cdLightBlue, {}, 'none', {})
|
||||
|
||||
" CSS (built-in)
|
||||
call <sid>hi('cssBraces', s:cdFront, {}, 'none', {})
|
||||
call <sid>hi('cssInclude', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('cssTagName', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('cssClassName', s:cdYellowOrange, {}, 'none', {})
|
||||
call <sid>hi('cssPseudoClass', s:cdYellowOrange, {}, 'none', {})
|
||||
call <sid>hi('cssPseudoClassId', s:cdOrange, {}, 'none', {})
|
||||
call <sid>hi('cssPseudoClassLang', s:cdYellowOrange, {}, 'none', {})
|
||||
call <sid>hi('cssIdentifier', s:cdYellowOrange, {}, 'none', {})
|
||||
call <sid>hi('cssProp', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('cssDefinition', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('cssAttr', s:cdOrange, {}, 'none', {})
|
||||
call <sid>hi('cssAttrRegion', s:cdOrange, {}, 'none', {})
|
||||
call <sid>hi('cssColor', s:cdOrange, {}, 'none', {})
|
||||
call <sid>hi('cssFunction', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('cssFunctionName', s:cdYellow, {}, 'none', {})
|
||||
call <sid>hi('cssVendor', s:cdOrange, {}, 'none', {})
|
||||
call <sid>hi('cssValueNumber', s:cdOrange, {}, 'none', {})
|
||||
call <sid>hi('cssValueLength', s:cdLightGreen, {}, 'none', {})
|
||||
call <sid>hi('cssUnitDecorators', s:cdLightGreen, {}, 'none', {})
|
||||
call <sid>hi('cssStyle', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('cssImportant', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('cssSelectorOp', s:cdFront, {}, 'none', {})
|
||||
call <sid>hi('cssKeyFrameProp2', s:cdLightGreen, {}, 'none', {})
|
||||
|
||||
" JavaScript:
|
||||
call <sid>hi('jsVariableDef', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('jsFuncArgs', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('jsFuncBlock', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('jsRegexpString', s:cdLightRed, {}, 'none', {})
|
||||
call <sid>hi('jsThis', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('jsOperatorKeyword', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('jsDestructuringBlock', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('jsObjectKey', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('jsGlobalObjects', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('jsModuleKeyword', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('jsClassDefinition', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('jsClassKeyword', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('jsExtendsKeyword', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('jsExportDefault', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('jsFuncCall', s:cdYellow, {}, 'none', {})
|
||||
call <sid>hi('jsObjectValue', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('jsParen', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('jsObjectProp', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('jsIfElseBlock', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('jsParenIfElse', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('jsSpreadOperator', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('jsSpreadExpression', s:cdLightBlue, {}, 'none', {})
|
||||
|
||||
" Vue:
|
||||
call <sid>hi('VueComponentName', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('VueValue', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('VueBrace', s:cdYellowOrange, {}, 'none', {})
|
||||
call <sid>hi('VueExpression', s:cdYellow, {}, 'none', {})
|
||||
call <sid>hi('VueTag', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('VueKey', s:cdPink, {}, 'none', {})
|
||||
|
||||
" Typescript:
|
||||
call <sid>hi('typescriptLabel', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptTry', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('typescriptExceptions', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('typescriptBraces', s:cdFront, {}, 'none', {})
|
||||
call <sid>hi('typescriptEndColons', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptParens', s:cdFront, {}, 'none', {})
|
||||
call <sid>hi('typescriptDocTags', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptDocComment', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('typescriptLogicSymbols', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptImport', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('typescriptBOM', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptVariableDeclaration', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptVariable', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptExport', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('typescriptAliasDeclaration', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('typescriptAliasKeyword', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptClassName', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('typescriptAccessibilityModifier', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptOperator', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptArrowFunc', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptMethodAccessor', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptMember', s:cdYellow, {}, 'none', {})
|
||||
call <sid>hi('typescriptTypeReference', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('typescriptDefault', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptTemplateSB', s:cdYellowOrange, {}, 'none', {})
|
||||
call <sid>hi('typescriptArrowFuncArg', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptParamImpl', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptFuncComma', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptCastKeyword', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptCall', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptCase', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptReserved', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('typescriptDefault', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptDecorator', s:cdYellow, {}, 'none', {})
|
||||
call <sid>hi('typescriptPredefinedType', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('typescriptClassHeritage', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('typescriptClassExtends', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptClassKeyword', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptBlock', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptDOMDocProp', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptTemplateSubstitution', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptClassBlock', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptFuncCallArg', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptIndexExpr', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptConditionalParen', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptArray', s:cdYellow, {}, 'none', {})
|
||||
call <sid>hi('typescriptES6SetProp', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptObjectLiteral', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptTypeParameter', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('typescriptEnumKeyword', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptEnum', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('typescriptLoopParen', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptParenExp', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptModule', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptAmbientDeclaration', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptModule', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptFuncTypeArrow', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptInterfaceHeritage', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('typescriptInterfaceName', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('typescriptInterfaceKeyword', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptInterfaceExtends', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptGlobal', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('typescriptAsyncFuncKeyword', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptFuncKeyword', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptGlobalMethod', s:cdYellow, {}, 'none', {})
|
||||
call <sid>hi('typescriptPromiseMethod', s:cdYellow, {}, 'none', {})
|
||||
call <sid>hi('typescriptIdentifierName', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('typescriptCacheMethod', s:cdYellow, {}, 'none', {})
|
||||
|
||||
" XML:
|
||||
call <sid>hi('xmlTag', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('xmlTagName', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('xmlEndTag', s:cdBlueGreen, {}, 'none', {})
|
||||
|
||||
" Ruby:
|
||||
call <sid>hi('rubyClassNameTag', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('rubyClassName', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('rubyModuleName', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('rubyConstant', s:cdBlueGreen, {}, 'none', {})
|
||||
|
||||
" Golang:
|
||||
call <sid>hi('goPackage', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('goImport', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('goVar', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('goConst', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('goStatement', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('goType', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('goSignedInts', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('goUnsignedInts', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('goFloats', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('goComplexes', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('goBuiltins', s:cdYellow, {}, 'none', {})
|
||||
call <sid>hi('goBoolean', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('goPredefinedIdentifiers', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('goTodo', s:cdGreen, {}, 'none', {})
|
||||
call <sid>hi('goDeclaration', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('goDeclType', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('goTypeDecl', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('goTypeName', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('goVarAssign', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('goVarDefs', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('goReceiver', s:cdFront, {}, 'none', {})
|
||||
call <sid>hi('goReceiverType', s:cdFront, {}, 'none', {})
|
||||
call <sid>hi('goFunctionCall', s:cdYellow, {}, 'none', {})
|
||||
call <sid>hi('goMethodCall', s:cdYellow, {}, 'none', {})
|
||||
call <sid>hi('goSingleDecl', s:cdLightBlue, {}, 'none', {})
|
||||
|
||||
" Python:
|
||||
call <sid>hi('pythonStatement', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('pythonOperator', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('pythonException', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('pythonExClass', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('pythonBuiltinObj', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('pythonBuiltinType', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('pythonBoolean', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('pythonNone', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('pythonTodo', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('pythonClassVar', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('pythonClassDef', s:cdBlueGreen, {}, 'none', {})
|
||||
|
||||
" TeX:
|
||||
call <sid>hi('texStatement', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('texBeginEnd', s:cdYellow, {}, 'none', {})
|
||||
call <sid>hi('texBeginEndName', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('texOption', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('texBeginEndModifier', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('texDocType', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('texDocTypeArgs', s:cdLightBlue, {}, 'none', {})
|
||||
|
||||
" GIT (built-in)
|
||||
call <sid>hi('gitcommitHeader', s:cdGray, {}, 'none', {})
|
||||
call <sid>hi('gitcommitOnBranch', s:cdGray, {}, 'none', {})
|
||||
call <sid>hi('gitcommitBranch', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('gitcommitComment', s:cdGray, {}, 'none', {})
|
||||
call <sid>hi('gitcommitSelectedType', s:cdGreen, {}, 'none', {})
|
||||
hi! link gitcommitSelectedFile gitcommitSelectedType
|
||||
call <sid>hi('gitcommitDiscardedType', s:cdRed, {}, 'none', {})
|
||||
hi! link gitcommitDiscardedFile gitcommitDiscardedType
|
||||
hi! link gitcommitOverflow gitcommitDiscardedType
|
||||
call <sid>hi('gitcommitSummary', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('gitcommitBlank', s:cdPink, {}, 'none', {})
|
||||
|
||||
" Lua:
|
||||
call <sid>hi('luaFuncCall', s:cdYellow, {}, 'none', {})
|
||||
call <sid>hi('luaFuncArgName', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('luaFuncKeyword', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('luaLocal', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('luaBuiltIn', s:cdBlue, {}, 'none', {})
|
||||
|
||||
" SH:
|
||||
call <sid>hi('shDeref', s:cdLightBlue, {}, 'none', {})
|
||||
call <sid>hi('shVariable', s:cdLightBlue, {}, 'none', {})
|
||||
|
||||
" SQL:
|
||||
call <sid>hi('sqlKeyword', s:cdPink, {}, 'none', {})
|
||||
call <sid>hi('sqlFunction', s:cdYellowOrange, {}, 'none', {})
|
||||
call <sid>hi('sqlOperator', s:cdPink, {}, 'none', {})
|
||||
|
||||
" YAML:
|
||||
call <sid>hi('yamlKey', s:cdBlue, {}, 'none', {})
|
||||
call <sid>hi('yamlConstant', s:cdBlue, {}, 'none', {})
|
||||
|
||||
" C++:
|
||||
call <sid>hi('CTagsClass', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('CTagsStructure', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('CTagsNamespace', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('CTagsGlobalVariable', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('CTagsDefinedName ', s:cdBlue, {}, 'none', {})
|
||||
highlight def link CTagsFunction Function
|
||||
highlight def link CTagsMember Identifier
|
||||
|
||||
" C++ color_coded
|
||||
call <sid>hi('StructDecl', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('UnionDecl', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('ClassDecl', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('TypeRef', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('TypedefDecl', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('TypeAliasDecl', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('EnumDecl', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('TemplateTypeParameter', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('TypeAliasTemplateDecl', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('ClassTemplate', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('ClassTemplatePartialSpecialization', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('FunctionTemplate', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('TemplateRef', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('TemplateTemplateParameter', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('UsingDeclaration', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('MemberRef', s:cdLightBlue, {}, 'italic', {})
|
||||
call <sid>hi('MemberRefExpr', s:cdYellow, {}, 'italic', {})
|
||||
call <sid>hi('Namespace', s:cdSilver, {}, 'none', {})
|
||||
call <sid>hi('NamespaceRef', s:cdSilver, {}, 'none', {})
|
||||
call <sid>hi('NamespaceAlias', s:cdSilver, {}, 'none', {})
|
||||
|
||||
" C++ lsp-cxx-highlight
|
||||
call <sid>hi('LspCxxHlSymClass', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('LspCxxHlSymStruct', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('LspCxxHlSymEnum', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('LspCxxHlSymTypeAlias', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('LspCxxHlSymTypeParameter', s:cdBlueGreen, {}, 'none', {})
|
||||
call <sid>hi('LspCxxHlSymConcept', s:cdBlueGreen, {}, 'italic', {})
|
||||
call <sid>hi('LspCxxHlSymNamespace', s:cdSilver, {}, 'none', {})
|
||||
|
||||
" Coc Explorer:
|
||||
call <sid>hi('CocHighlightText', {}, s:cdSelection, 'none', {})
|
||||
call <sid>hi('CocExplorerIndentLine', s:cdCursorDark, {}, 'none', {})
|
||||
361
home/.config/vim/vimrc
Normal file
361
home/.config/vim/vimrc
Normal file
@@ -0,0 +1,361 @@
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" => General
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Sets how many lines of history VIM has to remember
|
||||
set history=500
|
||||
|
||||
" Enable filetype plugins
|
||||
filetype plugin on
|
||||
filetype indent on
|
||||
|
||||
" Set to auto read when a file is changed from the outside
|
||||
set autoread
|
||||
au FocusGained,BufEnter * silent! checktime
|
||||
|
||||
" With a map leader it's possible to do extra key combinations
|
||||
" like <leader>w saves the current file
|
||||
let mapleader = " "
|
||||
|
||||
" Fast saving
|
||||
nmap <leader>w :w!<cr>
|
||||
|
||||
" :W sudo saves the file
|
||||
" (useful for handling the permission-denied error)
|
||||
command! W execute 'w !sudo tee % > /dev/null' <bar> edit!
|
||||
|
||||
" Use system clipboard
|
||||
set clipboard+=unnamedplus
|
||||
|
||||
" Center the screen when in insert mode
|
||||
autocmd InsertEnter * norm zz
|
||||
|
||||
set number relativenumber
|
||||
set cursorline
|
||||
set cursorcolumn
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" => VIM user interface
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Set 7 lines to the cursor - when moving vertically using j/k
|
||||
set so=7
|
||||
|
||||
" Avoid garbled characters in Chinese language windows OS
|
||||
let $LANG='en'
|
||||
set langmenu=en
|
||||
source $VIMRUNTIME/delmenu.vim
|
||||
source $VIMRUNTIME/menu.vim
|
||||
|
||||
" Turn on the Wild menu
|
||||
set wildmenu
|
||||
|
||||
" Ignore compiled files
|
||||
set wildignore=*.o,*~,*.pyc
|
||||
if has("win16") || has("win32")
|
||||
set wildignore+=.git\*,.hg\*,.svn\*
|
||||
else
|
||||
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
|
||||
endif
|
||||
|
||||
" Always show current position
|
||||
set ruler
|
||||
|
||||
" Height of the command bar
|
||||
set cmdheight=1
|
||||
|
||||
" A buffer becomes hidden when it is abandoned
|
||||
set hid
|
||||
|
||||
" Configure backspace so it acts as it should act
|
||||
set backspace=eol,start,indent
|
||||
set whichwrap+=<,>,h,l
|
||||
|
||||
" Ignore case when searching
|
||||
set ignorecase
|
||||
|
||||
" When searching try to be smart about cases
|
||||
set smartcase
|
||||
|
||||
" Highlight search results
|
||||
set hlsearch
|
||||
|
||||
" Makes search act like search in modern browsers
|
||||
set incsearch
|
||||
|
||||
" Don't redraw while executing macros (good performance config)
|
||||
set lazyredraw
|
||||
|
||||
" For regular expressions turn magic on
|
||||
set magic
|
||||
|
||||
" Show matching brackets when text indicator is over them
|
||||
set showmatch
|
||||
|
||||
" How many tenths of a second to blink when matching brackets
|
||||
set mat=2
|
||||
|
||||
" No annoying sound on errors
|
||||
set noerrorbells
|
||||
set novisualbell
|
||||
set t_vb=
|
||||
set tm=500
|
||||
|
||||
" Add a bit extra margin to the left
|
||||
set foldcolumn=1
|
||||
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" => Colors and Fonts
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
" Enable syntax highlighting
|
||||
syntax enable
|
||||
|
||||
" Set regular expression engine automatically
|
||||
set regexpengine=0
|
||||
|
||||
" Enable 256 colors palette in Gnome Terminal
|
||||
if $COLORTERM == 'gnome-terminal'
|
||||
set t_Co=256
|
||||
endif
|
||||
|
||||
try
|
||||
colorscheme codedark
|
||||
catch
|
||||
endtry
|
||||
|
||||
set background=dark
|
||||
|
||||
" Set background to transparent
|
||||
hi Normal guibg=NONE ctermbg=NONE
|
||||
|
||||
" Set extra options when running in GUI mode
|
||||
if has("gui_running")
|
||||
set guioptions-=T
|
||||
set guioptions-=e
|
||||
set t_Co=256
|
||||
set guitablabel=%M\ %t
|
||||
endif
|
||||
|
||||
" Set utf8 as standard encoding and en_US as the standard language
|
||||
set encoding=utf8
|
||||
|
||||
" Use Unix as the standard file type
|
||||
set ffs=unix,dos,mac
|
||||
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" => Files, backups and undo
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Turn backup off, since most stuff is in SVN, git etc. anyway...
|
||||
set nobackup
|
||||
set nowb
|
||||
set noswapfile
|
||||
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" => Text, tab and indent related
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Use spaces instead of tabs
|
||||
set expandtab
|
||||
set smarttab
|
||||
|
||||
" 1 tab == 2 spaces
|
||||
set shiftwidth=2
|
||||
set tabstop=2
|
||||
|
||||
" Linebreak on 500 characters
|
||||
set lbr
|
||||
set tw=500
|
||||
|
||||
set ai "Auto indent
|
||||
set si "Smart indent
|
||||
set wrap "Wrap lines
|
||||
|
||||
|
||||
""""""""""""""""""""""""""""""
|
||||
" => Visual mode related
|
||||
""""""""""""""""""""""""""""""
|
||||
" Visual mode pressing * or # searches for the current selection
|
||||
vnoremap <silent> * :<C-u>call VisualSelection('', '')<CR>/<C-R>=@/<CR><CR>
|
||||
vnoremap <silent> # :<C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR>
|
||||
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" => Moving around, tabs, windows and buffers
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Map <Space> to / (search) and Ctrl-<Space> to ? (backwards search)
|
||||
map <space> /
|
||||
map <C-space> ?
|
||||
|
||||
" Disable highlight when <leader><cr> is pressed
|
||||
map <silent> <leader><cr> :noh<cr>
|
||||
|
||||
" Smart way to move between windows
|
||||
map <C-j> <C-W>j
|
||||
map <C-k> <C-W>k
|
||||
map <C-h> <C-W>h
|
||||
map <C-l> <C-W>l
|
||||
|
||||
" Close the current buffer
|
||||
map <leader>bd :Bclose<cr>:tabclose<cr>gT
|
||||
|
||||
" Close all the buffers
|
||||
map <leader>ba :bufdo bd<cr>
|
||||
|
||||
map <leader>l :bnext<cr>
|
||||
map <leader>h :bprevious<cr>
|
||||
|
||||
" Useful mappings for managing tabs
|
||||
map <leader>tn :tabnew<cr>
|
||||
map <leader>to :tabonly<cr>
|
||||
map <leader>tc :tabclose<cr>
|
||||
map <leader>tm :tabmove
|
||||
map <leader>t<leader> :tabnext<cr>
|
||||
|
||||
" Let 'tl' toggle between this and the last accessed tab
|
||||
let g:lasttab = 1
|
||||
nmap <leader>tl :exe "tabn ".g:lasttab<CR>
|
||||
au TabLeave * let g:lasttab = tabpagenr()
|
||||
|
||||
|
||||
" Opens a new tab with the current buffer's path
|
||||
" Super useful when editing files in the same directory
|
||||
map <leader>te :tabedit <C-r>=escape(expand("%:p:h"), " ")<cr>/
|
||||
|
||||
" Switch CWD to the directory of the open buffer
|
||||
map <leader>cd :cd %:p:h<cr>:pwd<cr>
|
||||
|
||||
" Specify the behavior when switching between buffers
|
||||
try
|
||||
set switchbuf=useopen,usetab,newtab
|
||||
set stal=2
|
||||
catch
|
||||
endtry
|
||||
|
||||
" Return to last edit position when opening files (You want this!)
|
||||
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
||||
|
||||
|
||||
""""""""""""""""""""""""""""""
|
||||
" => Status line
|
||||
""""""""""""""""""""""""""""""
|
||||
" Always show the status line
|
||||
set laststatus=2
|
||||
|
||||
" Format the status line
|
||||
function! GitBranch()
|
||||
return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
|
||||
endfunction
|
||||
function! StatuslineGit()
|
||||
let l:branchname = GitBranch()
|
||||
return strlen(l:branchname) > 0?' '.l:branchname.' ':''
|
||||
endfunction
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" => Editing mappings
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Remap VIM 0 to first non-blank character
|
||||
map 0 ^
|
||||
|
||||
" Move a line of text using ALT+[jk] or Command+[jk] on mac
|
||||
nmap <M-j> mz:m+<cr>`z
|
||||
nmap <M-k> mz:m-2<cr>`z
|
||||
vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
|
||||
vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z
|
||||
|
||||
if has("mac") || has("macunix")
|
||||
nmap <D-j> <M-j>
|
||||
nmap <D-k> <M-k>
|
||||
vmap <D-j> <M-j>
|
||||
vmap <D-k> <M-k>
|
||||
endif
|
||||
|
||||
" Delete trailing white space on save, useful for some filetypes
|
||||
fun! CleanExtraSpaces()
|
||||
let save_cursor = getpos(".")
|
||||
let old_query = getreg('/')
|
||||
silent! %s/\s\+$//e
|
||||
call setpos('.', save_cursor)
|
||||
call setreg('/', old_query)
|
||||
endfun
|
||||
|
||||
if has("autocmd")
|
||||
autocmd BufWritePre *.txt,*.js,*.py,*.wiki,*.sh,*.coffee :call CleanExtraSpaces()
|
||||
endif
|
||||
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" => Spell checking
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Pressing ,ss will toggle and untoggle spell checking
|
||||
map <leader>ss :setlocal spell!<cr>
|
||||
|
||||
" Shortcuts using <leader>
|
||||
map <leader>sn ]s
|
||||
map <leader>sp [s
|
||||
map <leader>sa zg
|
||||
map <leader>s? z=
|
||||
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" => Misc
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Remove the Windows ^M - when the encodings gets messed up
|
||||
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
|
||||
|
||||
" Quickly open a buffer for scribble
|
||||
map <leader>q :e ~/buffer<cr>
|
||||
|
||||
" Quickly open a markdown buffer for scribble
|
||||
map <leader>x :e ~/buffer.md<cr>
|
||||
|
||||
" Toggle paste mode on and off
|
||||
map <leader>pp :setlocal paste!<cr>
|
||||
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" => Helper functions
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
" Don't close window, when deleting a buffer
|
||||
command! Bclose call <SID>BufcloseCloseIt()
|
||||
function! <SID>BufcloseCloseIt()
|
||||
let l:currentBufNum = bufnr("%")
|
||||
let l:alternateBufNum = bufnr("#")
|
||||
|
||||
if buflisted(l:alternateBufNum)
|
||||
buffer #
|
||||
else
|
||||
bnext
|
||||
endif
|
||||
|
||||
if bufnr("%") == l:currentBufNum
|
||||
new
|
||||
endif
|
||||
|
||||
if buflisted(l:currentBufNum)
|
||||
execute("bdelete! ".l:currentBufNum)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! CmdLine(str)
|
||||
call feedkeys(":" . a:str)
|
||||
endfunction
|
||||
|
||||
function! VisualSelection(direction, extra_filter) range
|
||||
let l:saved_reg = @"
|
||||
execute "normal! vgvy"
|
||||
|
||||
let l:pattern = escape(@", "\\/.*'$^~[]")
|
||||
let l:pattern = substitute(l:pattern, "\n$", "", "")
|
||||
|
||||
if a:direction == 'gv'
|
||||
call CmdLine("Ack '" . l:pattern . "' " )
|
||||
elseif a:direction == 'replace'
|
||||
call CmdLine("%s" . '/'. l:pattern . '/')
|
||||
endif
|
||||
|
||||
let @/ = l:pattern
|
||||
let @" = l:saved_reg
|
||||
endfunction
|
||||
|
||||
192
home/.config/waybar/config
Normal file
192
home/.config/waybar/config
Normal file
@@ -0,0 +1,192 @@
|
||||
{
|
||||
"layer": "top", // Waybar at top layer
|
||||
// "position": "bottom", // Waybar position (top|bottom|left|right)
|
||||
"height": 30, // Waybar height (to be removed for auto height)
|
||||
// "width": 1280, // Waybar width
|
||||
"spacing": 5, // Gaps between modules (4px)
|
||||
"margin-top": 5,
|
||||
"margin-right": 5,
|
||||
"margin-left": 5,
|
||||
"margin-bottom": 0,
|
||||
// Choose the order of the modules
|
||||
"modules-left": ["clock", "backlight", "battery", "mpd", "tray"],
|
||||
"modules-center": ["hyprland/workspaces"],
|
||||
"modules-right": ["wireplumber", "network", "cpu", "memory", "temperature"],
|
||||
// Modules configuration
|
||||
"custom/power": {
|
||||
"format": "",
|
||||
"on-click": "",
|
||||
},
|
||||
"hyprland/workspaces": {
|
||||
"format": "{icon}",
|
||||
"format-icons": {
|
||||
"active": "",
|
||||
"default": ""
|
||||
},
|
||||
"on-scroll-up": "hyprctl dispatch workspace e+1",
|
||||
"on-scroll-down": "hyprctl dispatch workspace e-1"
|
||||
},
|
||||
"keyboard-state": {
|
||||
"numlock": true,
|
||||
"capslock": true,
|
||||
"format": "{name} {icon}",
|
||||
"format-icons": {
|
||||
"locked": "",
|
||||
"unlocked": ""
|
||||
}
|
||||
},
|
||||
// "sway/mode": {
|
||||
// "format": "<span style=\"italic\">{}</span>"
|
||||
// },
|
||||
// "sway/scratchpad": {
|
||||
// "format": "{icon} {count}",
|
||||
// "show-empty": false,
|
||||
// "format-icons": ["", ""],
|
||||
// "tooltip": true,
|
||||
// "tooltip-format": "{app}: {title}"
|
||||
// },
|
||||
"mpd": {
|
||||
"format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ {volume}% ",
|
||||
"format-disconnected": "Disconnected ",
|
||||
"format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon} Stopped ",
|
||||
"unknown-tag": "N/A",
|
||||
"interval": 2,
|
||||
"consume-icons": {
|
||||
"on": " "
|
||||
},
|
||||
"random-icons": {
|
||||
"off": "<span color=\"#f53c3c\"></span> ",
|
||||
"on": " "
|
||||
},
|
||||
"repeat-icons": {
|
||||
"on": " "
|
||||
},
|
||||
"single-icons": {
|
||||
"on": "1 "
|
||||
},
|
||||
"state-icons": {
|
||||
"paused": "",
|
||||
"playing": ""
|
||||
},
|
||||
"tooltip-format": "MPD (connected)",
|
||||
"tooltip-format-disconnected": "MPD (disconnected)"
|
||||
},
|
||||
"idle_inhibitor": {
|
||||
"format": "{icon}",
|
||||
"format-icons": {
|
||||
"activated": "",
|
||||
"deactivated": ""
|
||||
}
|
||||
},
|
||||
"tray": {
|
||||
// "icon-size": 21,
|
||||
"spacing": 10
|
||||
},
|
||||
//"clock": {
|
||||
// // "timezone": "America/New_York",
|
||||
// "tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
|
||||
// "format-alt": "{:%Y-%m-%d}"
|
||||
//},
|
||||
"clock": {
|
||||
"format": "{:%H:%M} ",
|
||||
"format-alt": "{:%A, %B %d, %Y (%R)} ",
|
||||
"tooltip-format": "<tt><small>{calendar}</small></tt>",
|
||||
"calendar": {
|
||||
"mode" : "year",
|
||||
"mode-mon-col" : 3,
|
||||
"weeks-pos" : "right",
|
||||
"on-scroll" : 1,
|
||||
"on-click-right": "mode",
|
||||
"format": {
|
||||
"months": "<span color='#ffead3'><b>{}</b></span>",
|
||||
"days": "<span color='#ecc6d9'><b>{}</b></span>",
|
||||
"weeks": "<span color='#99ffdd'><b>W{}</b></span>",
|
||||
"weekdays": "<span color='#ffcc66'><b>{}</b></span>",
|
||||
"today": "<span color='#ff6699'><b><u>{}</u></b></span>"
|
||||
}
|
||||
},
|
||||
"actions": {
|
||||
"on-click-right": "mode",
|
||||
"on-click-forward": "tz_up",
|
||||
"on-click-backward": "tz_down",
|
||||
"on-scroll-up": "shift_up",
|
||||
"on-scroll-down": "shift_down"
|
||||
}
|
||||
},
|
||||
"cpu": {
|
||||
"interval": 1,
|
||||
"format": "{usage}% ",
|
||||
"tooltip": false
|
||||
},
|
||||
"memory": {
|
||||
"interval": 2,
|
||||
"format": "{}% "
|
||||
},
|
||||
"temperature": {
|
||||
// "thermal-zone": 2,
|
||||
"hwmon-path": "/sys/class/hwmon/hwmon3/temp1_input",
|
||||
"critical-threshold": 80,
|
||||
"format-critical": "{temperatureC}°C ",
|
||||
"format": "{temperatureC}°C {icon}",
|
||||
"format-icons": ["", ""],
|
||||
"interval": 1
|
||||
},
|
||||
"temperature#gpu": {
|
||||
// "thermal-zone": 2,
|
||||
"hwmon-path": "/sys/class/hwmon/hwmon5/temp1_input",
|
||||
"critical-threshold": 80,
|
||||
"format-critical": " {temperatureC}°C ",
|
||||
"format": " {temperatureC}°C {icon}",
|
||||
"format-icons": ["", ""],
|
||||
"interval": 1
|
||||
},
|
||||
"backlight": {
|
||||
// "device": "acpi_video1",
|
||||
"format": "{percent}% {icon}",
|
||||
"format-icons": ["", "", "", "", "", "", "", "", ""]
|
||||
},
|
||||
"battery": {
|
||||
"states": {
|
||||
// "good": 95,
|
||||
"warning": 30,
|
||||
"critical": 15
|
||||
},
|
||||
"format": "{capacity}% {icon}",
|
||||
"format-charging": "{capacity}% ",
|
||||
"format-plugged": "{capacity}% ",
|
||||
"format-alt": "{time} {icon}",
|
||||
// "format-good": "", // An empty format will hide the module
|
||||
// "format-full": "",
|
||||
"format-icons": ["", "", "", "", ""]
|
||||
},
|
||||
"battery#bat2": {
|
||||
"bat": "BAT2"
|
||||
},
|
||||
"network": {
|
||||
// "interface": "wlp2*", // (Optional) To force the use of this interface
|
||||
"format-wifi": "{essid} ({signalStrength}%) ",
|
||||
"format-ethernet": "{ipaddr}/{cidr} ",
|
||||
"tooltip-format": "{ifname} via {gwaddr} ",
|
||||
"format-linked": "{ifname} (No IP) ",
|
||||
"format-disconnected": "Disconnected ",
|
||||
"format-alt": "{ifname}: {ipaddr}/{cidr}"
|
||||
},
|
||||
"wireplumber": {
|
||||
"format": "{volume}% {icon}",
|
||||
"format-muted": "",
|
||||
"on-click": "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle",
|
||||
"format-icons": ["", "", ""]
|
||||
},
|
||||
"custom/media": {
|
||||
"format": "{icon} {}",
|
||||
"return-type": "json",
|
||||
"max-length": 40,
|
||||
"format-icons": {
|
||||
"spotify": "",
|
||||
"default": "🎜"
|
||||
},
|
||||
"escape": true,
|
||||
"exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder
|
||||
// "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name
|
||||
}
|
||||
}
|
||||
308
home/.config/waybar/style.css
Normal file
308
home/.config/waybar/style.css
Normal file
@@ -0,0 +1,308 @@
|
||||
@define-color base #282828;
|
||||
@define-color foreground #ebdbb2;
|
||||
@define-color cyan #83a598;
|
||||
@define-color green #8ec07c;
|
||||
@define-color orange #fe8019;
|
||||
@define-color pink #d3869b;
|
||||
@define-color purple #b16286;
|
||||
@define-color red #fb4934;
|
||||
@define-color yellow #fabd2f;
|
||||
|
||||
* {
|
||||
/* `otf-font-awesome` is required to be installed for icons */
|
||||
font-family: "JetBrainsMono Nerd Font", "Material Design Icons";
|
||||
font-size: 14px;
|
||||
color: @foreground;
|
||||
}
|
||||
|
||||
#window {
|
||||
color: @pink;
|
||||
background: @base;
|
||||
transition-property: background-color;
|
||||
border-radius: 100px;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
#waybar.empty #window {
|
||||
background: none;
|
||||
}
|
||||
|
||||
window#waybar {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
/*
|
||||
window#waybar.empty {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
|
||||
window#waybar.solo {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
*/
|
||||
|
||||
button {
|
||||
margin-right: 5px;
|
||||
/* Avoid rounded borders under each button name */
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
background: @base;
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
color: @pink;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
#workspaces {
|
||||
border-radius: 100px;
|
||||
background: @base;
|
||||
padding: 0 15px;
|
||||
}
|
||||
|
||||
#workspaces button {
|
||||
border: none;
|
||||
background-color: @base;
|
||||
color: @foreground;
|
||||
transition: 0.2s;
|
||||
padding-left: 0;
|
||||
padding-right: 4px;
|
||||
margin-left: 2px;
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
#workspaces button:hover {
|
||||
color: @orange;
|
||||
background: @base;
|
||||
transition: 0.2s;
|
||||
}
|
||||
|
||||
#workspaces button.focused {
|
||||
background: @base;
|
||||
}
|
||||
|
||||
#workspaces button.urgent {
|
||||
color: @red;
|
||||
}
|
||||
|
||||
#mode {
|
||||
background: @base;
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
#clock,
|
||||
#battery,
|
||||
#cpu,
|
||||
#memory,
|
||||
#disk,
|
||||
#temperature,
|
||||
#backlight,
|
||||
#network,
|
||||
#pulseaudio,
|
||||
#wireplumber,
|
||||
#custom-media,
|
||||
#tray,
|
||||
#mode,
|
||||
#idle_inhibitor,
|
||||
#scratchpad,
|
||||
#mpd,
|
||||
#language,
|
||||
#keyboard-state,
|
||||
#custom-power {
|
||||
padding-left: 15px;
|
||||
padding-right: 18px;
|
||||
background-color: @base;
|
||||
border-radius: 100px;
|
||||
}
|
||||
|
||||
#window,
|
||||
#workspaces {
|
||||
margin: 0 5px;
|
||||
}
|
||||
|
||||
/* If workspaces is the leftmost module, omit left margin */
|
||||
.modules-left > widget:first-child > #workspaces {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
/* If workspaces is the rightmost module, omit right margin */
|
||||
.modules-right > widget:last-child > #workspaces {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
#clock {
|
||||
color: @orange;
|
||||
}
|
||||
|
||||
#temperature {
|
||||
color: @orange;
|
||||
}
|
||||
|
||||
#battery {
|
||||
color: @purple;
|
||||
}
|
||||
|
||||
#battery.charging,
|
||||
#battery.plugged {
|
||||
color: @orange;
|
||||
}
|
||||
|
||||
@keyframes blink {
|
||||
to {
|
||||
background-color: @base;
|
||||
color: #000000;
|
||||
}
|
||||
}
|
||||
|
||||
#battery.critical:not(.charging) {
|
||||
background-color: @red;
|
||||
animation-name: blink;
|
||||
animation-duration: 0.5s;
|
||||
animation-timing-function: linear;
|
||||
animation-iteration-count: infinite;
|
||||
animation-direction: alternate;
|
||||
}
|
||||
|
||||
label:focus {
|
||||
color: @foreground;
|
||||
}
|
||||
|
||||
#cpu {
|
||||
color: @purple;
|
||||
}
|
||||
|
||||
#memory {
|
||||
color: @purple;
|
||||
}
|
||||
|
||||
#disk {
|
||||
color: @purple;
|
||||
}
|
||||
|
||||
#backlight {
|
||||
color: @yellow;
|
||||
}
|
||||
|
||||
#network {
|
||||
color: @pink;
|
||||
}
|
||||
|
||||
#network.disconnected {
|
||||
color: @red;
|
||||
}
|
||||
|
||||
#pulseaudio {
|
||||
color: @cyan;
|
||||
}
|
||||
|
||||
#pulseaudio.muted {
|
||||
color: @red;
|
||||
}
|
||||
|
||||
#wireplumber {
|
||||
color: @cyan;
|
||||
}
|
||||
|
||||
#wireplumber.muted {
|
||||
color: @red;
|
||||
}
|
||||
|
||||
#custom-media {
|
||||
color: @purple;
|
||||
min-width: 100px;
|
||||
}
|
||||
|
||||
#custom-media.custom-spotify {
|
||||
color: @purple;
|
||||
}
|
||||
|
||||
#custom-media.custom-vlc {
|
||||
color: @purple;
|
||||
}
|
||||
|
||||
#temperature {
|
||||
color: @purple;
|
||||
}
|
||||
|
||||
#temperature.critical {
|
||||
color: @base;
|
||||
background: @red;
|
||||
box-shadow: inset 0px 0px 0px 3px @base;
|
||||
}
|
||||
|
||||
#tray {
|
||||
color: @foreground;
|
||||
}
|
||||
|
||||
#tray > .passive {
|
||||
-gtk-icon-effect: dim;
|
||||
}
|
||||
|
||||
#tray > .needs-attention {
|
||||
-gtk-icon-effect: highlight;
|
||||
background-color: @base;
|
||||
}
|
||||
|
||||
#tray * {
|
||||
background: @base;
|
||||
}
|
||||
|
||||
#idle_inhibitor {
|
||||
color: @yellow;
|
||||
}
|
||||
|
||||
#idle_inhibitor.activated {
|
||||
background-color: @red;
|
||||
box-shadow: inset 0px 0px 0px 3px @base;
|
||||
color: @base;
|
||||
}
|
||||
|
||||
#mpd {
|
||||
color: @purple;
|
||||
}
|
||||
|
||||
#mpd.disconnected {
|
||||
background-color: @red;
|
||||
color: @base;
|
||||
box-shadow: inset 0px 0px 0px 3px @base;
|
||||
}
|
||||
|
||||
#mpd.stopped {
|
||||
color: @red;
|
||||
}
|
||||
|
||||
#mpd.paused {
|
||||
color: @yellow;
|
||||
}
|
||||
|
||||
#language {
|
||||
color: @orange;
|
||||
min-width: 16px;
|
||||
}
|
||||
|
||||
#keyboard-state {
|
||||
color: @orange;
|
||||
min-width: 16px;
|
||||
}
|
||||
|
||||
#keyboard-state > label {
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
#keyboard-state > label.locked {
|
||||
color: @red;
|
||||
}
|
||||
|
||||
#scratchpad {
|
||||
color: @yellow;
|
||||
}
|
||||
|
||||
#scratchpad.empty {
|
||||
color: @cyan;
|
||||
}
|
||||
3
home/.local/share/icons/GoogleDot-Black/cursor.theme
Normal file
3
home/.local/share/icons/GoogleDot-Black/cursor.theme
Normal file
@@ -0,0 +1,3 @@
|
||||
[Icon Theme]
|
||||
Name=GoogleDot-Black
|
||||
Inherits="GoogleDot-Black"
|
||||
@@ -0,0 +1 @@
|
||||
left_ptr_watch
|
||||
@@ -0,0 +1 @@
|
||||
sb_v_double_arrow
|
||||
@@ -0,0 +1 @@
|
||||
sb_h_double_arrow
|
||||
@@ -0,0 +1 @@
|
||||
dnd_no_drop
|
||||
@@ -0,0 +1 @@
|
||||
left_ptr_watch
|
||||
@@ -0,0 +1 @@
|
||||
copy
|
||||
@@ -0,0 +1 @@
|
||||
sb_h_double_arrow
|
||||
@@ -0,0 +1 @@
|
||||
sb_v_double_arrow
|
||||
@@ -0,0 +1 @@
|
||||
link
|
||||
@@ -0,0 +1 @@
|
||||
left_ptr_watch
|
||||
@@ -0,0 +1 @@
|
||||
move
|
||||
@@ -0,0 +1 @@
|
||||
question_arrow
|
||||
@@ -0,0 +1 @@
|
||||
copy
|
||||
@@ -0,0 +1 @@
|
||||
link
|
||||
@@ -0,0 +1 @@
|
||||
move
|
||||
@@ -0,0 +1 @@
|
||||
hand2
|
||||
BIN
home/.local/share/icons/GoogleDot-Black/cursors/X_cursor
Normal file
BIN
home/.local/share/icons/GoogleDot-Black/cursors/X_cursor
Normal file
Binary file not shown.
@@ -0,0 +1 @@
|
||||
link
|
||||
1
home/.local/share/icons/GoogleDot-Black/cursors/alias
Symbolic link
1
home/.local/share/icons/GoogleDot-Black/cursors/alias
Symbolic link
@@ -0,0 +1 @@
|
||||
link
|
||||
BIN
home/.local/share/icons/GoogleDot-Black/cursors/all-scroll
Normal file
BIN
home/.local/share/icons/GoogleDot-Black/cursors/all-scroll
Normal file
Binary file not shown.
1
home/.local/share/icons/GoogleDot-Black/cursors/arrow
Symbolic link
1
home/.local/share/icons/GoogleDot-Black/cursors/arrow
Symbolic link
@@ -0,0 +1 @@
|
||||
left_ptr
|
||||
@@ -0,0 +1 @@
|
||||
copy
|
||||
1
home/.local/share/icons/GoogleDot-Black/cursors/bd_double_arrow
Symbolic link
1
home/.local/share/icons/GoogleDot-Black/cursors/bd_double_arrow
Symbolic link
@@ -0,0 +1 @@
|
||||
bottom_right_corner
|
||||
Binary file not shown.
Binary file not shown.
1
home/.local/share/icons/GoogleDot-Black/cursors/bottom_side
Symbolic link
1
home/.local/share/icons/GoogleDot-Black/cursors/bottom_side
Symbolic link
@@ -0,0 +1 @@
|
||||
sb_v_double_arrow
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user