start rewrite
This commit is contained in:
parent
263eb51a6d
commit
962830f644
417 changed files with 182 additions and 44806 deletions
1
.envrc
1
.envrc
|
@ -1 +0,0 @@
|
|||
use flake
|
11
.github/dependabot.yml
vendored
11
.github/dependabot.yml
vendored
|
@ -1,11 +0,0 @@
|
|||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions" # See documentation for possible values
|
||||
directory: "/" # Location of package manifests
|
||||
schedule:
|
||||
interval: "weekly"
|
24
.github/workflows/update-riscv.yaml
vendored
24
.github/workflows/update-riscv.yaml
vendored
|
@ -1,24 +0,0 @@
|
|||
name: update-riscv
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
pr:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Create update pull request
|
||||
run: |
|
||||
curl -X 'POST' \
|
||||
'https://git.chir.rs/api/v1/repos/darkkirb/nixos-config/pulls' \
|
||||
-H 'Authorization: Bearer ${{secrets.GITHUB_TOKEN}}' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"base": "main-riscv",
|
||||
"body": "Keeping main-riscv up to date",
|
||||
"head": "main",
|
||||
"title": "Update RISC-V config"
|
||||
}'
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,5 +1 @@
|
|||
result
|
||||
*.qcow2
|
||||
*.fd
|
||||
.direnv
|
||||
/efi/secret
|
||||
|
|
75
.sops.yaml
75
.sops.yaml
|
@ -1,75 +0,0 @@
|
|||
keys:
|
||||
- &lotte age1tltjgexkp5fz3rum4j0k66ty5q4u8ptvkgkepumd20zal24g2qfs5xgw76
|
||||
- &nixos-8gb-fsn1-1 age1273ps5thcy70ckdt0270s2nysqgu48t38pq3wq975v3y7mf4eavsw38wsl
|
||||
- &thinkrac age1p400545a482fma40yfgytu40p6wr5a75v4f8yeudvgf7eh5erufqxhgynr
|
||||
- &nas age1c7y687sxh428wk34s8ws6kemu62mggafpt40rmanevgkuj5xa59q6f7tlc
|
||||
- &instance-20221213-1915 age1elra3uklw8rmwkevqms2l4tsd06d5utqda9d2w4qvqpz898uzuesugxkhc
|
||||
- &vf2 age1emv3kzvwgl36hgllrv7rlekqy3y3c6eztadl3lv09ks3z9vv6vdqw06yqa
|
||||
- &rainbow-resort age19vzypddhexvvsf8xylstxc9znnkd8rxmamhjlt7elvz4j3zaf5tqqura6f
|
||||
- &devterm age1sqvl2cwvzeztuelpwppaestqufzeap8uf0vgy7t5mzr9rwc3dpxqhx8ly9
|
||||
creation_rules:
|
||||
- path_regex: secrets/shared\.yaml$
|
||||
key_groups:
|
||||
- age:
|
||||
- *nixos-8gb-fsn1-1
|
||||
- *thinkrac
|
||||
- *nas
|
||||
- *instance-20221213-1915
|
||||
- *vf2
|
||||
- *rainbow-resort
|
||||
- *lotte
|
||||
- *devterm
|
||||
- path_regex: secrets/nixos-8gb-fsn1-1\.yaml$
|
||||
key_groups:
|
||||
- age:
|
||||
- *nixos-8gb-fsn1-1
|
||||
- *lotte
|
||||
- path_regex: secrets/thinkrac\.yaml$
|
||||
key_groups:
|
||||
- age:
|
||||
- *thinkrac
|
||||
- *lotte
|
||||
- path_regex: secrets/nixos\.yaml$
|
||||
key_groups:
|
||||
- age:
|
||||
- *lotte
|
||||
- path_regex: secrets/nas\.yaml$
|
||||
key_groups:
|
||||
- age:
|
||||
- *nas
|
||||
- *lotte
|
||||
- path_regex: secrets/desktop\.yaml$
|
||||
key_groups:
|
||||
- age:
|
||||
- *thinkrac
|
||||
- *rainbow-resort
|
||||
- *lotte
|
||||
- *devterm
|
||||
- path_regex: secrets/instance-20221213-1915\.yaml$
|
||||
key_groups:
|
||||
- age:
|
||||
- *instance-20221213-1915
|
||||
- *lotte
|
||||
- path_regex: secrets/vf2\.yaml$
|
||||
key_groups:
|
||||
- age:
|
||||
- *vf2
|
||||
- *lotte
|
||||
- path_regex: secrets/rainbow-resort\.yaml$
|
||||
key_groups:
|
||||
- age:
|
||||
- *rainbow-resort
|
||||
- *lotte
|
||||
- path_regex: secrets/devterm\.yaml$
|
||||
key_groups:
|
||||
- age:
|
||||
- *devterm
|
||||
- *lotte
|
||||
- path_regex: secrets/kubernetes\.yaml$
|
||||
key_groups:
|
||||
- age:
|
||||
- *nixos-8gb-fsn1-1
|
||||
- *nas
|
||||
- *instance-20221213-1915
|
||||
- *rainbow-resort
|
||||
- *lotte
|
18
.vscode/settings.json
vendored
18
.vscode/settings.json
vendored
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"python.formatting.provider": "yapf",
|
||||
"conventionalCommits.scopes": ["thinkrac", "aarch64"],
|
||||
"files.associations": {
|
||||
"*.hujson": "jsonc"
|
||||
},
|
||||
"json.schemas": [
|
||||
{
|
||||
"fileMatch": ["*.hujson"],
|
||||
"schema": {
|
||||
"allowTrailingCommas": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"files.watcherExclude": {
|
||||
"**/target": true
|
||||
}
|
||||
}
|
3
README.md
Normal file
3
README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Lotte’s New Nix configuration
|
||||
|
||||
Very WIP rewrite
|
|
@ -1,50 +0,0 @@
|
|||
_: {
|
||||
networking.firewall.extraCommands = ''
|
||||
# Taken from https://gist.github.com/rampageX/5cbe95be43ca3165f4d963629e3bb946
|
||||
# Block Torrent algo string using Boyer-Moore (bm)
|
||||
iptables -I FORWARD 1 -m string --algo bm --string "BitTorrent" -j DROP
|
||||
iptables -I FORWARD 1 -m string --algo bm --string "BitTorrent protocol" -j DROP
|
||||
iptables -I FORWARD 1 -m string --algo bm --string "peer_id=" -j DROP
|
||||
iptables -I FORWARD 1 -m string --algo bm --string ".torrent" -j DROP
|
||||
iptables -I FORWARD 1 -m string --algo bm --string "announce.php?passkey=" -j DROP
|
||||
iptables -I FORWARD 1 -m string --algo bm --string "torrent" -j DROP
|
||||
iptables -I FORWARD 1 -m string --algo bm --string "announce" -j DROP
|
||||
iptables -I FORWARD 1 -m string --algo bm --string "info_hash" -j DROP
|
||||
iptables -I FORWARD 1 -m string --algo bm --string "/default.ida?" -j DROP
|
||||
iptables -I FORWARD 1 -m string --algo bm --string ".exe?/c+dir" -j DROP
|
||||
iptables -I FORWARD 1 -m string --algo bm --string ".exe?/c_tftp" -j DROP
|
||||
ip6tables -I FORWARD 1 -m string --algo bm --string "BitTorrent" -j DROP
|
||||
ip6tables -I FORWARD 1 -m string --algo bm --string "BitTorrent protocol" -j DROP
|
||||
ip6tables -I FORWARD 1 -m string --algo bm --string "peer_id=" -j DROP
|
||||
ip6tables -I FORWARD 1 -m string --algo bm --string ".torrent" -j DROP
|
||||
ip6tables -I FORWARD 1 -m string --algo bm --string "announce.php?passkey=" -j DROP
|
||||
ip6tables -I FORWARD 1 -m string --algo bm --string "torrent" -j DROP
|
||||
ip6tables -I FORWARD 1 -m string --algo bm --string "announce" -j DROP
|
||||
ip6tables -I FORWARD 1 -m string --algo bm --string "info_hash" -j DROP
|
||||
ip6tables -I FORWARD 1 -m string --algo bm --string "/default.ida?" -j DROP
|
||||
ip6tables -I FORWARD 1 -m string --algo bm --string ".exe?/c+dir" -j DROP
|
||||
ip6tables -I FORWARD 1 -m string --algo bm --string ".exe?/c_tftp" -j DROP
|
||||
# Block Torrent keys
|
||||
iptables -I FORWARD 1 -m string --algo kmp --string "peer_id" -j DROP
|
||||
iptables -I FORWARD 1 -m string --algo kmp --string "BitTorrent" -j DROP
|
||||
iptables -I FORWARD 1 -m string --algo kmp --string "BitTorrent protocol" -j DROP
|
||||
iptables -I FORWARD 1 -m string --algo kmp --string "bittorrent-announce" -j DROP
|
||||
iptables -I FORWARD 1 -m string --algo kmp --string "announce.php?passkey=" -j DROP
|
||||
ip6tables -I FORWARD 1 -m string --algo kmp --string "peer_id" -j DROP
|
||||
ip6tables -I FORWARD 1 -m string --algo kmp --string "BitTorrent" -j DROP
|
||||
ip6tables -I FORWARD 1 -m string --algo kmp --string "BitTorrent protocol" -j DROP
|
||||
ip6tables -I FORWARD 1 -m string --algo kmp --string "bittorrent-announce" -j DROP
|
||||
ip6tables -I FORWARD 1 -m string --algo kmp --string "announce.php?passkey=" -j DROP
|
||||
# Block Distributed Hash Table (DHT) keywords
|
||||
iptables -I FORWARD 1 -m string --algo kmp --string "find_node" -j DROP
|
||||
iptables -I FORWARD 1 -m string --algo kmp --string "info_hash" -j DROP
|
||||
iptables -I FORWARD 1 -m string --algo kmp --string "get_peers" -j DROP
|
||||
iptables -I FORWARD 1 -m string --algo kmp --string "announce" -j DROP
|
||||
iptables -I FORWARD 1 -m string --algo kmp --string "announce_peers" -j DROP
|
||||
ip6tables -I FORWARD 1 -m string --algo kmp --string "find_node" -j DROP
|
||||
ip6tables -I FORWARD 1 -m string --algo kmp --string "info_hash" -j DROP
|
||||
ip6tables -I FORWARD 1 -m string --algo kmp --string "get_peers" -j DROP
|
||||
ip6tables -I FORWARD 1 -m string --algo kmp --string "announce" -j DROP
|
||||
ip6tables -I FORWARD 1 -m string --algo kmp --string "announce_peers" -j DROP
|
||||
'';
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
system,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
./users/darkkirb.nix
|
||||
./users/root.nix
|
||||
./nix.nix
|
||||
./sops.nix
|
||||
./home.nix
|
||||
./services/restic.nix
|
||||
./specialization.nix
|
||||
./services/promtail.nix
|
||||
./env.nix
|
||||
./tailscale.nix
|
||||
./services/otel.nix
|
||||
];
|
||||
services.openssh.enable = true;
|
||||
environment.systemPackages = with pkgs;
|
||||
[
|
||||
git
|
||||
]
|
||||
++ (
|
||||
if system != "riscv64-linux"
|
||||
then [kitty.terminfo]
|
||||
else []
|
||||
);
|
||||
networking.firewall.allowedTCPPorts = [22];
|
||||
networking.firewall.allowedUDPPortRanges = [
|
||||
{
|
||||
from = 60000;
|
||||
to = 61000;
|
||||
}
|
||||
];
|
||||
|
||||
users.defaultUserShell = pkgs.zsh;
|
||||
|
||||
environment.pathsToLink = ["/share/zsh"];
|
||||
|
||||
console.keyMap = "neo";
|
||||
|
||||
security.sudo.extraConfig = ''
|
||||
Defaults env_keep += "TMUX"
|
||||
'';
|
||||
|
||||
programs.zsh.enable = true;
|
||||
users.mutableUsers = false;
|
||||
|
||||
sops.secrets."root/aws/credentials" = {
|
||||
sopsFile = ../secrets/shared.yaml;
|
||||
owner = "root";
|
||||
key = "aws/credentials";
|
||||
path = "/root/.aws/credentials";
|
||||
};
|
||||
sops.secrets."root/ssh/builder_id_ed25519" = {
|
||||
sopsFile = ../secrets/shared.yaml;
|
||||
owner = "root";
|
||||
key = "ssh/builder_id_ed25519";
|
||||
path = "/root/.ssh/builder_id_ed25519";
|
||||
};
|
||||
sops.secrets."darkkirb/ssh/builder_id_ed25519" = {
|
||||
sopsFile = ../secrets/shared.yaml;
|
||||
owner = "darkkirb";
|
||||
key = "ssh/builder_id_ed25519";
|
||||
path = "/home/darkkirb/.ssh/builder_id_ed25519";
|
||||
};
|
||||
|
||||
programs.ssh.knownHosts = {
|
||||
"nas.int.chir.rs".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDhao1I1Kd1gK5bERUdjMxP9yHDrSHYZsTN2TcSk0K/U";
|
||||
"backup.int.chir.rs".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDhao1I1Kd1gK5bERUdjMxP9yHDrSHYZsTN2TcSk0K/U";
|
||||
};
|
||||
boot.kernel.sysctl = {
|
||||
"fs.inotify.max_user_watches" = 524288;
|
||||
};
|
||||
services.prometheus.exporters.node = {
|
||||
port = 31941;
|
||||
enabledCollectors = [
|
||||
"buddyinfo"
|
||||
"cgroups"
|
||||
"systemd"
|
||||
"ethtool"
|
||||
];
|
||||
enable = true;
|
||||
};
|
||||
i18n.defaultLocale = "nl_NL.UTF-8";
|
||||
nixpkgs.config.permittedInsecurePackages = [
|
||||
"olm-3.2.16"
|
||||
];
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
_: let
|
||||
mkSopsSecret = {
|
||||
name,
|
||||
path,
|
||||
}: {
|
||||
name = "desktop/${name}";
|
||||
value = {
|
||||
sopsFile = ../secrets/desktop.yaml;
|
||||
owner = "darkkirb";
|
||||
key = name;
|
||||
path = "/home/darkkirb/${path}";
|
||||
};
|
||||
};
|
||||
in {
|
||||
sops.secrets = builtins.listToAttrs (map mkSopsSecret [
|
||||
{
|
||||
name = "aws/credentials";
|
||||
path = ".aws/credentials";
|
||||
}
|
||||
{
|
||||
name = ".config/gh/hosts.yml";
|
||||
path = ".config/gh/hosts.yml";
|
||||
}
|
||||
]);
|
||||
}
|
|
@ -1,209 +0,0 @@
|
|||
{
|
||||
system,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
} @ args: let
|
||||
lockscreen-all = pkgs.writeScript "lockscreen-all" ''
|
||||
#!${pkgs.bash}/bin/bash
|
||||
|
||||
if ${pkgs.coreutils}/bin/[ -z "$(${pkgs.usbutils}/bin/lsusb | grep Yubico)" ]; then
|
||||
${pkgs.systemd}/bin/loginctl list-sessions | ${pkgs.gnugrep}/bin/grep '^\ ' | ${pkgs.gawk}/bin/awk '{print $1}' | ${pkgs.findutils}/bin/xargs -i ${pkgs.systemd}/bin/loginctl lock-session {}
|
||||
fi
|
||||
'';
|
||||
in {
|
||||
imports =
|
||||
[
|
||||
./services/pipewire.nix
|
||||
./desktop-secrets.nix
|
||||
./services/cups.nix
|
||||
./services/docker.nix
|
||||
./services/cifs.nix
|
||||
./kde.nix
|
||||
#./sway.nix
|
||||
]
|
||||
/*
|
||||
++ (
|
||||
if system == "x86_64-linux"
|
||||
then [./programs/virtualbox.nix]
|
||||
else []
|
||||
)
|
||||
*/
|
||||
;
|
||||
fonts = {
|
||||
fontDir.enable = true;
|
||||
fontconfig = {
|
||||
enable = true;
|
||||
defaultFonts = {
|
||||
emoji = ["Noto Color Emoji"];
|
||||
monospace = ["Fira Code" "Font Awesome 5 Free"];
|
||||
sansSerif = ["Noto Sans" "Font Awesome 5 Free"];
|
||||
serif = ["Noto Serif" "Font Awesome 5 Free"];
|
||||
};
|
||||
};
|
||||
packages = with pkgs; [
|
||||
fira-code
|
||||
fira-code-symbols
|
||||
font-awesome
|
||||
noto-fonts
|
||||
noto-fonts-cjk-sans
|
||||
noto-fonts-emoji
|
||||
noto-fonts-extra
|
||||
(nerdfonts.override {fonts = ["FiraCode" "DroidSansMono" "Noto"];})
|
||||
nasin-nanpa
|
||||
fairfax-hd
|
||||
(pkgs.stdenvNoCC.mkDerivation rec {
|
||||
pname = "zbalermorna";
|
||||
version = "920b28d798ae1c06885c674bbf02b08ffed12b2f";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "jackhumbert";
|
||||
repo = pname;
|
||||
rev = version;
|
||||
sha256 = "00sl3f1x4frh166mq85lwl9v1f5r3ckkfg8id5fibafymick5vyp";
|
||||
};
|
||||
installPhase = ''
|
||||
mkdir -p $out/share/fonts
|
||||
cp -r $src/fonts/*.otf $out/share/fonts
|
||||
'';
|
||||
})
|
||||
];
|
||||
};
|
||||
fonts.fontconfig.localConf = ''
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
|
||||
<fontconfig>
|
||||
<match target="scan">
|
||||
<test name="family">
|
||||
<string>Fairfax HD</string>
|
||||
</test>
|
||||
<edit name="spacing">
|
||||
<int>100</int>
|
||||
</edit>
|
||||
</match>
|
||||
</fontconfig>
|
||||
'';
|
||||
|
||||
time.timeZone = "Europe/Berlin";
|
||||
services.pcscd.enable = true;
|
||||
|
||||
security.pam = {
|
||||
services.login.u2fAuth = true;
|
||||
services.swaylock.u2fAuth = true;
|
||||
u2f = {
|
||||
enable = true;
|
||||
control = "required";
|
||||
};
|
||||
};
|
||||
services.udev.extraRules = ''
|
||||
ACTION=="remove", ENV{ID_VENDOR_ID}=="1050", ENV{ID_MODEL_ID}=="0407", RUN+="${lockscreen-all}"
|
||||
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="e621", ATTRS{idProduct}=="0000", TAG+="uaccess"
|
||||
ACTION=="add", SUBSYSTEM=="hidraw*", ATTRS{idVendor}=="e621", ATTRS{idProduct}=="0000", TAG+="uaccess"
|
||||
ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="057e", ATTRS{idProduct}=="0337", TAG+="uaccess"
|
||||
ACTION=="add", SUBSYSTEM=="hidraw*", ATTRS{idVendor}=="057e", ATTRS{idProduct}=="0306", TAG+="uaccess"
|
||||
ACTION=="add", SUBSYSTEM=="hidraw*", ATTRS{idVendor}=="057e", ATTRS{idProduct}=="0330", TAG+="uaccess"
|
||||
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS={idProduct}=="6010", OWNER="user", MODE="0777", GROUP="dialout"
|
||||
'';
|
||||
programs.steam.enable = system == "x86_64-linux";
|
||||
nixpkgs.overlays = [
|
||||
(curr: prev: {
|
||||
steam = prev.steam.override {
|
||||
extraPkgs = pkgs:
|
||||
with pkgs; [
|
||||
mono
|
||||
fuse
|
||||
];
|
||||
};
|
||||
})
|
||||
];
|
||||
services.flatpak.enable = true;
|
||||
programs.java.enable = true;
|
||||
hardware.opengl.driSupport32Bit = lib.mkForce (system == "x86_64-linux");
|
||||
home-manager.users.darkkirb = import ./home-manager/darkkirb.nix {
|
||||
desktop = true;
|
||||
inherit args;
|
||||
};
|
||||
|
||||
# For syncthing
|
||||
networking.firewall.allowedTCPPorts = [22000];
|
||||
networking.firewall.allowedUDPPorts = [22000];
|
||||
networking.firewall.allowedTCPPortRanges = [
|
||||
{
|
||||
from = 1714;
|
||||
to = 1764;
|
||||
}
|
||||
];
|
||||
networking.firewall.allowedUDPPortRanges = [
|
||||
{
|
||||
from = 1714;
|
||||
to = 1764;
|
||||
}
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
pinentry-qt
|
||||
dotool
|
||||
wl-clipboard
|
||||
#plasma5Packages.thirdParty.lightly
|
||||
];
|
||||
|
||||
xdg.portal = {
|
||||
enable = true;
|
||||
wlr.enable = true;
|
||||
# gtk portal needed to make gtk apps happy
|
||||
extraPortals = [pkgs.xdg-desktop-portal-gtk];
|
||||
config.common.default = "*";
|
||||
};
|
||||
programs.dconf.enable = true;
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
libinput.enable = true;
|
||||
layout = "de";
|
||||
xkbVariant = "neo";
|
||||
displayManager.lightdm.enable = false;
|
||||
extraLayouts.zlr = {
|
||||
description = "lojban layout";
|
||||
languages = ["jbo"];
|
||||
symbolsFile = ../extra/keyboard/symbols;
|
||||
};
|
||||
};
|
||||
i18n.inputMethod = {
|
||||
enabled = "ibus";
|
||||
ibus.engines = with pkgs.ibus-engines; [anthy];
|
||||
};
|
||||
security.polkit.enable = true;
|
||||
services.dbus.enable = true;
|
||||
services.dbus.packages = with pkgs; [dconf];
|
||||
# Futureproofing: on non-x86 machines, emulate x86
|
||||
boot.binfmt.emulatedSystems =
|
||||
if system != "x86_64-linux"
|
||||
then [
|
||||
"x86_64-linux"
|
||||
"i686-linux"
|
||||
]
|
||||
else [];
|
||||
|
||||
virtualisation = {
|
||||
waydroid.enable = true;
|
||||
lxd.enable = true;
|
||||
};
|
||||
|
||||
programs.gamemode.enable = true;
|
||||
nixpkgs.config.permittedInsecurePackages = ["electron-26.3.0"];
|
||||
|
||||
boot = {
|
||||
plymouth.enable = true;
|
||||
consoleLogLevel = 0;
|
||||
initrd.verbose = false;
|
||||
kernelParams = [
|
||||
"quiet"
|
||||
"splash"
|
||||
"boot.shell_on_fail"
|
||||
"loglevel=3"
|
||||
"rd.systemd.show_status=false"
|
||||
"rd.udev.log_level=3"
|
||||
"udev.log_priority=3"
|
||||
];
|
||||
loader.timeout = 0;
|
||||
};
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
{
|
||||
nixos-hardware,
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux-devterm;
|
||||
boot.kernelParams = ["fbcon=rotate:1"];
|
||||
networking.hostName = "devterm";
|
||||
imports = [
|
||||
./desktop.nix
|
||||
];
|
||||
boot.loader = {
|
||||
grub.enable = lib.mkDefault false;
|
||||
generic-extlinux-compatible.enable = lib.mkDefault true;
|
||||
};
|
||||
boot.initrd = {
|
||||
includeDefaultModules = false;
|
||||
availableKernelModules = [
|
||||
"usbhid"
|
||||
"usb_storage"
|
||||
"vc4"
|
||||
"pcie_brcmstb" # required for the pcie bus to work
|
||||
"reset-raspberrypi" # required for vl805 firmware to load
|
||||
"mmc_block"
|
||||
"usbhid"
|
||||
"hid_generic"
|
||||
"panel_cwd686"
|
||||
"ocp8178_bl"
|
||||
"ti_adc081c"
|
||||
];
|
||||
};
|
||||
environment.systemPackages = with pkgs; [
|
||||
libraspberrypi
|
||||
raspberrypi-eeprom
|
||||
];
|
||||
system.stateVersion = "24.05";
|
||||
fileSystems."/" = {
|
||||
device = "/dev/mmcblk0p2";
|
||||
fsType = "btrfs";
|
||||
options = ["compress=zstd"];
|
||||
};
|
||||
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/mmcblk0p1";
|
||||
fsType = "vfat";
|
||||
};
|
||||
security.pam = {
|
||||
services.login.u2fAuth = lib.mkForce false;
|
||||
services.swaylock.u2fAuth = lib.mkForce false;
|
||||
u2f.enable = lib.mkForce false;
|
||||
services.sddm.u2fAuth = lib.mkForce false;
|
||||
};
|
||||
networking.networkmanager.enable = true;
|
||||
users.users.darkkirb.extraGroups = ["networkmanager"];
|
||||
hardware.deviceTree.filter = "*rpi*.dtb";
|
||||
hardware.deviceTree.overlays = [
|
||||
{
|
||||
name = "dwc2";
|
||||
dtsFile = ./devterm/dwc2-overlay.dts;
|
||||
}
|
||||
{
|
||||
name = "cma";
|
||||
dtsFile = ./devterm/cma-overlay.dts;
|
||||
}
|
||||
{
|
||||
name = "vc4-kms-v3d-pi4";
|
||||
dtsFile = ./devterm/vc4-kms-v3d-pi4-overlay.dts;
|
||||
}
|
||||
{
|
||||
name = "devterm-pmu";
|
||||
dtsFile = ./devterm/devterm-pmu-overlay.dts;
|
||||
}
|
||||
{
|
||||
name = "devterm-panel";
|
||||
dtsFile = ./devterm/devterm-panel-overlay.dts;
|
||||
}
|
||||
{
|
||||
name = "devterm-misc";
|
||||
dtsFile = ./devterm/devterm-misc-overlay.dts;
|
||||
}
|
||||
{
|
||||
name = "audremap";
|
||||
dtsFile = ./devterm/audremap-overlay.dts;
|
||||
}
|
||||
{
|
||||
name = "spi";
|
||||
dtsFile = ./devterm/spi0-overlay.dts;
|
||||
}
|
||||
{
|
||||
name = "devterm-overlay";
|
||||
dtsFile = ./devterm/devterm-overlay.dts;
|
||||
}
|
||||
];
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
services.xserver.xkbVariant = lib.mkForce "us";
|
||||
console.keyMap = lib.mkForce "us";
|
||||
home-manager.users.darkkirb.wayland.windowManager.sway.config.input."*" = lib.mkForce {
|
||||
xkb_layout = "us";
|
||||
xkb_variant = "altgr-intl";
|
||||
};
|
||||
boot.initrd.systemd.tpm2.enable = lib.mkForce false;
|
||||
systemd.tpm2.enable = lib.mkForce false;
|
||||
services.displayManager = {
|
||||
autoLogin = {
|
||||
enable = true;
|
||||
user = "darkkirb";
|
||||
};
|
||||
sddm = {
|
||||
autoLogin.relogin = true;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
compatible = "brcm,bcm2711";
|
||||
|
||||
fragment@0 {
|
||||
target = <&audio_pins>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target = <&audio_pins>;
|
||||
__overlay__ {
|
||||
brcm,pins = < 12 13 >;
|
||||
brcm,function = < 4 >; /* alt0 alt0 */
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
};
|
|
@ -1,14 +0,0 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
compatible = "brcm,bcm2711";
|
||||
|
||||
fragment@0 {
|
||||
target = <&cma>;
|
||||
__overlay__ {
|
||||
size = <(384 * 1024 * 1024)>;
|
||||
};
|
||||
};
|
||||
};
|
|
@ -1,80 +0,0 @@
|
|||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/{
|
||||
compatible = "brcm,bcm2711";
|
||||
|
||||
fragment@0 {
|
||||
target = <&i2c1>;
|
||||
__overlay__ {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&i2c1_pins>;
|
||||
status = "okay";
|
||||
|
||||
adc101c: adc@54 {
|
||||
reg = <0x54>;
|
||||
compatible = "ti,adc101c";
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target = <&spi4>;
|
||||
__overlay__ {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&spi4_pins &spi4_cs_pins>;
|
||||
cs-gpios = <&gpio 4 1>;
|
||||
status = "okay";
|
||||
|
||||
spidev4_0: spidev@0 {
|
||||
compatible = "spidev";
|
||||
reg = <0>; /* CE0 */
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
spi-max-frequency = <125000000>;
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
fragment@2 {
|
||||
target = <&uart1>;
|
||||
__overlay__ {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart1_pins>;
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
fragment@3 {
|
||||
target = <&gpio>;
|
||||
__overlay__ {
|
||||
|
||||
i2c1_pins: i2c1 {
|
||||
brcm,pins = <44 45>;
|
||||
brcm,function = <6>;
|
||||
};
|
||||
|
||||
spi4_pins: spi4_pins {
|
||||
brcm,pins = <6 7>;
|
||||
brcm,function = <7>;
|
||||
};
|
||||
|
||||
spi4_cs_pins: spi0_cs_pins {
|
||||
brcm,pins = <4>;
|
||||
brcm,function = <1>;
|
||||
};
|
||||
|
||||
uart1_pins: uart1_pins {
|
||||
brcm,pins = <14 15>;
|
||||
brcm,function = <2>;
|
||||
brcm,pull = <0 2>;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
};
|
|
@ -1,130 +0,0 @@
|
|||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
compatible = "brcm,bcm2711";
|
||||
fragment@0 {
|
||||
target = <&dma40>;
|
||||
__overlay__ {
|
||||
dma-channel-mask = <0x3000>;
|
||||
};
|
||||
};
|
||||
fragment@1 {
|
||||
target = <&hdmi0>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
fragment@2 {
|
||||
target = <&uart0_pins>;
|
||||
__overlay__ {
|
||||
brcm,pull = <0x02 0x00 0x00 0x02>;
|
||||
brcm,pins = <0x1e 0x1f 0x20 0x21>;
|
||||
};
|
||||
};
|
||||
fragment@3 {
|
||||
target = <&dvp>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
fragment@4 {
|
||||
target = <&pixelvalve4>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
fragment@5 {
|
||||
target = <&ddc1>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
fragment@6 {
|
||||
target = <&txp>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
fragment@7 {
|
||||
target = <&hvs>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
fragment@8 {
|
||||
target = <&pixelvalve3>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
fragment@9 {
|
||||
target = <&spi4>;
|
||||
__overlay__ {
|
||||
pinctrl-0 = <0xf0 0xf1>;
|
||||
};
|
||||
};
|
||||
fragment@10 {
|
||||
target = <&pixelvalve2>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
fragment@11 {
|
||||
target = <&uart1>;
|
||||
__overlay__ {
|
||||
pinctrl-0 = <0xf2>;
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
fragment@12 {
|
||||
target = <&pixelvalve1>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
fragment@13 {
|
||||
target = <&hdmi1>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
fragment@14 {
|
||||
target = <&spi4>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
fragment@15 {
|
||||
target = <&ddc0>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
fragment@16 {
|
||||
target = <&aon_intr>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
fragment@17 {
|
||||
target = <&pixelvalve0>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
fragment@18 {
|
||||
target = <&audio>;
|
||||
__overlay__ {
|
||||
brcm,disable-headphones = <0x00>;
|
||||
status = "okay";
|
||||
bcrm,disable-hdmi;
|
||||
};
|
||||
};
|
||||
fragment@19 {
|
||||
target-path = "/chosen";
|
||||
__overlay__ {
|
||||
bootargs = "coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 8250.nr_uarts=0 smsc95xx.macaddr=E4:5F:01:E4:FE:2D vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 8250.nr_uarts=1";
|
||||
};
|
||||
};
|
||||
};
|
|
@ -1,47 +0,0 @@
|
|||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
compatible = "brcm,bcm2711";
|
||||
|
||||
fragment@0 {
|
||||
target=<&dsi1>;
|
||||
__overlay__ {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
status = "okay";
|
||||
|
||||
port {
|
||||
dsi_out_port: endpoint {
|
||||
remote-endpoint = <&panel_dsi_port>;
|
||||
};
|
||||
};
|
||||
|
||||
panel_cwd686: panel@0 {
|
||||
compatible = "cw,cwd686";
|
||||
reg = <0>;
|
||||
reset-gpio = <&gpio 8 1>;
|
||||
backlight = <&ocp8178_backlight>;
|
||||
rotation = <0x5a>;
|
||||
|
||||
port {
|
||||
panel_dsi_port: endpoint {
|
||||
remote-endpoint = <&dsi_out_port>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target-path = "/";
|
||||
__overlay__ {
|
||||
ocp8178_backlight: backlight@0 {
|
||||
compatible = "ocp8178-backlight";
|
||||
backlight-control-gpios = <&gpio 9 0>;
|
||||
default-brightness = <5>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
|
@ -1,104 +0,0 @@
|
|||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
compatible = "brcm,bcm2711";
|
||||
|
||||
fragment@0 {
|
||||
target = <&i2c0if>;
|
||||
__overlay__ {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
pinctrl-0 = <&i2c0_pins>;
|
||||
pinctrl-names = "default";
|
||||
status = "okay";
|
||||
|
||||
axp22x: pmic@34 {
|
||||
interrupt-controller;
|
||||
#interrupt-cells = <1>;
|
||||
compatible = "x-powers,axp223";
|
||||
reg = <0x34>; /* i2c address */
|
||||
interrupt-parent = <&gpio>;
|
||||
interrupts = <2 8>; /* IRQ_TYPE_EDGE_FALLING */
|
||||
irq-gpios = <&gpio 2 0>;
|
||||
|
||||
regulators {
|
||||
|
||||
x-powers,dcdc-freq = <3000>;
|
||||
|
||||
reg_aldo1: aldo1 {
|
||||
regulator-always-on;
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-name = "audio-vdd";
|
||||
};
|
||||
|
||||
reg_aldo2: aldo2 {
|
||||
regulator-always-on;
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-name = "display-vcc";
|
||||
};
|
||||
|
||||
reg_dldo2: dldo2 {
|
||||
regulator-always-on;
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-name = "dldo2";
|
||||
};
|
||||
|
||||
reg_dldo3: dldo3 {
|
||||
regulator-always-on;
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-name = "dldo3";
|
||||
};
|
||||
|
||||
reg_dldo4: dldo4 {
|
||||
regulator-always-on;
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-name = "dldo4";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
battery_power_supply: battery-power-supply {
|
||||
compatible = "x-powers,axp221-battery-power-supply";
|
||||
monitored-battery = <&battery>;
|
||||
};
|
||||
|
||||
ac_power_supply: ac_power_supply {
|
||||
compatible = "x-powers,axp221-ac-power-supply";
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
fragment@1 {
|
||||
target = <&i2c0if>;
|
||||
__overlay__ {
|
||||
compatible = "brcm,bcm2708-i2c";
|
||||
};
|
||||
};
|
||||
|
||||
fragment@2 {
|
||||
target-path = "/aliases";
|
||||
__overlay__ {
|
||||
i2c0 = "/soc/i2c@7e205000";
|
||||
};
|
||||
};
|
||||
|
||||
fragment@3 {
|
||||
target-path = "/";
|
||||
__overlay__ {
|
||||
battery: battery@0 {
|
||||
compatible = "simple-battery";
|
||||
constant-charge-current-max-microamp = <2100000>;
|
||||
voltage-min-design-microvolt = <3300000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
|
@ -1,22 +0,0 @@
|
|||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
compatible = "brcm,bcm2711";
|
||||
|
||||
fragment@0 {
|
||||
target = <&usb>;
|
||||
#address-cells = <0x01>;
|
||||
#size-cells = <0x01>;
|
||||
|
||||
__overlay__ {
|
||||
compatible = "brcm,bcm2835-usb";
|
||||
dr_mode = "host";
|
||||
g-np-tx-fifo-size = <0x20>;
|
||||
g-rx-fifo-size = <0x22e>;
|
||||
g-tx-fifo-size = <0x200 0x200 0x200 0x200 0x200 0x100 0x100>;
|
||||
status = "okay";
|
||||
phandle = <0x01>;
|
||||
};
|
||||
};
|
||||
};
|
|
@ -1,11 +0,0 @@
|
|||
/dts-v1/;
|
||||
/plugin/;
|
||||
/ {
|
||||
compatible = "bcrm,bcm2711";
|
||||
fragment@0 {
|
||||
target = <&spi>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
};
|
|
@ -1,35 +0,0 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
|
||||
/ {
|
||||
compatible = "brcm,bcm2711";
|
||||
|
||||
fragment@1 {
|
||||
target = <&fb>;
|
||||
__overlay__ {
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
|
||||
fragment@2 {
|
||||
target = <&firmwarekms>;
|
||||
__overlay__ {
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
|
||||
fragment@3 {
|
||||
target = <&v3d>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
fragment@4 {
|
||||
target = <&vc4>;
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
};
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
environment.extraInit = let
|
||||
systemdBin = lib.getBin config.systemd.package;
|
||||
in ''
|
||||
set -a
|
||||
. /dev/fd/0 <<EOF
|
||||
$(${systemdBin}/lib/systemd/user-environment-generators/30-systemd-environment-d-generator)
|
||||
EOF
|
||||
set +a
|
||||
'';
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
args: {
|
||||
pkgs,
|
||||
nixpkgs,
|
||||
nix-gaming,
|
||||
system,
|
||||
...
|
||||
}: let
|
||||
in {
|
||||
home.packages =
|
||||
[
|
||||
pkgs.prismlauncher
|
||||
pkgs.mgba-dev
|
||||
]
|
||||
++ (
|
||||
if system == "x86_64-linux"
|
||||
then [
|
||||
pkgs.xivlauncher
|
||||
(pkgs.wineWowPackages.stagingFull.override {waylandSupport = true;})
|
||||
]
|
||||
else []
|
||||
);
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
_: {
|
||||
boot.loader.grub.enable = true;
|
||||
boot.loader.grub.version = 2;
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,120 +0,0 @@
|
|||
desktop: {
|
||||
pkgs,
|
||||
system,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
imports =
|
||||
[
|
||||
(import ../programs/zsh.nix desktop)
|
||||
../programs/tmux.nix
|
||||
(import ../programs/vim desktop)
|
||||
]
|
||||
++ (
|
||||
if desktop
|
||||
then [
|
||||
../programs/mail.nix
|
||||
../programs/taskwarrior.nix
|
||||
]
|
||||
else []
|
||||
);
|
||||
programs = {
|
||||
zsh = {
|
||||
enable = true;
|
||||
oh-my-zsh = {
|
||||
enable = true;
|
||||
};
|
||||
initExtraBeforeCompInit = "source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
|
||||
|
||||
initExtra =
|
||||
if system != "riscv64-linux"
|
||||
then ''
|
||||
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
||||
|
||||
test -n "$KITTY_INSTALLATION_DIR" || export KITTY_INSTALLATION_DIR=${pkgs.kitty}/lib/kitty
|
||||
export KITTY_SHELL_INTEGRATION=enabled
|
||||
autoload -Uz -- "$KITTY_INSTALLATION_DIR"/shell-integration/zsh/kitty-integration
|
||||
kitty-integration
|
||||
unfunction kitty-integration
|
||||
''
|
||||
else "";
|
||||
|
||||
plugins = [
|
||||
];
|
||||
};
|
||||
autojump.enable = true;
|
||||
jq.enable = true;
|
||||
ledger.enable = true;
|
||||
};
|
||||
home.file.".p10k.zsh".source = ./.p10k.zsh;
|
||||
|
||||
home = {
|
||||
shellAliases =
|
||||
{
|
||||
cat = "bat";
|
||||
less = "bat";
|
||||
}
|
||||
// (
|
||||
if system != "riscv64-linux"
|
||||
then {
|
||||
icat = "${pkgs.kitty}/bin/kitty +kitten icat";
|
||||
d = "${pkgs.kitty}/bin/kitty +kitten diff";
|
||||
hg = "${pkgs.kitty}/bin/kitty +kitten hyperlinked_grep";
|
||||
#ssh = "${pkgs.kitty}/bin/kitty +kitten ssh";
|
||||
cargo = "${pkgs.cargo-mommy}/bin/cargo-mommy";
|
||||
}
|
||||
else {}
|
||||
);
|
||||
packages = with pkgs;
|
||||
[
|
||||
mosh
|
||||
ripgrep
|
||||
gh
|
||||
htop
|
||||
sops
|
||||
progress
|
||||
hexyl
|
||||
mc
|
||||
rclone
|
||||
libarchive
|
||||
p7zip
|
||||
unrar
|
||||
]
|
||||
++ (
|
||||
if desktop
|
||||
then [
|
||||
yubikey-manager
|
||||
yt-dlp
|
||||
oxipng
|
||||
jpegoptim
|
||||
#picard
|
||||
easytag
|
||||
alejandra
|
||||
yubico-piv-tool
|
||||
]
|
||||
else []
|
||||
);
|
||||
sessionVariables = if desktop then {
|
||||
QT_PLUGIN_PATH = lib.mkForce "\${QT_PLUGIN_PATH}:${config.i18n.inputMethod.package}/${pkgs.qt6.qtbase.qtPluginPrefix}:${pkgs.kdePackages.kimageformats}/${pkgs.qt6.qtbase.qtPluginPrefix}";
|
||||
} else {};
|
||||
};
|
||||
|
||||
programs.eza = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
|
||||
programs.bat = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
tmux.enableShellIntegration = true;
|
||||
};
|
||||
home.stateVersion = "22.05";
|
||||
manual.manpages.enable = false; # broken
|
||||
|
||||
_module.args.withNSFW = false;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
desktop,
|
||||
args,
|
||||
}: {pkgs, ...}: {
|
||||
imports =
|
||||
[
|
||||
(import ./base.nix desktop)
|
||||
../programs/ssh.nix
|
||||
(import ../programs/git.nix desktop)
|
||||
../programs/direnv.nix
|
||||
]
|
||||
++ (
|
||||
if desktop
|
||||
then [
|
||||
#../programs/sway.nix
|
||||
../programs/firefox.nix
|
||||
../programs/waybar.nix
|
||||
../programs/ims.nix
|
||||
../programs/syncthing.nix
|
||||
../programs/plover.nix
|
||||
(import ../games/default.nix args)
|
||||
../programs/yubikey.nix
|
||||
../programs/keybase.nix
|
||||
../programs/keepass.nix
|
||||
../programs/vscode
|
||||
../programs/misc.nix
|
||||
../programs/zk.nix
|
||||
../programs/fcitx.nix
|
||||
../programs/gpg.nix
|
||||
../programs/zoom.nix
|
||||
]
|
||||
else []
|
||||
);
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
imports = [
|
||||
(import ./base.nix false)
|
||||
];
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
imports = [
|
||||
(import ./base.nix false)
|
||||
../programs/builders.nix
|
||||
];
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
_: {
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.root = import ./home-manager/root.nix;
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{nixpkgs, ...}: {
|
||||
imports = [
|
||||
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-graphical-calamares-plasma6.nix"
|
||||
];
|
||||
networking.hostId = "8425e349";
|
||||
}
|
|
@ -1,149 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
modulesPath,
|
||||
...
|
||||
} @ args: {
|
||||
networking.hostName = "instance-20221213-1915";
|
||||
networking.hostId = "746d4523";
|
||||
|
||||
imports = [
|
||||
(modulesPath + "/profiles/qemu-guest.nix")
|
||||
./systemd-boot.nix
|
||||
./server.nix
|
||||
./wireguard/public-server.nix
|
||||
./services/named-submissive.nix
|
||||
./services/shitalloverme.nix
|
||||
./users/remote-build.nix
|
||||
./services/atticd.nix
|
||||
./services/minecraft.nix
|
||||
./services/postgres.nix
|
||||
./services/uptime-kuma.nix
|
||||
./services/reverse-proxy.nix
|
||||
./wireguard
|
||||
./zfs.nix
|
||||
#./services/kubernetes.nix
|
||||
./services/gitea.nix
|
||||
./services/chir-rs.nix
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = ["xhci_pci" "virtio_pci" "usbhid"];
|
||||
boot.initrd.kernelModules = [];
|
||||
boot.kernelModules = [];
|
||||
boot.extraModulePackages = [];
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "tank/local/root";
|
||||
fsType = "zfs";
|
||||
};
|
||||
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/6557-C4A0";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
fileSystems."/nix" = {
|
||||
device = "tank/local/nix";
|
||||
fsType = "zfs";
|
||||
};
|
||||
|
||||
fileSystems."/persist" = {
|
||||
device = "tank/safe/persist";
|
||||
fsType = "zfs";
|
||||
neededForBoot = true;
|
||||
};
|
||||
|
||||
fileSystems."/home" = {
|
||||
device = "tank/safe/home";
|
||||
fsType = "zfs";
|
||||
};
|
||||
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
|
||||
# https://grahamc.com/blog/erase-your-darlings
|
||||
boot.initrd.postDeviceCommands = lib.mkAfter ''
|
||||
zfs rollback -r tank/local/root@blank
|
||||
'';
|
||||
|
||||
services.openssh = {
|
||||
hostKeys = [
|
||||
{
|
||||
path = "/persist/ssh/ssh_host_ed25519_key";
|
||||
type = "ed25519";
|
||||
}
|
||||
{
|
||||
path = "/persist/ssh/ssh_host_rsa_key";
|
||||
type = "rsa";
|
||||
bits = 4096;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"L /var/lib/acme - - - - /persist/var/lib/acme"
|
||||
"L /var/lib/tailscale/tailscaled.state - - - - /persist/var/lib/tailscale/tailscaled.state"
|
||||
"d /build - - - - -"
|
||||
"L /var/lib/ipfs - - - - /persist/var/lib/ipfs"
|
||||
"L /var/lib/uptime-kuma - - - - /persist/var/lib/uptime-kuma"
|
||||
];
|
||||
|
||||
services.postgresql.dataDir = "/persist/var/lib/postgresql/${config.services.postgresql.package.psqlSchema}";
|
||||
|
||||
networking.wireguard.interfaces."wg0".ips = ["fd0d:a262:1fa6:e621:746d:4523:5c04:1453/64"];
|
||||
home-manager.users.darkkirb = import ./home-manager/darkkirb.nix {
|
||||
desktop = false;
|
||||
inherit args;
|
||||
};
|
||||
nix.settings.cores = 4;
|
||||
nix.settings.max-jobs = 4;
|
||||
nix.settings.system-features = [
|
||||
"nixos-test"
|
||||
"big-parallel"
|
||||
"benchmark"
|
||||
"gccarch-armv8-a"
|
||||
"gccarch-armv8.1-a"
|
||||
"gccarch-armv8.2-a"
|
||||
"ca-derivations"
|
||||
];
|
||||
nix.daemonCPUSchedPolicy = "idle";
|
||||
nix.daemonIOSchedClass = "idle";
|
||||
boot.binfmt.emulatedSystems = [
|
||||
"riscv32-linux"
|
||||
"riscv64-linux"
|
||||
];
|
||||
|
||||
system.stateVersion = "22.11";
|
||||
|
||||
sops.secrets."root/.ssh/id_ed25519" = {
|
||||
owner = "root";
|
||||
path = "/root/.ssh/id_ed25519";
|
||||
};
|
||||
sops.secrets."services/ssh/host-key" = {
|
||||
owner = "root";
|
||||
path = "/etc/secrets/initrd/ssh_host_ed25519_key";
|
||||
};
|
||||
sops.age.sshKeyPaths = lib.mkForce ["/persist/ssh/ssh_host_ed25519_key"];
|
||||
services.bind.forwarders = lib.mkForce [];
|
||||
boot.loader.systemd-boot.configurationLimit = lib.mkForce 1;
|
||||
services.tailscale.useRoutingFeatures = "server";
|
||||
services.postgresql.settings = {
|
||||
max_connections = 200;
|
||||
shared_buffers = "6GB";
|
||||
effective_cache_size = "18GB";
|
||||
maintenance_work_mem = "1536MB";
|
||||
checkpoint_completion_target = 0.9;
|
||||
wal_buffers = "16MB";
|
||||
default_statistics_target = 100;
|
||||
random_page_cost = 1.1;
|
||||
effective_io_concurrency = 200;
|
||||
work_mem = "15728kB";
|
||||
min_wal_size = "1GB";
|
||||
max_wal_size = "4GB";
|
||||
max_worker_processes = 4;
|
||||
max_parallel_workers_per_gather = 2;
|
||||
max_parallel_workers = 4;
|
||||
max_parallel_maintenance_workers = 2;
|
||||
};
|
||||
|
||||
services.restic.backups.sysbackup.paths = ["/persist"];
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
{
|
||||
security.pam.services.sddm.u2fAuth = true;
|
||||
services.displayManager.sddm = {
|
||||
enable = true;
|
||||
wayland.enable = true;
|
||||
wayland.compositor = "kwin";
|
||||
};
|
||||
services.xserver = {
|
||||
desktopManager.plasma6.enable = true;
|
||||
#desktopManager.plasma5.enable = true;
|
||||
displayManager.defaultSession = "plasma";
|
||||
#displayManager.defaultSession = "plasmawayland";
|
||||
};
|
||||
}
|
211
config/nas.nix
211
config/nas.nix
|
@ -1,211 +0,0 @@
|
|||
{
|
||||
config,
|
||||
modulesPath,
|
||||
lib,
|
||||
nixos-hardware,
|
||||
nixpkgs,
|
||||
pkgs,
|
||||
...
|
||||
} @ args: {
|
||||
networking.hostName = "nas";
|
||||
networking.hostId = "70af00ed";
|
||||
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
./systemd-boot.nix
|
||||
./services/tpm2.nix
|
||||
./server.nix
|
||||
./services/hydra.nix
|
||||
nixos-hardware.nixosModules.common-cpu-amd
|
||||
nixos-hardware.nixosModules.common-pc-ssd
|
||||
./services/syncthing.nix
|
||||
../modules/tc-cake.nix
|
||||
./services/cups.nix
|
||||
./services/iscsi.nix
|
||||
./services/docker.nix
|
||||
./users/remote-build.nix
|
||||
./services/nfs.nix
|
||||
./services/tempo.nix
|
||||
./services/loki.nix
|
||||
./services/prometheus.nix
|
||||
./services/yiff-stash.nix
|
||||
./services/reverse-proxy.nix
|
||||
./services/jellyfin.nix
|
||||
./services/mautrix-discord.nix
|
||||
./services/mautrix-telegram.nix
|
||||
./services/mautrix-whatsapp.nix
|
||||
./services/mautrix-signal.nix
|
||||
./services/synapse.nix
|
||||
./services/heisenbridge.nix
|
||||
#./services/kubernetes.nix
|
||||
./services/forgejo-runner.nix
|
||||
./services/renovate.nix
|
||||
./services/mautrix-slack.nix
|
||||
];
|
||||
|
||||
hardware.cpu.amd.updateMicrocode = true;
|
||||
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usb_storage" "sd_mod" "bcache"];
|
||||
boot.initrd.kernelModules = ["igb"];
|
||||
boot.kernelModules = ["kvm-amd"];
|
||||
boot.extraModulePackages = [
|
||||
config.boot.kernelPackages.zenpower
|
||||
];
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "/dev/bcache0";
|
||||
fsType = "btrfs";
|
||||
options = ["subvol=root" "compress=zstd"];
|
||||
};
|
||||
|
||||
fileSystems."/home" = {
|
||||
device = "/dev/bcache0";
|
||||
fsType = "btrfs";
|
||||
options = ["subvol=home" "compress=zstd"];
|
||||
};
|
||||
|
||||
fileSystems."/nix" = {
|
||||
device = "/dev/bcache0";
|
||||
fsType = "btrfs";
|
||||
options = ["subvol=nix" "compress=zstd" "noatime"];
|
||||
};
|
||||
|
||||
services.snapper.configs.main = {
|
||||
SUBVOLUME = "/";
|
||||
TIMELINE_LIMIT_HOURLY = 5;
|
||||
TIMELINE_LIMIT_DAILY = 7;
|
||||
TIMELINE_LIMIT_WEEKLY = 4;
|
||||
TIMELINE_LIMIT_MONTHLY = 12;
|
||||
TIMELINE_LIMIT_YEARLY = 0;
|
||||
};
|
||||
services.beesd.filesystems.root = {
|
||||
spec = "/";
|
||||
hashTableSizeMB = 2048;
|
||||
verbosity = "crit";
|
||||
extraOptions = ["--loadavg-target" "5.0"];
|
||||
};
|
||||
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/nvme0n1p1";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
environment.etc."sysconfig/lm_sensors".text = ''
|
||||
# Generated by sensors-detect on Sun Apr 24 08:31:51 2022
|
||||
# This file is sourced by /etc/init.d/lm_sensors and defines the modules to
|
||||
# be loaded/unloaded.
|
||||
#
|
||||
# The format of this file is a shell script that simply defines variables:
|
||||
# HWMON_MODULES for hardware monitoring driver modules, and optionally
|
||||
# BUS_MODULES for any required bus driver module (for example for I2C or SPI).
|
||||
|
||||
HWMON_MODULES="it87"
|
||||
'';
|
||||
nix.settings.cores = 12;
|
||||
nix.settings.system-features = [
|
||||
"kvm"
|
||||
"nixos-test"
|
||||
"big-parallel"
|
||||
"benchmark"
|
||||
"gccarch-znver1"
|
||||
"gccarch-skylake"
|
||||
"ca-derivations"
|
||||
];
|
||||
boot.binfmt.emulatedSystems = [
|
||||
"armv7l-linux"
|
||||
"powerpc-linux"
|
||||
"powerpc64-linux"
|
||||
"powerpc64le-linux"
|
||||
"wasm32-wasi"
|
||||
"riscv32-linux"
|
||||
"riscv64-linux"
|
||||
];
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
nix.settings.substituters = lib.mkForce [
|
||||
"https://attic.chir.rs/chir-rs/"
|
||||
"https://cache.nixos.org/"
|
||||
];
|
||||
nix.daemonCPUSchedPolicy = "idle";
|
||||
nix.daemonIOSchedClass = "idle";
|
||||
|
||||
system.stateVersion = "22.05";
|
||||
home-manager.users.darkkirb = import ./home-manager/darkkirb.nix {
|
||||
desktop = false;
|
||||
inherit args;
|
||||
};
|
||||
|
||||
networking.tc_cake = {
|
||||
enp2s0f0u4 = {
|
||||
disableOffload = true;
|
||||
shapeEgress = {
|
||||
bandwidth = "4mbit";
|
||||
extraArgs = "docsis nat ack-filter";
|
||||
};
|
||||
shapeIngress = {
|
||||
bandwidth = "33mbit";
|
||||
ifb = "ifb4enp2s0f0u4";
|
||||
};
|
||||
};
|
||||
};
|
||||
services.postgresql.settings = {
|
||||
max_connections = 200;
|
||||
shared_buffers = "4GB";
|
||||
effective_cache_size = "12GB";
|
||||
maintenance_work_mem = "1GB";
|
||||
checkpoint_completion_target = 0.9;
|
||||
wal_buffers = "16MB";
|
||||
default_statistics_target = 100;
|
||||
random_page_cost = 1.1;
|
||||
effective_io_concurrency = 200;
|
||||
work_mem = "5242kB";
|
||||
min_wal_size = "1GB";
|
||||
max_wal_size = "4GB";
|
||||
max_worker_processes = 12;
|
||||
max_parallel_workers_per_gather = 4;
|
||||
max_parallel_workers = 12;
|
||||
max_parallel_maintenance_workers = 4;
|
||||
};
|
||||
services.tailscale.useRoutingFeatures = "both";
|
||||
hardware.sane.brscan4.enable = true;
|
||||
|
||||
swapDevices = [
|
||||
{
|
||||
device = "/dev/sda2";
|
||||
}
|
||||
{
|
||||
device = "/dev/sdb2";
|
||||
}
|
||||
{
|
||||
device = "/dev/sdc2";
|
||||
}
|
||||
];
|
||||
|
||||
hardware.opengl = {
|
||||
enable = true;
|
||||
driSupport32Bit = true;
|
||||
};
|
||||
|
||||
services.xserver.videoDrivers = ["nvidia"];
|
||||
|
||||
hardware.nvidia = {
|
||||
modesetting.enable = true;
|
||||
powerManagement.enable = false;
|
||||
powerManagement.finegrained = false;
|
||||
open = false;
|
||||
nvidiaSettings = true;
|
||||
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
};
|
||||
services.restic.backups.sysbackup = {
|
||||
paths = ["/media"];
|
||||
pruneOpts = [
|
||||
"--keep-daily 7"
|
||||
"--keep-weekly 4"
|
||||
"--keep-monthly 12"
|
||||
"--keep-yearly 10"
|
||||
];
|
||||
};
|
||||
virtualisation.docker = {
|
||||
enable = true;
|
||||
#enableNvidia = true;
|
||||
};
|
||||
environment.systemPackages = with pkgs; [docker runc];
|
||||
}
|
208
config/nix.nix
208
config/nix.nix
|
@ -1,208 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
system,
|
||||
attic,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
./workarounds
|
||||
];
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
nix = {
|
||||
settings = {
|
||||
sandbox = true;
|
||||
trusted-users = ["@wheel" "remote-build"];
|
||||
require-sigs = true;
|
||||
substituters = [
|
||||
"https://attic.chir.rs/chir-rs/"
|
||||
"https://hydra.int.chir.rs"
|
||||
];
|
||||
trusted-public-keys = [
|
||||
"nixcache:8KKuGz95Pk4UJ5W/Ni+pN+v+LDTkMMFV4yrGmAYgkDg="
|
||||
"hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs="
|
||||
"chir-rs:rzK1Czm3RqBbZLnXYrLM6JyOhfr6Z/8lhACIPO/LNFQ="
|
||||
];
|
||||
auto-optimise-store = true;
|
||||
};
|
||||
extraOptions = ''
|
||||
experimental-features = nix-command flakes ca-derivations
|
||||
'';
|
||||
gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 7d";
|
||||
};
|
||||
buildMachines = with lib;
|
||||
mkMerge [
|
||||
(mkIf (config.networking.hostName != "instance-20221213-1915") [
|
||||
{
|
||||
hostName = "build-aarch64";
|
||||
systems = [
|
||||
"aarch64-linux"
|
||||
"riscv32-linux"
|
||||
"riscv64-linux"
|
||||
];
|
||||
maxJobs = 4;
|
||||
speedFactor = 1;
|
||||
supportedFeatures = ["nixos-test" "benchmark" "ca-derivations" "gccarch-armv8-a" "gccarch-armv8.1-a" "gccarch-armv8.2-a" "big-parallel"];
|
||||
}
|
||||
])
|
||||
(mkIf (config.networking.hostName != "nas") [
|
||||
{
|
||||
hostName = "build-nas";
|
||||
systems = [
|
||||
"i686-linux"
|
||||
"x86_64-linux"
|
||||
"armv7l-linux"
|
||||
"powerpc-linux"
|
||||
"powerpc64-linux"
|
||||
"powerpc64le-linux"
|
||||
"wasm32-wasi"
|
||||
"riscv32-linux"
|
||||
"riscv64-linux"
|
||||
];
|
||||
maxJobs = 12;
|
||||
speedFactor = 1;
|
||||
supportedFeatures = [
|
||||
"kvm"
|
||||
"nixos-test"
|
||||
"big-parallel"
|
||||
"benchmark"
|
||||
"gccarch-znver1"
|
||||
"gccarch-skylake"
|
||||
"ca-derivations"
|
||||
];
|
||||
}
|
||||
])
|
||||
(mkIf (config.networking.hostName != "rainbow-resort") [
|
||||
{
|
||||
hostName = "build-rainbow-resort";
|
||||
systems = [
|
||||
"i686-linux"
|
||||
"x86_64-linux"
|
||||
"armv7l-linux"
|
||||
"powerpc-linux"
|
||||
"powerpc64-linux"
|
||||
"powerpc64le-linux"
|
||||
"wasm32-wasi"
|
||||
"riscv32-linux"
|
||||
"riscv64-linux"
|
||||
];
|
||||
maxJobs = 16;
|
||||
speedFactor = 1;
|
||||
supportedFeatures = [
|
||||
"kvm"
|
||||
"nixos-test"
|
||||
"big-parallel"
|
||||
"benchmark"
|
||||
"gccarch-skylake-avx512"
|
||||
"gccarch-znver3"
|
||||
"gccarch-znver2"
|
||||
"gccarch-znver1"
|
||||
"gccarch-skylake"
|
||||
"ca-derivations"
|
||||
];
|
||||
}
|
||||
])
|
||||
(mkIf (config.networking.hostName != "vf2") [
|
||||
{
|
||||
hostName = "build-riscv";
|
||||
systems = [
|
||||
"riscv32-linux"
|
||||
"riscv64-linux"
|
||||
];
|
||||
maxJobs = 4;
|
||||
speedFactor = 2;
|
||||
supportedFeatures = [
|
||||
"nixos-test"
|
||||
"big-parallel"
|
||||
"benchmark"
|
||||
"ca-derivations"
|
||||
# There are many more combinations but i simply do not care lol
|
||||
"gccarch-rv64gc_zba_zbb"
|
||||
"gccarch-rv64gc_zba"
|
||||
"gccarch-rv64gc_zbb"
|
||||
"gccarch-rv64gc"
|
||||
"gccarch-rv32gc_zba_zbb"
|
||||
"gccarch-rv32gc_zba"
|
||||
"gccarch-rv32gc_zbb"
|
||||
"gccarch-rv32gc"
|
||||
"native-riscv"
|
||||
];
|
||||
}
|
||||
])
|
||||
];
|
||||
distributedBuilds = true;
|
||||
};
|
||||
systemd.services.nix-daemon.environment.TMPDIR = "/build";
|
||||
systemd.services.nixos-upgrade = {
|
||||
description = "NixOS Upgrade";
|
||||
|
||||
restartIfChanged = false;
|
||||
unitConfig.X-StopOnRemoval = false;
|
||||
|
||||
serviceConfig.Type = "oneshot";
|
||||
|
||||
path = with pkgs; [
|
||||
coreutils
|
||||
gnutar
|
||||
xz.bin
|
||||
gzip
|
||||
gitMinimal
|
||||
config.nix.package.out
|
||||
config.programs.ssh.package
|
||||
jq
|
||||
curl
|
||||
];
|
||||
|
||||
script = lib.mkDefault ''
|
||||
#!${pkgs.bash}/bin/bash
|
||||
set -ex
|
||||
builds=$(${pkgs.curl}/bin/curl -H 'accept: application/json' https://hydra.int.chir.rs/jobset/flakes/${
|
||||
if config.networking.hostName != "vf2"
|
||||
then "nixos-config"
|
||||
else "nixos-config-riscv"
|
||||
}/evals | ${pkgs.jq}/bin/jq -r '.evals[0].builds[]')
|
||||
for build in $builds; do
|
||||
doc=$(${pkgs.curl}/bin/curl -H 'accept: application/json' https://hydra.int.chir.rs/build/$build)
|
||||
jobname=$(echo $doc | ${pkgs.jq}/bin/jq -r '.job')
|
||||
if [ "$jobname" = "${config.networking.hostName}.${system}" ]; then
|
||||
drvname=$(echo $doc | ${pkgs.jq}/bin/jq -r '.drvpath')
|
||||
output=$(${pkgs.nix}/bin/nix-store -r $drvname)
|
||||
|
||||
${pkgs.nix}/bin/nix-env -p /nix/var/nix/profiles/system --set $output
|
||||
|
||||
${
|
||||
if config.networking.hostName != "nixos-8gb-fsn1-1"
|
||||
then ''
|
||||
$output/bin/switch-to-configuration boot
|
||||
booted="$(${pkgs.coreutils}/bin/readlink /run/booted-system/{initrd,kernel,kernel-modules})"
|
||||
built="$(${pkgs.coreutils}/bin/readlink $output/{initrd,kernel,kernel-modules})"
|
||||
if [ "$booted" = "$built" ]; then
|
||||
$output/bin/switch-to-configuration switch
|
||||
else
|
||||
${pkgs.systemd}/bin/shutdown -r +1
|
||||
fi
|
||||
exit
|
||||
''
|
||||
else "$output/bin/switch-to-configuration switch"
|
||||
}
|
||||
fi
|
||||
done
|
||||
'';
|
||||
after = ["network-online.target"];
|
||||
wants = ["network-online.target"];
|
||||
};
|
||||
systemd.timers.nixos-upgrade = {
|
||||
enable = true;
|
||||
description = "Automatically update nixos";
|
||||
requires = ["nixos-upgrade.service"];
|
||||
wantedBy = ["multi-user.target"];
|
||||
timerConfig = {
|
||||
OnUnitActiveSec = "30min";
|
||||
RandomizedDelaySec = "1h";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,215 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
modulesPath,
|
||||
pkgs,
|
||||
config,
|
||||
system,
|
||||
...
|
||||
} @ args: {
|
||||
networking.hostName = "nixos-8gb-fsn1-1";
|
||||
networking.hostId = "73561e1f";
|
||||
|
||||
imports = [
|
||||
(modulesPath + "/profiles/qemu-guest.nix")
|
||||
./grub.nix
|
||||
./server.nix
|
||||
./services/named.nix
|
||||
./services/grafana.nix
|
||||
./users/miifox.nix
|
||||
./services/postgres.nix
|
||||
./services/dovecot.nix
|
||||
./services/postfix.nix
|
||||
./services/reverse-proxy.nix
|
||||
./services/matrix-media-repo.nix
|
||||
./bittorrent-blocker.nix
|
||||
./services/akkoma
|
||||
./services/peertube
|
||||
./services/rspamd.nix
|
||||
./wireguard/public-server.nix
|
||||
./services/shitalloverme.nix
|
||||
./services/initrd-ssh.nix
|
||||
./wireguard
|
||||
./zfs.nix
|
||||
#./services/kubernetes.nix
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = ["ata_piix" "virtio_pci" "virtio_scsi" "xhci_pci" "sd_mod" "sr_mod"];
|
||||
boot.initrd.kernelModules = [];
|
||||
boot.kernelModules = [];
|
||||
boot.extraModulePackages = [];
|
||||
boot.supportedFilesystems = ["zfs"];
|
||||
boot.loader.grub.devices = ["/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_16151622"];
|
||||
boot.loader.timeout = 5;
|
||||
boot.initrd.luks.devices = {
|
||||
disk0 = {
|
||||
device = "/dev/disk/by-partuuid/29ccd4c9-5ef5-a146-8e42-9244f712baca";
|
||||
};
|
||||
};
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "tank/nixos";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil"];
|
||||
};
|
||||
|
||||
fileSystems."/nix" = {
|
||||
device = "tank/nixos/nix";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil"];
|
||||
};
|
||||
|
||||
fileSystems."/etc" = {
|
||||
device = "tank/nixos/etc";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil"];
|
||||
};
|
||||
|
||||
fileSystems."/var" = {
|
||||
device = "tank/nixos/var";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil"];
|
||||
};
|
||||
|
||||
fileSystems."/var/lib" = {
|
||||
device = "tank/nixos/var/lib";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil"];
|
||||
};
|
||||
|
||||
fileSystems."/var/lib/minio" = {
|
||||
device = "tank/nixos/var/lib/minio";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil"];
|
||||
};
|
||||
|
||||
fileSystems."/var/lib/minio/disk0" = {
|
||||
device = "tank/nixos/var/lib/minio/disk0";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil"];
|
||||
};
|
||||
|
||||
fileSystems."/var/lib/minio/disk1" = {
|
||||
device = "tank/nixos/var/lib/minio/disk1";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil"];
|
||||
};
|
||||
|
||||
fileSystems."/var/lib/minio/disk2" = {
|
||||
device = "tank/nixos/var/lib/minio/disk2";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil"];
|
||||
};
|
||||
|
||||
fileSystems."/var/lib/minio/disk3" = {
|
||||
device = "tank/nixos/var/lib/minio/disk3";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil"];
|
||||
};
|
||||
|
||||
fileSystems."/var/log" = {
|
||||
device = "tank/nixos/var/log";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil"];
|
||||
};
|
||||
|
||||
fileSystems."/var/spool" = {
|
||||
device = "tank/nixos/var/spool";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil"];
|
||||
};
|
||||
|
||||
fileSystems."/home" = {
|
||||
device = "tank/userdata/home";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil"];
|
||||
};
|
||||
|
||||
fileSystems."/root" = {
|
||||
device = "tank/userdata/home/root";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil"];
|
||||
};
|
||||
|
||||
fileSystems."/home/darkkirb" = {
|
||||
device = "tank/userdata/home/darkkirb";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil"];
|
||||
};
|
||||
|
||||
fileSystems."/home/miifox" = {
|
||||
device = "tank/userdata/home/miifox";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil"];
|
||||
};
|
||||
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/8E14-4366";
|
||||
fsType = "vfat";
|
||||
options = ["X-mount.mkdir"];
|
||||
};
|
||||
|
||||
swapDevices = [];
|
||||
|
||||
system.stateVersion = "21.11";
|
||||
|
||||
systemd.network = {
|
||||
enable = true;
|
||||
networks."ens3".extraConfig = ''
|
||||
[Match]
|
||||
Name = ens3
|
||||
[Network]
|
||||
Address = 2a01:4f8:1c17:d953:b4e1:08ff:e658:6f49/64
|
||||
Gateway = fe80::1
|
||||
'';
|
||||
};
|
||||
|
||||
networking.wireguard.interfaces."wg0".ips = ["fd0d:a262:1fa6:e621:b4e1:08ff:e658:6f49/64"];
|
||||
home-manager.users.darkkirb = import ./home-manager/darkkirb.nix {
|
||||
desktop = false;
|
||||
inherit args;
|
||||
};
|
||||
nix.settings.cores = 2;
|
||||
nix.settings.max-jobs = 2;
|
||||
nix.daemonCPUSchedPolicy = "idle";
|
||||
nix.daemonIOSchedClass = "idle";
|
||||
|
||||
nix.settings.system-features = [
|
||||
"kvm"
|
||||
"nixos-test"
|
||||
"big-parallel"
|
||||
"benchmark"
|
||||
"gccarch-skylake"
|
||||
"ca-derivations"
|
||||
];
|
||||
nix.settings.auto-optimise-store = true;
|
||||
|
||||
services.postgresql.settings = {
|
||||
max_connections = 200;
|
||||
shared_buffers = "1GB";
|
||||
effective_cache_size = "3GB";
|
||||
maintenance_work_mem = "256MB";
|
||||
checkpoint_completion_target = 0.9;
|
||||
wal_buffers = "16MB";
|
||||
default_statistics_target = 100;
|
||||
random_page_cost = 1.1;
|
||||
effective_io_concurrency = 200;
|
||||
work_mem = "52422kB";
|
||||
min_wal_size = "1GB";
|
||||
max_wal_size = "4GB";
|
||||
max_worker_processes = 2;
|
||||
max_parallel_workers_per_gather = 1;
|
||||
max_parallel_workers = 2;
|
||||
max_parallel_maintenance_workers = 1;
|
||||
};
|
||||
|
||||
services.resolved.enable = false;
|
||||
services.bind.forwarders = lib.mkForce [];
|
||||
services.tailscale.useRoutingFeatures = "server";
|
||||
services.caddy.virtualHosts."darkkirb.de" = {
|
||||
useACMEHost = "darkkirb.de";
|
||||
logFormat = pkgs.lib.mkForce "";
|
||||
extraConfig = ''
|
||||
redir https://lotte.chir.rs
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
{config, ...}: {
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
matchBlocks = {
|
||||
"build-nas" = {
|
||||
hostname = "nas.int.chir.rs";
|
||||
identitiesOnly = true;
|
||||
identityFile = "${config.home.homeDirectory}/.ssh/builder_id_ed25519";
|
||||
port = 22;
|
||||
user = "remote-build";
|
||||
};
|
||||
"build-rainbow-resort" = {
|
||||
hostname = "rainbow-resort.int.chir.rs";
|
||||
identitiesOnly = true;
|
||||
identityFile = "${config.home.homeDirectory}/.ssh/builder_id_ed25519";
|
||||
port = 22;
|
||||
user = "remote-build";
|
||||
};
|
||||
"build-aarch64" = {
|
||||
hostname = "instance-20221213-1915.int.chir.rs";
|
||||
identitiesOnly = true;
|
||||
identityFile = "${config.home.homeDirectory}/.ssh/builder_id_ed25519";
|
||||
port = 22;
|
||||
user = "remote-build";
|
||||
};
|
||||
"backup" = {
|
||||
hostname = "backup.int.chir.rs";
|
||||
identitiesOnly = true;
|
||||
identityFile = "${config.home.homeDirectory}/.ssh/builder_id_ed25519";
|
||||
port = 22;
|
||||
user = "backup";
|
||||
};
|
||||
"build-riscv" = {
|
||||
hostname = "vf2.int.chir.rs";
|
||||
identitiesOnly = true;
|
||||
identityFile = "${config.home.homeDirectory}/.ssh/builder_id_ed25519";
|
||||
port = 22;
|
||||
user = "remote-build";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
{...}: {
|
||||
accounts.calendar.accounts.lotte = {
|
||||
};
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
_: {
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
i18n.inputMethod = {
|
||||
enabled = "fcitx5";
|
||||
fcitx5.addons = with pkgs; [fcitx5-chinese-addons fcitx5-table-extra fcitx5-table-other fcitx5-gtk fcitx5-mozc];
|
||||
};
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
firefox,
|
||||
...
|
||||
}: {
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
profiles = {
|
||||
unhardened = {
|
||||
id = 1;
|
||||
};
|
||||
default = {
|
||||
userChrome = ''
|
||||
/* Hide tab bar in FF Quantum */
|
||||
@-moz-document url("chrome://browser/content/browser.xul") {
|
||||
#TabsToolbar {
|
||||
visibility: collapse !important;
|
||||
margin-bottom: 21px !important;
|
||||
}
|
||||
|
||||
#sidebar-box[sidebarcommand="treestyletab_piro_sakura_ne_jp-sidebar-action"] #sidebar-header {
|
||||
visibility: collapse !important;
|
||||
}
|
||||
}
|
||||
'';
|
||||
settings = {
|
||||
"font.default.x-western" = "sans-serif";
|
||||
"font.name-list.monospace.x-western" = "monospace, nasin-nanpa";
|
||||
"font.name-list.sans-serif.x-western" = "sans-serif, nasin-nanpa";
|
||||
"font.name-list.serif.x-western" = "sans-serif, nasin-nanpa";
|
||||
};
|
||||
id = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
desktop: {pkgs, ...}: {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
package =
|
||||
if desktop
|
||||
then pkgs.gitAndTools.gitFull
|
||||
else pkgs.git;
|
||||
lfs.enable = true;
|
||||
userEmail = "lotte@chir.rs";
|
||||
userName = "Charlotte 🦝 Delenk";
|
||||
extraConfig = {
|
||||
init.defaultBranch = "main";
|
||||
merge.conflictstyle = "diff3";
|
||||
push.autoSetupRemote = true;
|
||||
rerere.enabled = true;
|
||||
};
|
||||
delta.enable = true;
|
||||
};
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
programs.gpg = {
|
||||
enable = true;
|
||||
publicKeys = [
|
||||
{
|
||||
source = ../../keys/lotte_chir.rs.pgp;
|
||||
trust = 5;
|
||||
}
|
||||
{
|
||||
source = ../../keys/miifox_miifox.net.pgp;
|
||||
trust = 3;
|
||||
}
|
||||
{
|
||||
source = ../../keys/mdelenk_hs-mittweida.de.pgp;
|
||||
trust = 5;
|
||||
}
|
||||
];
|
||||
scdaemonSettings = {
|
||||
disable-ccid = true;
|
||||
pcsc-driver = "${pkgs.pcsclite.out}/lib/libpcsclite.so.1";
|
||||
reader-port = "Yubico YubiKey";
|
||||
};
|
||||
settings = {
|
||||
# https://github.com/drduh/config/blob/master/gpg.conf
|
||||
personal-cipher-preferences = "AES256 AES192 AES";
|
||||
personal-digest-preferences = "SHA512 SHA384 SHA256";
|
||||
personal-compress-preferences = "ZLIB BZIP2 ZIP Uncompressed";
|
||||
default-preference-list = "SHA512 SHA384 SHA256 AES256 AES192 AES ZLIB BZIP2 ZIP Uncompressed";
|
||||
cert-digest-algo = "SHA512";
|
||||
s2k-digest-algo = "SHA512";
|
||||
s2k-cipher-algo = "AES256";
|
||||
charset = "utf-8";
|
||||
fixed-list-mode = true;
|
||||
no-comments = true;
|
||||
no-emit-version = true;
|
||||
no-greeting = true;
|
||||
keyid-format = "0xlong";
|
||||
list-options = "show-uid-validity";
|
||||
verify-options = "show-uid-validity";
|
||||
with-fingerprint = true;
|
||||
with-key-origin = true;
|
||||
require-cross-certification = true;
|
||||
no-symkey-cache = true;
|
||||
use-agent = true;
|
||||
throw-keyids = true;
|
||||
keyserver = ["hkps://keys.openpgp.org" "hkps://keyserver.ubuntu.com:443" "hkps://hkps.pool.sks-keyservers.net" "hkps://pgp.ocf.berkeley.edu"];
|
||||
auto-key-locate = ["local" "dane" "cert" "wkd"];
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
{
|
||||
system,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs;
|
||||
[
|
||||
nheko
|
||||
twinkle
|
||||
tokodon
|
||||
telegram-desktop
|
||||
]
|
||||
++ (
|
||||
if system == "x86_64-linux"
|
||||
then [
|
||||
pkgs.discord
|
||||
]
|
||||
else []
|
||||
);
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
{...}: {
|
||||
services.kdeconnect.enable = true;
|
||||
services.kdeconnect.indicator = true;
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
home.packages = [pkgs.keepassxc];
|
||||
systemd.user.services.keepassxc = {
|
||||
Unit = {
|
||||
Description = "keepassxc";
|
||||
After = ["graphical-session-pre.target"];
|
||||
PartOf = ["graphical-session.target"];
|
||||
};
|
||||
Install.WantedBy = ["graphical-session.target"];
|
||||
Service = {
|
||||
ExecStart = "${pkgs.keepassxc}/bin/keepassxc";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
{nixpkgs, ...}: let
|
||||
x86_64-linux-pkgs = import nixpkgs {system = "x86_64-linux";};
|
||||
in {
|
||||
services.keybase.enable = true;
|
||||
services.kbfs.enable = true;
|
||||
home.packages = [
|
||||
x86_64-linux-pkgs.keybase-gui
|
||||
];
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
home.packages = with pkgs; [kicad-unstable-small];
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
_: {
|
||||
programs.kitty = {
|
||||
enable = true;
|
||||
font.name = "FiraCode Nerd Font Mono";
|
||||
settings = {
|
||||
disable_ligatures = "cursor";
|
||||
shell_integration = "disabled";
|
||||
font_size = 8;
|
||||
};
|
||||
extraConfig = ''
|
||||
symbol_map U+F1900-U+F19FF Fairfax HD
|
||||
narrow_symbols U+F1900-U+F19FF 2
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
programs.thunderbird = {
|
||||
enable = true;
|
||||
profiles.main = {
|
||||
withExternalGnupg = true;
|
||||
isDefault = true;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
programs.mako = {
|
||||
enable = true;
|
||||
defaultTimeout = 30000;
|
||||
};
|
||||
systemd.user.services.mako = {
|
||||
Unit = {
|
||||
Description = "mako";
|
||||
After = ["graphical-session-pre.target"];
|
||||
PartOf = ["graphical-session.target"];
|
||||
};
|
||||
Install.WantedBy = ["graphical-session.target"];
|
||||
Service = {
|
||||
ExecStart = "mako";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
nixpkgs,
|
||||
...
|
||||
}: let
|
||||
x86_64-linux-pkgs = import nixpkgs {system = "x86_64-linux";};
|
||||
in {
|
||||
home.packages = with pkgs; [
|
||||
#anki
|
||||
mdcat
|
||||
gimp
|
||||
krita
|
||||
ffmpeg-full
|
||||
audacious
|
||||
];
|
||||
xdg.configFile."gdb/gdbinit".text = "set auto-load safe-path /nix/store";
|
||||
services.xsettingsd = {
|
||||
enable = true;
|
||||
settings = {
|
||||
"Gtk/EnableAnimations" = 1;
|
||||
"Gtk/DecorationLayout" = "icon:minimize,maximize,close";
|
||||
"Gtk/PrimaryButtonWarpsSlider" = 0;
|
||||
"Gtk/ToolbarStyle" = 3;
|
||||
"Gtk/MenuImages" = 1;
|
||||
"Gtk/ButtonImages" = 1;
|
||||
"Gtk/CursorThemeSize" = 24;
|
||||
"Gtk/CursorThemeName" = "breeze_cursors";
|
||||
"Gtk/FontName" = "Noto Sans, 10";
|
||||
"Net/IconThemeName" = "breeze-dark";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
_: {
|
||||
services.mpd = {
|
||||
enable = true;
|
||||
musicDirectory = "/home/darkkirb/Music";
|
||||
extraConfig = ''
|
||||
audio_output {
|
||||
type "pipewire"
|
||||
name "Pipewire"
|
||||
}
|
||||
replaygain "track"
|
||||
replaygain_preamp "-10"
|
||||
max_playlist_length "1048576"
|
||||
max_command_list_size "1048576"
|
||||
max_output_buffer_size "1048576"
|
||||
auto_update "yes"
|
||||
'';
|
||||
};
|
||||
programs.ncmpcpp.enable = true;
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
system,
|
||||
emily-modifiers,
|
||||
emily-symbols,
|
||||
...
|
||||
}: let
|
||||
plover-env =
|
||||
(pkgs.plover.pythonModule.withPackages (_:
|
||||
with pkgs; [
|
||||
plover
|
||||
plover-plugins-manager
|
||||
plover-plugin-emoji
|
||||
plover-plugin-tapey-tape
|
||||
plover-plugin-yaml-dictionary
|
||||
plover-plugin-rkb1-hid
|
||||
plover-plugin-python-dictionary
|
||||
plover-plugin-stenotype-extended
|
||||
plover-plugin-dotool-output
|
||||
plover-plugin-lapwing-aio
|
||||
]))
|
||||
.overrideDerivation (super: {
|
||||
nativeBuildInputs = super.nativeBuildInputs or [] ++ [pkgs.qt5.wrapQtAppsHook];
|
||||
postBuild =
|
||||
super.postBuild
|
||||
+ ''
|
||||
wrapQtApp $out/bin/plover
|
||||
'';
|
||||
});
|
||||
in {
|
||||
home.packages = [
|
||||
plover-env
|
||||
];
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
programs.rofi = {
|
||||
enable = true;
|
||||
font = "Noto Sans";
|
||||
extraConfig = {
|
||||
display-drun = " Apps ";
|
||||
display-run = " Run ";
|
||||
};
|
||||
terminal = "${pkgs.kitty}/bin/kitty";
|
||||
};
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
_: {
|
||||
imports = [
|
||||
./builders.nix
|
||||
];
|
||||
programs.ssh = {
|
||||
controlMaster = "auto";
|
||||
controlPersist = "10m";
|
||||
enable = true;
|
||||
};
|
||||
}
|
|
@ -1,157 +0,0 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
system,
|
||||
...
|
||||
}: let
|
||||
c = "$";
|
||||
switch_window = pkgs.writeScript "switchWindow" ''
|
||||
set -euo pipefail
|
||||
tree=$(${pkgs.sway}/bin/swaymsg -t get_tree)
|
||||
readarray -t win_ids <<< "$(${pkgs.jq}/bin/jq -r '.. | objects | select(has("app_id")) | .id' <<< "$tree")"
|
||||
readarray -t win_names <<< "$(${pkgs.jq}/bin/jq -r '.. | objects | select(has("app_id")) | .name' <<< "$tree")"
|
||||
readarray -t win_types <<< "$(${pkgs.jq}/bin/jq -r '.. | objects | select(has("app_id")) | .app_id // .window_properties.class' <<< "$tree")"
|
||||
switch () {
|
||||
local k
|
||||
read -r k
|
||||
swaymsg "[con_id=${c}{win_ids[$k]}] focus"
|
||||
}
|
||||
for k in $(seq 0 $((${c}{#win_ids[@]} - 1))); do
|
||||
echo -e "<span weight=\"bold\">${c}{win_types[$k]}</span> - ${c}{win_names[$k]}"
|
||||
done | rofi -dmenu -markup-rows -i -p window -format i | switch
|
||||
'';
|
||||
screenshot_then_switch = pkgs.writeScript "screenshotThenSwitch" ''
|
||||
${pkgs.sway-contrib.grimshot}/bin/grimshot "$@"
|
||||
${pkgs.sway}/bin/swaymsg mode default
|
||||
'';
|
||||
mkKeybind = combo: number: [
|
||||
{
|
||||
name = "Mod4+${combo}";
|
||||
value = "workspace number ${toString number}";
|
||||
}
|
||||
{
|
||||
name = "Mod4+Shift+${combo}";
|
||||
value = "move container to workspace number ${toString number}";
|
||||
}
|
||||
];
|
||||
keys = ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "f1" "f2" "f3" "f4" "f5" "f6" "f7" "f8" "f9" "f10" "f11" "f12"];
|
||||
combos = lib.concatMap (k: map (s: "${k}${s}") keys) ["" "ctrl+" "alt+" "ctrl+alt+"];
|
||||
keybinds = lib.flatten (lib.zipListsWith mkKeybind combos (lib.lists.range 0 ((lib.lists.length combos) - 1)));
|
||||
in {
|
||||
imports = [
|
||||
./wl-clipboard.nix
|
||||
./mako.nix
|
||||
./swayidle.nix
|
||||
./rofi.nix
|
||||
./fcitx.nix
|
||||
./kitty.nix
|
||||
./mpd.nix
|
||||
./theming.nix
|
||||
];
|
||||
wayland.windowManager.sway = {
|
||||
enable = true;
|
||||
config = {
|
||||
modifier = "Mod4";
|
||||
input = {
|
||||
"*" = {
|
||||
xkb_layout = "de";
|
||||
xkb_variant = "neo";
|
||||
};
|
||||
};
|
||||
output = {
|
||||
"DP-1" = {
|
||||
mode = "2560x1440@74.971Hz";
|
||||
position = "0 0";
|
||||
subpixel = "rgb";
|
||||
adaptive_sync = "on";
|
||||
};
|
||||
"HDMI-A-1" = {
|
||||
mode = "1920x1080@60Hz";
|
||||
position = "2560 0";
|
||||
subpixel = "rgb";
|
||||
};
|
||||
"DSI-1" = {
|
||||
transform = "90";
|
||||
};
|
||||
};
|
||||
keybindings = let
|
||||
inherit (config.wayland.windowManager.sway.config) modifier;
|
||||
in
|
||||
lib.mkOptionDefault ({
|
||||
"${modifier}+Return" = "exec ${pkgs.kitty}/bin/kitty";
|
||||
"${modifier}+d" = "exec ${pkgs.rofi}/bin/rofi -show drun";
|
||||
"Print" = "mode screenshot";
|
||||
"XF86AudioRaiseVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%";
|
||||
"XF86AudioLowerVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%";
|
||||
"XF86AudioMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
|
||||
"XF86AudioMicMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle";
|
||||
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
|
||||
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%";
|
||||
"XF86AudioPlay" = "exec ${pkgs.mpc-cli}/bin/mpc toggle";
|
||||
"XF86AudioNext" = "exec ${pkgs.mpc-cli}/bin/mpc next";
|
||||
"XF86AudioPrev" = "exec ${pkgs.mpc-cli}/bin/mpc prev";
|
||||
"XF86AudioStop" = "exec ${pkgs.mpc-cli}/bin/mpc stop";
|
||||
"Mod1+Tab" = "exec ${switch_window}";
|
||||
}
|
||||
// (lib.listToAttrs keybinds));
|
||||
bars = [
|
||||
{
|
||||
command = "${pkgs.waybar}/bin/waybar";
|
||||
}
|
||||
];
|
||||
modes = {
|
||||
screenshot = {
|
||||
Print = "exec ${screenshot_then_switch} copy area";
|
||||
"Shift+Print" = "exec ${screenshot_then_switch} save area $HOME/Pictures/grim-$(date --iso=s | sed 's/:/-/g').png";
|
||||
a = "exec ${screenshot_then_switch} copy active";
|
||||
"Shift+a" = "exec ${screenshot_then_switch} save active $HOME/Pictures/grim-$(date --iso=s | sed 's/:/-/g').png";
|
||||
s = "exec ${screenshot_then_switch} copy screen";
|
||||
"Shift+s" = "exec ${screenshot_then_switch} save screen $HOME/Pictures/grim-$(date --iso=s | sed 's/:/-/g').png";
|
||||
o = "exec ${screenshot_then_switch} copy output";
|
||||
"Shift+o" = "exec ${screenshot_then_switch} save output $HOME/Pictures/grim-$(date --iso=s | sed 's/:/-/g').png";
|
||||
w = "exec ${screenshot_then_switch} copy window";
|
||||
"Shift+w" = "exec ${screenshot_then_switch} save window $HOME/Pictures/grim-$(date --iso=s | sed 's/:/-/g').png";
|
||||
Escape = ''mode "default"'';
|
||||
Return = ''mode "default"'';
|
||||
};
|
||||
};
|
||||
};
|
||||
wrapperFeatures = {
|
||||
base = true;
|
||||
gtk = true;
|
||||
};
|
||||
extraSessionCommands =
|
||||
''
|
||||
export XDG_SESSION_TYPE=wayland
|
||||
export XDG_CURRENT_DESKTOP=sway
|
||||
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
|
||||
export QT_AUTO_SCREEN_SCALE_FACTOR=0
|
||||
export QT_SCALE_FACTOR=1
|
||||
export GDK_SCALE=1
|
||||
export GDK_DPI_SCALE=1
|
||||
export MOZ_ENABLE_WAYLAND=1
|
||||
export _JAVA_AWT_WM_NONREPARENTING=1
|
||||
export QT_QPA_PLATFORMTHEME=qt5ct
|
||||
export GTK_IM_MODULE=fcitx
|
||||
export QT_IM_MODULE=fcitx
|
||||
export XMODIFIERS=@im=fcitx
|
||||
export GLFW_IM_MODULE=ibus
|
||||
export SDL_IM_MODULE=fcitx
|
||||
''
|
||||
+ (
|
||||
if system == "x86_64-linux"
|
||||
then ''
|
||||
export VK_ICD_FILENAMES=/run/opengl-driver/share/vulkan/icd.d/intel_icd.x86_64.json:/run/opengl-driver/share/vulkan/icd.d/radeon_icd.x86_64.json:/run/opengl-driver-32/share/vulkan/icd.d/radeon_icd.i686.json:/run/opengl-driver-32/share/vulkan/icd.d/intel_icd.i686.json
|
||||
''
|
||||
else ""
|
||||
);
|
||||
extraConfig = ''
|
||||
default_border none
|
||||
gaps outer 8
|
||||
gaps inner 4
|
||||
exec_always ${pkgs.xorg.xrandr}/bin/xrandr --output DP-1 --primary
|
||||
'';
|
||||
};
|
||||
home.file.".XCompose".source = ../../extra/.XCompose;
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
{pkgs, ...}: let
|
||||
lock-script = pkgs.writeScript "suspend" ''
|
||||
${pkgs.swaylock}/bin/swaylock -f -c 000000
|
||||
${pkgs.mpc-cli}/bin/mpc pause
|
||||
'';
|
||||
screen-off-script = pkgs.writeScript "screenOff" ''
|
||||
${pkgs.sway}/bin/swaymsg "output * dpms off"
|
||||
'';
|
||||
suspend-script = pkgs.writeScript "suspend" ''
|
||||
${pkgs.systemd}/bin/systemctl suspend
|
||||
'';
|
||||
resume-script = pkgs.writeScript "resume" ''
|
||||
${pkgs.sway}/bin/swaymsg "output * dpms on"
|
||||
'';
|
||||
unlock-script = pkgs.writeScript "unlock" ''
|
||||
${pkgs.procps}/bin/pkill swaylock
|
||||
${pkgs.mpc-cli}/bin/mpc play
|
||||
'';
|
||||
in {
|
||||
services.swayidle = {
|
||||
enable = true;
|
||||
events = [
|
||||
{
|
||||
event = "before-sleep";
|
||||
command = "${lock-script}";
|
||||
}
|
||||
{
|
||||
event = "lock";
|
||||
command = "${lock-script}";
|
||||
}
|
||||
{
|
||||
event = "unlock";
|
||||
command = "${unlock-script}";
|
||||
}
|
||||
];
|
||||
timeouts = [
|
||||
{
|
||||
timeout = 300;
|
||||
command = "${lock-script}";
|
||||
}
|
||||
{
|
||||
timeout = 305;
|
||||
command = "${screen-off-script}";
|
||||
resumeCommand = "${resume-script}";
|
||||
}
|
||||
{
|
||||
timeout = 900;
|
||||
command = "${suspend-script}";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
_: {
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
tray.enable = true;
|
||||
};
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
_: {
|
||||
programs.taskwarrior = {
|
||||
enable = true;
|
||||
colorTheme = "dark-violets-256";
|
||||
config = {
|
||||
weekstart = "monday"; # no americans, the week does not start with week-end
|
||||
};
|
||||
dataLocation = "~/Data/tasks/";
|
||||
};
|
||||
}
|
|
@ -1,606 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
colorpickle,
|
||||
withNSFW,
|
||||
lib,
|
||||
self,
|
||||
nixpkgs,
|
||||
...
|
||||
}: let
|
||||
theme = import ../../extra/theme.nix;
|
||||
inherit (config.lib.formats.rasi) mkLiteral;
|
||||
|
||||
prepBGs = [
|
||||
["${pkgs.lotte-art}/2021-01-27-ceeza-lottedonut.jxl" "-crop" "2048x1152+0+106"]
|
||||
["${pkgs.lotte-art}/2021-09-15-cloverhare-lotteplush.jxl" "-crop" "1774x997+0+173"]
|
||||
["${pkgs.lotte-art}/2022-11-15-wolfsifi-maff-me-leashed.jxl" "-crop" "1699x956+0+88"]
|
||||
];
|
||||
|
||||
prepBGsNSFW = [
|
||||
["${pkgs.lotte-art}/2021-11-27-theroguez-lottegassyvore1.jxl" "-crop" "1233x694+0+65"]
|
||||
["${pkgs.lotte-art}/2021-12-12-baltnwolf-christmas-diaper.jxl" "-crop" "2599x1462+0+294"]
|
||||
["${pkgs.lotte-art}/2021-12-12-baltnwolf-christmas-diaper-messy.jxl" "-crop" "2599x1462+0+294"]
|
||||
["${pkgs.lotte-art}/2022-04-20-cloverhare-mxbatty-maffsie-train-plush.jxl" "-crop" "3377x1900+0+211"]
|
||||
["${pkgs.lotte-art}/2022-04-20-cloverhare-mxbatty-me-train-maffsie-plush.jxl" "-crop" "3377x1900+0+211"]
|
||||
["${pkgs.lotte-art}/2022-12-27-rexyi-scatych.jxl" "-crop" "2000x1120+0+0"]
|
||||
["${pkgs.lotte-art}/2023-03-09-rexyi-voredisposal-ych.jxl" "-crop" "2000x1120+0+0"]
|
||||
["${pkgs.lotte-art}/2023-04-16-baltnwolf-lottediaperplushies.jxl" "-gravity" "center" "-background" "white" "-extent" "5333x3000"]
|
||||
["${pkgs.lotte-art}/2023-04-16-baltnwolf-lottediaperplushies-messy.jxl" "-gravity" "center" "-background" "white" "-extent" "5333x3000"]
|
||||
["${pkgs.lotte-art}/2023-08-09-coldquarantine-lotte-eating-trash.jxl" "-crop" "6000x3375+0+312"]
|
||||
["${pkgs.lotte-art}/2023-08-20-coldquarantine-lotte-eating-trash-clean.jxl" "-crop" "6000x3375+0+312"]
|
||||
["${pkgs.lotte-art}/2023-08-10-coldquarantine-lotte-eating-trash-diapers.jxl" "-crop" "6000x3375+0+312"]
|
||||
];
|
||||
|
||||
fixupImage = instructions:
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "bg.jxl";
|
||||
src = pkgs.emptyDirectory;
|
||||
nativeBuildInputs = [pkgs.imagemagick];
|
||||
buildPhase = ''
|
||||
convert ${toString instructions} $out
|
||||
'';
|
||||
installPhase = "true";
|
||||
};
|
||||
|
||||
validBGs = ["${pkgs.lotte-art}/2020-07-24-urbankitsune-bna-ych.jxl" "${pkgs.lotte-art}/2022-05-02-anonfurryartist-giftart.jxl" "${pkgs.lotte-art}/2022-06-21-sammythetanuki-lotteplushpride.jxl"] ++ (map fixupImage prepBGs);
|
||||
validBGsNSFW = ["${pkgs.lotte-art}/2021-10-29-butterskunk-lotte-scat-buffet.jxl" "${pkgs.lotte-art}/2022-08-12-deathtoaster-funpit-scat.jxl" "${pkgs.lotte-art}/2022-08-15-deathtoaster-funpit-mud.jxl"] ++ (map fixupImage prepBGsNSFW) ++ validBGs;
|
||||
|
||||
mod = a: b: a - (a / b * b);
|
||||
choose = l: rand: let len = builtins.length l; in builtins.elemAt l (mod rand len);
|
||||
hexToIntList = {
|
||||
"0" = 0;
|
||||
"1" = 1;
|
||||
"2" = 2;
|
||||
"3" = 3;
|
||||
"4" = 4;
|
||||
"5" = 5;
|
||||
"6" = 6;
|
||||
"7" = 7;
|
||||
"8" = 8;
|
||||
"9" = 9;
|
||||
"a" = 10;
|
||||
"b" = 11;
|
||||
"c" = 12;
|
||||
"d" = 13;
|
||||
"e" = 14;
|
||||
"f" = 15;
|
||||
"A" = 10;
|
||||
"B" = 11;
|
||||
"C" = 12;
|
||||
"D" = 13;
|
||||
"E" = 14;
|
||||
"F" = 15;
|
||||
};
|
||||
hexToInt = s: lib.foldl (state: new: state * 16 + hexToIntList.${new}) 0 (lib.strings.stringToCharacters s);
|
||||
|
||||
seed = hexToInt (self.shortRev or nixpkgs.shortRev);
|
||||
bg =
|
||||
choose (
|
||||
if withNSFW
|
||||
then validBGsNSFW
|
||||
else validBGs
|
||||
)
|
||||
seed;
|
||||
|
||||
color = n:
|
||||
config.environment.graphical.colors.main."${builtins.toString n}";
|
||||
colorD = n:
|
||||
config.environment.graphical.colors.disabled."${builtins.toString n}";
|
||||
colorI = n:
|
||||
config.environment.graphical.colors.inactive."${builtins.toString n}";
|
||||
|
||||
color' = n: mkLiteral (color n);
|
||||
bgPng = pkgs.stdenv.mkDerivation {
|
||||
name = "bg.png";
|
||||
src = pkgs.emptyDirectory;
|
||||
nativeBuildInputs = [pkgs.imagemagick];
|
||||
buildPhase = ''
|
||||
convert ${bg} $out
|
||||
'';
|
||||
installPhase = "true";
|
||||
};
|
||||
in {
|
||||
imports = [
|
||||
colorpickle.nixosModules.default
|
||||
];
|
||||
environment.graphical.colorschemes.main = {
|
||||
image = bgPng;
|
||||
params = ["--lighten" "0.3"];
|
||||
};
|
||||
environment.graphical.colorschemes.disabled = {
|
||||
image = bgPng;
|
||||
params = ["--lighten" "0.1" "--saturate" "-0.5"];
|
||||
};
|
||||
environment.graphical.colorschemes.inactive = {
|
||||
image = bgPng;
|
||||
params = [];
|
||||
};
|
||||
wayland.windowManager.sway.config.output."*".bg = "${bgPng} fill";
|
||||
/*
|
||||
dconf.settings."org/gnome/desktop/interface" = {
|
||||
icon-theme = "breeze-dark";
|
||||
cursor-theme = "Vanilla-DMZ";
|
||||
};
|
||||
*/
|
||||
gtk = {
|
||||
#enable = true;
|
||||
gtk2.extraConfig = ''
|
||||
gtk-cursor-theme-name = "Vanilla-DMZ"
|
||||
gtk-cursor-theme-size = 0
|
||||
'';
|
||||
gtk3.extraConfig = {
|
||||
gtk-cursor-theme-name = "Vanilla-DMZ";
|
||||
gtk-cursor-theme-size = 0;
|
||||
};
|
||||
font = {
|
||||
package = pkgs.noto-fonts;
|
||||
name = "Noto Sans";
|
||||
size = 10;
|
||||
};
|
||||
iconTheme = {
|
||||
package = pkgs.libsForQt5.breeze-icons;
|
||||
name = "breeze-dark";
|
||||
};
|
||||
theme = {
|
||||
name = "Catppuccin-Mocha-Compact-Pink-Dark";
|
||||
package = pkgs.catppuccin-gtk.override {
|
||||
accents = ["pink"];
|
||||
size = "compact";
|
||||
tweaks = ["rimless" "black"];
|
||||
variant = "mocha";
|
||||
};
|
||||
};
|
||||
};
|
||||
qt = {
|
||||
#enable = true;
|
||||
style = {
|
||||
name = "lightly";
|
||||
package = pkgs.plasma5Packages.lightly;
|
||||
};
|
||||
platformTheme = "qtct";
|
||||
};
|
||||
xdg.configFile."qt5ct/colors/Catppuccin-Custom.conf".text = ''
|
||||
[ColorScheme]
|
||||
active_colors=${color 15}, ${color 0}, #ffa6adc8, #ff9399b2, ${color 1}, #ff6c7086, ${color 15}, ${color 15}, ${color 15}, #ff1e1e2e, ${colorD 0}, #ff7f849c, ${color 8}, ${color 15}, ${color 13}, ${color 5}, ${color 0}, ${color 15}, ${colorI 0}, ${color 5}, #807f849c
|
||||
disabled_colors=${colorD 15}, ${colorD 0}, #ffa6adc8, #ff9399b2, ${colorD 1}, #ff6c7086, ${colorD 15}, ${colorD 15}, ${colorD 15}, #ff1e1e2e, ${colorD 0}, #ff7f849c, ${colorD 8}, ${colorD 15}, ${colorD 13}, ${colorD 5}, ${colorD 0}, ${colorD 15}, ${colorI 0}, ${colorD 5}, #807f849c
|
||||
inactive_colors=${colorI 15}, ${colorI 0}, #ffa6adc8, #ff9399b2, ${colorI 1}, #ff6c7086, ${colorI 15}, ${colorI 15}, ${colorI 15}, #ff1e1e2e, ${colorD 0}, #ff7f849c, ${colorI 8}, ${colorI 15}, ${colorI 13}, ${colorI 5}, ${colorI 0}, ${colorI 15}, ${colorI 0}, ${colorI 5}, #807f849c
|
||||
'';
|
||||
xdg.configFile."qt6ct/colors/Catppuccin-Custom.conf".text = ''
|
||||
[ColorScheme]
|
||||
active_colors=${color 15}, ${color 0}, #ffa6adc8, #ff9399b2, ${color 1}, #ff6c7086, ${color 15}, ${color 15}, ${color 15}, #ff1e1e2e, ${colorD 0}, #ff7f849c, ${color 8}, ${color 15}, ${color 13}, ${color 5}, ${color 0}, ${color 15}, ${colorI 0}, ${color 5}, #807f849c
|
||||
disabled_colors=${colorD 15}, ${colorD 0}, #ffa6adc8, #ff9399b2, ${colorD 1}, #ff6c7086, ${colorD 15}, ${colorD 15}, ${colorD 15}, #ff1e1e2e, ${colorD 0}, #ff7f849c, ${colorD 8}, ${colorD 15}, ${colorD 13}, ${colorD 5}, ${colorD 0}, ${colorD 15}, ${colorI 0}, ${colorD 5}, #807f849c
|
||||
inactive_colors=${colorI 15}, ${colorI 0}, #ffa6adc8, #ff9399b2, ${colorI 1}, #ff6c7086, ${colorI 15}, ${colorI 15}, ${colorI 15}, #ff1e1e2e, ${colorD 0}, #ff7f849c, ${colorI 8}, ${colorI 15}, ${colorI 13}, ${colorI 5}, ${colorI 0}, ${colorI 15}, ${colorI 0}, ${colorI 5}, #807f849c
|
||||
'';
|
||||
nixpkgs.overlays = [
|
||||
(super: self: {
|
||||
python3 = super.python.override {
|
||||
packageOverrides = self: super: {
|
||||
python3Packages = self.python3.pkgs;
|
||||
catppuccin = super.catppuccin.overrideAttrs (super: {
|
||||
patches =
|
||||
super.patches
|
||||
or []
|
||||
++ [
|
||||
(pkgs.writeText "color.patch" ''
|
||||
diff --git a/catppuccin/colour.py b/catppuccin/colour.py
|
||||
index 193eea7..7620cf0 100644
|
||||
--- a/catppuccin/colour.py
|
||||
+++ b/catppuccin/colour.py
|
||||
@@ -43,6 +43,9 @@ class Colour:
|
||||
@classmethod
|
||||
def from_hex(cls, hex_string: str) -> Colour:
|
||||
"""Create a colour from hex string."""
|
||||
+ if hex_string.startswith("#"):
|
||||
+ hex_string = hex_string[1:]
|
||||
+
|
||||
if len(hex_string) not in (6, 8):
|
||||
raise ValueError("Hex string must be 6 or 8 characters long.")
|
||||
diff --git a/catppuccin/flavour.py b/catppuccin/flavour.py
|
||||
index aa7df98..4bf849a 100644
|
||||
--- a/catppuccin/flavour.py
|
||||
+++ b/catppuccin/flavour.py
|
||||
@@ -138,30 +138,30 @@ class Flavour: # pylint: disable=too-many-instance-attributes
|
||||
def mocha() -> "Flavour":
|
||||
"""Mocha flavoured Catppuccin."""
|
||||
return Flavour(
|
||||
- rosewater=Colour(245, 224, 220),
|
||||
- flamingo=Colour(242, 205, 205),
|
||||
- pink=Colour(245, 194, 231),
|
||||
- mauve=Colour(203, 166, 247),
|
||||
- red=Colour(243, 139, 168),
|
||||
- maroon=Colour(235, 160, 172),
|
||||
- peach=Colour(250, 179, 135),
|
||||
- yellow=Colour(249, 226, 175),
|
||||
- green=Colour(166, 227, 161),
|
||||
- teal=Colour(148, 226, 213),
|
||||
- sky=Colour(137, 220, 235),
|
||||
- sapphire=Colour(116, 199, 236),
|
||||
- blue=Colour(137, 180, 250),
|
||||
- lavender=Colour(180, 190, 254),
|
||||
- text=Colour(205, 214, 244),
|
||||
+ rosewater=Colour.from_hex("${color 1}"),
|
||||
+ flamingo=Colour.from_hex("${color 2}"),
|
||||
+ pink=Colour.from_hex("${color 3}"),
|
||||
+ mauve=Colour.from_hex("${color 4}"),
|
||||
+ red=Colour.from_hex("${color 5}"),
|
||||
+ maroon=Colour.from_hex("${color 6}"),
|
||||
+ peach=Colour.from_hex("${color 7}"),
|
||||
+ yellow=Colour.from_hex("${color 8}"),
|
||||
+ green=Colour.from_hex("${color 9}"),
|
||||
+ teal=Colour.from_hex("${color 10}"),
|
||||
+ sky=Colour.from_hex("${color 11}"),
|
||||
+ sapphire=Colour.from_hex("${color 12}"),
|
||||
+ blue=Colour.from_hex("${color 13}"),
|
||||
+ lavender=Colour.from_hex("${color 14}"),
|
||||
+ text=Colour.from_hex("${color 15}"),
|
||||
subtext1=Colour(186, 194, 222),
|
||||
subtext0=Colour(166, 173, 200),
|
||||
overlay2=Colour(147, 153, 178),
|
||||
overlay1=Colour(127, 132, 156),
|
||||
overlay0=Colour(108, 112, 134),
|
||||
- surface2=Colour(88, 91, 112),
|
||||
- surface1=Colour(69, 71, 90),
|
||||
- surface0=Colour(49, 50, 68),
|
||||
- base=Colour(30, 30, 46),
|
||||
- mantle=Colour(24, 24, 37),
|
||||
- crust=Colour(17, 17, 27),
|
||||
+ surface2=Colour.from_hex("${color 2}"),
|
||||
+ surface1=Colour.from_hex("${color 1}"),
|
||||
+ surface0=Colour.from_hex("${color 0}"),
|
||||
+ base=Colour.from_hex("${color 0}"),
|
||||
+ mantle=Colour.from_hex("${color 0}"),
|
||||
+ crust=Colour.from_hex("${color 0}"),
|
||||
)
|
||||
'')
|
||||
];
|
||||
});
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
|
||||
/*
|
||||
home.file = {
|
||||
".icons/default/index.theme".text = ''
|
||||
[Icon Theme]
|
||||
Name=Default
|
||||
Comment=Default Cursor Theme
|
||||
Inherits=Vanilla-DMZ
|
||||
'';
|
||||
};
|
||||
*/
|
||||
programs.kitty.settings = with theme; {
|
||||
background = color 0;
|
||||
foreground = color 15;
|
||||
cursor = color 15;
|
||||
selection_background = "#4f414c";
|
||||
color0 = color 0;
|
||||
color1 = color 9;
|
||||
color2 = color 10;
|
||||
color3 = color 11;
|
||||
color4 = color 12;
|
||||
color5 = color 13;
|
||||
color6 = color 14;
|
||||
color7 = color 15;
|
||||
color8 = color 8;
|
||||
color9 = color 9;
|
||||
color10 = color 10;
|
||||
color11 = color 11;
|
||||
color12 = color 12;
|
||||
color13 = color 13;
|
||||
color14 = color 14;
|
||||
color15 = color 15;
|
||||
};
|
||||
# Taken from https://github.com/jakehamilton/dotfiles/blob/master/waybar/style.css
|
||||
programs.waybar.style = with theme; ''
|
||||
* {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
font-size: 14px;
|
||||
min-height: 24px;
|
||||
font-family: "NotoSansDisplay Nerd Font", "Noto Sans Mono CJK JP";
|
||||
color: ${color 0};
|
||||
}
|
||||
window#waybar {
|
||||
background: transparent;
|
||||
color: ${color 15};
|
||||
opacity: 0.9;
|
||||
}
|
||||
window#waybar.hidden {
|
||||
opacity: 0.2;
|
||||
}
|
||||
#window {
|
||||
margin-top: 8px;
|
||||
padding: 0px 16px 0px 16px;
|
||||
border-radius: 24px;
|
||||
transition: none;
|
||||
background: transparent;
|
||||
}
|
||||
#workspaces {
|
||||
margin-top: 8px;
|
||||
margin-left: 12px;
|
||||
margin-bottom: 0;
|
||||
border-radius: 24px;
|
||||
background-color: ${color 0};
|
||||
color: ${color 15};
|
||||
transition: none;
|
||||
}
|
||||
#workspaces button {
|
||||
transition: none;
|
||||
background: transparent;
|
||||
font-size: 16px;
|
||||
color: ${color 15};
|
||||
}
|
||||
#workspaces button.focused {
|
||||
background: ${color 13};
|
||||
color: ${color 0};
|
||||
}
|
||||
#workspaces button:hover {
|
||||
background: ${color 10};
|
||||
color: ${color 0};
|
||||
}
|
||||
#mpd {
|
||||
margin-top: 8px;
|
||||
margin-left: 8px;
|
||||
padding-left: 16px;
|
||||
padding-right: 16px;
|
||||
margin-bottom: 0;
|
||||
border-radius: 24px;
|
||||
background: ${color 2};
|
||||
transition: none;
|
||||
}
|
||||
#mpd.disconnected,
|
||||
#mpd.stopped {
|
||||
background: ${color 4};
|
||||
}
|
||||
#network {
|
||||
margin-top: 8px;
|
||||
margin-left: 8px;
|
||||
padding-left: 16px;
|
||||
padding-right: 16px;
|
||||
margin-bottom: 0;
|
||||
border-radius: 24px;
|
||||
transition: none;
|
||||
background: ${color 13};
|
||||
}
|
||||
#pulseaudio {
|
||||
margin-top: 8px;
|
||||
margin-left: 8px;
|
||||
padding-left: 16px;
|
||||
padding-right: 16px;
|
||||
margin-bottom: 0;
|
||||
border-radius: 24px;
|
||||
transition: none;
|
||||
background: ${color 11};
|
||||
}
|
||||
#temperature, #battery {
|
||||
margin-top: 8px;
|
||||
margin-left: 8px;
|
||||
padding-left: 16px;
|
||||
padding-right: 16px;
|
||||
margin-bottom: 0;
|
||||
border-radius: 24px;
|
||||
transition: none;
|
||||
background: ${color 2};
|
||||
}
|
||||
#cpu, #backlight, #battery.warning {
|
||||
margin-top: 8px;
|
||||
margin-left: 8px;
|
||||
padding-left: 16px;
|
||||
padding-right: 16px;
|
||||
margin-bottom: 0;
|
||||
border-radius: 24px;
|
||||
transition: none;
|
||||
background: ${color 14};
|
||||
}
|
||||
#memory, #battery.critical {
|
||||
margin-top: 8px;
|
||||
margin-left: 8px;
|
||||
padding-left: 16px;
|
||||
padding-right: 16px;
|
||||
margin-bottom: 0;
|
||||
border-radius: 24px;
|
||||
transition: none;
|
||||
background: ${color 12};
|
||||
}
|
||||
#clock {
|
||||
margin-top: 8px;
|
||||
margin-left: 8px;
|
||||
margin-right: 12px;
|
||||
padding-left: 16px;
|
||||
padding-right: 16px;
|
||||
margin-bottom: 0;
|
||||
border-radius: 26px;
|
||||
transition: none;
|
||||
background: ${color 0};
|
||||
color: ${color 15};
|
||||
}
|
||||
'';
|
||||
|
||||
wayland.windowManager.sway.extraConfig = with theme; ''
|
||||
# target title bg text indicator border
|
||||
client.focused ${color 5} ${color 0} ${color 15} ${color 12} ${color 5}
|
||||
client.focused_inactive ${color 13} ${color 0} ${color 15} ${color 12} ${color 13}
|
||||
client.unfocused ${color 13} ${color 0} ${color 15} ${color 12} ${color 13}
|
||||
client.urgent ${color 14} ${color 0} ${color 14} ${color 8} ${color 14}
|
||||
client.placeholder ${color 8} ${color 0} ${color 15} ${color 8} ${color 8}
|
||||
client.background ${color 0}
|
||||
seat seat0 xcursor_theme breeze-dark 24
|
||||
'';
|
||||
home.packages = with pkgs; [
|
||||
libsForQt5.breeze-icons
|
||||
libsForQt5.qt5ct
|
||||
vanilla-dmz
|
||||
pkgs.plasma5Packages.lightly
|
||||
];
|
||||
|
||||
programs.rofi.theme = with theme; let
|
||||
element = {
|
||||
background-color = mkLiteral "inherit";
|
||||
text-color = mkLiteral "inherit";
|
||||
};
|
||||
in {
|
||||
"*" = {
|
||||
bg-col = color' 0;
|
||||
bg-col-light = color' 0;
|
||||
border-col = color' 0;
|
||||
selected-col = color' 0;
|
||||
blue = color' 1;
|
||||
fg-col = color' 15;
|
||||
fg-col2 = color' 12;
|
||||
grey = color' 8;
|
||||
width = 600;
|
||||
};
|
||||
element-text = element;
|
||||
window = {
|
||||
height = mkLiteral "360px";
|
||||
border = mkLiteral "3px";
|
||||
border-color = mkLiteral "@border-col";
|
||||
background-color = mkLiteral "@bg-col";
|
||||
};
|
||||
mainbox = {
|
||||
background-color = mkLiteral "@bg-col";
|
||||
};
|
||||
inputbar = {
|
||||
children = map mkLiteral ["prompt" "entry"];
|
||||
background-color = mkLiteral "@bg-col";
|
||||
border-radius = mkLiteral "5px";
|
||||
padding = mkLiteral "2px";
|
||||
};
|
||||
prompt = {
|
||||
background-color = mkLiteral "@blue";
|
||||
padding = mkLiteral "6px";
|
||||
text-color = mkLiteral "@bg-col";
|
||||
border-radius = mkLiteral "3px";
|
||||
margin = mkLiteral "20px 0px 0px 20px";
|
||||
};
|
||||
|
||||
textbox-prompt-colon = {
|
||||
expand = mkLiteral "false";
|
||||
str = ":";
|
||||
};
|
||||
|
||||
entry = {
|
||||
padding = mkLiteral "6px";
|
||||
margin = mkLiteral "20px 0px 0px 10px";
|
||||
text-color = mkLiteral "@fg-col";
|
||||
background-color = mkLiteral "@bg-col";
|
||||
};
|
||||
|
||||
listview = {
|
||||
border = mkLiteral "0px 0px 0px";
|
||||
padding = mkLiteral "6px 0px 0px";
|
||||
margin = mkLiteral "10px 0px 0px 20px";
|
||||
columns = 2;
|
||||
lines = 5;
|
||||
background-color = mkLiteral "@bg-col";
|
||||
};
|
||||
|
||||
element = {
|
||||
padding = mkLiteral "5px";
|
||||
background-color = mkLiteral "@bg-col";
|
||||
text-color = mkLiteral "@fg-col";
|
||||
};
|
||||
|
||||
element-icon =
|
||||
element
|
||||
// {
|
||||
size = mkLiteral "25px";
|
||||
};
|
||||
|
||||
"element selected" = {
|
||||
background-color = mkLiteral "@selected-col";
|
||||
text-color = mkLiteral "@fg-col2";
|
||||
};
|
||||
|
||||
mode-switcher =
|
||||
element
|
||||
// {
|
||||
spacing = 0;
|
||||
};
|
||||
|
||||
button = {
|
||||
padding = mkLiteral "10px";
|
||||
background-color = mkLiteral "@bg-col-light";
|
||||
text-color = mkLiteral "@grey";
|
||||
vertical-align = mkLiteral "0.5";
|
||||
horizontal-align = mkLiteral "0.5";
|
||||
};
|
||||
|
||||
"button selected" = {
|
||||
background-color = mkLiteral "@bg-col";
|
||||
text-color = mkLiteral "@blue";
|
||||
};
|
||||
|
||||
message = {
|
||||
background-color = mkLiteral "@bg-col-light";
|
||||
margin = mkLiteral "2px";
|
||||
padding = mkLiteral "2px";
|
||||
border-radius = mkLiteral "5px";
|
||||
};
|
||||
|
||||
textbox = {
|
||||
padding = mkLiteral "6px";
|
||||
margin = mkLiteral "20px 0px 0px 20px";
|
||||
text-color = mkLiteral "@blue";
|
||||
background-color = mkLiteral "@bg-col-light";
|
||||
};
|
||||
};
|
||||
programs.neomutt.extraConfig = ''
|
||||
color normal default default # Text is "Text"
|
||||
color index color2 default ~N # New Messages are Green
|
||||
color index color1 default ~F # Flagged messages are Red
|
||||
color index color13 default ~T # Tagged Messages are Red
|
||||
color index color1 default ~D # Messages to delete are Red
|
||||
color attachment color5 default # Attachments are Pink
|
||||
color signature color8 default # Signatures are Surface 2
|
||||
color search color4 default # Highlighted results are Blue
|
||||
color indicator default color8 # currently highlighted message Surface 2=Background Text=Foreground
|
||||
color error color1 default # error messages are Red
|
||||
color status color15 default # status line "Subtext 0"
|
||||
color tree color15 default # thread tree arrows Subtext 0
|
||||
color tilde color15 default # blank line padding Subtext 0
|
||||
color hdrdefault color13 default # default headers Pink
|
||||
color header color13 default "^From:"
|
||||
color header color13 default "^Subject:"
|
||||
color quoted color15 default # Subtext 0
|
||||
color quoted1 color7 default # Subtext 1
|
||||
color quoted2 color8 default # Surface 2
|
||||
color quoted3 color0 default # Surface 1
|
||||
color quoted4 color0 default
|
||||
color quoted5 color0 default
|
||||
color body color2 default [\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+ # email addresses Green
|
||||
color body color2 default (https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+ # URLs Green
|
||||
color body color4 default (^|[[:space:]])\\*[^[:space:]]+\\*([[:space:]]|$) # *bold* text Blue
|
||||
color body color4 default (^|[[:space:]])_[^[:space:]]+_([[:space:]]|$) # _underlined_ text Blue
|
||||
color body color4 default (^|[[:space:]])/[^[:space:]]+/([[:space:]]|$) # /italic/ text Blue
|
||||
color sidebar_flagged color1 default # Mailboxes with flagged mails are Red
|
||||
color sidebar_new color10 default # Mailboxes with new mail are Green
|
||||
'';
|
||||
home.file.".local/share/mc/skins/catppuccin.ini".source = ../../extra/mc-catppuccin.ini;
|
||||
systemd.user.services.transparency = {
|
||||
Unit = {
|
||||
Description = "transparency";
|
||||
After = ["graphical-session-pre.target"];
|
||||
PartOf = ["graphical-session.target"];
|
||||
};
|
||||
Install.WantedBy = ["graphical-session.target"];
|
||||
Service = {
|
||||
ExecStart = "${pkgs.python3.withPackages (ps: with ps; [i3ipc])}/bin/python ${./transparency.py}";
|
||||
};
|
||||
};
|
||||
|
||||
programs.zsh.initExtra =
|
||||
if withNSFW
|
||||
then ''
|
||||
export CARGO_MOMMYS_MOODS=chill/ominous/thirsty/yikes
|
||||
export CARGO_MOMMYS_LITTLE=racc/plush
|
||||
export CARGO_MOMMYS_PARTS=shit/pee
|
||||
export CARGO_MOMMYS_FUCKING="pet/toy/toilet/shitslut/septic tank"
|
||||
''
|
||||
else ''
|
||||
export CARGO_MOMMYS_MOODS=chill/ominous
|
||||
export CARGO_MOMMYS_LITTLE=racc/plush
|
||||
'';
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
baseIndex = 1;
|
||||
clock24 = true;
|
||||
prefix = "C-a";
|
||||
sensibleOnTop = true;
|
||||
plugins = with pkgs.tmuxPlugins; [
|
||||
power-theme
|
||||
cpu
|
||||
{
|
||||
plugin = resurrect;
|
||||
extraConfig = "set -g @resurrect-strategy-nvim 'session'";
|
||||
}
|
||||
{
|
||||
plugin = continuum;
|
||||
extraConfig = ''
|
||||
set -g @continuum-restore 'on'
|
||||
'';
|
||||
}
|
||||
];
|
||||
extraConfig = ''
|
||||
set-window-option -g automatic-rename on
|
||||
set-option -g set-titles on
|
||||
bind -n M-Left select-pane -L
|
||||
bind -n M-Right select-pane -R
|
||||
bind -n M-Up select-pane -U
|
||||
bind -n M-Down select-pane -D
|
||||
bind -n S-Left previous-window
|
||||
bind -n S-Right next-window
|
||||
set -sg escape-time 0
|
||||
set -g mouse on
|
||||
set -g default-terminal "screen-256color"
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i python3 -p python3 python3Packages.i3ipc
|
||||
|
||||
import i3ipc
|
||||
import signal
|
||||
import sys
|
||||
from functools import partial
|
||||
|
||||
foreground_transparency = "0.9"
|
||||
background_transparency = "0.7"
|
||||
|
||||
|
||||
def on_window_focus(ipc, event):
|
||||
global prev_focused
|
||||
|
||||
focused = event.container
|
||||
|
||||
if focused.id != prev_focused.id: # https://github.com/swaywm/sway/issues/2859
|
||||
if focused.fullscreen_mode > 0:
|
||||
focused.command("opacity 1")
|
||||
else:
|
||||
focused.command("opacity " + foreground_transparency)
|
||||
if prev_focused.fullscreen_mode == 0:
|
||||
prev_focused.command("opacity " + background_transparency)
|
||||
prev_focused = focused
|
||||
|
||||
|
||||
def on_fullscreen_mode(ipc, event):
|
||||
global prev_focused
|
||||
if event.container.id == prev_focused.id:
|
||||
prev_focused = event.container
|
||||
|
||||
if event.container.fullscreen_mode > 0:
|
||||
event.container.command("opacity 1")
|
||||
elif event.container.focused:
|
||||
event.container.command("opacity " + foreground_transparency)
|
||||
else:
|
||||
event.container.command("opacity " + background_transparency)
|
||||
|
||||
|
||||
def remove_opacity(ipc):
|
||||
for workspace in ipc.get_tree().workspaces():
|
||||
for w in workspace:
|
||||
w.command("opacity 1")
|
||||
ipc.main_quit()
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
ipc = i3ipc.Connection()
|
||||
prev_args = None
|
||||
|
||||
for window in ipc.get_tree():
|
||||
if window.fullscreen_mode > 0:
|
||||
window.command("opacity 1")
|
||||
elif window.focused:
|
||||
prev_focused = window
|
||||
window.command("opacity " + foreground_transparency)
|
||||
else:
|
||||
window.command("opacity " + background_transparency)
|
||||
for sig in [signal.SIGINT, signal.SIGTERM]:
|
||||
signal.signal(sig, lambda signal, frame: remove_opacity(ipc))
|
||||
ipc.on("window::focus", on_window_focus)
|
||||
ipc.on("window::fullscreen_mode", on_fullscreen_mode)
|
||||
ipc.main()
|
|
@ -1,39 +0,0 @@
|
|||
set commentstring=//\ %s
|
||||
|
||||
" Disable inserting comment leader after hitting o or O or <Enter>
|
||||
set formatoptions-=o
|
||||
set formatoptions-=r
|
||||
|
||||
nnoremap <silent> <buffer> <F9> :call <SID>compile_run_cpp()<CR>
|
||||
|
||||
function! s:compile_run_cpp() abort
|
||||
let src_path = expand('%:p:~')
|
||||
let src_noext = expand('%:p:~:r')
|
||||
" The building flags
|
||||
let _flag = '-Wall -Wextra -std=c++11 -O2'
|
||||
|
||||
if executable('clang++')
|
||||
let prog = 'clang++'
|
||||
elseif executable('g++')
|
||||
let prog = 'g++'
|
||||
else
|
||||
echoerr 'No C++ compiler found on the system!'
|
||||
endif
|
||||
call s:create_term_buf('h', 20)
|
||||
execute printf('term %s %s %s -o %s && %s', prog, _flag, src_path, src_noext, src_noext)
|
||||
startinsert
|
||||
endfunction
|
||||
|
||||
function s:create_term_buf(_type, size) abort
|
||||
set splitbelow
|
||||
set splitright
|
||||
if a:_type ==# 'v'
|
||||
vnew
|
||||
else
|
||||
new
|
||||
endif
|
||||
execute 'resize ' . a:size
|
||||
endfunction
|
||||
|
||||
" For delimitMate
|
||||
let b:delimitMate_matchpairs = "(:),[:],{:}"
|
|
@ -1 +0,0 @@
|
|||
set commentstring=#\ %s
|
|
@ -1,3 +0,0 @@
|
|||
" Disable inserting comment leader after hitting o or O or <Enter>
|
||||
set formatoptions-=o
|
||||
set formatoptions-=r
|
|
@ -1,6 +0,0 @@
|
|||
" let the initial folding state be that all folds are closed.
|
||||
set foldlevel=0
|
||||
|
||||
" Use nvim-treesitter for folding
|
||||
set foldmethod=expr
|
||||
set foldexpr=nvim_treesitter#foldexpr()
|
|
@ -1,12 +0,0 @@
|
|||
" Disable inserting comment leader after hitting o or O or <Enter>
|
||||
set formatoptions-=o
|
||||
set formatoptions-=r
|
||||
|
||||
nnoremap <buffer><silent> <F9> :luafile %<CR>
|
||||
|
||||
" For delimitMate
|
||||
let b:delimitMate_matchpairs = "(:),[:],{:}"
|
||||
|
||||
" Use nvim-treesitter for folding
|
||||
set foldmethod=expr
|
||||
set foldexpr=nvim_treesitter#foldexpr()
|
|
@ -1,69 +0,0 @@
|
|||
set concealcursor=c
|
||||
set synmaxcol=3000 " For long Chinese paragraphs
|
||||
|
||||
set wrap
|
||||
|
||||
" Fix minor issue with footnote, see https://github.com/vim-pandoc/vim-markdownfootnotes/issues/22
|
||||
if exists(':FootnoteNumber')
|
||||
nnoremap <buffer><silent> ^^ :<C-U>call markdownfootnotes#VimFootnotes('i')<CR>
|
||||
inoremap <buffer><silent> ^^ <C-O>:<C-U>call markdownfootnotes#VimFootnotes('i')<CR>
|
||||
imap <buffer> <silent> @@ <Plug>ReturnFromFootnote
|
||||
nmap <buffer> <silent> @@ <Plug>ReturnFromFootnote
|
||||
endif
|
||||
|
||||
" Text objects for Markdown code blocks.
|
||||
xnoremap <buffer><silent> ic :<C-U>call text_obj#MdCodeBlock('i')<CR>
|
||||
xnoremap <buffer><silent> ac :<C-U>call text_obj#MdCodeBlock('a')<CR>
|
||||
onoremap <buffer><silent> ic :<C-U>call text_obj#MdCodeBlock('i')<CR>
|
||||
onoremap <buffer><silent> ac :<C-U>call text_obj#MdCodeBlock('a')<CR>
|
||||
|
||||
" Use + to turn several lines to an unordered list.
|
||||
" Ref: https://vi.stackexchange.com/q/5495/15292 and https://stackoverflow.com/q/42438795/6064933.
|
||||
nnoremap <buffer><silent> + :set operatorfunc=AddListSymbol<CR>g@
|
||||
xnoremap <buffer><silent> + :<C-U> call AddListSymbol(visualmode(), 1)<CR>
|
||||
|
||||
function! AddListSymbol(type, ...) abort
|
||||
if a:0
|
||||
let line_start = line("'<")
|
||||
let line_end = line("'>")
|
||||
else
|
||||
let line_start = line("'[")
|
||||
let line_end = line("']")
|
||||
endif
|
||||
|
||||
" add list symbol to each line
|
||||
for line in range(line_start, line_end)
|
||||
let text = getline(line)
|
||||
|
||||
let l:end = matchend(text, '^\s*')
|
||||
if l:end == 0
|
||||
let new_text = '+ ' . text
|
||||
else
|
||||
let new_text = text[0 : l:end-1] . ' + ' . text[l:end :]
|
||||
endif
|
||||
|
||||
call setline(line, new_text)
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
" Add hard line breaks for Markdown
|
||||
nnoremap <buffer><silent> \ :set operatorfunc=AddLineBreak<CR>g@
|
||||
xnoremap <buffer><silent> \ :<C-U> call AddLineBreak(visualmode(), 1)<CR>
|
||||
|
||||
function! AddLineBreak(type, ...) abort
|
||||
if a:0
|
||||
let line_start = line("'<")
|
||||
let line_end = line("'>")
|
||||
else
|
||||
let line_start = line("'[")
|
||||
let line_end = line("']")
|
||||
endif
|
||||
|
||||
for line in range(line_start, line_end)
|
||||
let text = getline(line)
|
||||
" add backslash to each line
|
||||
let new_text = text . "\\"
|
||||
|
||||
call setline(line, new_text)
|
||||
endfor
|
||||
endfunction
|
|
@ -1,21 +0,0 @@
|
|||
if exists(':AsyncRun')
|
||||
nnoremap <buffer><silent> <F9> :<C-U>AsyncRun python -u "%"<CR>
|
||||
endif
|
||||
|
||||
" Do not wrap Python source code.
|
||||
set nowrap
|
||||
set sidescroll=5
|
||||
set sidescrolloff=2
|
||||
set colorcolumn=100
|
||||
|
||||
set tabstop=4 " number of visual spaces per TAB
|
||||
set softtabstop=4 " number of spaces in tab when editing
|
||||
set shiftwidth=4 " number of spaces to use for autoindent
|
||||
set expandtab " expand tab to spaces so that tabs are spaces
|
||||
|
||||
" For delimitMate
|
||||
let b:delimitMate_matchpairs = "(:),[:],{:}"
|
||||
|
||||
" Use nvim-treesitter for folding
|
||||
set foldmethod=expr
|
||||
set foldexpr=nvim_treesitter#foldexpr()
|
|
@ -1,6 +0,0 @@
|
|||
" Set quickfix window height, see also https://github.com/lervag/vimtex/issues/1127
|
||||
function! AdjustWindowHeight(minheight, maxheight)
|
||||
execute max([a:minheight, min([line('$'), a:maxheight])]) . 'wincmd _'
|
||||
endfunction
|
||||
|
||||
call AdjustWindowHeight(5, 15)
|
|
@ -1 +0,0 @@
|
|||
set commentstring=--\ %s
|
|
@ -1,2 +0,0 @@
|
|||
vim.o.textwidth = 120
|
||||
vim.o.wrap = true
|
|
@ -1 +0,0 @@
|
|||
set colorcolumn=
|
|
@ -1,15 +0,0 @@
|
|||
" Disable inserting comment leader after hitting o or O or <Enter>
|
||||
set formatoptions-=o
|
||||
set formatoptions-=r
|
||||
|
||||
" Set the folding related options for vim script. Setting folding option in
|
||||
" modeline is annoying in that the modeline get executed each time the window
|
||||
" focus is lost (see
|
||||
" https://github.com/tmux-plugins/vim-tmux-focus-events/issues/14)
|
||||
set foldmethod=expr foldexpr=utils#VimFolds(v:lnum) foldtext=utils#MyFoldText()
|
||||
|
||||
" Use :help command for keyword when pressing `K` in vim file,
|
||||
" see `:h K` and https://stackoverflow.com/q/15867323/6064933
|
||||
set keywordprg=:help
|
||||
|
||||
nnoremap <buffer><silent> <F9> :source %<CR>
|
|
@ -1,4 +0,0 @@
|
|||
" Turn off syntax highlighting for large YAML files.
|
||||
if line('$') > 500
|
||||
setlocal syntax=OFF
|
||||
endif
|
|
@ -1,30 +0,0 @@
|
|||
function! buf_utils#GoToBuffer(count, direction) abort
|
||||
if a:count == 0
|
||||
if a:direction ==# 'forward'
|
||||
bnext
|
||||
elseif a:direction ==# 'backward'
|
||||
bprevious
|
||||
else
|
||||
echoerr 'Bad argument ' a:direction
|
||||
endif
|
||||
return
|
||||
endif
|
||||
" Check the validity of buffer number.
|
||||
if index(s:GetBufNums(), a:count) == -1
|
||||
" Using `lua vim.notify('invalid bufnr: ' .. a:count)` won't work, because
|
||||
" we are essentially mixing Lua and vim script. We need to make sure that
|
||||
" args inside vim.notify() are valid vim values. The conversion from vim
|
||||
" value to lua value will be done by Nvim. See also https://github.com/neovim/neovim/pull/11338.
|
||||
call v:lua.vim.notify('Invalid bufnr: ' . a:count, 4, {'title': 'nvim-config'})
|
||||
return
|
||||
endif
|
||||
|
||||
" Do not use {count} for gB (it is less useful)
|
||||
if a:direction ==# 'forward'
|
||||
silent execute('buffer' . a:count)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:GetBufNums() abort
|
||||
return map(copy(getbufinfo({'buflisted':1})), 'v:val.bufnr')
|
||||
endfunction
|
|
@ -1,86 +0,0 @@
|
|||
function! text_obj#URL() abort
|
||||
if match(&runtimepath, 'vim-highlighturl') != -1
|
||||
" Note that we use https://github.com/itchyny/vim-highlighturl to get the URL pattern.
|
||||
let url_pattern = highlighturl#default_pattern()
|
||||
else
|
||||
let url_pattern = expand('<cfile>')
|
||||
" Since expand('<cfile>') also works for normal words, we need to check if
|
||||
" this is really URL using heuristics, e.g., URL length.
|
||||
if len(url_pattern) <= 10
|
||||
return
|
||||
endif
|
||||
endif
|
||||
|
||||
" We need to find all possible URL on this line and their start, end index.
|
||||
" Then find where current cursor is, and decide if cursor is on one of the
|
||||
" URLs.
|
||||
let line_text = getline('.')
|
||||
let url_infos = []
|
||||
|
||||
let [_url, _idx_start, _idx_end] = matchstrpos(line_text, url_pattern)
|
||||
while _url !=# ''
|
||||
let url_infos += [[_url, _idx_start+1, _idx_end]]
|
||||
let [_url, _idx_start, _idx_end] = matchstrpos(line_text, url_pattern, _idx_end)
|
||||
endwhile
|
||||
|
||||
" echo url_infos
|
||||
" If no URL is found, do nothing.
|
||||
if len(url_infos) == 0
|
||||
return
|
||||
endif
|
||||
|
||||
let [start_col, end_col] = [-1, -1]
|
||||
" If URL is found, find if cursor is on it.
|
||||
let [buf_num, cur_row, cur_col] = getcurpos()[0:2]
|
||||
for url_info in url_infos
|
||||
" echo url_info
|
||||
let [_url, _idx_start, _idx_end] = url_info
|
||||
if cur_col >= _idx_start && cur_col <= _idx_end
|
||||
let start_col = _idx_start
|
||||
let end_col = _idx_end
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
|
||||
" Cursor is not on a URL, do nothing.
|
||||
if start_col == -1
|
||||
return
|
||||
endif
|
||||
|
||||
" Now set the '< and '> mark
|
||||
call setpos("'<", [buf_num, cur_row, start_col, 0])
|
||||
call setpos("'>", [buf_num, cur_row, end_col, 0])
|
||||
normal! gv
|
||||
endfunction
|
||||
|
||||
function! text_obj#MdCodeBlock(type) abort
|
||||
" the parameter type specify whether it is inner text objects or around
|
||||
" text objects.
|
||||
|
||||
" Move the cursor to the end of line in case that cursor is on the opening
|
||||
" of a code block. Actually, there are still issues if the cursor is on the
|
||||
" closing of a code block. In this case, the start row of code blocks would
|
||||
" be wrong. Unless we can match code blocks, it not easy to fix this.
|
||||
normal! $
|
||||
let start_row = searchpos('\s*```', 'bnW')[0]
|
||||
let end_row = searchpos('\s*```', 'nW')[0]
|
||||
|
||||
let buf_num = bufnr()
|
||||
if a:type ==# 'i'
|
||||
let start_row += 1
|
||||
let end_row -= 1
|
||||
endif
|
||||
" echo a:type start_row end_row
|
||||
|
||||
call setpos("'<", [buf_num, start_row, 1, 0])
|
||||
call setpos("'>", [buf_num, end_row, 1, 0])
|
||||
execute 'normal! `<V`>'
|
||||
endfunction
|
||||
|
||||
function! text_obj#Buffer() abort
|
||||
let buf_num = bufnr()
|
||||
|
||||
call setpos("'<", [buf_num, 1, 1, 0])
|
||||
call setpos("'>", [buf_num, line('$'), 1, 0])
|
||||
execute 'normal! `<V`>'
|
||||
endfunction
|
|
@ -1,194 +0,0 @@
|
|||
" Create command alias safely, see https://stackoverflow.com/q/3878692/6064933
|
||||
" The following two functions are taken from answer below on SO:
|
||||
" https://stackoverflow.com/a/10708687/6064933
|
||||
function! utils#Cabbrev(key, value) abort
|
||||
execute printf('cabbrev <expr> %s (getcmdtype() == ":" && getcmdpos() <= %d) ? %s : %s',
|
||||
\ a:key, 1+len(a:key), <SID>Single_quote(a:value), <SID>Single_quote(a:key))
|
||||
endfunction
|
||||
|
||||
function! s:Single_quote(str) abort
|
||||
return "'" . substitute(copy(a:str), "'", "''", 'g') . "'"
|
||||
endfunction
|
||||
|
||||
" Check the syntax group in the current cursor position, see
|
||||
" https://stackoverflow.com/q/9464844/6064933 and
|
||||
" https://jordanelver.co.uk/blog/2015/05/27/working-with-vim-colorschemes/
|
||||
function! utils#SynGroup() abort
|
||||
if !exists('*synstack')
|
||||
return
|
||||
endif
|
||||
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
|
||||
endfunction
|
||||
|
||||
" Check if a colorscheme exists in runtimepath.
|
||||
" The following two functions are inspired by https://stackoverflow.com/a/5703164/6064933.
|
||||
function! utils#HasColorscheme(name) abort
|
||||
let l:pat = printf('colors/%s.vim', a:name)
|
||||
return !empty(globpath(&runtimepath, l:pat))
|
||||
endfunction
|
||||
|
||||
" Custom fold expr, adapted from https://vi.stackexchange.com/a/9094/15292
|
||||
function! utils#VimFolds(lnum) abort
|
||||
" get content of current line and the line below
|
||||
let l:cur_line = getline(a:lnum)
|
||||
let l:next_line = getline(a:lnum+1)
|
||||
|
||||
if l:cur_line =~# '^"{'
|
||||
return '>' . (matchend(l:cur_line, '"{*') - 1)
|
||||
endif
|
||||
|
||||
if l:cur_line ==# '' && (matchend(l:next_line, '"{*') - 1) == 1
|
||||
return 0
|
||||
endif
|
||||
|
||||
return '='
|
||||
endfunction
|
||||
|
||||
" Custom fold text, adapted from https://vi.stackexchange.com/a/3818/15292
|
||||
" and https://vi.stackexchange.com/a/6608/15292
|
||||
function! utils#MyFoldText() abort
|
||||
let l:line = getline(v:foldstart)
|
||||
let l:fold_line_num = v:foldend - v:foldstart
|
||||
let l:fold_text = substitute(l:line, '^"{\+', '', 'g')
|
||||
let l:fill_char_num = &textwidth - len(l:fold_text) - len(l:fold_line_num) - 10
|
||||
return printf('+%s%s %s (%s L)', repeat('-', 4), l:fold_text, repeat('-', l:fill_char_num), l:fold_line_num)
|
||||
endfunction
|
||||
|
||||
" Toggle cursor column
|
||||
function! utils#ToggleCursorCol() abort
|
||||
if &cursorcolumn
|
||||
set nocursorcolumn
|
||||
echo 'cursorcolumn: OFF'
|
||||
else
|
||||
set cursorcolumn
|
||||
echo 'cursorcolumn: ON'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! utils#SwitchLine(src_line_idx, direction) abort
|
||||
if a:direction ==# 'up'
|
||||
if a:src_line_idx == 1
|
||||
return
|
||||
endif
|
||||
move-2
|
||||
elseif a:direction ==# 'down'
|
||||
if a:src_line_idx == line('$')
|
||||
return
|
||||
endif
|
||||
move+1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! utils#MoveSelection(direction) abort
|
||||
" only do this if previous mode is visual line mode. Once we press some keys in
|
||||
" visual line mode, we will leave this mode. So the output of `mode()` will be
|
||||
" `n` instead of `V`. We can use `visualmode()` instead to check the previous
|
||||
" mode, see also https://stackoverflow.com/a/61486601/6064933
|
||||
if visualmode() !=# 'V'
|
||||
return
|
||||
endif
|
||||
|
||||
let l:start_line = line("'<")
|
||||
let l:end_line = line("'>")
|
||||
let l:num_line = l:end_line - l:start_line + 1
|
||||
|
||||
if a:direction ==# 'up'
|
||||
if l:start_line == 1
|
||||
" we can also directly use `normal gv`, see https://stackoverflow.com/q/9724123/6064933
|
||||
normal! gv
|
||||
return
|
||||
endif
|
||||
silent execute printf('%s,%smove-2', l:start_line, l:end_line)
|
||||
normal! gv
|
||||
elseif a:direction ==# 'down'
|
||||
if l:end_line == line('$')
|
||||
normal! gv
|
||||
return
|
||||
endif
|
||||
silent execute printf('%s,%smove+%s', l:start_line, l:end_line, l:num_line)
|
||||
normal! gv
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
function! utils#Get_titlestr() abort
|
||||
let l:title_str = ''
|
||||
if g:is_linux
|
||||
let l:title_str = hostname() . ' '
|
||||
endif
|
||||
|
||||
let l:buf_path = expand('%:p:~')
|
||||
let l:title_str = l:title_str . l:buf_path . ' '
|
||||
if &buflisted && l:buf_path != ""
|
||||
let l:title_str = l:title_str . strftime('%Y-%m-%d %H:%M:%S%z', getftime(expand('%')))
|
||||
endif
|
||||
|
||||
return l:title_str
|
||||
endfunction
|
||||
|
||||
" Output current time or unix timestamp in human-readable format.
|
||||
function! utils#iso_time(timestamp) abort
|
||||
" Get current datetime
|
||||
if !a:timestamp
|
||||
return strftime('%Y-%m-%d %H:%M:%S%z')
|
||||
endif
|
||||
|
||||
" this timestamp in expressed in milliseconds
|
||||
if len(a:timestamp) == 13
|
||||
let l:timestamp = a:timestamp[:-4]
|
||||
" this timestamp in expressed in microseconds
|
||||
elseif len(a:timestamp) == 16
|
||||
let l:timestamp = a:timestamp[:-7]
|
||||
else
|
||||
let l:timestamp = a:timestamp
|
||||
endif
|
||||
return strftime('%Y-%m-%d %H:%M:%S%z', l:timestamp)
|
||||
|
||||
endfunction
|
||||
|
||||
" Check if we are inside a Git repo.
|
||||
function! utils#Inside_git_repo() abort
|
||||
let res = system('git rev-parse --is-inside-work-tree')
|
||||
if match(res, 'true') == -1
|
||||
return v:false
|
||||
else
|
||||
" Manually trigger a special user autocmd InGitRepo (used lazyloading.
|
||||
doautocmd User InGitRepo
|
||||
return v:true
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! utils#GetGitBranch()
|
||||
let l:res = systemlist('git rev-parse --abbrev-ref HEAD')[0]
|
||||
if match(l:res, 'fatal') != -1
|
||||
return ''
|
||||
else
|
||||
return l:res
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Redirect command output to a register for later processing.
|
||||
" Ref: https://stackoverflow.com/q/2573021/6064933 and https://unix.stackexchange.com/q/8101/221410 .
|
||||
function! utils#CaptureCommandOutput(command) abort
|
||||
let l:tmp = @m
|
||||
redir @m
|
||||
silent! execute a:command
|
||||
redir END
|
||||
|
||||
"create a scratch buffer for dumping the text, ref: https://vi.stackexchange.com/a/11311/15292.
|
||||
tabnew | setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile
|
||||
|
||||
let l:lines = split(@m, '\n')
|
||||
call nvim_buf_set_lines(0, 0, 0, 0, l:lines)
|
||||
|
||||
let @m = l:tmp
|
||||
endfunction
|
||||
|
||||
" Edit all files matching the given patterns.
|
||||
function! utils#MultiEdit(patterns) abort
|
||||
for p in a:patterns
|
||||
for f in glob(p, 0, 1)
|
||||
execute 'edit ' . f
|
||||
endfor
|
||||
endfor
|
||||
endfunction
|
|
@ -1,4 +0,0 @@
|
|||
augroup det_md
|
||||
autocmd!
|
||||
autocmd BufRead,BufNewFile *.pdc set filetype=markdown
|
||||
augroup END
|
|
@ -1,4 +0,0 @@
|
|||
vim.g.catppuccin_flavour = "mocha"
|
||||
require("catppuccin").setup()
|
||||
|
||||
vim.cmd([[colorscheme catppuccin]])
|
|
@ -1,6 +0,0 @@
|
|||
require("bqf").setup {
|
||||
auto_resize_height = false,
|
||||
preview = {
|
||||
auto_preview = false,
|
||||
},
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
require("bufferline").setup {
|
||||
options = {
|
||||
numbers = "buffer_id",
|
||||
close_command = "bdelete! %d",
|
||||
right_mouse_command = nil,
|
||||
left_mouse_command = "buffer %d",
|
||||
middle_mouse_command = nil,
|
||||
indicator = {
|
||||
icon = "▎", -- this should be omitted if indicator style is not 'icon'
|
||||
style = "icon",
|
||||
},
|
||||
buffer_close_icon = "",
|
||||
modified_icon = "●",
|
||||
close_icon = "",
|
||||
left_trunc_marker = "",
|
||||
right_trunc_marker = "",
|
||||
max_name_length = 18,
|
||||
max_prefix_length = 15,
|
||||
tab_size = 10,
|
||||
diagnostics = false,
|
||||
custom_filter = function(bufnr)
|
||||
-- if the result is false, this buffer will be shown, otherwise, this
|
||||
-- buffer will be hidden.
|
||||
|
||||
-- filter out filetypes you don't want to see
|
||||
local exclude_ft = { "qf", "fugitive", "git" }
|
||||
local cur_ft = vim.bo[bufnr].filetype
|
||||
local should_filter = vim.tbl_contains(exclude_ft, cur_ft)
|
||||
|
||||
if should_filter then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end,
|
||||
show_buffer_icons = false,
|
||||
show_buffer_close_icons = true,
|
||||
show_close_icon = true,
|
||||
show_tab_indicators = true,
|
||||
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
|
||||
separator_style = "bar",
|
||||
enforce_regular_tabs = false,
|
||||
always_show_bufferline = true,
|
||||
sort_by = "id",
|
||||
},
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
local cmp_ai = require('cmp_ai.config')
|
||||
|
||||
cmp_ai:setup({
|
||||
max_lines = 100,
|
||||
provider = 'Ollama',
|
||||
provider_options = {
|
||||
model = 'codellama:13b-code-q6_K',
|
||||
},
|
||||
notify = true,
|
||||
notify_callback = function(msg)
|
||||
vim.notify(msg)
|
||||
end,
|
||||
run_on_every_keystroke = true,
|
||||
ignored_file_types = {
|
||||
-- default is not to ignore
|
||||
-- uncomment to ignore in lua:
|
||||
-- lua = true
|
||||
},
|
||||
})
|
|
@ -1,75 +0,0 @@
|
|||
local api = vim.api
|
||||
local keymap = vim.keymap
|
||||
local dashboard = require("dashboard")
|
||||
|
||||
local conf = {}
|
||||
conf.header = {
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗",
|
||||
" ████╗ ██║ ██╔════╝██╔═══██╗ ██║ ██║ ██║ ████╗ ████║",
|
||||
" ██╔██╗ ██║ █████╗ ██║ ██║ ██║ ██║ ██║ ██╔████╔██║",
|
||||
" ██║╚██╗██║ ██╔══╝ ██║ ██║ ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║",
|
||||
" ██║ ╚████║ ███████╗╚██████╔╝ ╚████╔╝ ██║ ██║ ╚═╝ ██║",
|
||||
" ╚═╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
}
|
||||
|
||||
conf.center = {
|
||||
{
|
||||
icon = " ",
|
||||
desc = "Find File ",
|
||||
action = "Leaderf file --popup",
|
||||
key = "<Leader> f f",
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
desc = "Recently opened files ",
|
||||
action = "Leaderf mru --popup",
|
||||
key = "<Leader> f r",
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
desc = "Project grep ",
|
||||
action = "Leaderf rg --popup",
|
||||
key = "<Leader> f g",
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
desc = "Open Nvim config ",
|
||||
action = "tabnew $MYVIMRC | tcd %:p:h",
|
||||
key = "<Leader> e v",
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
desc = "New file ",
|
||||
action = "enew",
|
||||
key = "e",
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
desc = "Quit Nvim ",
|
||||
-- desc = "Quit Nvim ",
|
||||
action = "qa",
|
||||
key = "q",
|
||||
},
|
||||
}
|
||||
|
||||
dashboard.setup({
|
||||
theme = 'doom',
|
||||
shortcut_type = 'number',
|
||||
config = conf
|
||||
})
|
||||
|
||||
api.nvim_create_autocmd("FileType", {
|
||||
pattern = "dashboard",
|
||||
group = api.nvim_create_augroup("dashboard_enter", { clear = true }),
|
||||
callback = function ()
|
||||
keymap.set("n", "q", ":qa<CR>", { buffer = true, silent = true })
|
||||
keymap.set("n", "e", ":enew<CR>", { buffer = true, silent = true })
|
||||
end
|
||||
})
|
|
@ -1 +0,0 @@
|
|||
require("fidget").setup {}
|
|
@ -1,11 +0,0 @@
|
|||
local keymap = vim.keymap
|
||||
|
||||
keymap.set("n", "<leader>gs", "<cmd>Git<cr>", { desc = "Git status" })
|
||||
keymap.set("n", "<leader>gw", "<cmd>Gwrite<cr>", { desc = "Git add" })
|
||||
keymap.set("n", "<leader>gc", "<cmd>Git commit<cr>", { desc = "Git commit" })
|
||||
keymap.set("n", "<leader>gd", "<cmd>Gdiffsplit<cr>", { desc = "Git diff" })
|
||||
keymap.set("n", "<leader>gpl", "<cmd>Git pull<cr>", { desc = "Git pull" })
|
||||
keymap.set("n", "<leader>gpu", "<cmd>15 split|term git push<cr>", { desc = "Git push" })
|
||||
|
||||
-- convert git to Git in command line mode
|
||||
vim.fn['utils#Cabbrev']('git', 'Git')
|
|
@ -1,37 +0,0 @@
|
|||
local keymap = vim.keymap
|
||||
local gitlinker = require("gitlinker")
|
||||
|
||||
gitlinker.setup {
|
||||
callbacks = {
|
||||
["dev.azure.com"] = function(url_data)
|
||||
vim.print(url_data)
|
||||
local url = require"gitlinker.hosts".get_base_https_url(url_data)
|
||||
|
||||
if url_data.lstart then
|
||||
if url_data.lend == nil then
|
||||
url_data.lend = url_data.lstart
|
||||
end
|
||||
url = url .. "?path=/" .. url_data.file .. "&version=GC" .. url_data.rev .. "&line=" .. url_data.lstart .. "&lineEnd=" .. url_data.lend .. "&lineStartColumn=1" .. "&lineEndColumn=120"
|
||||
end
|
||||
return url
|
||||
end
|
||||
},
|
||||
mappings = nil,
|
||||
}
|
||||
|
||||
keymap.set({ "n", "v" }, "<leader>gl", function()
|
||||
local mode = string.lower(vim.fn.mode())
|
||||
gitlinker.get_buf_range_url(mode)
|
||||
end, {
|
||||
silent = true,
|
||||
desc = "get git permlink",
|
||||
})
|
||||
|
||||
keymap.set("n", "<leader>gb", function()
|
||||
gitlinker.get_repo_url({
|
||||
action_callback = gitlinker.actions.open_in_browser
|
||||
})
|
||||
end, {
|
||||
silent = true,
|
||||
desc = "browse repo in browser",
|
||||
})
|
|
@ -1,57 +0,0 @@
|
|||
local gs = require("gitsigns")
|
||||
|
||||
gs.setup {
|
||||
signs = {
|
||||
add = { text = "+" },
|
||||
change = { text = "~" },
|
||||
delete = { text = "_" },
|
||||
topdelete = { text = "‾" },
|
||||
changedelete = { text = "│" },
|
||||
},
|
||||
word_diff = true,
|
||||
on_attach = function(bufnr)
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map("n", "]c", function()
|
||||
if vim.wo.diff then
|
||||
return "]c"
|
||||
end
|
||||
vim.schedule(function()
|
||||
gs.next_hunk()
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end, { expr = true, desc = "next hunk" })
|
||||
|
||||
map("n", "[c", function()
|
||||
if vim.wo.diff then
|
||||
return "[c"
|
||||
end
|
||||
vim.schedule(function()
|
||||
gs.prev_hunk()
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end, { expr = true, desc = "previous hunk" })
|
||||
|
||||
-- Actions
|
||||
map("n", "<leader>hp", gs.preview_hunk)
|
||||
map("n", "<leader>hb", function()
|
||||
gs.blame_line { full = true }
|
||||
end)
|
||||
end,
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd('ColorScheme', {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.cmd [[
|
||||
hi GitSignsChangeInline gui=reverse
|
||||
hi GitSignsAddInline gui=reverse
|
||||
hi GitSignsDeleteInline gui=reverse
|
||||
]]
|
||||
end
|
||||
})
|
|
@ -1,49 +0,0 @@
|
|||
local api = vim.api
|
||||
local keymap = vim.keymap
|
||||
|
||||
local hlslens = require("hlslens")
|
||||
|
||||
hlslens.setup {
|
||||
calm_down = true,
|
||||
nearest_only = true,
|
||||
}
|
||||
|
||||
local activate_hlslens = function(direction)
|
||||
local cmd = string.format("normal! %s%szzzv", vim.v.count1, direction)
|
||||
local status, msg = pcall(vim.cmd, cmd)
|
||||
|
||||
-- Deal with the case that there is no such pattern in current buffer.
|
||||
if not status then
|
||||
local start_idx, _ = string.find(msg, 'E486', 1, true)
|
||||
local msg_part = string.sub(msg, start_idx)
|
||||
api.nvim_err_writeln(msg_part)
|
||||
return
|
||||
end
|
||||
|
||||
hlslens.start()
|
||||
end
|
||||
|
||||
keymap.set("n", "n", "", {
|
||||
callback = function()
|
||||
activate_hlslens("n")
|
||||
end,
|
||||
})
|
||||
|
||||
keymap.set("n", "N", "", {
|
||||
callback = function()
|
||||
activate_hlslens("N")
|
||||
end,
|
||||
})
|
||||
|
||||
keymap.set("n", "*", "", {
|
||||
callback = function()
|
||||
vim.fn.execute("normal! *N")
|
||||
hlslens.start()
|
||||
end,
|
||||
})
|
||||
keymap.set("n", "#", "", {
|
||||
callback = function()
|
||||
vim.fn.execute("normal! #N")
|
||||
hlslens.start()
|
||||
end,
|
||||
})
|
|
@ -1,36 +0,0 @@
|
|||
local api = vim.api
|
||||
|
||||
local exclude_ft = { "help", "git", "markdown", "text", "gitconfig", "alpha", "dashboard" }
|
||||
|
||||
require("ibl").setup {
|
||||
indent = {
|
||||
-- -- U+2502 may also be a good choice, it will be on the middle of cursor.
|
||||
-- -- U+250A is also a good choice
|
||||
char = "▏",
|
||||
},
|
||||
scope = {
|
||||
show_start = false,
|
||||
show_end = false,
|
||||
},
|
||||
exclude = {
|
||||
filetypes = exclude_ft,
|
||||
buftypes = { "terminal" },
|
||||
},
|
||||
}
|
||||
|
||||
local gid = api.nvim_create_augroup("indent_blankline", { clear = true })
|
||||
api.nvim_create_autocmd("InsertEnter", {
|
||||
pattern = "*",
|
||||
group = gid,
|
||||
command = "IBLDisable",
|
||||
})
|
||||
|
||||
api.nvim_create_autocmd("InsertLeave", {
|
||||
pattern = "*",
|
||||
group = gid,
|
||||
callback = function()
|
||||
if not vim.tbl_contains(exclude_ft, vim.bo.filetype) then
|
||||
vim.cmd([[IBLEnable]])
|
||||
end
|
||||
end,
|
||||
})
|
|
@ -1,273 +0,0 @@
|
|||
local fn = vim.fn
|
||||
local api = vim.api
|
||||
local keymap = vim.keymap
|
||||
local lsp = vim.lsp
|
||||
local diagnostic = vim.diagnostic
|
||||
|
||||
local utils = require("utils")
|
||||
|
||||
-- set quickfix list from diagnostics in a certain buffer, not the whole workspace
|
||||
local set_qflist = function(buf_num, severity)
|
||||
local diagnostics = nil
|
||||
diagnostics = diagnostic.get(buf_num, { severity = severity })
|
||||
|
||||
local qf_items = diagnostic.toqflist(diagnostics)
|
||||
vim.fn.setqflist({}, ' ', { title = 'Diagnostics', items = qf_items })
|
||||
|
||||
-- open quickfix by default
|
||||
vim.cmd[[copen]]
|
||||
end
|
||||
|
||||
local custom_attach = function(client, bufnr)
|
||||
-- Mappings.
|
||||
local map = function(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.silent = true
|
||||
opts.buffer = bufnr
|
||||
keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
map("n", "gd", vim.lsp.buf.definition, { desc = "go to definition" })
|
||||
map("n", "<C-]>", vim.lsp.buf.definition)
|
||||
map("n", "K", vim.lsp.buf.hover)
|
||||
map("n", "<C-k>", vim.lsp.buf.signature_help)
|
||||
map("n", "<space>rn", vim.lsp.buf.rename, { desc = "varialbe rename" })
|
||||
map("n", "gr", vim.lsp.buf.references, { desc = "show references" })
|
||||
map("n", "[d", diagnostic.goto_prev, { desc = "previous diagnostic" })
|
||||
map("n", "]d", diagnostic.goto_next, { desc = "next diagnostic" })
|
||||
-- this puts diagnostics from opened files to quickfix
|
||||
map("n", "<space>qw", diagnostic.setqflist, { desc = "put window diagnostics to qf" })
|
||||
-- this puts diagnostics from current buffer to quickfix
|
||||
map("n", "<space>qb", function() set_qflist(bufnr) end, { desc = "put buffer diagnostics to qf" })
|
||||
map("n", "<space>ca", vim.lsp.buf.code_action, { desc = "LSP code action" })
|
||||
map("n", "<space>wa", vim.lsp.buf.add_workspace_folder, { desc = "add workspace folder" })
|
||||
map("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, { desc = "remove workspace folder" })
|
||||
map("n", "<space>wl", function()
|
||||
inspect(vim.lsp.buf.list_workspace_folders())
|
||||
end, { desc = "list workspace folder" })
|
||||
|
||||
-- Set some key bindings conditional on server capabilities
|
||||
if client.server_capabilities.documentFormattingProvider then
|
||||
map("n", "<space>f", vim.lsp.buf.format, { desc = "format code" })
|
||||
end
|
||||
|
||||
api.nvim_create_autocmd("CursorHold", {
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
local float_opts = {
|
||||
focusable = false,
|
||||
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
|
||||
border = "rounded",
|
||||
source = "always", -- show source in diagnostic popup window
|
||||
prefix = " ",
|
||||
}
|
||||
|
||||
if not vim.b.diagnostics_pos then
|
||||
vim.b.diagnostics_pos = { nil, nil }
|
||||
end
|
||||
|
||||
local cursor_pos = api.nvim_win_get_cursor(0)
|
||||
if (cursor_pos[1] ~= vim.b.diagnostics_pos[1] or cursor_pos[2] ~= vim.b.diagnostics_pos[2])
|
||||
and #diagnostic.get() > 0
|
||||
then
|
||||
diagnostic.open_float(nil, float_opts)
|
||||
end
|
||||
|
||||
vim.b.diagnostics_pos = cursor_pos
|
||||
end,
|
||||
})
|
||||
|
||||
-- The blow command will highlight the current variable and its usages in the buffer.
|
||||
if client.server_capabilities.documentHighlightProvider then
|
||||
vim.cmd([[
|
||||
hi! link LspReferenceRead Visual
|
||||
hi! link LspReferenceText Visual
|
||||
hi! link LspReferenceWrite Visual
|
||||
]])
|
||||
|
||||
local gid = api.nvim_create_augroup("lsp_document_highlight", { clear = true })
|
||||
api.nvim_create_autocmd("CursorHold" , {
|
||||
group = gid,
|
||||
buffer = bufnr,
|
||||
callback = function ()
|
||||
lsp.buf.document_highlight()
|
||||
end
|
||||
})
|
||||
|
||||
api.nvim_create_autocmd("CursorMoved" , {
|
||||
group = gid,
|
||||
buffer = bufnr,
|
||||
callback = function ()
|
||||
lsp.buf.clear_references()
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
if vim.g.logging_level == "debug" then
|
||||
local msg = string.format("Language server %s started!", client.name)
|
||||
vim.notify(msg, vim.log.levels.DEBUG, { title = "Nvim-config" })
|
||||
end
|
||||
end
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
if utils.executable("pylsp") then
|
||||
local venv_path = os.getenv('VIRTUAL_ENV')
|
||||
local py_path = nil
|
||||
-- decide which python executable to use for mypy
|
||||
if venv_path ~= nil then
|
||||
py_path = venv_path .. "/bin/python3"
|
||||
else
|
||||
py_path = vim.g.python3_host_prog
|
||||
end
|
||||
|
||||
lspconfig.pylsp.setup {
|
||||
on_attach = custom_attach,
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
-- formatter options
|
||||
black = { enabled = true },
|
||||
autopep8 = { enabled = false },
|
||||
yapf = { enabled = false },
|
||||
-- linter options
|
||||
pylint = { enabled = true, executable = "pylint" },
|
||||
ruff = { enabled = false },
|
||||
pyflakes = { enabled = false },
|
||||
pycodestyle = { enabled = false },
|
||||
-- type checker
|
||||
pylsp_mypy = {
|
||||
enabled = true,
|
||||
overrides = { "--python-executable", py_path, true },
|
||||
report_progress = true,
|
||||
live_mode = false
|
||||
},
|
||||
-- auto-completion options
|
||||
jedi_completion = { fuzzy = true },
|
||||
-- import sorting
|
||||
isort = { enabled = true },
|
||||
},
|
||||
},
|
||||
},
|
||||
flags = {
|
||||
debounce_text_changes = 200,
|
||||
},
|
||||
capabilities = capabilities,
|
||||
}
|
||||
else
|
||||
--vim.notify("pylsp not found!", vim.log.levels.WARN, { title = "Nvim-config" })
|
||||
end
|
||||
|
||||
-- if utils.executable('pyright') then
|
||||
-- lspconfig.pyright.setup{
|
||||
-- on_attach = custom_attach,
|
||||
-- capabilities = capabilities
|
||||
-- }
|
||||
-- else
|
||||
-- vim.notify("pyright not found!", vim.log.levels.WARN, {title = 'Nvim-config'})
|
||||
-- end
|
||||
|
||||
if utils.executable("ltex-ls") then
|
||||
lspconfig.ltex.setup {
|
||||
on_attach = custom_attach,
|
||||
cmd = { "ltex-ls" },
|
||||
filetypes = { "text", "plaintex", "tex", "markdown" },
|
||||
settings = {
|
||||
ltex = {
|
||||
language = "en"
|
||||
},
|
||||
},
|
||||
flags = { debounce_text_changes = 300 },
|
||||
}
|
||||
end
|
||||
|
||||
if utils.executable("clangd") then
|
||||
lspconfig.clangd.setup {
|
||||
on_attach = custom_attach,
|
||||
capabilities = capabilities,
|
||||
filetypes = { "c", "cpp", "cc" },
|
||||
flags = {
|
||||
debounce_text_changes = 500,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
-- set up vim-language-server
|
||||
if utils.executable("vim-language-server") then
|
||||
lspconfig.vimls.setup {
|
||||
on_attach = custom_attach,
|
||||
flags = {
|
||||
debounce_text_changes = 500,
|
||||
},
|
||||
capabilities = capabilities,
|
||||
}
|
||||
else
|
||||
-- vim.notify("vim-language-server not found!", vim.log.levels.WARN, { title = "Nvim-config" })
|
||||
end
|
||||
|
||||
-- set up bash-language-server
|
||||
if utils.executable("bash-language-server") then
|
||||
lspconfig.bashls.setup {
|
||||
on_attach = custom_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end
|
||||
|
||||
if utils.executable("lua-language-server") then
|
||||
-- settings for lua-language-server can be found on https://github.com/LuaLS/lua-language-server/wiki/Settings .
|
||||
lspconfig.lua_ls.setup {
|
||||
on_attach = custom_attach,
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files,
|
||||
-- see also https://github.com/LuaLS/lua-language-server/wiki/Libraries#link-to-workspace .
|
||||
-- Lua-dev.nvim also has similar settings for lua ls, https://github.com/folke/neodev.nvim/blob/main/lua/neodev/luals.lua .
|
||||
library = {
|
||||
vim.env.VIMRUNTIME,
|
||||
fn.stdpath("config"),
|
||||
},
|
||||
maxPreload = 2000,
|
||||
preloadFileSize = 50000,
|
||||
},
|
||||
},
|
||||
},
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end
|
||||
|
||||
-- Change diagnostic signs.
|
||||
fn.sign_define("DiagnosticSignError", { text = '🆇', texthl = "DiagnosticSignError" })
|
||||
fn.sign_define("DiagnosticSignWarn", { text = '⚠️', texthl = "DiagnosticSignWarn" })
|
||||
fn.sign_define("DiagnosticSignInfo", { text = 'ℹ️', texthl = "DiagnosticSignInfo" })
|
||||
fn.sign_define("DiagnosticSignHint", { text = '', texthl = "DiagnosticSignHint" })
|
||||
|
||||
-- global config for diagnostic
|
||||
diagnostic.config {
|
||||
underline = false,
|
||||
virtual_text = false,
|
||||
signs = true,
|
||||
severity_sort = true,
|
||||
}
|
||||
|
||||
-- lsp.handlers["textDocument/publishDiagnostics"] = lsp.with(lsp.diagnostic.on_publish_diagnostics, {
|
||||
-- underline = false,
|
||||
-- virtual_text = false,
|
||||
-- signs = true,
|
||||
-- update_in_insert = false,
|
||||
-- })
|
||||
|
||||
-- Change border of documentation hover window, See https://github.com/neovim/neovim/pull/13998.
|
||||
lsp.handlers["textDocument/hover"] = lsp.with(vim.lsp.handlers.hover, {
|
||||
border = "rounded",
|
||||
})
|
|
@ -1,92 +0,0 @@
|
|||
-- Setup nvim-cmp.
|
||||
local cmp = require("cmp")
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
cmp.setup {
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
["<Tab>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
["<S-Tab>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
["<CR>"] = cmp.mapping.confirm { select = true },
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<Esc>"] = cmp.mapping.close(),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
['<C-x>'] = cmp.mapping(
|
||||
cmp.mapping.complete({
|
||||
config = {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'cmp_ai' },
|
||||
}),
|
||||
},
|
||||
}),
|
||||
{ 'i' }
|
||||
),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" }, -- For nvim-lsp
|
||||
{ name = "path" }, -- for path completion
|
||||
{ name = "buffer", keyword_length = 2 }, -- for buffer word completion
|
||||
{ name = "emoji", insert = true }, -- emoji completion
|
||||
},
|
||||
completion = {
|
||||
keyword_length = 1,
|
||||
completeopt = "menu,noselect",
|
||||
},
|
||||
view = {
|
||||
entries = "custom",
|
||||
},
|
||||
formatting = {
|
||||
format = lspkind.cmp_format {
|
||||
mode = "symbol_text",
|
||||
menu = {
|
||||
nvim_lsp = "[LSP]",
|
||||
nvim_lua = "[Lua]",
|
||||
path = "[Path]",
|
||||
buffer = "[Buffer]",
|
||||
emoji = "[Emoji]",
|
||||
omni = "[Omni]",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
cmp.setup.filetype("tex", {
|
||||
sources = {
|
||||
{ name = "omni" },
|
||||
{ name = "buffer", keyword_length = 2 }, -- for buffer word completion
|
||||
{ name = "path" }, -- for path completion
|
||||
},
|
||||
})
|
||||
|
||||
-- see https://github.com/hrsh7th/nvim-cmp/wiki/Menu-Appearance#how-to-add-visual-studio-code-dark-theme-colors-to-the-menu
|
||||
vim.cmd([[
|
||||
highlight! link CmpItemMenu Comment
|
||||
" gray
|
||||
highlight! CmpItemAbbrDeprecated guibg=NONE gui=strikethrough guifg=#808080
|
||||
" blue
|
||||
highlight! CmpItemAbbrMatch guibg=NONE guifg=#569CD6
|
||||
highlight! CmpItemAbbrMatchFuzzy guibg=NONE guifg=#569CD6
|
||||
" light blue
|
||||
highlight! CmpItemKindVariable guibg=NONE guifg=#9CDCFE
|
||||
highlight! CmpItemKindInterface guibg=NONE guifg=#9CDCFE
|
||||
highlight! CmpItemKindText guibg=NONE guifg=#9CDCFE
|
||||
" pink
|
||||
highlight! CmpItemKindFunction guibg=NONE guifg=#C586C0
|
||||
highlight! CmpItemKindMethod guibg=NONE guifg=#C586C0
|
||||
" front
|
||||
highlight! CmpItemKindKeyword guibg=NONE guifg=#D4D4D4
|
||||
highlight! CmpItemKindProperty guibg=NONE guifg=#D4D4D4
|
||||
highlight! CmpItemKindUnit guibg=NONE guifg=#D4D4D4
|
||||
]])
|
|
@ -1,10 +0,0 @@
|
|||
local nvim_notify = require("notify")
|
||||
nvim_notify.setup {
|
||||
-- Animation style
|
||||
stages = "fade_in_slide_out",
|
||||
-- Default timeout for notifications
|
||||
timeout = 1500,
|
||||
background_colour = "#2E3440",
|
||||
}
|
||||
|
||||
vim.notify = nvim_notify
|
|
@ -1,108 +0,0 @@
|
|||
local keymap = vim.keymap
|
||||
local nvim_tree = require("nvim-tree")
|
||||
|
||||
nvim_tree.setup {
|
||||
auto_reload_on_write = true,
|
||||
disable_netrw = false,
|
||||
hijack_netrw = true,
|
||||
hijack_cursor = false,
|
||||
hijack_unnamed_buffer_when_opening = false,
|
||||
open_on_tab = false,
|
||||
sort_by = "name",
|
||||
update_cwd = false,
|
||||
view = {
|
||||
width = 30,
|
||||
side = "left",
|
||||
preserve_window_proportions = false,
|
||||
number = false,
|
||||
relativenumber = false,
|
||||
signcolumn = "yes",
|
||||
},
|
||||
renderer = {
|
||||
indent_markers = {
|
||||
enable = false,
|
||||
icons = {
|
||||
corner = "└ ",
|
||||
edge = "│ ",
|
||||
none = " ",
|
||||
},
|
||||
},
|
||||
icons = {
|
||||
webdev_colors = true,
|
||||
},
|
||||
},
|
||||
hijack_directories = {
|
||||
enable = true,
|
||||
auto_open = true,
|
||||
},
|
||||
update_focused_file = {
|
||||
enable = false,
|
||||
update_cwd = false,
|
||||
ignore_list = {},
|
||||
},
|
||||
system_open = {
|
||||
cmd = "",
|
||||
args = {},
|
||||
},
|
||||
diagnostics = {
|
||||
enable = false,
|
||||
show_on_dirs = false,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
warning = "",
|
||||
error = "",
|
||||
},
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
custom = {},
|
||||
exclude = {},
|
||||
},
|
||||
git = {
|
||||
enable = true,
|
||||
ignore = true,
|
||||
timeout = 400,
|
||||
},
|
||||
actions = {
|
||||
use_system_clipboard = true,
|
||||
change_dir = {
|
||||
enable = true,
|
||||
global = false,
|
||||
restrict_above_cwd = false,
|
||||
},
|
||||
open_file = {
|
||||
quit_on_open = false,
|
||||
resize_window = false,
|
||||
window_picker = {
|
||||
enable = true,
|
||||
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
|
||||
exclude = {
|
||||
filetype = { "notify", "qf", "diff", "fugitive", "fugitiveblame" },
|
||||
buftype = { "nofile", "terminal", "help" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
trash = {
|
||||
cmd = "trash",
|
||||
require_confirm = true,
|
||||
},
|
||||
log = {
|
||||
enable = false,
|
||||
truncate = false,
|
||||
types = {
|
||||
all = false,
|
||||
config = false,
|
||||
copy_paste = false,
|
||||
diagnostics = false,
|
||||
git = false,
|
||||
profile = false,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
keymap.set("n", "<space>s", require("nvim-tree.api").tree.toggle, {
|
||||
silent = true,
|
||||
desc = "toggle nvim-tree",
|
||||
})
|
|
@ -1,28 +0,0 @@
|
|||
local keymap = vim.keymap
|
||||
local hop = require("hop")
|
||||
hop.setup {
|
||||
case_insensitive = true,
|
||||
char2_fallback_key = "<CR>",
|
||||
quit_key = "<Esc>",
|
||||
match_mappings = { "zh_sc" }
|
||||
}
|
||||
|
||||
keymap.set({ "n", "v", "o" }, "f", "", {
|
||||
silent = true,
|
||||
noremap = true,
|
||||
callback = function()
|
||||
hop.hint_char2()
|
||||
end,
|
||||
desc = "nvim-hop char2",
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("ColorScheme", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.cmd([[
|
||||
hi HopNextKey cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff
|
||||
hi HopNextKey1 cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff
|
||||
hi HopNextKey2 cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff
|
||||
]])
|
||||
end
|
||||
})
|
|
@ -1,197 +0,0 @@
|
|||
local fn = vim.fn
|
||||
|
||||
local function spell()
|
||||
if vim.o.spell then
|
||||
return string.format("[SPELL]")
|
||||
end
|
||||
|
||||
return ""
|
||||
end
|
||||
|
||||
--- show indicator for Chinese IME
|
||||
local function ime_state()
|
||||
if vim.g.is_mac then
|
||||
-- ref: https://github.com/vim-airline/vim-airline/blob/master/autoload/airline/extensions/xkblayout.vim#L11
|
||||
local layout = fn.libcall(vim.g.XkbSwitchLib, "Xkb_Switch_getXkbLayout", "")
|
||||
|
||||
-- We can use `xkbswitch -g` on the command line to get current mode.
|
||||
-- mode for macOS builtin pinyin IME: com.apple.inputmethod.SCIM.ITABC
|
||||
-- mode for Rime: im.rime.inputmethod.Squirrel.Rime
|
||||
local res = fn.match(layout, [[\v(Squirrel\.Rime|SCIM.ITABC)]])
|
||||
if res ~= -1 then
|
||||
return "[CN]"
|
||||
end
|
||||
end
|
||||
|
||||
return ""
|
||||
end
|
||||
|
||||
local function trailing_space()
|
||||
if not vim.o.modifiable then
|
||||
return ""
|
||||
end
|
||||
|
||||
local line_num = nil
|
||||
|
||||
for i = 1, fn.line("$") do
|
||||
local linetext = fn.getline(i)
|
||||
-- To prevent invalid escape error, we wrap the regex string with `[[]]`.
|
||||
local idx = fn.match(linetext, [[\v\s+$]])
|
||||
|
||||
if idx ~= -1 then
|
||||
line_num = i
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
local msg = ""
|
||||
if line_num ~= nil then
|
||||
msg = string.format("[%d]trailing", line_num)
|
||||
end
|
||||
|
||||
return msg
|
||||
end
|
||||
|
||||
local function mixed_indent()
|
||||
if not vim.o.modifiable then
|
||||
return ""
|
||||
end
|
||||
|
||||
local space_pat = [[\v^ +]]
|
||||
local tab_pat = [[\v^\t+]]
|
||||
local space_indent = fn.search(space_pat, "nwc")
|
||||
local tab_indent = fn.search(tab_pat, "nwc")
|
||||
local mixed = (space_indent > 0 and tab_indent > 0)
|
||||
local mixed_same_line
|
||||
if not mixed then
|
||||
mixed_same_line = fn.search([[\v^(\t+ | +\t)]], "nwc")
|
||||
mixed = mixed_same_line > 0
|
||||
end
|
||||
if not mixed then
|
||||
return ""
|
||||
end
|
||||
if mixed_same_line ~= nil and mixed_same_line > 0 then
|
||||
return "MI:" .. mixed_same_line
|
||||
end
|
||||
local space_indent_cnt = fn.searchcount({ pattern = space_pat, max_count = 1e3 }).total
|
||||
local tab_indent_cnt = fn.searchcount({ pattern = tab_pat, max_count = 1e3 }).total
|
||||
if space_indent_cnt > tab_indent_cnt then
|
||||
return "MI:" .. tab_indent
|
||||
else
|
||||
return "MI:" .. space_indent
|
||||
end
|
||||
end
|
||||
|
||||
local diff = function()
|
||||
local git_status = vim.b.gitsigns_status_dict
|
||||
if git_status == nil then
|
||||
return
|
||||
end
|
||||
|
||||
local modify_num = git_status.changed
|
||||
local remove_num = git_status.removed
|
||||
local add_num = git_status.added
|
||||
|
||||
local info = { added = add_num, modified = modify_num, removed = remove_num }
|
||||
-- vim.print(info)
|
||||
return info
|
||||
end
|
||||
|
||||
local virtual_env = function()
|
||||
-- only show virtual env for Python
|
||||
if vim.bo.filetype ~= 'python' then
|
||||
return ""
|
||||
end
|
||||
|
||||
local conda_env = os.getenv('CONDA_DEFAULT_ENV')
|
||||
local venv_path = os.getenv('VIRTUAL_ENV')
|
||||
|
||||
if venv_path == nil then
|
||||
if conda_env == nil then
|
||||
return ""
|
||||
else
|
||||
return string.format(" %s (conda)", conda_env)
|
||||
end
|
||||
else
|
||||
local venv_name = vim.fn.fnamemodify(venv_path, ':t')
|
||||
return string.format(" %s (venv)", venv_name)
|
||||
end
|
||||
end
|
||||
|
||||
require("lualine").setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = "auto",
|
||||
-- component_separators = { left = "", right = "" },
|
||||
-- section_separators = { left = "", right = "" },
|
||||
section_separators = "",
|
||||
component_separators = "",
|
||||
disabled_filetypes = {},
|
||||
always_divide_middle = true,
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = {
|
||||
"branch",
|
||||
{
|
||||
"diff",
|
||||
source = diff,
|
||||
},
|
||||
{
|
||||
virtual_env,
|
||||
color = { fg = 'black', bg = "#F1CA81" }
|
||||
}
|
||||
},
|
||||
lualine_c = {
|
||||
"filename",
|
||||
{
|
||||
ime_state,
|
||||
color = { fg = "black", bg = "#f46868" },
|
||||
},
|
||||
{
|
||||
spell,
|
||||
color = { fg = "black", bg = "#a7c080" },
|
||||
},
|
||||
{
|
||||
"diagnostics",
|
||||
sources = { "nvim_diagnostic" },
|
||||
symbols = {error = '🆇 ', warn = '⚠️ ', info = 'ℹ️ ', hint = ' '},
|
||||
},
|
||||
},
|
||||
lualine_x = {
|
||||
"encoding",
|
||||
{
|
||||
"fileformat",
|
||||
symbols = {
|
||||
unix = "unix",
|
||||
dos = "win",
|
||||
mac = "mac",
|
||||
},
|
||||
},
|
||||
"filetype",
|
||||
},
|
||||
lualine_y = {
|
||||
"location",
|
||||
},
|
||||
lualine_z = {
|
||||
{
|
||||
trailing_space,
|
||||
color = "WarningMsg",
|
||||
},
|
||||
{
|
||||
mixed_indent,
|
||||
color = "WarningMsg",
|
||||
},
|
||||
},
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = { "location" },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {},
|
||||
extensions = { "quickfix", "fugitive", "nvim-tree" },
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
require("nvim-treesitter.configs").setup {
|
||||
ensure_installed = {},
|
||||
ignore_install = {}, -- List of parsers to ignore installing
|
||||
highlight = {
|
||||
enable = true, -- false will disable the whole extension
|
||||
disable = { 'help' }, -- list of language that will be disabled
|
||||
},
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
require("which-key").setup {
|
||||
plugins = {
|
||||
marks = true, -- shows a list of your marks on ' and `
|
||||
registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
|
||||
spelling = {
|
||||
enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions
|
||||
suggestions = 9, -- how many suggestions should be shown in the list?
|
||||
},
|
||||
-- the presets plugin, adds help for a bunch of default keybindings in Neovim
|
||||
-- No actual key bindings are created
|
||||
presets = {
|
||||
operators = true, -- adds help for operators like d, y, ... and registers them for motion / text object completion
|
||||
motions = true, -- adds help for motions
|
||||
text_objects = true, -- help for text objects triggered after entering an operator
|
||||
windows = true, -- default bindings on <c-w>
|
||||
nav = true, -- misc bindings to work with windows
|
||||
z = true, -- bindings for folds, spelling and others prefixed with z
|
||||
g = true, -- bindings for prefixed with g
|
||||
},
|
||||
},
|
||||
-- add operators that will trigger motion and text object completion
|
||||
-- to enable all native operators, set the preset / operators plugin above
|
||||
operators = { gc = "Comments" },
|
||||
key_labels = {
|
||||
-- override the label used to display some keys. It doesn't effect WK in any other way.
|
||||
-- For example:
|
||||
-- ["<space>"] = "SPC",
|
||||
-- ["<cr>"] = "RET",
|
||||
-- ["<tab>"] = "TAB",
|
||||
},
|
||||
icons = {
|
||||
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
|
||||
separator = "➜", -- symbol used between a key and it's label
|
||||
group = "+", -- symbol prepended to a group
|
||||
},
|
||||
window = {
|
||||
border = "none", -- none, single, double, shadow
|
||||
position = "bottom", -- bottom, top
|
||||
margin = { 0, 0, 0, 0 }, -- extra window margin [top, right, bottom, left]
|
||||
padding = { 1, 0, 1, 0 }, -- extra window padding [top, right, bottom, left]
|
||||
},
|
||||
layout = {
|
||||
height = { min = 1, max = 25 }, -- min and max height of the columns
|
||||
width = { min = 20, max = 50 }, -- min and max width of the columns
|
||||
spacing = 1, -- spacing between columns
|
||||
align = "center", -- align columns left, center or right
|
||||
},
|
||||
ignore_missing = false, -- enable this to hide mappings for which you didn't specify a label
|
||||
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate
|
||||
show_help = true, -- show help message on the command line when the popup is visible
|
||||
triggers = "auto", -- automatically setup triggers
|
||||
-- triggers = {"<leader>"} -- or specify a list manually
|
||||
|
||||
triggers_blacklist = {
|
||||
-- list of mode / prefixes that should never be hooked by WhichKey
|
||||
-- this is mostly relevant for key maps that start with a native binding
|
||||
-- most people should not need to change this
|
||||
n = { "o", "O" },
|
||||
},
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue