Compare commits
141 Commits
dc07455b30
...
quickshell
| Author | SHA1 | Date | |
|---|---|---|---|
|
237a62ea8a
|
|||
|
a63be876f7
|
|||
| 2b5a96bc20 | |||
| 02216bfa0c | |||
|
793dbac197
|
|||
|
c584091e60
|
|||
|
68b1765582
|
|||
|
8a169dbfa1
|
|||
|
2c035ac47a
|
|||
|
5648ae6b31
|
|||
|
c504274eca
|
|||
|
bd192f0443
|
|||
|
99e5362345
|
|||
|
35693c9782
|
|||
|
aba70d46a9
|
|||
|
be4de25d84
|
|||
|
2177549100
|
|||
|
abdc2f5c6c
|
|||
|
99121f72c9
|
|||
|
b460cb58ef
|
|||
|
32232d08db
|
|||
|
2d9c505ad7
|
|||
|
667af5a5a6
|
|||
|
e79ed0f643
|
|||
|
d0fcde133d
|
|||
|
b953e5b7ce
|
|||
|
c8f098f1a2
|
|||
|
e454e12d2f
|
|||
|
44a72b39e4
|
|||
|
4af7226777
|
|||
|
28c59be2a7
|
|||
|
51b882f2c5
|
|||
|
13b69ccc95
|
|||
|
be5fd3b9ff
|
|||
|
20ddfb5ddd
|
|||
|
4d2949ab93
|
|||
|
e0faac096b
|
|||
|
1c6708bad5
|
|||
|
a07742a206
|
|||
|
7bacc8ae06
|
|||
|
f400aaf570
|
|||
|
dbd3195430
|
|||
|
d041f61c46
|
|||
|
705f702535
|
|||
|
8fe373eeb5
|
|||
|
64dd1077b6
|
|||
|
8fe95f071a
|
|||
|
bd21506f0d
|
|||
|
c8c6a09684
|
|||
|
0c679290c5
|
|||
|
4685f31aa1
|
|||
|
77b8578379
|
|||
|
5bf4a22e8f
|
|||
|
91257fbcf8
|
|||
|
13cc8234e1
|
|||
|
89aa6186f2
|
|||
|
794593222c
|
|||
|
8c64e8e7b9
|
|||
|
8348cd9a54
|
|||
|
83772d34dd
|
|||
|
5e5f2ed1bb
|
|||
|
d7a3fc7a07
|
|||
|
3c4bc5043e
|
|||
|
a2261cacd1
|
|||
|
558faa058d
|
|||
|
9c547b6207
|
|||
|
2a4694b633
|
|||
|
2f170b9e08
|
|||
|
b762cb91fe
|
|||
|
53e15c2324
|
|||
|
6a1889722c
|
|||
|
ae231ba132
|
|||
|
feda825add
|
|||
|
f231663fe9
|
|||
|
ca45d3da81
|
|||
|
985cd8aa9d
|
|||
|
1b6cf3b07f
|
|||
|
16cddf0335
|
|||
|
91a0e56ef1
|
|||
|
e5b07a6fbe
|
|||
|
506ca711b5
|
|||
|
0267058530
|
|||
|
06317b6c70
|
|||
|
ad5e7aa5e7
|
|||
|
2cf0562cb6
|
|||
|
8c7b85fa12
|
|||
|
cdb232a484
|
|||
|
0f55da26e1
|
|||
|
2fdf5aa8fe
|
|||
|
2d85716642
|
|||
|
117ada55c2
|
|||
|
87018a1c06
|
|||
|
4d36ddff56
|
|||
|
c477dbeae6
|
|||
|
07890c4d9f
|
|||
|
2e2f77fffe
|
|||
|
ab3fbe30a9
|
|||
|
7522628517
|
|||
|
ffc74c1e6f
|
|||
|
c45dadafa3
|
|||
|
27b7718048
|
|||
|
33d0b7a694
|
|||
|
80f0feed39
|
|||
|
6daffb4d5e
|
|||
|
68e83817a5
|
|||
|
454c12ce90
|
|||
|
7e4c48c3f1
|
|||
|
990224174f
|
|||
|
dbbafc5140
|
|||
|
dea4d8ed4c
|
|||
|
3a12722913
|
|||
|
06c670bf30
|
|||
|
713f430b6d
|
|||
|
3ec4bdaa9b
|
|||
|
50be5cf024
|
|||
|
d69b965651
|
|||
|
e2e8e35b0e
|
|||
|
64d4085b98
|
|||
|
e380732f90
|
|||
|
48ebcb7104
|
|||
| 90dc945353 | |||
|
c9dab71e9b
|
|||
|
c40b78db93
|
|||
|
8e2fe9ba0b
|
|||
|
7c627d2a42
|
|||
|
a477e7095b
|
|||
|
27041ff1fa
|
|||
|
bf1539e914
|
|||
|
0a52c5f1b2
|
|||
|
1a7112c21d
|
|||
|
515cfe3866
|
|||
|
8949fbea6b
|
|||
|
ba30d87ef4
|
|||
|
ece19eadb8
|
|||
|
a0164ce7c0
|
|||
|
36d63a667c
|
|||
| 095d9ecb67 | |||
| 1ff4475a8f | |||
| dd010c6271 | |||
| 2242e26ede | |||
| d34da2b672 |
@@ -1,11 +1,13 @@
|
||||
keys:
|
||||
- &imxyy-nix age1jf5pg2x6ta8amj40xdy0stvcvrdlkwc2nrwtmkpymu0qclk0eg5qmm9kns
|
||||
- &imxyy-nix-server age1hpgg6psejh4y6jcdd34wxuml75fnweqpe0kh8376yqsctsfn9qxs037kk6
|
||||
- &imxyy-nix-x16 age1r0fv0tagxupfacv0aaxk5ss7sqvswv6kq8tk3x46ndqrj6f5afvqegahxq
|
||||
- &imxyy-cloudwin age1tp7th3rrv3x0l6jl76n0hjqjp223w2y586pkgr0hcjwdm254jd5shkj6a8
|
||||
creation_rules:
|
||||
- path_regex: secrets/.*\.(yaml|toml|json|env|dae|txt)$
|
||||
- path_regex: secrets/.*\.(yaml|toml|json|env|dae|txt|conf)$
|
||||
key_groups:
|
||||
- age:
|
||||
- *imxyy-nix
|
||||
- *imxyy-nix-server
|
||||
- *imxyy-nix-x16
|
||||
- *imxyy-cloudwin
|
||||
|
||||
16
Makefile
16
Makefile
@@ -2,15 +2,19 @@ all: fmt switch
|
||||
|
||||
switch:
|
||||
@echo "Rebuilding NixOS..."
|
||||
@nixos-rebuild switch --flake . --use-remote-sudo
|
||||
@nh os switch .
|
||||
|
||||
boot:
|
||||
@echo "Rebuilding NixOS..."
|
||||
@nixos-rebuild boot --flake . --use-remote-sudo
|
||||
@nh os boot .
|
||||
|
||||
test:
|
||||
@echo "Rebuilding NixOS..."
|
||||
@nh os test .
|
||||
|
||||
vm:
|
||||
@echo "Building NixOS VM..."
|
||||
@nixos-rebuild build-vm --flake .
|
||||
@nh os build-vm .
|
||||
|
||||
update:
|
||||
@echo "Updating flakes..."
|
||||
@@ -23,17 +27,17 @@ replpkgs:
|
||||
@nix repl -f flake:nixpkgs
|
||||
|
||||
repl:
|
||||
@nixos-rebuild repl --flake .
|
||||
@nh os repl .
|
||||
|
||||
cleandry:
|
||||
@echo "Listing all generations older than 15 days..."
|
||||
@sudo nix profile wipe-history --profile /nix/var/nix/profiles/system --dry-run --older-than 15d
|
||||
@nix run home-manager#home-manager -- expire-generations -15days --dry-run
|
||||
@nix profile wipe-history --profile ~/.local/state/nix/profiles/home-manager --dry-run --older-than 15d
|
||||
|
||||
clean:
|
||||
@echo "Removing all generations older than 15 days..."
|
||||
@sudo nix profile wipe-history --profile /nix/var/nix/profiles/system --older-than 15d
|
||||
@nix run home-manager#home-manager -- expire-generations -15days
|
||||
@nix profile wipe-history --profile ~/.local/state/nix/profiles/home-manager --older-than 15d
|
||||
|
||||
gc:
|
||||
@nix store gc --debug
|
||||
|
||||
54
README.md
Normal file
54
README.md
Normal file
@@ -0,0 +1,54 @@
|
||||
<h2 align="center">:snowflake: imxyy_soope_'s NixOS Config :snowflake:</h2>
|
||||
|
||||
> This configuration and READMEs in this repo borrows heavily from [ryan4yin/nix-config](https://github.com/ryan4yin/nix-config) and his
|
||||
> [cookbook](https://github.com/ryan4yin/nixos-and-flakes-book). Many thanks to his spirit of sharing!
|
||||
|
||||
This repository is home to the nix code that builds my systems:
|
||||
Currently, this repository contains the nix code that builds:
|
||||
|
||||
1. NixOS Desktop: NixOS with home-manager, niri, neovim, etc.
|
||||
2. NixOS home server
|
||||
3. NixOS WSL
|
||||
|
||||
See [./config/hosts](./config/hosts) for details of each host.
|
||||
|
||||
## Why NixOS & Flakes?
|
||||
|
||||
Nix allows for easy-to-manage, collaborative, reproducible deployments. This
|
||||
means that once something is setup and configured once, it works (almost)
|
||||
forever. If someone else shares their configuration, anyone else can just use it
|
||||
(if you really understand what you're copying/refering now).
|
||||
|
||||
As for Flakes, refer to
|
||||
[Introduction to Flakes - NixOS & Nix Flakes Book](https://nixos-and-flakes.thiscute.world/nixos-with-flakes/introduction-to-flakes)
|
||||
|
||||
## Components
|
||||
|
||||
| | NixOS(Wayland) |
|
||||
| ----------------------------- | :------------------------------------------------------ |
|
||||
| **Window Manager** | Niri |
|
||||
| **Terminal Emulator** | Alacritty & Kitty & Foot & Ghostty |
|
||||
| **Bar** | Waybar |
|
||||
| **Application Launcher** | wofi |
|
||||
| **Notification Daemon** | SwayNotificationCenter |
|
||||
| **Input method framework** | Fcitx5 |
|
||||
| **Shell** | Zsh |
|
||||
| **Netease Cloudmusic Player** | go-musicfox |
|
||||
| **Media Player** | mpv |
|
||||
| **Text Editor** | Neovim |
|
||||
| **Fonts** | Noto Sans CJK & Jetbrains Mono & Nerd Font |
|
||||
| **Filesystem** | btrfs subvolumes, clean '/' every boot for impermanence |
|
||||
|
||||
And more...
|
||||
|
||||
## Folder Structure
|
||||
|
||||
- `modules/` - custom NixOS modules
|
||||
- `config/base.nix` - generic configs
|
||||
- `config/hosts/<name>/` - hosts-specific configs
|
||||
- `lib/` - custom nix library
|
||||
- `pkgs/` - custom packages
|
||||
- `overlays/` - nixpkgs overlays
|
||||
- `vars.nix` - my variables
|
||||
- `secrets/` - secrets managed by sops-nix. see [./secrets](./secrets) for details
|
||||
- `flake.nix` - flake entry
|
||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
@@ -1,13 +1,18 @@
|
||||
{ lib, hostname, ... }:
|
||||
{ config, hostname, ... }:
|
||||
{
|
||||
# I prefer this to the default issue text
|
||||
# ported from ArchLinux IIRC
|
||||
environment.etc.issue.text = "\\e{lightcyan}\\S\\e{reset} Login (\\l)\n\n";
|
||||
networking.hostName = hostname;
|
||||
# don't change this unless you know what you are doing!
|
||||
# for further information, see wiki.nixos.org
|
||||
system.stateVersion = "24.11";
|
||||
systemd.services."systemd-machine-id-commit".enable = lib.mkForce false;
|
||||
# disable this since we already have machine-id persisted
|
||||
systemd.services."systemd-machine-id-commit".enable = !config.my.persist.enable;
|
||||
|
||||
my = {
|
||||
home = {
|
||||
# Nicely reload system units when changing configs
|
||||
# nicely reload system units when changing configs
|
||||
systemd.user.startServices = "sd-switch";
|
||||
home.stateVersion = "24.11";
|
||||
};
|
||||
@@ -17,10 +22,17 @@
|
||||
nixosDirs = [
|
||||
"/root"
|
||||
"/var"
|
||||
"/etc/ssh"
|
||||
];
|
||||
nixosFiles = [
|
||||
"/etc/machine-id"
|
||||
];
|
||||
homeDirs = [
|
||||
{
|
||||
directory = ".ssh";
|
||||
mode = "0700";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ ... }:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
services.open-webui = {
|
||||
enable = true;
|
||||
host = "127.0.0.1";
|
||||
port = 8089;
|
||||
package = pkgs.stable.open-webui;
|
||||
};
|
||||
services.caddy.virtualHosts."ai.imxyy.top" = {
|
||||
extraConfig = ''
|
||||
|
||||
47
config/hosts/imxyy-nix-server/build.nix
Normal file
47
config/hosts/imxyy-nix-server/build.nix
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
sopsRoot,
|
||||
...
|
||||
}:
|
||||
{
|
||||
sops.secrets.et-imxyy-nix-server-nixremote = {
|
||||
sopsFile = sopsRoot + /et-imxyy-nix-server-nixremote.toml;
|
||||
format = "binary";
|
||||
};
|
||||
environment.systemPackages = [ pkgs.easytier ];
|
||||
systemd.services."easytier-nixremote" = {
|
||||
enable = true;
|
||||
script = "${pkgs.easytier}/bin/easytier-core -c ${config.sops.secrets.et-imxyy-nix-server-nixremote.path}";
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 500 "always";
|
||||
RestartMaxDelaySec = lib.mkOverride 500 "1m";
|
||||
RestartSec = lib.mkOverride 500 "100ms";
|
||||
RestartSteps = lib.mkOverride 500 9;
|
||||
User = "root";
|
||||
};
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [
|
||||
"network.target"
|
||||
"sops-nix.service"
|
||||
];
|
||||
};
|
||||
users.groups.nixremote = { };
|
||||
users.users.nixremote = {
|
||||
isSystemUser = true;
|
||||
description = "nix remote build user";
|
||||
group = "nixremote";
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOEFLUkyeaK8ZPPZdVNEmtx8zvoxi7xqS2Z6oxRBuUPO imxyy@imxyy-nix"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBWOy0QmAyxENg/O5m3cus8U3c9jCLioivwcWsh5/a82 imxyy-hisense-pad"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK8pivvE8PMtsOxmccfNhH/4KehDKhBfUfJbQZxo/SZT imxyy-ace5"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKALTBn/QSGcSPgMg0ViSazFcaA0+nEF05EJpjbsI6dE imxyy_soope_@imxyy-cloudwin"
|
||||
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIENauvvhVMLsUwH9cPYsvnOg7VCL3a4yEiKm8I524TE efl@efl-nix"
|
||||
];
|
||||
};
|
||||
nix.settings.trusted-users = [
|
||||
"nixremote"
|
||||
];
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
{ ... }:
|
||||
{
|
||||
services.caddy = {
|
||||
enable = true;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./nixos.nix
|
||||
@@ -22,5 +21,7 @@
|
||||
./note.nix
|
||||
./matrix.nix
|
||||
./minio.nix
|
||||
./build.nix
|
||||
./immich.nix
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
{ ... }:
|
||||
{
|
||||
services.caddy.virtualHosts."git.imxyy.top" = {
|
||||
extraConfig = ''
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
btrfs = "/dev/disk/by-uuid/c7889c5c-c5b6-4e3c-9645-dfd49c2e84d0";
|
||||
in
|
||||
{
|
||||
boot.initrd.availableKernelModules = [
|
||||
"xhci_pci"
|
||||
@@ -16,20 +18,22 @@
|
||||
];
|
||||
boot.initrd.kernelModules = [ "amdgpu" ];
|
||||
boot.kernelModules = [ "kvm-amd" ];
|
||||
boot.kernelPackages = lib.mkForce pkgs.stable.linuxKernel.packages.linux_zen;
|
||||
boot.kernelPackages = lib.mkForce pkgs.linuxPackages_cachyos;
|
||||
services.scx.enable = true;
|
||||
boot.extraModulePackages = [ ];
|
||||
boot.tmp.useTmpfs = true;
|
||||
boot.supportedFilesystems = [ "zfs" ];
|
||||
boot.zfs = {
|
||||
extraPools = [ "data" ];
|
||||
forceImportRoot = false;
|
||||
package = pkgs.zfs_cachyos;
|
||||
};
|
||||
services.zfs.autoScrub.enable = true;
|
||||
services.btrfs.autoScrub.enable = true;
|
||||
networking.hostId = "10ca95b4";
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/c7889c5c-c5b6-4e3c-9645-dfd49c2e84d0";
|
||||
device = btrfs;
|
||||
fsType = "btrfs";
|
||||
options = [
|
||||
"compress=zstd"
|
||||
@@ -38,7 +42,7 @@
|
||||
};
|
||||
|
||||
fileSystems."/nix" = {
|
||||
device = "/dev/disk/by-uuid/c7889c5c-c5b6-4e3c-9645-dfd49c2e84d0";
|
||||
device = btrfs;
|
||||
fsType = "btrfs";
|
||||
options = [
|
||||
"compress=zstd"
|
||||
@@ -46,8 +50,9 @@
|
||||
];
|
||||
};
|
||||
|
||||
fileSystems."/persistent" = {
|
||||
device = "/dev/disk/by-uuid/c7889c5c-c5b6-4e3c-9645-dfd49c2e84d0";
|
||||
my.persist.location = "/nix/persist";
|
||||
fileSystems."/nix/persist" = {
|
||||
device = btrfs;
|
||||
fsType = "btrfs";
|
||||
options = [
|
||||
"compress=zstd"
|
||||
@@ -58,7 +63,7 @@
|
||||
|
||||
boot.initrd.postDeviceCommands = lib.mkAfter ''
|
||||
mkdir /btrfs_tmp
|
||||
mount /dev/disk/by-uuid/c7889c5c-c5b6-4e3c-9645-dfd49c2e84d0 /btrfs_tmp
|
||||
mount ${btrfs} /btrfs_tmp
|
||||
mkdir -p /btrfs_tmp/old_roots
|
||||
if [[ -e /btrfs_tmp/root ]]; then
|
||||
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
|
||||
@@ -84,6 +89,12 @@
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/32AA-2998";
|
||||
fsType = "vfat";
|
||||
options = [
|
||||
"uid=0"
|
||||
"gid=0"
|
||||
"fmask=0077"
|
||||
"dmask=0077"
|
||||
];
|
||||
};
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
|
||||
@@ -1,37 +1,22 @@
|
||||
{ lib, ... }:
|
||||
{ ... }:
|
||||
{
|
||||
my.home = {
|
||||
programs.zsh = {
|
||||
shellAliases = {
|
||||
proxy_on = lib.mkForce "export http_proxy=http://127.0.0.1:7890 https_proxy=http://127.0.0.1:7890 all_proxy=socks://127.0.0.1:7891";
|
||||
};
|
||||
sessionVariables = {
|
||||
no_proxy = "192.168.3.0/24";
|
||||
};
|
||||
};
|
||||
};
|
||||
my = {
|
||||
cmd.all.enable = true;
|
||||
cli.all.enable = true;
|
||||
coding.editor.neovim.enable = true;
|
||||
coding.misc.enable = true;
|
||||
coding.langs.lua.enable = true;
|
||||
coding.langs.rust.enable = true;
|
||||
persist = {
|
||||
enable = true;
|
||||
homeDirs = [
|
||||
"workspace"
|
||||
"Virt"
|
||||
|
||||
".ssh"
|
||||
".local/state"
|
||||
".local/share"
|
||||
".local/share/nvim"
|
||||
".cache"
|
||||
|
||||
".ollama"
|
||||
];
|
||||
nixosDirs = [
|
||||
"/etc/ssh"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
{ ... }:
|
||||
{
|
||||
virtualisation.oci-containers = {
|
||||
containers = {
|
||||
|
||||
17
config/hosts/imxyy-nix-server/immich.nix
Normal file
17
config/hosts/imxyy-nix-server/immich.nix
Normal file
@@ -0,0 +1,17 @@
|
||||
{ ... }:
|
||||
{
|
||||
services.immich = {
|
||||
enable = true;
|
||||
host = "127.0.0.1";
|
||||
port = 8096;
|
||||
mediaLocation = "/mnt/nas/immich";
|
||||
group = "nextcloud";
|
||||
};
|
||||
services.caddy.virtualHosts."immich.imxyy.top" = {
|
||||
extraConfig = ''
|
||||
reverse_proxy :8096 {
|
||||
header_up X-Real-IP {remote_host}
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
{ ... }:
|
||||
{
|
||||
services.matrix-synapse = {
|
||||
enable = true;
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
interface = "mac0";
|
||||
};
|
||||
nameservers = [
|
||||
"192.168.3.1"
|
||||
"192.168.3.2"
|
||||
];
|
||||
|
||||
firewall.enable = false;
|
||||
@@ -129,13 +129,15 @@
|
||||
};
|
||||
users.users.root.openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOEFLUkyeaK8ZPPZdVNEmtx8zvoxi7xqS2Z6oxRBuUPO imxyy@imxyy-nix"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqza/3b6a9JxsNxytHF5GPe4gQhbLrKxAPyZ0GpfVQt imxyy-hisense-pad"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBWOy0QmAyxENg/O5m3cus8U3c9jCLioivwcWsh5/a82 imxyy-hisense-pad"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK8pivvE8PMtsOxmccfNhH/4KehDKhBfUfJbQZxo/SZT imxyy-ace5"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKALTBn/QSGcSPgMg0ViSazFcaA0+nEF05EJpjbsI6dE imxyy_soope_@imxyy-cloudwin"
|
||||
];
|
||||
users.users.${username}.openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOEFLUkyeaK8ZPPZdVNEmtx8zvoxi7xqS2Z6oxRBuUPO imxyy@imxyy-nix"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqza/3b6a9JxsNxytHF5GPe4gQhbLrKxAPyZ0GpfVQt imxyy-hisense-pad"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBWOy0QmAyxENg/O5m3cus8U3c9jCLioivwcWsh5/a82 imxyy-hisense-pad"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK8pivvE8PMtsOxmccfNhH/4KehDKhBfUfJbQZxo/SZT imxyy-ace5"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKALTBn/QSGcSPgMg0ViSazFcaA0+nEF05EJpjbsI6dE imxyy_soope_@imxyy-cloudwin"
|
||||
];
|
||||
|
||||
sops.secrets.dae-imxyy-nix-server = {
|
||||
@@ -170,7 +172,7 @@
|
||||
enable = true;
|
||||
role = "client";
|
||||
settings = {
|
||||
serverAddr = "vkvm.imxyy.top";
|
||||
serverAddr = "hk.vkvm.imxyy.top";
|
||||
serverPort = 7000;
|
||||
auth.token = "{{ .Envs.FRP_AUTH_TOKEN }}";
|
||||
proxies = [
|
||||
@@ -390,6 +392,21 @@
|
||||
customDomains = [ "matrix.imxyy.top" ];
|
||||
}
|
||||
|
||||
{
|
||||
name = "immich-http";
|
||||
type = "http";
|
||||
localIP = "127.0.0.1";
|
||||
localPort = 80;
|
||||
customDomains = [ "immich.imxyy.top" ];
|
||||
}
|
||||
{
|
||||
name = "immich-https";
|
||||
type = "https";
|
||||
localIP = "127.0.0.1";
|
||||
localPort = 443;
|
||||
customDomains = [ "immich.imxyy.top" ];
|
||||
}
|
||||
|
||||
{
|
||||
name = "minecraft";
|
||||
type = "tcp";
|
||||
@@ -413,82 +430,9 @@
|
||||
settings = {
|
||||
logtail.enabled = false;
|
||||
server_url = "https://headscale.imxyy.top";
|
||||
dns = {
|
||||
base_domain = "tailnet.imxyy.top";
|
||||
extra_records = [
|
||||
{
|
||||
"name" = "home.imxyy.top";
|
||||
"type" = "A";
|
||||
"value" = "100.64.0.2";
|
||||
}
|
||||
{
|
||||
"name" = "nextcloud.imxyy.top";
|
||||
"type" = "A";
|
||||
"value" = "100.64.0.2";
|
||||
}
|
||||
{
|
||||
"name" = "mail.imxyy.top";
|
||||
"type" = "A";
|
||||
"value" = "100.64.0.2";
|
||||
}
|
||||
{
|
||||
"name" = "git.imxyy.top";
|
||||
"type" = "A";
|
||||
"value" = "100.64.0.2";
|
||||
}
|
||||
{
|
||||
"name" = "vault.imxyy.top";
|
||||
"type" = "A";
|
||||
"value" = "100.64.0.2";
|
||||
}
|
||||
{
|
||||
"name" = "mc.imxyy.top";
|
||||
"type" = "A";
|
||||
"value" = "100.64.0.2";
|
||||
}
|
||||
{
|
||||
"name" = "home.imxyy.top";
|
||||
"type" = "A";
|
||||
"value" = "100.64.0.2";
|
||||
}
|
||||
{
|
||||
"name" = "coder.imxyy.top";
|
||||
"type" = "A";
|
||||
"value" = "100.64.0.2";
|
||||
}
|
||||
{
|
||||
"name" = "music.imxyy.top";
|
||||
"type" = "A";
|
||||
"value" = "100.64.0.2";
|
||||
}
|
||||
];
|
||||
};
|
||||
dns.magic_dns = false;
|
||||
dns.override_local_dns = false;
|
||||
ip_prefixes = "100.64.0.0/10";
|
||||
derp.paths = [
|
||||
(toString (
|
||||
pkgs.writeText "derp.yaml" ''
|
||||
regions:
|
||||
900:
|
||||
regionid: 900
|
||||
regioncode: custom-tok
|
||||
regionname: imxyy_soope_ Tokyo
|
||||
nodes:
|
||||
- name: 900a
|
||||
regionid: 900
|
||||
hostname: vkvm.imxyy.top
|
||||
# 901:
|
||||
# regionid: 901
|
||||
# regioncode: custom-cn
|
||||
# regionname: imxyy_soope_ Hu Bei
|
||||
# nodes:
|
||||
# - name: 901a
|
||||
# regionid: 901
|
||||
# hostname: ry.imxyy.top
|
||||
# derpport: 1443
|
||||
''
|
||||
))
|
||||
];
|
||||
derp.urls = lib.mkForce [ ];
|
||||
|
||||
oidc = {
|
||||
only_start_if_oidc_is_available = true;
|
||||
@@ -501,7 +445,6 @@
|
||||
client_secret = "";
|
||||
expiry = 0;
|
||||
extra_params.domain_hint = "imxyy.top";
|
||||
strip_email_domain = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -527,7 +470,7 @@
|
||||
environment.systemPackages = [ pkgs.easytier ];
|
||||
systemd.services."easytier" = {
|
||||
enable = true;
|
||||
script = "easytier-core -c ${config.sops.secrets.et-imxyy-nix-server.path}";
|
||||
script = "${pkgs.easytier}/bin/easytier-core -c ${config.sops.secrets.et-imxyy-nix-server.path}";
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 500 "always";
|
||||
RestartMaxDelaySec = lib.mkOverride 500 "1m";
|
||||
@@ -540,11 +483,6 @@
|
||||
"network.target"
|
||||
"sops-nix.service"
|
||||
];
|
||||
path = with pkgs; [
|
||||
easytier
|
||||
iproute2
|
||||
bash
|
||||
];
|
||||
};
|
||||
|
||||
virtualisation.oci-containers = {
|
||||
@@ -609,6 +547,9 @@
|
||||
Restart = "always";
|
||||
RestartSec = 120;
|
||||
};
|
||||
path = [
|
||||
pkgs.bash
|
||||
];
|
||||
};
|
||||
|
||||
services.dnsmasq =
|
||||
@@ -621,10 +562,15 @@
|
||||
"vault"
|
||||
"coder"
|
||||
"headscale"
|
||||
"grafana"
|
||||
"matrix"
|
||||
"note"
|
||||
"oidc"
|
||||
"mc"
|
||||
"music"
|
||||
"ai"
|
||||
"sy"
|
||||
"minio"
|
||||
];
|
||||
in
|
||||
{
|
||||
@@ -640,6 +586,7 @@
|
||||
"/imxyy-cloudwin/192.168.3.4"
|
||||
"/printer.home/192.168.3.53"
|
||||
];
|
||||
cache-size = 0;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
{ ... }:
|
||||
{
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
ports = [ "8093:8080" ];
|
||||
};
|
||||
siyuan = {
|
||||
image = "apkdv/siyuan-unlock:v3.1.24";
|
||||
image = "apkdv/siyuan-unlock:v3.1.30";
|
||||
volumes = [
|
||||
"/mnt/nas/siyuan/workspace:/workspace"
|
||||
"/mnt/nas/siyuan:/home/siyuan"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
{ ... }:
|
||||
{
|
||||
services.samba = {
|
||||
enable = true;
|
||||
@@ -27,9 +26,8 @@
|
||||
];
|
||||
users = {
|
||||
users.nas = {
|
||||
isNormalUser = true;
|
||||
home = "/var/empty";
|
||||
description = "nas user";
|
||||
isSystemUser = true;
|
||||
description = "NAS user";
|
||||
group = "nextcloud";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -3,9 +3,10 @@ let
|
||||
# T400
|
||||
gpuIDs = [
|
||||
"8086:56a0" # A770
|
||||
"8086:4f90"
|
||||
|
||||
"10de:1f82" # 1650
|
||||
"10de:10fa" # 1650
|
||||
"10de:10fa"
|
||||
|
||||
"10de:1fb2" # T400
|
||||
];
|
||||
@@ -22,6 +23,10 @@ in
|
||||
"amd_iommu=on"
|
||||
"vfio-pci.ids=${lib.concatStringsSep "," gpuIDs}"
|
||||
];
|
||||
extraModprobeConfig = ''
|
||||
options kvm ignore_msrs=Y
|
||||
options kvm report_ignored_msrs=N
|
||||
'';
|
||||
};
|
||||
virtualisation.spiceUSBRedirection.enable = true;
|
||||
my.virt.enable = true;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
{ ... }:
|
||||
{
|
||||
virtualisation.oci-containers.containers."YesPlayMusic" = {
|
||||
image = "git.imxyy.top/imxyy1soope1/yesplaymusic:latest";
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./nixos.nix
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
sops.sshKeyPath = "/home/${username}/.ssh/id_ed25519";
|
||||
coding.all.enable = true;
|
||||
coding.editor.vscode.enable = lib.mkForce false;
|
||||
cmd.misc.enable = true;
|
||||
cli.misc.enable = true;
|
||||
xdg.enable = true;
|
||||
cmd.media.all.enable = true;
|
||||
cli.media.all.enable = true;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
{ username, nixos-wsl, ... }:
|
||||
{
|
||||
lib,
|
||||
username,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
nixos-wsl.nixosModules.wsl
|
||||
inputs.nixos-wsl.nixosModules.wsl
|
||||
];
|
||||
wsl.enable = true;
|
||||
wsl.defaultUser = "${username}";
|
||||
wsl.defaultUser = username;
|
||||
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
@@ -17,4 +22,6 @@
|
||||
|
||||
# fix vscode remote
|
||||
programs.nix-ld.enable = true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkForce "x86_64-linux";
|
||||
}
|
||||
|
||||
8
config/hosts/imxyy-nix-x16/default.nix
Normal file
8
config/hosts/imxyy-nix-x16/default.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
imports = [
|
||||
./nixos.nix
|
||||
./hardware.nix
|
||||
./home.nix
|
||||
./net.nix
|
||||
];
|
||||
}
|
||||
106
config/hosts/imxyy-nix-x16/hardware.nix
Normal file
106
config/hosts/imxyy-nix-x16/hardware.nix
Normal file
@@ -0,0 +1,106 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
username,
|
||||
...
|
||||
}:
|
||||
let
|
||||
btrfs = "/dev/disk/by-uuid/69ab72d4-6ced-4f70-8b5e-aa2daa8c0b6b";
|
||||
in
|
||||
{
|
||||
boot = {
|
||||
initrd = {
|
||||
kernelModules = [ "amdgpu" ];
|
||||
availableKernelModules = [
|
||||
"nvme"
|
||||
"xhci_pci"
|
||||
"thunderbolt"
|
||||
"uas"
|
||||
"sd_mod"
|
||||
];
|
||||
verbose = false;
|
||||
};
|
||||
|
||||
kernelPackages = lib.mkForce pkgs.linuxPackages_cachyos;
|
||||
kernelModules = [ "kvm-amd" ];
|
||||
|
||||
tmp.useTmpfs = true;
|
||||
kernel.sysctl = {
|
||||
"fs.file-max" = 9223372036854775807;
|
||||
};
|
||||
};
|
||||
services.scx.enable = true;
|
||||
|
||||
fileSystems."/" = {
|
||||
device = btrfs;
|
||||
fsType = "btrfs";
|
||||
options = [
|
||||
"compress=zstd"
|
||||
"subvol=root"
|
||||
];
|
||||
};
|
||||
|
||||
fileSystems."/nix" = {
|
||||
device = btrfs;
|
||||
fsType = "btrfs";
|
||||
options = [
|
||||
"compress=zstd"
|
||||
"subvol=nix"
|
||||
];
|
||||
};
|
||||
|
||||
my.persist.location = "/nix/persist";
|
||||
fileSystems."/nix/persist" = {
|
||||
device = btrfs;
|
||||
fsType = "btrfs";
|
||||
options = [
|
||||
"compress=zstd"
|
||||
"subvol=persist"
|
||||
];
|
||||
neededForBoot = true;
|
||||
};
|
||||
|
||||
boot.initrd.postDeviceCommands = lib.mkAfter ''
|
||||
mkdir /btrfs_tmp
|
||||
mount ${btrfs} /btrfs_tmp
|
||||
mkdir -p /btrfs_tmp/old_roots
|
||||
if [[ -e /btrfs_tmp/root ]]; then
|
||||
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
|
||||
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
||||
fi
|
||||
|
||||
delete_subvolume_recursively() {
|
||||
IFS=$'\n'
|
||||
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
||||
delete_subvolume_recursively "/btrfs_tmp/$i"
|
||||
done
|
||||
btrfs subvolume delete "$1"
|
||||
}
|
||||
|
||||
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +14); do
|
||||
delete_subvolume_recursively "$i"
|
||||
done
|
||||
|
||||
btrfs subvolume create /btrfs_tmp/root
|
||||
umount /btrfs_tmp
|
||||
'';
|
||||
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/96D3-93B0";
|
||||
fsType = "vfat";
|
||||
options = [
|
||||
"uid=0"
|
||||
"gid=0"
|
||||
"fmask=0077"
|
||||
"dmask=0077"
|
||||
];
|
||||
};
|
||||
|
||||
networking.useDHCP = lib.mkDefault false;
|
||||
|
||||
hardware.enableRedistributableFirmware = lib.mkDefault true;
|
||||
hardware.cpu.amd.updateMicrocode = config.hardware.enableRedistributableFirmware;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkForce "x86_64-linux";
|
||||
}
|
||||
141
config/hosts/imxyy-nix-x16/home.nix
Normal file
141
config/hosts/imxyy-nix-x16/home.nix
Normal file
@@ -0,0 +1,141 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
username,
|
||||
...
|
||||
}:
|
||||
{
|
||||
my.home = {
|
||||
home.packages = with pkgs; [
|
||||
localsend
|
||||
|
||||
rclone
|
||||
|
||||
wpsoffice-cn
|
||||
wps-office-fonts
|
||||
ttf-wps-fonts
|
||||
evince
|
||||
|
||||
anki
|
||||
|
||||
ayugram-desktop
|
||||
telegram-desktop
|
||||
signal-desktop
|
||||
discord
|
||||
qq
|
||||
wechat
|
||||
|
||||
gnome-clocks
|
||||
|
||||
wineWowPackages.waylandFull
|
||||
|
||||
pavucontrol
|
||||
pamixer
|
||||
];
|
||||
programs.zsh = {
|
||||
sessionVariables = {
|
||||
PATH = "/home/${username}/bin:$PATH";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
my = {
|
||||
gpg.enable = true;
|
||||
cli.all.enable = true;
|
||||
coding.all.enable = true;
|
||||
desktop.all.enable = true;
|
||||
|
||||
desktop.browser.librewolf.enable = lib.mkForce false;
|
||||
|
||||
i18n.fcitx5.enable = true;
|
||||
|
||||
xdg = {
|
||||
enable = true;
|
||||
defaultApplications =
|
||||
let
|
||||
browser = [ "zen-beta.desktop" ];
|
||||
editor = [ "codium.desktop" ];
|
||||
imageviewer = [ "org.gnome.Shotwell-Viewer.desktop" ];
|
||||
in
|
||||
{
|
||||
"inode/directory" = [ "nemo.desktop" ];
|
||||
|
||||
"application/pdf" = [ "org.gnome.Evince.desktop" ];
|
||||
|
||||
"text/*" = editor;
|
||||
"application/json" = editor;
|
||||
"text/html" = editor;
|
||||
"text/xml" = editor;
|
||||
"application/xml" = editor;
|
||||
"application/xhtml+xml" = editor;
|
||||
"application/xhtml_xml" = editor;
|
||||
"application/rdf+xml" = editor;
|
||||
"application/rss+xml" = editor;
|
||||
"application/x-extension-htm" = editor;
|
||||
"application/x-extension-html" = editor;
|
||||
"application/x-extension-shtml" = editor;
|
||||
"application/x-extension-xht" = editor;
|
||||
"application/x-extension-xhtml" = editor;
|
||||
|
||||
"x-scheme-handler/about" = browser;
|
||||
"x-scheme-handler/ftp" = browser;
|
||||
"x-scheme-handler/http" = browser;
|
||||
"x-scheme-handler/https" = browser;
|
||||
"x-scheme-handler/unknown" = browser;
|
||||
|
||||
"audio/*" = imageviewer;
|
||||
"video/*" = imageviewer;
|
||||
"image/*" = imageviewer;
|
||||
"image/gif" = imageviewer;
|
||||
"image/jpeg" = imageviewer;
|
||||
"image/png" = imageviewer;
|
||||
"image/webp" = imageviewer;
|
||||
};
|
||||
extraBookmarks =
|
||||
let
|
||||
homedir = config.my.home.home.homeDirectory;
|
||||
in
|
||||
[
|
||||
"file://${homedir}/NAS NAS"
|
||||
"file://${homedir}/NAS/imxyy_soope_ NAS imxyy_soope_"
|
||||
"file://${homedir}/NAS/imxyy_soope_/OS NAS OS"
|
||||
];
|
||||
};
|
||||
persist = {
|
||||
enable = true;
|
||||
homeDirs = [
|
||||
"Documents"
|
||||
"Downloads"
|
||||
"Videos"
|
||||
"Music"
|
||||
"Pictures"
|
||||
|
||||
"bin"
|
||||
"workspace"
|
||||
|
||||
".cache"
|
||||
".local/state"
|
||||
".local/share/Anki2"
|
||||
".local/share/shotwell"
|
||||
".local/share/cheat.sh"
|
||||
".local/share/Kingsoft"
|
||||
|
||||
".local/share/AyuGramDesktop"
|
||||
".local/share/TelegramDesktop"
|
||||
".config/Signal"
|
||||
".config/discord"
|
||||
".config/QQ"
|
||||
".xwechat"
|
||||
|
||||
".config/Kingsoft"
|
||||
".config/dconf"
|
||||
".config/gh"
|
||||
".config/pulse"
|
||||
".config/pip"
|
||||
".config/libreoffice"
|
||||
".config/sunshine"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
59
config/hosts/imxyy-nix-x16/net.nix
Normal file
59
config/hosts/imxyy-nix-x16/net.nix
Normal file
@@ -0,0 +1,59 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
sopsRoot,
|
||||
...
|
||||
}:
|
||||
{
|
||||
boot.kernelParams = [
|
||||
"biosdevname=0"
|
||||
"net.ifnames=0"
|
||||
];
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
sops.secrets.dae-imxyy-nix-x16 = {
|
||||
sopsFile = sopsRoot + /dae-imxyy-nix-x16.dae;
|
||||
format = "binary";
|
||||
};
|
||||
services.dae = {
|
||||
enable = true;
|
||||
configFile = config.sops.secrets.dae-imxyy-nix-x16.path;
|
||||
};
|
||||
systemd.services.dae.after = [ "sops-nix.service" ];
|
||||
sops.secrets.mihomo = {
|
||||
sopsFile = sopsRoot + /mihomo.yaml;
|
||||
format = "yaml";
|
||||
key = "";
|
||||
};
|
||||
systemd.services.mihomo.after = [ "sops-nix.service" ];
|
||||
services.mihomo = {
|
||||
enable = true;
|
||||
configFile = config.sops.secrets.mihomo.path;
|
||||
webui = pkgs.metacubexd;
|
||||
};
|
||||
|
||||
sops.secrets.et-imxyy-nix-x16 = {
|
||||
sopsFile = sopsRoot + /et-imxyy-nix-x16.toml;
|
||||
format = "binary";
|
||||
};
|
||||
environment.systemPackages = with pkgs; [
|
||||
easytier
|
||||
];
|
||||
systemd.services."easytier" = {
|
||||
enable = true;
|
||||
script = "${pkgs.easytier}/bin/easytier-core -c ${config.sops.secrets.et-imxyy-nix-x16.path}";
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 500 "always";
|
||||
RestartMaxDelaySec = lib.mkOverride 500 "1m";
|
||||
RestartSec = lib.mkOverride 500 "100ms";
|
||||
RestartSteps = lib.mkOverride 500 9;
|
||||
User = "root";
|
||||
};
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [
|
||||
"network.target"
|
||||
"sops-nix.service"
|
||||
];
|
||||
};
|
||||
}
|
||||
175
config/hosts/imxyy-nix-x16/nixos.nix
Normal file
175
config/hosts/imxyy-nix-x16/nixos.nix
Normal file
@@ -0,0 +1,175 @@
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
username,
|
||||
sopsRoot,
|
||||
...
|
||||
}:
|
||||
{
|
||||
security.pam.loginLimits = [
|
||||
{
|
||||
domain = "*";
|
||||
type = "soft";
|
||||
item = "nofile";
|
||||
value = "524288";
|
||||
}
|
||||
];
|
||||
|
||||
boot.kernelParams = [
|
||||
"usbcore.autosuspend=-1" # Avoid usb autosuspend (for usb bluetooth adapter)
|
||||
];
|
||||
|
||||
boot.loader = {
|
||||
efi.canTouchEfiVariables = true;
|
||||
systemd-boot.enable = true;
|
||||
grub.enable = false;
|
||||
timeout = 0;
|
||||
};
|
||||
|
||||
hardware.graphics.enable = true;
|
||||
hardware.graphics.enable32Bit = true;
|
||||
|
||||
systemd.services.nix-daemon = {
|
||||
environment.TMPDIR = "/var/cache/nix";
|
||||
serviceConfig.CacheDirectory = "nix";
|
||||
};
|
||||
environment.variables.NIX_REMOTE = "daemon";
|
||||
|
||||
security.rtkit.enable = true;
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = false;
|
||||
alsa.support32Bit = false;
|
||||
pulse.enable = false;
|
||||
audio.enable = false;
|
||||
};
|
||||
services.pulseaudio = {
|
||||
enable = true;
|
||||
support32Bit = true;
|
||||
package = pkgs.pulseaudioFull;
|
||||
extraConfig = ''
|
||||
load-module module-switch-on-connect
|
||||
unload-module module-suspend-on-idle
|
||||
'';
|
||||
};
|
||||
hardware.bluetooth = {
|
||||
enable = true;
|
||||
powerOnBoot = true;
|
||||
settings = {
|
||||
General = {
|
||||
Enable = "Source,Sink,Media,Socket";
|
||||
Disable = "HeadSet";
|
||||
MultiProfile = "multiple";
|
||||
};
|
||||
};
|
||||
};
|
||||
users.extraUsers.${username}.extraGroups = [ "audio" ];
|
||||
|
||||
fonts = {
|
||||
enableDefaultPackages = false;
|
||||
fontDir.enable = true;
|
||||
|
||||
packages = with pkgs; [
|
||||
noto-fonts
|
||||
noto-fonts-cjk-sans
|
||||
noto-fonts-emoji
|
||||
|
||||
jetbrains-mono
|
||||
|
||||
nerd-fonts.symbols-only
|
||||
];
|
||||
|
||||
fontconfig.defaultFonts = {
|
||||
serif = [
|
||||
"Noto Serif CJK SC"
|
||||
"Noto Serif"
|
||||
"Symbols Nerd Font"
|
||||
];
|
||||
sansSerif = [
|
||||
"Noto Sans CJK SC"
|
||||
"Noto Sans"
|
||||
"Symbols Nerd Font"
|
||||
];
|
||||
monospace = [
|
||||
"JetBrains Mono"
|
||||
"Noto Sans Mono CJK SC"
|
||||
"Symbols Nerd Font Mono"
|
||||
];
|
||||
emoji = [ "Noto Color Emoji" ];
|
||||
};
|
||||
};
|
||||
|
||||
services.printing.enable = true;
|
||||
|
||||
services.keyd = {
|
||||
enable = true;
|
||||
keyboards.default.settings = {
|
||||
main = {
|
||||
capslock = "overload(control, esc)";
|
||||
home = "end";
|
||||
};
|
||||
shift = {
|
||||
home = "home";
|
||||
};
|
||||
control = {
|
||||
delete = "print";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.gvfs.enable = true;
|
||||
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
# Forbid root login through SSH.
|
||||
PermitRootLogin = null;
|
||||
PasswordAuthentication = true;
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = [
|
||||
pkgs.rclone
|
||||
];
|
||||
|
||||
sops.secrets.imxyy-nix-rclone = {
|
||||
sopsFile = sopsRoot + /imxyy-nix-rclone.conf;
|
||||
format = "binary";
|
||||
};
|
||||
fileSystems = {
|
||||
"/home/${username}/Nextcloud" = {
|
||||
device = "Nextcloud:";
|
||||
fsType = "rclone";
|
||||
options = [
|
||||
"nodev"
|
||||
"nofail"
|
||||
"allow_other"
|
||||
"args2env"
|
||||
"config=${config.sops.secrets.imxyy-nix-rclone.path}"
|
||||
"uid=1000"
|
||||
"gid=100"
|
||||
"rw"
|
||||
"no-check-certificate"
|
||||
"vfs-cache-mode=full"
|
||||
];
|
||||
};
|
||||
"/home/${username}/NAS" = {
|
||||
device = "//10.0.0.1/share";
|
||||
fsType = "cifs";
|
||||
options = [
|
||||
"username=nas"
|
||||
"password=nasshare"
|
||||
"x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s"
|
||||
"nodev"
|
||||
"nofail"
|
||||
"uid=1000"
|
||||
"gid=100"
|
||||
"vers=3"
|
||||
"rw"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
my.persist.nixosDirs = [ "/etc/NetworkManager/system-connections" ];
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./nixos.nix
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
username,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
btrfs = "/dev/disk/by-uuid/0404de0a-9c4d-4c98-b3e5-b8ff8115f36c";
|
||||
in
|
||||
{
|
||||
boot = {
|
||||
initrd = {
|
||||
@@ -21,7 +23,7 @@
|
||||
verbose = false;
|
||||
};
|
||||
|
||||
kernelPackages = lib.mkForce pkgs.linuxKernel.packages.linux_zen;
|
||||
kernelPackages = lib.mkForce pkgs.linuxPackages_cachyos;
|
||||
kernelModules = [ "kvm-amd" ];
|
||||
|
||||
tmp.useTmpfs = true;
|
||||
@@ -29,27 +31,15 @@
|
||||
"fs.file-max" = 9223372036854775807;
|
||||
};
|
||||
|
||||
resumeDevice = "/dev/disk/by-uuid/0404de0a-9c4d-4c98-b3e5-b8ff8115f36c";
|
||||
resumeDevice = btrfs;
|
||||
kernelParams = [
|
||||
"resume_offset=6444127"
|
||||
|
||||
# "quiet"
|
||||
# "splash"
|
||||
# "log_level=3"
|
||||
];
|
||||
consoleLogLevel = 3;
|
||||
|
||||
/*
|
||||
plymouth = {
|
||||
enable = true;
|
||||
theme = "bgrt";
|
||||
themePackages = [ pkgs.nixos-bgrt-plymouth ];
|
||||
};
|
||||
*/
|
||||
};
|
||||
services.scx.enable = true;
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/0404de0a-9c4d-4c98-b3e5-b8ff8115f36c";
|
||||
device = btrfs;
|
||||
fsType = "btrfs";
|
||||
options = [
|
||||
"compress=zstd"
|
||||
@@ -63,8 +53,9 @@
|
||||
options = [ "compress=zstd" ];
|
||||
};
|
||||
|
||||
fileSystems."/persistent" = {
|
||||
device = "/dev/disk/by-uuid/0404de0a-9c4d-4c98-b3e5-b8ff8115f36c";
|
||||
my.persist.location = "/nix/persist";
|
||||
fileSystems."/nix/persist" = {
|
||||
device = btrfs;
|
||||
fsType = "btrfs";
|
||||
options = [
|
||||
"compress=zstd"
|
||||
@@ -74,7 +65,7 @@
|
||||
};
|
||||
|
||||
fileSystems."/swap" = {
|
||||
device = "/dev/disk/by-uuid/0404de0a-9c4d-4c98-b3e5-b8ff8115f36c";
|
||||
device = btrfs;
|
||||
fsType = "btrfs";
|
||||
options = [
|
||||
"compress=zstd"
|
||||
@@ -85,7 +76,7 @@
|
||||
|
||||
boot.initrd.postDeviceCommands = lib.mkAfter ''
|
||||
mkdir /btrfs_tmp
|
||||
mount /dev/disk/by-uuid/0404de0a-9c4d-4c98-b3e5-b8ff8115f36c /btrfs_tmp
|
||||
mount ${btrfs} /btrfs_tmp
|
||||
mkdir -p /btrfs_tmp/old_roots
|
||||
if [[ -e /btrfs_tmp/root ]]; then
|
||||
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
|
||||
@@ -111,6 +102,12 @@
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/B7DC-E9AC";
|
||||
fsType = "vfat";
|
||||
options = [
|
||||
"uid=0"
|
||||
"gid=0"
|
||||
"fmask=0077"
|
||||
"dmask=0077"
|
||||
];
|
||||
};
|
||||
|
||||
fileSystems."/home/${username}/Documents" = {
|
||||
|
||||
@@ -14,17 +14,17 @@
|
||||
|
||||
wpsoffice-cn
|
||||
wps-office-fonts
|
||||
ttf-wps-fonts
|
||||
evince
|
||||
# siyuan-unlock
|
||||
|
||||
anki
|
||||
|
||||
ayugram-desktop
|
||||
telegram-desktop
|
||||
signal-desktop
|
||||
cinny-desktop
|
||||
discord
|
||||
qq
|
||||
wechat
|
||||
|
||||
gnome-clocks
|
||||
|
||||
@@ -44,16 +44,15 @@
|
||||
PATH = "/home/${username}/bin:$PATH";
|
||||
};
|
||||
profileExtra = ''
|
||||
if [ `tty` = "/dev/tty1" -a $XDG_RUNTIME_DIR ]; then
|
||||
echo 'Starting Niri...'
|
||||
exec uwsm start niri-uwsm.desktop
|
||||
elif [ `tty` = "/dev/tty6" ]; then
|
||||
if [ `tty` = "/dev/tty6" ]; then
|
||||
clear
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
programs.niri.settings.outputs = {
|
||||
programs.niri.settings = {
|
||||
environment.STEAM_FORCE_DESKTOPUI_SCALING = "1.25";
|
||||
outputs = {
|
||||
DP-2 = {
|
||||
enable = true;
|
||||
mode = {
|
||||
@@ -77,25 +76,21 @@
|
||||
scale = 1.25;
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
my = {
|
||||
autologin = {
|
||||
enable = true;
|
||||
user = "${username}";
|
||||
ttys = [
|
||||
1
|
||||
6
|
||||
];
|
||||
user = username;
|
||||
ttys = [ 6 ];
|
||||
};
|
||||
|
||||
gpg.enable = true;
|
||||
cmd.all.enable = true;
|
||||
cli.all.enable = true;
|
||||
coding.all.enable = true;
|
||||
desktop.all.enable = true;
|
||||
|
||||
desktop.wm.dwm.enable = lib.mkForce false;
|
||||
|
||||
desktop.browser.librewolf.enable = lib.mkForce false;
|
||||
|
||||
i18n.fcitx5.enable = true;
|
||||
@@ -104,14 +99,14 @@
|
||||
enable = true;
|
||||
defaultApplications =
|
||||
let
|
||||
browser = [ "chromium-browser.desktop" ];
|
||||
browser = [ "zen-beta.desktop" ];
|
||||
editor = [ "codium.desktop" ];
|
||||
imageviewer = [ "org.gnome.Shotwell-Viewer.desktop" ];
|
||||
in
|
||||
{
|
||||
"inode/directory" = [ "nemo.desktop" ];
|
||||
|
||||
"application/pdf" = [ "evince.desktop" ];
|
||||
"application/pdf" = [ "org.gnome.Evince.desktop" ];
|
||||
|
||||
"text/*" = editor;
|
||||
"application/json" = editor;
|
||||
@@ -159,57 +154,32 @@
|
||||
".android"
|
||||
"Android"
|
||||
|
||||
".ssh"
|
||||
|
||||
"bin"
|
||||
"workspace"
|
||||
"WineApps"
|
||||
"Virt"
|
||||
|
||||
".cache"
|
||||
".local/state"
|
||||
".local/share/Anki2"
|
||||
".local/share/dooit"
|
||||
".local/share/nvim"
|
||||
".local/share/shotwell"
|
||||
".local/share/Steam"
|
||||
".local/share/SteamOS"
|
||||
".local/share/Trash"
|
||||
".local/share/cheat.sh"
|
||||
".local/share/Kingsoft"
|
||||
".local/share/oss.krtirtho.spotube"
|
||||
|
||||
".local/share/AyuGramDesktop"
|
||||
".local/share/TelegramDesktop"
|
||||
".local/share/cinny"
|
||||
".config/Signal"
|
||||
".config/discord"
|
||||
".config/QQ"
|
||||
".xwechat"
|
||||
|
||||
".config/Kingsoft"
|
||||
".config/dconf"
|
||||
".config/gh"
|
||||
".config/pulse"
|
||||
".config/chromium"
|
||||
".config/go-musicfox/db"
|
||||
".config/tmux/plugins"
|
||||
".config/pip"
|
||||
".config/obs-studio"
|
||||
".config/libreoffice"
|
||||
".config/Moonlight Game Streaming Project"
|
||||
".config/sunshine"
|
||||
];
|
||||
nixosDirs = [
|
||||
"/etc/ssh"
|
||||
];
|
||||
homeFiles = [
|
||||
".config/mpd/mpd.db" # requires bindfs
|
||||
".config/go-musicfox/cookie"
|
||||
".hmcl.json"
|
||||
];
|
||||
nixosFiles = [
|
||||
"/etc/davfs2/secrets"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
lib,
|
||||
pkgs,
|
||||
sopsRoot,
|
||||
username,
|
||||
...
|
||||
}:
|
||||
{
|
||||
@@ -105,8 +106,6 @@
|
||||
webui = pkgs.metacubexd;
|
||||
};
|
||||
|
||||
services.tailscale.enable = true;
|
||||
|
||||
sops.secrets.et-imxyy-nix = {
|
||||
sopsFile = sopsRoot + /et-imxyy-nix.toml;
|
||||
format = "binary";
|
||||
@@ -114,7 +113,7 @@
|
||||
environment.systemPackages = [ pkgs.easytier ];
|
||||
systemd.services."easytier" = {
|
||||
enable = true;
|
||||
script = "easytier-core -c ${config.sops.secrets.et-imxyy-nix.path}";
|
||||
script = "${pkgs.easytier}/bin/easytier-core -c ${config.sops.secrets.et-imxyy-nix.path}";
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 500 "always";
|
||||
RestartMaxDelaySec = lib.mkOverride 500 "1m";
|
||||
@@ -127,10 +126,5 @@
|
||||
"network.target"
|
||||
"sops-nix.service"
|
||||
];
|
||||
path = with pkgs; [
|
||||
easytier
|
||||
iproute2
|
||||
bash
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
username,
|
||||
sopsRoot,
|
||||
...
|
||||
}:
|
||||
let
|
||||
@@ -109,56 +111,13 @@ in
|
||||
};
|
||||
environment.variables.NIX_REMOTE = "daemon";
|
||||
|
||||
# services.pipewire.enable = false;
|
||||
security.rtkit.enable = true;
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
# alsa.enable = true;
|
||||
# alsa.support32Bit = true;
|
||||
# pulse.enable = true;
|
||||
alsa.enable = false;
|
||||
alsa.support32Bit = false;
|
||||
pulse.enable = false;
|
||||
audio.enable = false;
|
||||
configPackages = [
|
||||
/*
|
||||
(pkgs.writeTextDir "share/pipewire/media-session.d/bluez-monitor.conf" ''
|
||||
rules = [
|
||||
{
|
||||
actions = {
|
||||
update-props = {
|
||||
bluez5.autoswitch-profile = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
'')
|
||||
*/
|
||||
];
|
||||
};
|
||||
services.pipewire.wireplumber.extraConfig = {
|
||||
/*
|
||||
"10-bluez" = {
|
||||
"monitor.bluez.properties" = {
|
||||
"bluez5.enable-sbc-xq" = true;
|
||||
"bluez5.enable-msbc" = true;
|
||||
"bluez5.enable-hw-volume" = true;
|
||||
"bluez5.roles" = [
|
||||
"hsp_hs"
|
||||
"hsp_ag"
|
||||
"hfp_hf"
|
||||
"hfp_ag"
|
||||
];
|
||||
};
|
||||
};
|
||||
*/
|
||||
/*
|
||||
"11-bluetooth-policy" = {
|
||||
"wireplumber.settings" = {
|
||||
"bluetooth.autoswitch-to-headset-profile" = false;
|
||||
};
|
||||
};
|
||||
*/
|
||||
};
|
||||
services.pulseaudio = {
|
||||
enable = true;
|
||||
@@ -173,7 +132,11 @@ in
|
||||
enable = true;
|
||||
powerOnBoot = true;
|
||||
settings = {
|
||||
General.Enable = "Source,Sink,Media,Socket";
|
||||
General = {
|
||||
Enable = "Source,Sink,Media,Socket";
|
||||
Disable = "HeadSet";
|
||||
MultiProfile = "multiple";
|
||||
};
|
||||
};
|
||||
};
|
||||
users.extraUsers.${username}.extraGroups = [ "audio" ];
|
||||
@@ -197,19 +160,16 @@ in
|
||||
"Noto Serif CJK SC"
|
||||
"Noto Serif"
|
||||
"Symbols Nerd Font"
|
||||
"Noto Color Emoji"
|
||||
];
|
||||
sansSerif = [
|
||||
"Noto Sans CJK SC"
|
||||
"Noto Sans"
|
||||
"Symbols Nerd Font"
|
||||
"Noto Color Emoji"
|
||||
];
|
||||
monospace = [
|
||||
"JetBrains Mono"
|
||||
"Noto Sans Mono CJK SC"
|
||||
"Symbols Nerd Font Mono"
|
||||
"Noto Color Emoji"
|
||||
];
|
||||
emoji = [ "Noto Color Emoji" ];
|
||||
};
|
||||
@@ -235,8 +195,6 @@ in
|
||||
|
||||
services.gvfs.enable = true;
|
||||
|
||||
virtualisation.waydroid.enable = true;
|
||||
|
||||
programs.wireshark.enable = true;
|
||||
programs.wireshark.package = pkgs.wireshark;
|
||||
users.users.${username}.extraGroups = [ "wireshark" ];
|
||||
@@ -266,24 +224,11 @@ in
|
||||
btreset
|
||||
];
|
||||
|
||||
fileSystems =
|
||||
let
|
||||
config = pkgs.writeText "rclone.conf" ''
|
||||
[Nextcloud]
|
||||
type = webdav
|
||||
url = https://192.168.3.2/remote.php/dav/files/imxyy_soope_
|
||||
vendor = nextcloud
|
||||
user = imxyy_soope_
|
||||
pass = C2UUiMyPoynWWKS9kf_Fr8rcoXxgUswPYi4s
|
||||
|
||||
[NAS]
|
||||
type = smb
|
||||
host = 192.168.3.2
|
||||
user = nas
|
||||
pass = O74S6-7jDFykwCvZ8vuIxohh00Ty7XJF
|
||||
'';
|
||||
in
|
||||
{
|
||||
sops.secrets.imxyy-nix-rclone = {
|
||||
sopsFile = sopsRoot + /imxyy-nix-rclone.conf;
|
||||
format = "binary";
|
||||
};
|
||||
fileSystems = {
|
||||
"/home/${username}/Nextcloud" = {
|
||||
device = "Nextcloud:";
|
||||
fsType = "rclone";
|
||||
@@ -292,7 +237,7 @@ in
|
||||
"nofail"
|
||||
"allow_other"
|
||||
"args2env"
|
||||
"config=${toString config}"
|
||||
"config=${config.sops.secrets.imxyy-nix-rclone.path}"
|
||||
"uid=1000"
|
||||
"gid=100"
|
||||
"rw"
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
{
|
||||
"version": 1,
|
||||
"rules": [
|
||||
{
|
||||
"domain": [
|
||||
"cm.steampowered.com",
|
||||
"ol.epicgames.com",
|
||||
"csgo.wmsj.cn",
|
||||
"dota2.wmsj.cn",
|
||||
"wmsjsteam.com",
|
||||
"dl.steam.clngaa.com",
|
||||
"dl.steam.ksyna.com",
|
||||
"gstore.val.manlaxy.com",
|
||||
"st.dl.bscstorage.net",
|
||||
"st.dl.eccdnx.com",
|
||||
"st.dl.pinyuncloud.com",
|
||||
"steampipe.steamcontent.tnkjmec.com",
|
||||
"steampowered.com.8686c.com",
|
||||
"steamstatic.com.8686c.com",
|
||||
"steambroadcast.akamaized.net",
|
||||
"steamcdn-a.akamaihd.net",
|
||||
"steamcommunity-a.akamaihd.net",
|
||||
"steamstore-a.akamaihd.net",
|
||||
"steamusercontent-a.akamaihd.net",
|
||||
"steamuserimages-a.akamaihd.net"
|
||||
],
|
||||
"domain_suffix": [
|
||||
".steamcontent.com",
|
||||
".steamserver.net",
|
||||
".steamchina.com"
|
||||
],
|
||||
"invert": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
sudo mkdir -p /run/systemd/system/docker.service.d
|
||||
sudo su -c 'cat << EOF >/run/systemd/system/docker.service.d/override.conf
|
||||
[Service]
|
||||
Environment="http_proxy=http://127.0.0.1:7890"
|
||||
Environment="https_proxy=http://127.0.0.1:7890"
|
||||
Environment="all_proxy=socks5h://127.0.0.1:7891"
|
||||
EOF'
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl restart docker
|
||||
742
flake.lock
generated
742
flake.lock
generated
File diff suppressed because it is too large
Load Diff
180
flake.nix
180
flake.nix
@@ -4,10 +4,14 @@
|
||||
inputs = {
|
||||
# Nixpkgs
|
||||
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable-small";
|
||||
nixpkgs-stable.url = "github:nixos/nixpkgs/release-24.11";
|
||||
nixpkgs-stable.url = "github:nixos/nixpkgs/release-25.05";
|
||||
nixpkgs-master.url = "github:nixos/nixpkgs/master";
|
||||
# nixpkgs.follows = "nixpkgs-stable";
|
||||
nixpkgs.follows = "nixpkgs-unstable";
|
||||
# nixpkgs.follows = "nixpkgs-master";
|
||||
|
||||
# Nyxpkgs
|
||||
chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable";
|
||||
|
||||
# SOPS
|
||||
sops-nix.url = "github:Mic92/sops-nix";
|
||||
@@ -23,20 +27,6 @@
|
||||
# NUR
|
||||
nur.url = "github:nix-community/NUR";
|
||||
|
||||
# NeoVim nightly
|
||||
# neovim-nightly.url = "github:nix-community/neovim-nightly-overlay";
|
||||
# neovim-nightly.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
|
||||
|
||||
# OMZ
|
||||
omz.url = "github:imxyy1soope1/omz/master";
|
||||
omz.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
# dwm
|
||||
dwm.url = "github:imxyy1soope1/dwm/master";
|
||||
dwm.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
# Niri
|
||||
niri.url = "github:sodiboo/niri-flake";
|
||||
niri.inputs.nixpkgs.follows = "nixpkgs";
|
||||
@@ -61,32 +51,60 @@
|
||||
|
||||
fenix.url = "github:nix-community/fenix";
|
||||
fenix.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
zen.url = "github:0xc000022070/zen-browser-flake";
|
||||
zen.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
infuse.url = "git+https://codeberg.org/amjoseph/infuse.nix";
|
||||
infuse.flake = false;
|
||||
|
||||
haumea.url = "github:nix-community/haumea/v0.2.2";
|
||||
haumea.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
nixos-wsl,
|
||||
...
|
||||
}@inputs:
|
||||
let
|
||||
inherit (self) outputs;
|
||||
variables = import ./variables.nix;
|
||||
vars = import ./vars.nix;
|
||||
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
|
||||
forAllHosts =
|
||||
gen:
|
||||
mkSystem:
|
||||
nixpkgs.lib.attrsets.mergeAttrsList (
|
||||
builtins.map (
|
||||
{ hostname, ... }@host:
|
||||
{
|
||||
${hostname} = gen host;
|
||||
}
|
||||
) variables.hosts
|
||||
builtins.map (hostname: {
|
||||
${hostname} = mkSystem hostname;
|
||||
}) (builtins.attrNames (builtins.readDir ./config/hosts))
|
||||
);
|
||||
|
||||
lib = (import ./lib/stdlib-extended.nix nixpkgs.lib).extend (
|
||||
final: prev: {
|
||||
inherit (inputs.home-manager.lib) hm;
|
||||
inherit infuse;
|
||||
haumea = inputs.haumea.lib;
|
||||
}
|
||||
);
|
||||
infuse = (import inputs.infuse { inherit (nixpkgs) lib; }).v1.infuse;
|
||||
in
|
||||
{
|
||||
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
|
||||
packages = forAllSystems (
|
||||
system:
|
||||
lib.haumea.load {
|
||||
src = ./pkgs;
|
||||
loader = [
|
||||
{
|
||||
matches = str: builtins.match ".*\\.nix" str != null;
|
||||
loader = _: path: nixpkgs.legacyPackages.${system}.callPackage path { };
|
||||
}
|
||||
];
|
||||
transformer = lib.haumea.transformers.liftDefault;
|
||||
}
|
||||
);
|
||||
|
||||
# workaround for "treefmt warning"
|
||||
formatter = forAllSystems (
|
||||
system:
|
||||
let
|
||||
@@ -95,9 +113,9 @@
|
||||
pkgs.writeShellApplication {
|
||||
name = "nixfmt-wrapper";
|
||||
|
||||
runtimeInputs = [
|
||||
pkgs.fd
|
||||
pkgs.nixfmt-rfc-style
|
||||
runtimeInputs = with pkgs; [
|
||||
fd
|
||||
nixfmt-rfc-style
|
||||
];
|
||||
|
||||
text = ''
|
||||
@@ -106,27 +124,17 @@
|
||||
}
|
||||
);
|
||||
|
||||
overlays = import ./overlays { inherit inputs; };
|
||||
overlays = import ./overlays {
|
||||
inherit inputs lib;
|
||||
};
|
||||
|
||||
# Available through 'nixos-rebuild --flake .#{hostname}'
|
||||
nixosConfigurations = forAllHosts (
|
||||
{ hostname, system }:
|
||||
hostname:
|
||||
let
|
||||
lib = import ./lib/stdlib-extended.nix (
|
||||
nixpkgs.lib.extend (
|
||||
final: prev: {
|
||||
inherit (inputs.home-manager.lib) hm;
|
||||
}
|
||||
)
|
||||
);
|
||||
overlays = builtins.attrValues self.overlays ++ [
|
||||
inputs.go-musicfox.overlays.default
|
||||
inputs.omz.overlays.default
|
||||
inputs.dwm.overlays.default
|
||||
inputs.niri.overlays.niri
|
||||
# inputs.neovim-nightly.overlays.default
|
||||
inputs.fenix.overlays.default
|
||||
inputs.nix-vscode-extensions.overlays.default
|
||||
(final: prev: {
|
||||
darkly-qt5 = inputs.darkly.packages.${final.system}.darkly-qt5;
|
||||
darkly-qt6 = inputs.darkly.packages.${final.system}.darkly-qt6;
|
||||
@@ -136,58 +144,24 @@
|
||||
withJemalloc = true;
|
||||
withQtSvg = true;
|
||||
withWayland = true;
|
||||
withPipewire = false;
|
||||
withPipewire = true;
|
||||
withPam = false;
|
||||
withX11 = false;
|
||||
withHyprland = false;
|
||||
};
|
||||
})
|
||||
(final: prev: {
|
||||
inherit lib;
|
||||
})
|
||||
];
|
||||
pkgs = import nixpkgs {
|
||||
inherit system overlays;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
specialArgs = {
|
||||
inherit (variables)
|
||||
username
|
||||
userdesc
|
||||
userfullname
|
||||
useremail
|
||||
;
|
||||
|
||||
inherit
|
||||
inputs
|
||||
outputs
|
||||
nixos-wsl
|
||||
system
|
||||
hostname
|
||||
;
|
||||
|
||||
sopsRoot = ./secrets;
|
||||
};
|
||||
in
|
||||
lib.nixosSystem {
|
||||
inherit specialArgs;
|
||||
modules = [
|
||||
./modules
|
||||
./config/base.nix
|
||||
./config/hosts/${hostname}
|
||||
{
|
||||
nixpkgs = {
|
||||
inherit pkgs;
|
||||
};
|
||||
}
|
||||
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
inputs.impermanence.nixosModules.impermanence
|
||||
inputs.home-manager.nixosModules.default
|
||||
{
|
||||
home = {
|
||||
home-manager = {
|
||||
sharedModules = [
|
||||
inputs.sops-nix.homeManagerModules.sops
|
||||
inputs.impermanence.nixosModules.home-manager.impermanence
|
||||
inputs.stylix.homeManagerModules.stylix
|
||||
inputs.niri.homeModules.niri
|
||||
inputs.stylix.homeModules.stylix
|
||||
inputs.zen.homeModules.beta
|
||||
# workaround for annoying stylix
|
||||
(
|
||||
{ lib, ... }:
|
||||
{
|
||||
@@ -197,7 +171,43 @@
|
||||
];
|
||||
useGlobalPkgs = true;
|
||||
};
|
||||
}
|
||||
};
|
||||
pkgsConf.nixpkgs = {
|
||||
inherit overlays;
|
||||
config.allowUnfree = true;
|
||||
flake.setNixPath = false;
|
||||
};
|
||||
in
|
||||
lib.nixosSystem {
|
||||
specialArgs = {
|
||||
inherit
|
||||
inputs
|
||||
outputs
|
||||
hostname
|
||||
;
|
||||
sopsRoot = ./secrets;
|
||||
flake = ./.;
|
||||
} // vars;
|
||||
modules =
|
||||
(lib.umport {
|
||||
paths = [ ./modules ];
|
||||
exclude = [
|
||||
./modules/virt/types
|
||||
./modules/desktop/wm/niri/waybar
|
||||
];
|
||||
recursive = true;
|
||||
})
|
||||
++ [
|
||||
(lib.mkAliasOptionModule [ "my" "home" ] [ "home-manager" "users" vars.username ])
|
||||
./config/base.nix
|
||||
./config/hosts/${hostname}
|
||||
inputs.chaotic.nixosModules.default
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
inputs.impermanence.nixosModules.impermanence
|
||||
inputs.home-manager.nixosModules.default
|
||||
inputs.niri.nixosModules.niri
|
||||
home
|
||||
pkgsConf
|
||||
];
|
||||
}
|
||||
);
|
||||
|
||||
@@ -9,5 +9,6 @@ in
|
||||
stdlib.extend (
|
||||
self: super: {
|
||||
my = mkMyLib { lib = self; };
|
||||
umport = import ./umport.nix { lib = self; };
|
||||
}
|
||||
)
|
||||
|
||||
48
lib/umport.nix
Normal file
48
lib/umport.nix
Normal file
@@ -0,0 +1,48 @@
|
||||
# This function is modified from:
|
||||
# https://github.com/yunfachi/nypkgs/blob/master/lib/umport.nix
|
||||
#
|
||||
# !!! REMOVING THIS NOTICE VIOLATES THE MIT LICENSE OF THE UMPORT PROJECT !!!
|
||||
# This notice must be retained in all copies of this function, including modified versions!
|
||||
# The MIT License can be found here:
|
||||
# https://github.com/yunfachi/nypkgs/blob/master/LICENSE
|
||||
{ lib, ... }:
|
||||
let
|
||||
umport =
|
||||
{
|
||||
path ? null,
|
||||
paths ? [ ],
|
||||
include ? [ ],
|
||||
exclude ? [ ],
|
||||
recursive ? true,
|
||||
}:
|
||||
with lib;
|
||||
with fileset;
|
||||
let
|
||||
excludedFiles = filter (path: pathIsRegularFile path) exclude;
|
||||
excludedDirs = filter (path: pathIsDirectory path) exclude;
|
||||
isExcluded =
|
||||
path:
|
||||
if elem path excludedFiles then
|
||||
true
|
||||
else
|
||||
(filter (excludedDir: lib.path.hasPrefix excludedDir path) excludedDirs) != [ ];
|
||||
in
|
||||
unique (
|
||||
(filter
|
||||
(file: pathIsRegularFile file && hasSuffix ".nix" (builtins.toString file) && !isExcluded file)
|
||||
(
|
||||
concatMap (
|
||||
_path:
|
||||
if recursive then
|
||||
toList _path
|
||||
else
|
||||
mapAttrsToList (
|
||||
name: type: _path + (if type == "directory" then "/${name}/default.nix" else "/${name}")
|
||||
) (builtins.readDir _path)
|
||||
) (unique (if path == null then paths else [ path ] ++ paths))
|
||||
)
|
||||
)
|
||||
++ (if recursive then concatMap (path: toList path) (unique include) else unique include)
|
||||
);
|
||||
in
|
||||
umport
|
||||
@@ -3,15 +3,16 @@ lib.my.makeSwitch {
|
||||
inherit config;
|
||||
optionName = "all command line tools";
|
||||
optionPath = [
|
||||
"cmd"
|
||||
"cli"
|
||||
"all"
|
||||
];
|
||||
config' = {
|
||||
my.cmd = {
|
||||
my.cli = {
|
||||
media.all.enable = true;
|
||||
misc.enable = true;
|
||||
monitor.all.enable = true;
|
||||
shell.all.enable = true;
|
||||
vcs.all.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -3,12 +3,12 @@ lib.my.makeSwitch {
|
||||
inherit config;
|
||||
optionName = "all command line media tools";
|
||||
optionPath = [
|
||||
"cmd"
|
||||
"cli"
|
||||
"media"
|
||||
"all"
|
||||
];
|
||||
config' = {
|
||||
my.cmd.media = {
|
||||
my.cli.media = {
|
||||
cava.enable = true;
|
||||
go-musicfox.enable = true;
|
||||
mpd.enable = true;
|
||||
@@ -9,7 +9,7 @@ lib.my.makeHomePackageConfig {
|
||||
packageName = "cava";
|
||||
packagePath = [ "cava" ];
|
||||
optionPath = [
|
||||
"cmd"
|
||||
"cli"
|
||||
"media"
|
||||
"cava"
|
||||
];
|
||||
@@ -9,7 +9,7 @@ lib.my.makeHomePackageConfig {
|
||||
packageName = "ffmpeg";
|
||||
packagePath = [ "ffmpeg" ];
|
||||
optionPath = [
|
||||
"cmd"
|
||||
"cli"
|
||||
"media"
|
||||
"ffmpeg"
|
||||
];
|
||||
@@ -8,7 +8,7 @@ lib.my.makeSwitch {
|
||||
inherit config;
|
||||
optionName = "go-musicfox";
|
||||
optionPath = [
|
||||
"cmd"
|
||||
"cli"
|
||||
"media"
|
||||
"go-musicfox"
|
||||
];
|
||||
@@ -22,7 +22,14 @@ lib.my.makeSwitch {
|
||||
xdg.configFile."go-musicfox/go-musicfox.ini".source = ./go-musicfox.ini;
|
||||
};
|
||||
|
||||
cmd.media.mpd.enable = true;
|
||||
cli.media.mpd.enable = true;
|
||||
|
||||
persist.homeDirs = [
|
||||
".config/go-musicfox/db"
|
||||
];
|
||||
persist.homeFiles = [
|
||||
".config/go-musicfox/cookie"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -8,18 +8,21 @@ lib.my.makeSwitch {
|
||||
inherit config;
|
||||
optionName = "mpd";
|
||||
optionPath = [
|
||||
"cmd"
|
||||
"cli"
|
||||
"media"
|
||||
"mpd"
|
||||
];
|
||||
config' = {
|
||||
my.home = {
|
||||
home.packages = with pkgs; [
|
||||
home.packages = with pkgs.stable; [
|
||||
mpd
|
||||
mpc-cli
|
||||
];
|
||||
services.mpris-proxy.enable = true;
|
||||
xdg.configFile."mpd/mpd.conf".source = ./mpd.conf;
|
||||
};
|
||||
my.persist.homeFiles = [
|
||||
".config/mpd/mpd.db"
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
username,
|
||||
userfullname,
|
||||
useremail,
|
||||
...
|
||||
@@ -11,7 +12,7 @@ lib.my.makeSwitch {
|
||||
default = true;
|
||||
optionName = "misc command line tools";
|
||||
optionPath = [
|
||||
"cmd"
|
||||
"cli"
|
||||
"misc"
|
||||
];
|
||||
config' = {
|
||||
@@ -43,21 +44,9 @@ lib.my.makeSwitch {
|
||||
killall
|
||||
];
|
||||
|
||||
programs.zsh.enable = true;
|
||||
programs.dconf.enable = true;
|
||||
|
||||
my.home = {
|
||||
programs.home-manager.enable = true;
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = "${userfullname}";
|
||||
userEmail = "${useremail}";
|
||||
extraConfig = {
|
||||
pull.rebase = true;
|
||||
push.autoSetupRemote = true;
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
lsd
|
||||
fd
|
||||
@@ -68,20 +57,29 @@ lib.my.makeSwitch {
|
||||
|
||||
aria2
|
||||
socat
|
||||
|
||||
nix-output-monitor
|
||||
|
||||
tmux
|
||||
|
||||
trash-cli
|
||||
|
||||
cht-sh
|
||||
|
||||
dooit
|
||||
|
||||
# translate-shell
|
||||
];
|
||||
xdg.configFile."tmux/tmux.conf".source = ./tmux.conf;
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
extraConfig = "set-option -g mouse on";
|
||||
plugins = [
|
||||
(pkgs.tmuxPlugins.mkTmuxPlugin {
|
||||
pluginName = "tokyo-night-tmux";
|
||||
rtpFilePath = "tokyo-night.tmux";
|
||||
version = "legacy";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "janoamaral";
|
||||
repo = "tokyo-night-tmux";
|
||||
rev = "16469dfad86846138f594ceec780db27039c06cd";
|
||||
hash = "sha256-EKCgYan0WayXnkSb2fDJxookdBLW0XBKi2hf/YISwJE=";
|
||||
};
|
||||
})
|
||||
];
|
||||
};
|
||||
programs.tealdeer = {
|
||||
enable = true;
|
||||
enableAutoUpdates = true;
|
||||
settings.updates.auto_update = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -3,12 +3,12 @@ lib.my.makeSwitch {
|
||||
inherit config;
|
||||
optionName = "all command line monitor tools";
|
||||
optionPath = [
|
||||
"cmd"
|
||||
"cli"
|
||||
"monitor"
|
||||
"all"
|
||||
];
|
||||
config' = {
|
||||
my.cmd.monitor = {
|
||||
my.cli.monitor = {
|
||||
btop.enable = true;
|
||||
};
|
||||
};
|
||||
@@ -9,7 +9,7 @@ lib.my.makeHomePackageConfig {
|
||||
packageName = "btop";
|
||||
packagePath = [ "btop" ];
|
||||
optionPath = [
|
||||
"cmd"
|
||||
"cli"
|
||||
"monitor"
|
||||
"btop"
|
||||
];
|
||||
@@ -3,12 +3,12 @@ lib.my.makeSwitch {
|
||||
inherit config;
|
||||
optionName = "all shells";
|
||||
optionPath = [
|
||||
"cmd"
|
||||
"cli"
|
||||
"shell"
|
||||
"all"
|
||||
];
|
||||
config' = {
|
||||
my.cmd.shell = {
|
||||
my.cli.shell = {
|
||||
zsh.enable = true;
|
||||
};
|
||||
};
|
||||
190
modules/cli/shell/starship-preset.toml
Normal file
190
modules/cli/shell/starship-preset.toml
Normal file
@@ -0,0 +1,190 @@
|
||||
[aws]
|
||||
symbol = " "
|
||||
|
||||
[buf]
|
||||
symbol = " "
|
||||
|
||||
[bun]
|
||||
symbol = " "
|
||||
|
||||
[c]
|
||||
symbol = " "
|
||||
|
||||
[cpp]
|
||||
symbol = " "
|
||||
|
||||
[cmake]
|
||||
symbol = " "
|
||||
|
||||
[conda]
|
||||
symbol = " "
|
||||
|
||||
[crystal]
|
||||
symbol = " "
|
||||
|
||||
[dart]
|
||||
symbol = " "
|
||||
|
||||
[deno]
|
||||
symbol = " "
|
||||
|
||||
[directory]
|
||||
read_only = " "
|
||||
|
||||
[docker_context]
|
||||
symbol = " "
|
||||
|
||||
[elixir]
|
||||
symbol = " "
|
||||
|
||||
[elm]
|
||||
symbol = " "
|
||||
|
||||
[fennel]
|
||||
symbol = " "
|
||||
|
||||
[fossil_branch]
|
||||
symbol = " "
|
||||
|
||||
[gcloud]
|
||||
symbol = " "
|
||||
|
||||
[git_branch]
|
||||
symbol = " "
|
||||
|
||||
[git_commit]
|
||||
tag_symbol = ' '
|
||||
|
||||
[golang]
|
||||
symbol = " "
|
||||
|
||||
[guix_shell]
|
||||
symbol = " "
|
||||
|
||||
[haskell]
|
||||
symbol = " "
|
||||
|
||||
[haxe]
|
||||
symbol = " "
|
||||
|
||||
[hg_branch]
|
||||
symbol = " "
|
||||
|
||||
[hostname]
|
||||
ssh_symbol = " "
|
||||
|
||||
[java]
|
||||
symbol = " "
|
||||
|
||||
[julia]
|
||||
symbol = " "
|
||||
|
||||
[kotlin]
|
||||
symbol = " "
|
||||
|
||||
[lua]
|
||||
symbol = " "
|
||||
|
||||
[memory_usage]
|
||||
symbol = " "
|
||||
|
||||
[meson]
|
||||
symbol = " "
|
||||
|
||||
[nim]
|
||||
symbol = " "
|
||||
|
||||
[nix_shell]
|
||||
symbol = " "
|
||||
|
||||
[nodejs]
|
||||
symbol = " "
|
||||
|
||||
[ocaml]
|
||||
symbol = " "
|
||||
|
||||
[os.symbols]
|
||||
Alpaquita = " "
|
||||
Alpine = " "
|
||||
AlmaLinux = " "
|
||||
Amazon = " "
|
||||
Android = " "
|
||||
Arch = " "
|
||||
Artix = " "
|
||||
CachyOS = " "
|
||||
CentOS = " "
|
||||
Debian = " "
|
||||
DragonFly = " "
|
||||
Emscripten = " "
|
||||
EndeavourOS = " "
|
||||
Fedora = " "
|
||||
FreeBSD = " "
|
||||
Garuda = " "
|
||||
Gentoo = " "
|
||||
HardenedBSD = " "
|
||||
Illumos = " "
|
||||
Kali = " "
|
||||
Linux = " "
|
||||
Mabox = " "
|
||||
Macos = " "
|
||||
Manjaro = " "
|
||||
Mariner = " "
|
||||
MidnightBSD = " "
|
||||
Mint = " "
|
||||
NetBSD = " "
|
||||
NixOS = " "
|
||||
Nobara = " "
|
||||
OpenBSD = " "
|
||||
openSUSE = " "
|
||||
OracleLinux = " "
|
||||
Pop = " "
|
||||
Raspbian = " "
|
||||
Redhat = " "
|
||||
RedHatEnterprise = " "
|
||||
RockyLinux = " "
|
||||
Redox = " "
|
||||
Solus = " "
|
||||
SUSE = " "
|
||||
Ubuntu = " "
|
||||
Unknown = " "
|
||||
Void = " "
|
||||
Windows = " "
|
||||
|
||||
[package]
|
||||
symbol = " "
|
||||
|
||||
[perl]
|
||||
symbol = " "
|
||||
|
||||
[php]
|
||||
symbol = " "
|
||||
|
||||
[pijul_channel]
|
||||
symbol = " "
|
||||
|
||||
[pixi]
|
||||
symbol = " "
|
||||
|
||||
[python]
|
||||
symbol = " "
|
||||
|
||||
[rlang]
|
||||
symbol = " "
|
||||
|
||||
[ruby]
|
||||
symbol = " "
|
||||
|
||||
[rust]
|
||||
symbol = " "
|
||||
|
||||
[scala]
|
||||
symbol = " "
|
||||
|
||||
[swift]
|
||||
symbol = " "
|
||||
|
||||
[zig]
|
||||
symbol = " "
|
||||
|
||||
[gradle]
|
||||
symbol = " "
|
||||
127
modules/cli/shell/zsh.nix
Normal file
127
modules/cli/shell/zsh.nix
Normal file
@@ -0,0 +1,127 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
lib.my.makeSwitch {
|
||||
inherit config;
|
||||
default = true;
|
||||
optionName = "default zsh settings";
|
||||
optionPath = [
|
||||
"cli"
|
||||
"shell"
|
||||
"zsh"
|
||||
];
|
||||
config' = {
|
||||
my.persist.homeDirs = [ ".local/share/zoxide" ];
|
||||
my.home =
|
||||
let
|
||||
stateHome = config.my.home.xdg.stateHome;
|
||||
zsh-syntax-highlighting = pkgs.fetchFromGitHub {
|
||||
owner = "zsh-users";
|
||||
repo = "zsh-syntax-highlighting";
|
||||
rev = "0.8.0";
|
||||
hash = "sha256-iJdWopZwHpSyYl5/FQXEW7gl/SrKaYDEtTH9cGP7iPo=";
|
||||
};
|
||||
fzf-tab = pkgs.fetchFromGitHub {
|
||||
owner = "Aloxaf";
|
||||
repo = "fzf-tab";
|
||||
rev = "v1.2.0";
|
||||
hash = "sha256-q26XVS/LcyZPRqDNwKKA9exgBByE0muyuNb0Bbar2lY=";
|
||||
};
|
||||
in
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
fzf
|
||||
zoxide
|
||||
];
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
settings = lib.recursiveUpdate (with builtins; fromTOML (readFile ./starship-preset.toml)) {
|
||||
add_newline = false;
|
||||
custom = {
|
||||
jj = {
|
||||
ignore_timeout = true;
|
||||
description = "The current jj status";
|
||||
when = "jj root";
|
||||
symbol = " ";
|
||||
command = ''
|
||||
jj log --revisions @ --no-graph --ignore-working-copy --color always --limit 1 --template '
|
||||
separate(" ",
|
||||
change_id.shortest(4),
|
||||
bookmarks,
|
||||
"|",
|
||||
concat(
|
||||
if(conflict, "💥"),
|
||||
if(divergent, "🚧"),
|
||||
if(hidden, "👻"),
|
||||
if(immutable, "🔒"),
|
||||
),
|
||||
raw_escape_sequence("\x1b[1;32m") ++ if(empty, "(empty)"),
|
||||
raw_escape_sequence("\x1b[1;32m") ++ coalesce(
|
||||
truncate_end(29, description.first_line(), "…"),
|
||||
"(no description set)",
|
||||
) ++ raw_escape_sequence("\x1b[0m"),
|
||||
)
|
||||
'
|
||||
'';
|
||||
};
|
||||
git_branch = {
|
||||
when = true;
|
||||
command = "jj root >/dev/null 2>&1 || starship module git_branch";
|
||||
description = "Only show git_branch if we're not in a jj repo";
|
||||
};
|
||||
git_status = {
|
||||
when = true;
|
||||
command = "jj root >/dev/null 2>&1 || starship module git_status";
|
||||
description = "Only show git_status if we're not in a jj repo";
|
||||
};
|
||||
};
|
||||
git_state.disabled = true;
|
||||
git_commit.disabled = true;
|
||||
git_metrics.disabled = true;
|
||||
git_branch.disabled = true;
|
||||
git_status.disabled = true;
|
||||
nix_shell.disabled = true;
|
||||
};
|
||||
};
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
dotDir = ".config/zsh";
|
||||
history = {
|
||||
path = "${stateHome}/zsh_history";
|
||||
ignorePatterns = [
|
||||
"la"
|
||||
];
|
||||
};
|
||||
initContent = lib.mkAfter ''
|
||||
source ${fzf-tab}/fzf-tab.plugin.zsh
|
||||
|
||||
eval "$(zoxide init zsh)"
|
||||
source ${zsh-syntax-highlighting}/zsh-syntax-highlighting.plugin.zsh
|
||||
source ${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
'';
|
||||
oh-my-zsh = {
|
||||
enable = true;
|
||||
theme = "gentoo";
|
||||
plugins = [
|
||||
"git"
|
||||
"git-extras"
|
||||
"extract"
|
||||
"sudo"
|
||||
"dotenv"
|
||||
];
|
||||
};
|
||||
shellAliases = {
|
||||
x = "extract";
|
||||
ls = "lsd";
|
||||
svim = "sudoedit";
|
||||
nf = "neofetch";
|
||||
tmux = "tmux -T RGB,focus,overline,mouse,clipboard,usstyle";
|
||||
pastart = "pasuspender true";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
16
modules/cli/vcs/all.nix
Normal file
16
modules/cli/vcs/all.nix
Normal file
@@ -0,0 +1,16 @@
|
||||
{ config, lib, ... }:
|
||||
lib.my.makeSwitch {
|
||||
inherit config;
|
||||
optionName = "all command line tools";
|
||||
optionPath = [
|
||||
"cli"
|
||||
"vcs"
|
||||
"all"
|
||||
];
|
||||
config' = {
|
||||
my.cli.vcs = {
|
||||
git.enable = true;
|
||||
jj.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
42
modules/cli/vcs/git.nix
Normal file
42
modules/cli/vcs/git.nix
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
username,
|
||||
userfullname,
|
||||
useremail,
|
||||
...
|
||||
}:
|
||||
lib.my.makeHomeProgramConfig {
|
||||
inherit config;
|
||||
programName = "git";
|
||||
optionPath = [
|
||||
"cli"
|
||||
"vcs"
|
||||
"git"
|
||||
];
|
||||
extraConfig = {
|
||||
my.home = {
|
||||
programs.git = {
|
||||
userName = "${userfullname}";
|
||||
userEmail = "${useremail}";
|
||||
signing = {
|
||||
format = "ssh";
|
||||
signByDefault = true;
|
||||
key = "/home/${username}/.ssh/id_ed25519";
|
||||
};
|
||||
extraConfig = {
|
||||
push.autoSetupRemote = true;
|
||||
gpg.ssh.allowedSignersFile =
|
||||
(pkgs.writeText "allowed_signers" ''
|
||||
imxyy1soope1@gmail.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOEFLUkyeaK8ZPPZdVNEmtx8zvoxi7xqS2Z6oxRBuUPO imxyy@imxyy-nix
|
||||
imxyy@imxyy.top ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOEFLUkyeaK8ZPPZdVNEmtx8zvoxi7xqS2Z6oxRBuUPO imxyy@imxyy-nix
|
||||
'').outPath;
|
||||
};
|
||||
};
|
||||
programs.lazygit = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
45
modules/cli/vcs/jj.nix
Normal file
45
modules/cli/vcs/jj.nix
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
username,
|
||||
userfullname,
|
||||
useremail,
|
||||
...
|
||||
}:
|
||||
lib.my.makeHomeProgramConfig {
|
||||
inherit config;
|
||||
programName = "jujutsu";
|
||||
optionPath = [
|
||||
"cli"
|
||||
"vcs"
|
||||
"jj"
|
||||
];
|
||||
extraConfig = {
|
||||
my.home = {
|
||||
programs.jujutsu = {
|
||||
settings = {
|
||||
user = {
|
||||
name = "${userfullname}";
|
||||
email = "${useremail}";
|
||||
};
|
||||
ui = {
|
||||
graph.style = "square";
|
||||
default-command = "status";
|
||||
};
|
||||
signing = {
|
||||
backend = "ssh";
|
||||
behavior = "own";
|
||||
key = "/home/${username}/.ssh/id_ed25519";
|
||||
backends.backends.ssh.allowed-signers =
|
||||
(pkgs.writeText "allowed_signers" ''
|
||||
imxyy1soope1@gmail.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOEFLUkyeaK8ZPPZdVNEmtx8zvoxi7xqS2Z6oxRBuUPO imxyy@imxyy-nix
|
||||
imxyy@imxyy.top ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOEFLUkyeaK8ZPPZdVNEmtx8zvoxi7xqS2Z6oxRBuUPO imxyy@imxyy-nix
|
||||
'').outPath;
|
||||
};
|
||||
};
|
||||
};
|
||||
home.packages = [ pkgs.lazyjj ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./all.nix
|
||||
./media
|
||||
./misc
|
||||
./monitor
|
||||
./shell
|
||||
];
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./all.nix
|
||||
./ffmpeg.nix
|
||||
./mpd
|
||||
./cava
|
||||
./go-musicfox
|
||||
];
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
set-option -g mouse on
|
||||
|
||||
set -g @plugin 'tmux-plugins/tpm'
|
||||
set -g @plugin 'tmux-plugins/tmux-sensible'
|
||||
|
||||
set -g @plugin "janoamaral/tokyo-night-tmux#legacy"
|
||||
|
||||
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
|
||||
run '~/.config/tmux/plugins/tpm/tpm'
|
||||
@@ -1,7 +0,0 @@
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./all.nix
|
||||
./btop
|
||||
];
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./all.nix
|
||||
./zsh.nix
|
||||
];
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
lib.my.makeSwitch {
|
||||
inherit config;
|
||||
default = true;
|
||||
optionName = "default zsh settings";
|
||||
optionPath = [
|
||||
"cmd"
|
||||
"shell"
|
||||
"zsh"
|
||||
];
|
||||
config' = {
|
||||
my.home =
|
||||
let
|
||||
stateHome = config.my.home.xdg.stateHome;
|
||||
in
|
||||
{
|
||||
home.packages = [ pkgs.omz ];
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
dotDir = ".config/zsh";
|
||||
history = {
|
||||
path = "${stateHome}/zsh_history";
|
||||
ignorePatterns = [
|
||||
"la"
|
||||
];
|
||||
};
|
||||
initExtra = ''
|
||||
source ${pkgs.omz}/share/omz/omz.zsh
|
||||
'';
|
||||
sessionVariables = {
|
||||
_ZL_DATA = "${stateHome}/zlua";
|
||||
_FZF_HISTORY = "${stateHome}/fzf_history";
|
||||
};
|
||||
shellAliases = {
|
||||
ls = "lsd";
|
||||
svim = "sudoedit";
|
||||
nf = "neofetch";
|
||||
tmux = "tmux -T RGB,focus,overline,mouse,clipboard,usstyle";
|
||||
pastart = "pasuspender true";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./all.nix
|
||||
./misc.nix
|
||||
./langs
|
||||
./editor
|
||||
];
|
||||
}
|
||||
@@ -11,6 +11,7 @@ lib.my.makeSwitch {
|
||||
my.coding.editor = {
|
||||
neovim.enable = true;
|
||||
vscode.enable = true;
|
||||
zed.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./all.nix
|
||||
./neovim
|
||||
./vscode
|
||||
];
|
||||
}
|
||||
@@ -20,9 +20,6 @@ lib.my.makeHomeProgramConfig {
|
||||
recursive = true;
|
||||
};
|
||||
programs.neovim = {
|
||||
package = pkgs.neovim-unwrapped.overrideAttrs {
|
||||
treesitter-parsers = { };
|
||||
};
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
viAlias = true;
|
||||
@@ -39,7 +36,7 @@ lib.my.makeHomeProgramConfig {
|
||||
rust-analyzer
|
||||
pest-ide-tools
|
||||
|
||||
nil
|
||||
nixd
|
||||
|
||||
gotools
|
||||
gopls
|
||||
@@ -57,5 +54,8 @@ lib.my.makeHomeProgramConfig {
|
||||
];
|
||||
};
|
||||
};
|
||||
my.persist.homeDirs = [
|
||||
".local/share/nvim"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,4 +6,3 @@ require("langs.langs-setup")
|
||||
require("plugins.plugins-setup")
|
||||
|
||||
require("core.autostart")
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ function G.switch_input_method(req)
|
||||
return input_status
|
||||
end
|
||||
|
||||
|
||||
function G.buf_kill(kill_command, bufnr, force)
|
||||
kill_command = kill_command or "bd"
|
||||
|
||||
@@ -61,7 +60,8 @@ function G.buf_kill(kill_command, bufnr, force)
|
||||
end)
|
||||
elseif choice == 2 then
|
||||
force = true
|
||||
else return
|
||||
else
|
||||
return
|
||||
end
|
||||
elseif api.nvim_buf_get_option(bufnr, "buftype") == "terminal" then
|
||||
choice = fn.confirm(fmt([[Close "%s"?]], bufname), "&Yes\n&No\n&Cancel")
|
||||
|
||||
@@ -39,7 +39,9 @@ keymap.set("n", "<leader>ww", ":w<CR>", opt)
|
||||
keymap.set("n", "<leader>so", ":so<CR>", opt)
|
||||
keymap.set("n", "<leader>qq", ":q<CR>", opt)
|
||||
keymap.set("n", "<leader>qa", ":qa<CR>", opt)
|
||||
keymap.set("n", "<leader>c", function () buf_kill("bd", nil, false) end, opt)
|
||||
keymap.set("n", "<leader>c", function()
|
||||
buf_kill("bd", nil, false)
|
||||
end, opt)
|
||||
|
||||
keymap.set("n", "<C-up>", ":resize +5<CR>", opt)
|
||||
keymap.set("n", "<C-down>", ":resize -5<CR>", opt)
|
||||
@@ -63,9 +65,8 @@ keymap.set("n", "<leader>wr", ":WorkspacesRemove<CR>", opt)
|
||||
|
||||
-- Neovide config
|
||||
if vim.g.neovide then
|
||||
keymap.set("v", "<C-C>", "\"+y", opt)
|
||||
keymap.set("n", "<C-V>", "\"+P", opt)
|
||||
keymap.set("i", "<C-V>", "<ESC>l\"+Pli", opt)
|
||||
keymap.set("v", "<C-C>", '"+y', opt)
|
||||
keymap.set("n", "<C-V>", '"+P', opt)
|
||||
keymap.set("i", "<C-V>", '<ESC>l"+Pli', opt)
|
||||
keymap.set("c", "<C-V>", "<C-R>+", opt)
|
||||
end
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ vim.g.autoread = true
|
||||
vim.g.loaded_ruby_provider = 0
|
||||
|
||||
-- Hightlight on yank
|
||||
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true })
|
||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
@@ -62,7 +62,7 @@ vim.api.nvim_create_autocmd("InsertLeave", {
|
||||
callback = function()
|
||||
Last_input_method = require("core.globals").switch_input_method(1)
|
||||
end,
|
||||
group = "AutoInputMethod"
|
||||
group = "AutoInputMethod",
|
||||
})
|
||||
vim.api.nvim_create_autocmd("CmdlineLeave", {
|
||||
pattern = "*",
|
||||
@@ -70,7 +70,7 @@ vim.api.nvim_create_autocmd("CmdlineLeave", {
|
||||
callback = function()
|
||||
require("core.globals").switch_input_method(1)
|
||||
end,
|
||||
group = "AutoInputMethod"
|
||||
group = "AutoInputMethod",
|
||||
})
|
||||
vim.api.nvim_create_autocmd("InsertEnter", {
|
||||
pattern = "*",
|
||||
@@ -78,7 +78,7 @@ vim.api.nvim_create_autocmd("InsertEnter", {
|
||||
callback = function()
|
||||
require("core.globals").switch_input_method(Last_input_method)
|
||||
end,
|
||||
group = "AutoInputMethod"
|
||||
group = "AutoInputMethod",
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
@@ -89,8 +89,8 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||
-- credit: https://github.com/sam4llis/nvim-lua-gf
|
||||
vim.opt_local.include = [[\v<((do|load)file|require|reload)[^''"]*[''"]\zs[^''"]+]]
|
||||
vim.opt_local.includeexpr = "substitute(v:fname,'\\.','/','g')"
|
||||
vim.opt_local.suffixesadd:prepend ".lua"
|
||||
vim.opt_local.suffixesadd:prepend "init.lua"
|
||||
vim.opt_local.suffixesadd:prepend(".lua")
|
||||
vim.opt_local.suffixesadd:prepend("init.lua")
|
||||
|
||||
for _, path in pairs(vim.api.nvim_list_runtime_paths()) do
|
||||
vim.opt_local.path:append(path .. "/lua")
|
||||
@@ -98,13 +98,6 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||
end,
|
||||
})
|
||||
|
||||
-- fix https://github.com/neovim/neovim/issues/21856
|
||||
vim.api.nvim_create_autocmd({ "VimLeave" }, {
|
||||
callback = function()
|
||||
vim.fn.jobstart("", { detach = true })
|
||||
end,
|
||||
})
|
||||
|
||||
-- MkDir
|
||||
vim.api.nvim_create_user_command("MakeDirectory", function()
|
||||
---@diagnostic disable-next-line: missing-parameter
|
||||
@@ -116,25 +109,3 @@ vim.api.nvim_create_user_command("MakeDirectory", function()
|
||||
vim.notify("Directory already exists", vim.log.levels.WARN, { title = "Nvim" })
|
||||
end
|
||||
end, { desc = "Create directory if it doesn't exist" })
|
||||
|
||||
-- Neovide config
|
||||
if vim.g.neovide then
|
||||
local global = vim.g
|
||||
vim.o.guifont = "monospace:h14"
|
||||
global.neovide_padding_top = 0
|
||||
global.neovide_padding_bottom = 0
|
||||
global.neovide_padding_right = 0
|
||||
global.neovide_padding_left = 0
|
||||
global.neovide_hide_mouse_when_typing = true
|
||||
global.neovide_cursor_animation_length = 0.05
|
||||
global.neovide_cursor_trail_size = 0.15
|
||||
global.neovide_confirm_quit = true
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({ "VimEnter" }, {
|
||||
callback = function()
|
||||
-- A dumb way to clear annoying NeoVim startup screen
|
||||
vim.cmd("normal ia")
|
||||
vim.cmd("normal u")
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -10,4 +10,3 @@ vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
end,
|
||||
group = "Go",
|
||||
})
|
||||
|
||||
|
||||
@@ -32,4 +32,3 @@ vim.api.nvim_create_autocmd("BufLeave", {
|
||||
end,
|
||||
group = "Lua",
|
||||
})
|
||||
|
||||
|
||||
@@ -32,4 +32,3 @@ vim.api.nvim_create_autocmd("BufLeave", {
|
||||
end,
|
||||
group = "Markdown",
|
||||
})
|
||||
|
||||
|
||||
@@ -32,4 +32,3 @@ vim.api.nvim_create_autocmd("BufLeave", {
|
||||
end,
|
||||
group = "Nix",
|
||||
})
|
||||
|
||||
|
||||
@@ -8,4 +8,3 @@ vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
end,
|
||||
group = "Rust",
|
||||
})
|
||||
|
||||
|
||||
@@ -5,14 +5,14 @@ M = {
|
||||
javascript = { "string", "template_string" },
|
||||
},
|
||||
fast_wrap = {
|
||||
map = '<M-e>',
|
||||
chars = { '{', '[', '(', '"', "'" },
|
||||
map = "<M-e>",
|
||||
chars = { "{", "[", "(", '"', "'" },
|
||||
pattern = [=[[%'%"%)%>%]%)%}%,]]=],
|
||||
end_key = '$',
|
||||
keys = 'qwertyuiopzxcvbnmasdfghjkl',
|
||||
end_key = "$",
|
||||
keys = "qwertyuiopzxcvbnmasdfghjkl",
|
||||
check_comma = true,
|
||||
highlight = 'Search',
|
||||
highlight_grey='Comment'
|
||||
highlight = "Search",
|
||||
highlight_grey = "Comment",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -23,4 +23,3 @@ if ok then
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ local buf_kill = require("core.globals").buf_kill
|
||||
M = {
|
||||
highlights = {
|
||||
buffer_selected = {
|
||||
bold = true
|
||||
}
|
||||
bold = true,
|
||||
},
|
||||
},
|
||||
options = {
|
||||
diagnostics = "nvim_lsp",
|
||||
@@ -13,19 +13,18 @@ M = {
|
||||
filetype = "NvimTree",
|
||||
text = "File Explorer",
|
||||
highlight = "Directory",
|
||||
text_align = "center"
|
||||
text_align = "center",
|
||||
},
|
||||
},
|
||||
close_command = function (bufnr)
|
||||
close_command = function(bufnr)
|
||||
buf_kill("bd", bufnr, false)
|
||||
end,
|
||||
right_mouse_command = function (bufnr)
|
||||
right_mouse_command = function(bufnr)
|
||||
buf_kill("bd", bufnr, true)
|
||||
end
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
return M
|
||||
|
||||
|
||||
@@ -3,21 +3,20 @@ local cmp = require("cmp")
|
||||
M = {
|
||||
window = {
|
||||
completion = {
|
||||
border = 'rounded',
|
||||
scrollbar = '║',
|
||||
border = "rounded",
|
||||
scrollbar = "║",
|
||||
},
|
||||
documentation = {
|
||||
border = 'rounded',
|
||||
scrollbar = '║',
|
||||
border = "rounded",
|
||||
scrollbar = "║",
|
||||
},
|
||||
},
|
||||
formatting = {
|
||||
format = require('lspkind').cmp_format({
|
||||
format = require("lspkind").cmp_format({
|
||||
mode = "symbol",
|
||||
maxwidth = 50,
|
||||
ellipsis_char = '...',
|
||||
symbol_map = { Codeium = "", }
|
||||
})
|
||||
ellipsis_char = "...",
|
||||
}),
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
@@ -29,7 +28,7 @@ M = {
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<Escape>"] = cmp.mapping.abort(),
|
||||
["<Tab>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<Up>"] = cmp.mapping(function (fallback)
|
||||
["<Up>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
@@ -37,9 +36,9 @@ M = {
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s"
|
||||
"s",
|
||||
}),
|
||||
["<Down>"] = cmp.mapping(function (fallback)
|
||||
["<Down>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
@@ -47,22 +46,19 @@ M = {
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s"
|
||||
"s",
|
||||
}),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
-- { name = "codeium" },
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
})
|
||||
|
||||
}),
|
||||
}
|
||||
|
||||
vim.o.wildmenu = true
|
||||
vim.o.pumheight = 10
|
||||
|
||||
return M
|
||||
|
||||
|
||||
@@ -1,34 +1,30 @@
|
||||
M = {
|
||||
sources = {
|
||||
friendly_snippets = true
|
||||
friendly_snippets = true,
|
||||
},
|
||||
history = true,
|
||||
updateevents = { "TextChanged", "TextChangedI" }
|
||||
updateevents = { "TextChanged", "TextChangedI" },
|
||||
}
|
||||
|
||||
-- vscode format
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.vscode_snippets_path or "" }
|
||||
require("luasnip.loaders.from_vscode").lazy_load({ paths = vim.g.vscode_snippets_path or "" })
|
||||
|
||||
-- snipmate format
|
||||
require("luasnip.loaders.from_snipmate").load()
|
||||
require("luasnip.loaders.from_snipmate").lazy_load { paths = vim.g.snipmate_snippets_path or "" }
|
||||
require("luasnip.loaders.from_snipmate").lazy_load({ paths = vim.g.snipmate_snippets_path or "" })
|
||||
|
||||
-- lua format
|
||||
require("luasnip.loaders.from_lua").load()
|
||||
require("luasnip.loaders.from_lua").lazy_load { paths = vim.g.lua_snippets_path or "" }
|
||||
require("luasnip.loaders.from_lua").lazy_load({ paths = vim.g.lua_snippets_path or "" })
|
||||
|
||||
local luasnip = require("luasnip")
|
||||
vim.api.nvim_create_autocmd("InsertLeave", {
|
||||
callback = function()
|
||||
if
|
||||
luasnip.session.current_nodes[vim.api.nvim_get_current_buf()]
|
||||
and not luasnip.session.jump_active
|
||||
then
|
||||
if luasnip.session.current_nodes[vim.api.nvim_get_current_buf()] and not luasnip.session.jump_active then
|
||||
luasnip.unlink_current()
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
return M
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
M = {}
|
||||
|
||||
return M
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
M = {
|
||||
signs = {
|
||||
add = { text = '▎', color = "green" },
|
||||
change = { text = '▎', color = "blue" },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
add = { text = "▎", color = "green" },
|
||||
change = { text = "▎", color = "blue" },
|
||||
delete = { text = "_" },
|
||||
topdelete = { text = "‾" },
|
||||
changedelete = { text = "~" },
|
||||
},
|
||||
current_line_blame = true,
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = 'eol',
|
||||
virt_text_pos = "eol",
|
||||
delay = 0,
|
||||
ignore_whitespace = false,
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
M = {
|
||||
enabled = true,
|
||||
indent = {
|
||||
tab_char = "▎"
|
||||
tab_char = "▎",
|
||||
},
|
||||
scope = {
|
||||
enabled = true,
|
||||
show_start = false,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
vim.opt.list = true
|
||||
|
||||
return M
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
M = {}
|
||||
|
||||
return M
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ local servers = {
|
||||
"ts_ls",
|
||||
"jsonls",
|
||||
"cssls",
|
||||
"nil_ls",
|
||||
"nixd",
|
||||
"html",
|
||||
}
|
||||
|
||||
@@ -20,49 +20,53 @@ local extra_config = {
|
||||
vim.api.nvim_get_runtime_file("", true),
|
||||
"${3rd}/luv/library",
|
||||
"${3rd}/luassert/library",
|
||||
}
|
||||
},
|
||||
},
|
||||
diagnostics = {
|
||||
globals = {
|
||||
"vim"
|
||||
}
|
||||
"vim",
|
||||
},
|
||||
},
|
||||
completion = {
|
||||
callSnippet = "Replace"
|
||||
}
|
||||
}
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
rust_analyzer = {
|
||||
settings = {
|
||||
rust_analyzer = {
|
||||
check = {
|
||||
command = "clippy"
|
||||
command = "clippy",
|
||||
},
|
||||
diagnostics = {
|
||||
experimental = true,
|
||||
},
|
||||
formatting = {
|
||||
command = { "rustfmt" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
nixd = {
|
||||
settings = {
|
||||
nixd = {
|
||||
nixpkgs = {
|
||||
expr = "import <nixpkgs> { }",
|
||||
},
|
||||
options = {
|
||||
nixos = {
|
||||
expr = '(builtins.getFlake ("git+file://" + toString ./.)).nixosConfigurations.imxyy-nix.options',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
qmlls = {
|
||||
cmd = {"qmlls", "-E"}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
vim.api.nvim_create_autocmd("CursorHold", {
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
local opts = {
|
||||
focusable = false,
|
||||
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
|
||||
border = "rounded",
|
||||
source = "always",
|
||||
prefix = " ",
|
||||
scope = "line",
|
||||
}
|
||||
vim.diagnostic.open_float(nil, opts)
|
||||
end,
|
||||
})
|
||||
end
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.foldingRange = {
|
||||
@@ -73,16 +77,10 @@ local lspconfig = require("lspconfig")
|
||||
for _, server in ipairs(servers) do
|
||||
local extra = extra_config[server] or {}
|
||||
local config = {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
capabilities = capabilities,
|
||||
}
|
||||
for k, v in pairs(extra) do
|
||||
config[k] = v
|
||||
end
|
||||
lspconfig[server].setup(config)
|
||||
end
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_lines = true
|
||||
})
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
M = {
|
||||
-- ensure_installed = require("plugins.lsp.servers")
|
||||
ensure_installed = {}
|
||||
ensure_installed = {},
|
||||
}
|
||||
|
||||
return M
|
||||
|
||||
|
||||
@@ -3,10 +3,9 @@ M = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗"
|
||||
}
|
||||
}
|
||||
package_uninstalled = "✗",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
|
||||
|
||||
@@ -4,26 +4,56 @@ local opt = require("core.globals").keymap_opt
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opt)
|
||||
vim.keymap.set("n", "<leader>lR", vim.lsp.buf.rename, opt)
|
||||
|
||||
local icons = {}
|
||||
local sev = vim.diagnostic.severity
|
||||
local signs = {
|
||||
[sev.ERROR] = " ",
|
||||
[sev.WARN] = " ",
|
||||
[sev.HINT] = " ",
|
||||
[sev.INFO] = " ",
|
||||
}
|
||||
for type, icon in pairs(icons) do
|
||||
local hl = vim.diagnostic.severity[type]
|
||||
signs[hl] = icon
|
||||
end
|
||||
vim.diagnostic.config({
|
||||
virtual_text = { spacing = 4, prefix = "●" },
|
||||
signs = true,
|
||||
signs = {
|
||||
text = signs,
|
||||
},
|
||||
underline = true,
|
||||
update_in_insert = true,
|
||||
severity_sort = true,
|
||||
})
|
||||
|
||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||
end
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||
border = "single",
|
||||
})
|
||||
--[[ vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
border = "single",
|
||||
focusable = false,
|
||||
relative = "cursor",
|
||||
}) ]]
|
||||
|
||||
local diag_config1 = {
|
||||
virtual_text = {
|
||||
severity = {
|
||||
max = vim.diagnostic.severity.WARN,
|
||||
},
|
||||
spacing = 4,
|
||||
prefix = "●",
|
||||
},
|
||||
virtual_lines = {
|
||||
severity = {
|
||||
min = vim.diagnostic.severity.ERROR,
|
||||
},
|
||||
},
|
||||
}
|
||||
local diag_config2 = {
|
||||
virtual_text = { spacing = 4, prefix = "●" },
|
||||
virtual_lines = false,
|
||||
}
|
||||
vim.diagnostic.config(diag_config1)
|
||||
local diag_config_basic = false
|
||||
vim.keymap.set("n", "<leader>ll", function()
|
||||
diag_config_basic = not diag_config_basic
|
||||
if diag_config_basic then
|
||||
vim.diagnostic.config(diag_config2)
|
||||
else
|
||||
vim.diagnostic.config(diag_config1)
|
||||
end
|
||||
end, { desc = "Toggle diagnostic virtual_lines" })
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
M = {}
|
||||
M = {
|
||||
symbols = {
|
||||
icon_source = "lspkind",
|
||||
},
|
||||
}
|
||||
|
||||
vim.keymap.set("n", "<leader>o", "<cmd>Outline<CR>",
|
||||
{ desc = "Toggle Outline" })
|
||||
vim.keymap.set("n", "<leader>o", "<cmd>Outline<CR>", { desc = "Toggle Outline" })
|
||||
|
||||
return M
|
||||
|
||||
@@ -12,4 +12,3 @@ M = {
|
||||
}
|
||||
|
||||
return M
|
||||
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
M = {
|
||||
bind = true, -- This is mandatory, otherwise border config won't get registered.
|
||||
handler_opts = {
|
||||
border = "rounded"
|
||||
border = "rounded",
|
||||
},
|
||||
hint_prefix = "^ ",
|
||||
toggle_key = "<C-k>",
|
||||
}
|
||||
|
||||
vim.keymap.set({ 'n' }, '<leader>k', require('lsp_signature').toggle_float_win,
|
||||
{ silent = true, noremap = true, desc = 'toggle signature' })
|
||||
vim.keymap.set(
|
||||
{ "n" },
|
||||
"<leader>k",
|
||||
require("lsp_signature").toggle_float_win,
|
||||
{ silent = true, noremap = true, desc = "toggle signature" }
|
||||
)
|
||||
|
||||
vim.keymap.set({ 'n' }, 'K', vim.lsp.buf.signature_help,
|
||||
{ silent = true, noremap = true, desc = 'toggle signature' })
|
||||
vim.keymap.set({ "n" }, "K", vim.lsp.buf.signature_help, { silent = true, noremap = true, desc = "toggle signature" })
|
||||
|
||||
return M
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
M = {
|
||||
options = {
|
||||
theme = "tokyonight"
|
||||
theme = "tokyonight",
|
||||
},
|
||||
sections = {
|
||||
lualine_y = {
|
||||
'encoding', 'fileformat', 'filetype',
|
||||
"encoding",
|
||||
"fileformat",
|
||||
"filetype",
|
||||
},
|
||||
lualine_x = {
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user