Compare commits

..

92 Commits

Author SHA1 Message Date
Ryan Yin d7c0e7caa6 feat(modules/base.nix): add more cache mirrors 2024-07-23 10:00:11 +08:00
Ryan Yin d8759cc845 feat: darwin - font.packages 2024-07-23 09:49:04 +08:00
Ryan Yin 6c6ada4243 fix: nixos installer 2024-07-23 09:43:46 +08:00
Ryan Yin 95cdd40c77 feat: adjust btrbk's backups preserve policy, and disable backups... 2024-07-21 04:50:09 +08:00
Ryan Yin a04d6dfdf6 feat: adjust btrbk's snapshot timer 2024-07-21 02:13:24 +08:00
Ryan Yin adf1415868 docs: minior update 2024-07-20 17:54:25 +08:00
Ryan Yin b1c6f1b90f Merge pull request #137 from ryan4yin/update
Update dependencies
2024-07-20 12:14:05 +08:00
Ryan Yin 5e9f98e56d fix: anyrun - https://github.com/anyrun-org/anyrun/issues/153 2024-07-20 12:12:57 +08:00
Ryan Yin 885205d9e3 fix: remove non-existent tree sitter 2024-07-20 11:52:56 +08:00
Ryan Yin 385bcd2d87 chore: update graphics config 2024-07-20 11:49:14 +08:00
Ryan Yin b3b55c36d8 fix: hyprland - crash 2024-07-20 11:43:16 +08:00
Ryan Yin 7d6fa4028d chore: debug hyprland 2024-07-20 11:42:01 +08:00
Ryan Yin 0ea8548f37 fix: remove hyprlnad's flake 2024-07-20 11:42:01 +08:00
Ryan Yin c29148fc77 fix: update flake again to fix lanzaboote's error 2024-07-20 11:42:01 +08:00
Ryan Yin 1eecf89793 feat: update dependencies 2024-07-20 11:42:01 +08:00
Ryan Yin 5fcf0d0995 refactor(home/base/tui/edistors): neovim - adjust the classification of lsp/treesitter 2024-07-19 18:28:06 +08:00
Ryan Yin 66949f6b8f feat: neovim - add support for nickel 2024-07-19 15:43:50 +08:00
Ryan Yin 36ba5a4efc feat: remove afdian 2024-07-16 14:44:21 +08:00
Ryan Yin 68285a70d0 feat: add idea for java development 2024-07-12 12:20:54 +08:00
Ryan Yin f97ad2fd1e feat: java language server 2024-07-12 12:09:07 +08:00
Ryan Yin 1d66cf655d feat: add k8s related tools 2024-07-10 15:22:49 +08:00
Ryan Yin 04fa05151a Merge pull request #136 from DataEraserC/patch-11
fix: ignore typo `crypted-nixos`
2024-07-08 09:36:09 +08:00
Sacabambaspis 62d986d1c8 fix: ignore typo crypted-nixos 2024-07-06 18:50:55 +08:00
Ryan Yin 730906ebf2 feat: neovim - add syntax highlight for justfiles 2024-06-28 17:36:40 +08:00
Ryan Yin bcf5b8b1cb feat: add gitleaks 2024-06-24 09:11:43 +08:00
Ryan Yin 1f14f5899c Merge pull request #135 from DataEraserC/patch-9
fix(docs): update url in docs
2024-06-19 09:29:30 +08:00
Sacabambaspis 9732c87d1f fix(docs): update url in docs 2024-06-18 23:02:27 +08:00
Ryan Yin 032f478d2a docs: neovim 2024-06-18 11:08:23 +08:00
Ryan Yin 71cb1cf295 Merge pull request #134 from ryan4yin/rename-luks-device
chore: rename luks device to crypted-nixos
2024-06-18 09:41:09 +08:00
Ryan Yin 09a9e086d8 chore: rename luks device to crypted-nixos 2024-06-18 09:40:00 +08:00
Ryan Yin e903f95a46 Merge pull request #133 from yocoldle/patch-1
docs: fix description about the helix plugin system
2024-06-18 09:37:41 +08:00
Coldle 1239f4549a docs: fix description about the helix plugin system 2024-06-17 22:23:47 +08:00
Ryan Yin 4433e018d9 feat: disable treesitter-wing 2024-06-16 21:38:14 +08:00
Ryan Yin e9ac7d8ddc feat: darwin - timezone 2024-06-16 20:13:53 +08:00
Ryan Yin cf51e77d75 Merge pull request #132 from ryan4yin/update-flake-lock
Update flake lock, adjust nushell
2024-06-15 11:54:09 +08:00
Ryan Yin 095b092e08 feat: adjust nushell 2024-06-15 11:39:20 +08:00
Ryan Yin 4e4eb9a003 feat: update flake.lock 2024-06-14 17:15:42 +08:00
Ryan Yin 1efe489846 feat: add gcloud & doctl 2024-06-14 15:29:58 +08:00
Ryan Yin ea13da3031 feat: add ko for go project 2024-06-14 15:26:30 +08:00
Ryan Yin 47a735d235 feat: add dae rules for steam 2024-06-10 20:53:05 +08:00
Ryan Yin 84c4708b98 feat: add kubebuilder 2024-06-04 11:09:37 +08:00
Ryan Yin 12494d66af Merge pull request #130 from DataEraserC/main
fix(docs): fix partition unmatched
2024-06-03 18:40:51 +08:00
Sacabambaspis 97ff571431 fix(docs): fix docs typo 2024-06-03 18:27:41 +08:00
Ryan Yin c0e3af3fad docs: README 2024-06-03 15:20:19 +08:00
Ryan Yin bbe2e80650 docs: README 2024-06-03 15:07:17 +08:00
Ryan Yin 5bc941d9e2 docs: README 2024-06-03 15:00:37 +08:00
Ryan Yin 7f6c061041 docs: README 2024-06-03 14:59:56 +08:00
Ryan Yin b8e45b28e1 docs: README 2024-06-03 14:58:49 +08:00
Ryan Yin 21555a4148 feat(neovim): update plugins - orgmode 2024-06-03 14:33:39 +08:00
Ryan Yin 0f4387800f fix: #122 - cgo-builtin-prolog:1:10: fatal error: 'stddef.h' file not found 2024-06-03 10:11:17 +08:00
Ryan Yin 1095d8fa53 fix: missing pkgs-stable 2024-06-02 14:22:44 +08:00
Ryan Yin 98e2e7196d Merge pull request #129 from ryan4yin/upgrade-to-24.05
feat: upgrade to 24.05
2024-06-02 13:58:13 +08:00
Ryan Yin 0a764cfdf3 fix: python3.11-k5test-0.10.4 is marked as broken 2024-06-02 13:56:51 +08:00
Ryan Yin 54e4dfcec0 chore: update yabai 2024-06-02 13:35:40 +08:00
Ryan Yin f37588df64 fix: nixpkgs for darwin 2024-06-02 12:59:13 +08:00
Ryan Yin 9adf87aaf5 feat: upgrade to 24.05
fix: remove or update some packages
2024-06-02 11:17:32 +08:00
Ryan Yin 82dccbdeca fix: add exfat support for idols-ai 2024-05-15 20:49:51 +08:00
Ryan Yin af88851772 feat(modules/base.nix): add cuda-maintainer's cache server 2024-05-14 15:21:01 +08:00
Ryan Yin b3d7d0d2a3 Merge pull request #128 from shelken/main
chore(Justfile): Use recipe attributes to scope commands on specific platform
2024-05-13 10:49:23 +08:00
shelken b0fcf9d9e7 chore(Justfile): Use recipe attributes to scope commands on specific platforms
使用
[配方属性](https://github.com/casey/just/tree/master?tab=readme-ov-file#recipe-attributes)
以限定命令使用的平台
2024-05-13 10:01:25 +08:00
Ryan Yin 7bd264fee9 chore: update darwin's home configs 2024-05-11 17:05:28 +08:00
Ryan Yin 2a841a5a32 feat: yazi intergration - nushell 2024-05-11 11:26:09 +08:00
Ryan Yin e97e61c8d2 feat(home/base/core/git.nix): trim.bases 2024-05-10 15:01:47 +08:00
Ryan Yin c65018f450 Update FUNDING.yml 2024-05-10 12:14:26 +08:00
Ryan Yin 218ff4c1da Merge pull request #127 from DataEraserC/patch-8
fix(Justfile): fix `'--update-input' is a deprecated alias for 'flake update'`
2024-05-10 09:41:10 +08:00
Sacabambaspis e26c20a29b fix(Justfile): fix '--update-input' is a deprecated alias for 'flake update' 2024-05-09 22:49:16 +08:00
Ryan Yin 13751a4b66 fix: mason-nvim-dap - debugger not found 2024-05-06 15:06:32 +08:00
Ryan Yin f4d91b6827 feat: enableNushellIntegration for atuin 2024-05-06 11:59:45 +08:00
Ryan Yin 4f780f3f61 refactor: scripts 2024-05-06 11:59:45 +08:00
Ryan Yin a626458b8e Merge pull request #126 from DataEraserC/patch-7
fix(secrets/README.md): fix nixpkgs does not contain agenix
2024-05-06 09:33:47 +08:00
Sacabambaspis 87c041f8b4 fix(secrets/README.md): fix nixpkgs does not contain agenix
Closes #125
2024-05-05 18:05:43 +08:00
Ryan Yin ace653e9d6 Merge pull request #124 from DataEraserC/patch-6
feat: Replace unzip with unzipNLS for proper extraction of non-English content
2024-04-30 13:59:21 +08:00
Sacabambaspis bb913b181d feat: replace unzip with unzipNLS for proper extraction of non-English content 2024-04-30 00:53:18 +08:00
Ryan Yin bec52f9d60 feat: update flake.lock, disable all configs related to remote desktop 2024-04-25 21:14:56 +08:00
Ryan Yin de891782cb fix(home/base/tui/editors/packages.nix): python debugger 2024-04-24 18:34:21 +08:00
Ryan Yin 5abbd63284 docs: fix the maxium keyfile size of luks 2024-04-24 11:22:15 +08:00
Ryan Yin 14dabdcee5 Merge pull request #123 from ryan4yin/fix-nixpkgs-flakes
fix: option `nix.registry.nixpkgs.to.path' has conflicting definition
2024-04-20 14:59:41 +08:00
Ryan Yin 5583f1ffe9 fix: option `nix.registry.nixpkgs.to.path' has conflicting definition 2024-04-20 14:58:49 +08:00
Ryan Yin 6b016a2432 refactor: macos's nixpkgs registry 2024-04-20 14:02:56 +08:00
Ryan Yin cad8cf325d fix: suzu - deployment - networking 2024-04-20 13:51:11 +08:00
Ryan Yin 9a0e41429a docs: nixos-install + persistent 2024-04-20 13:29:03 +08:00
Ryan Yin 44ce90bf68 docs: nvidia 2024-04-20 13:20:49 +08:00
Ryan Yin 9fe6ef9165 fix: enable networkmanager for idols-ai 2024-04-20 12:51:58 +08:00
Ryan Yin 4b2035a0dc chore: update all flake inputs 2024-04-20 12:48:07 +08:00
Ryan Yin 21d85d41ef feat: use the latest version of the nix package manager 2024-04-18 11:03:49 +08:00
Ryan Yin 7fd3baca0f docs: copy closure 2024-04-17 23:28:59 +08:00
Ryan Yin ce645e7935 fix: homepage - backgroud image 2024-04-17 23:22:13 +08:00
Ryan Yin 9631334088 Merge pull request #121 from kluen/patch-1
docs(README): Fix links to neovim and emacs
2024-04-16 09:42:41 +08:00
Kristof Lünenschloß a9bb04c37d docs(README): Fix links to neovim and emacs 2024-04-15 21:48:02 +02:00
Ryan Yin ddad742023 Merge pull request #120 from DataEraserC/patch-5
fix several typos
2024-04-15 09:47:24 +08:00
Sacabambaspis 21c9e572af fix(home/linux/gui/base/xdg.nix): fix code typo (dekstop -> desktop) 2024-04-14 02:09:28 +08:00
Sacabambaspis 6b2168b925 fix(utils.nu): fix comment typo (Virutal -> Virtual) 2024-04-14 02:09:05 +08:00
93 changed files with 797 additions and 988 deletions
+2 -1
View File
@@ -1,2 +1,3 @@
github: ryan4yin
patreon: ryan4yin
custom: ["https://buymeacoffee.com/ryan4yin", "https://afdian.net/a/ryan4yin"]
custom: ["https://buymeacoffee.com/ryan4yin"]
+1
View File
@@ -10,4 +10,5 @@ extend-ignore-re = [
"iterm2",
"iHgEIBYKACAWIQSizQe9ljFEyyclWmtVhZllwnQrSwUCZZ1T9wIdAAAKCRBVhZll", # crypto keys
"noice", # noice.nvim
"crypted-nixos",
]
+22 -11
View File
@@ -28,7 +28,7 @@ up:
# Update specific input
# Usage: just upp nixpkgs
upp input:
nix flake lock --update-input {{input}}
nix flake update {{input}}
# List all generations of the system profile
history:
@@ -59,19 +59,23 @@ gitgc:
#
############################################################################
[linux]
i3 mode="default":
use utils.nu *; \
nixos-switch ai-i3 {{mode}}
[linux]
hypr mode="default":
use utils.nu *; \
nixos-switch ai-hyprland {{mode}}
[linux]
s-i3 mode="default":
use utils.nu *; \
nixos-switch shoukei-i3 {{mode}}
[linux]
s-hypr mode="default":
use utils.nu *; \
nixos-switch shoukei-hyprland {{mode}}
@@ -82,27 +86,32 @@ s-hypr mode="default":
#
############################################################################
[macos]
darwin-set-proxy:
sudo python3 scripts/darwin_set_proxy.py
sleep 1sec
[macos]
darwin-rollback:
use utils.nu *; \
darwin-rollback
# Deploy to harmonica(macOS host)
[macos]
ha mode="default":
use utils.nu *; \
darwin-build "harmonica" {{mode}}; \
darwin-switch "harmonica" {{mode}}
# Depoly to fern(macOS host)
[macos]
fe mode="default": darwin-set-proxy
use utils.nu *; \
darwin-build "fern" {{mode}}; \
darwin-switch "fern" {{mode}}
# Reload yabai and skhd(macOS)
[macos]
yabai-reload:
launchctl kickstart -k "gui/502/org.nixos.yabai";
launchctl kickstart -k "gui/502/org.nixos.skhd";
@@ -232,16 +241,6 @@ yukina:
#
############################################################################
aarch:
colmena apply --on '@aarch' --build-on-target --verbose --show-trace
suzu:
colmena apply --on '@suzu' --build-on-target --verbose --show-trace
suzu-local mode="default":
use utils.nu *; \
nixos-switch suzu {{mode}}
rakushun:
colmena apply --on '@rakushun' --build-on-target --verbose --show-trace
@@ -249,6 +248,18 @@ rakushun-local mode="default":
use utils.nu *; \
nixos-switch rakushun {{mode}}
suzu-set-proxy:
ip route del default via 192.168.5.1
ip route add default via 192.168.5.178
suzu-unset-proxy:
ip route del default via 192.168.5.178
ip route add default via 192.168.5.1
suzu-local mode="default":
use utils.nu *; \
nixos-switch suzu {{mode}}
############################################################################
#
# Misc, other useful commands
+9 -7
View File
@@ -8,16 +8,18 @@
<a href="https://github.com/ryan4yin/nix-config/stargazers">
<img alt="Stargazers" src="https://img.shields.io/github/stars/ryan4yin/nix-config?style=for-the-badge&logo=starship&color=C9CBFF&logoColor=D9E0EE&labelColor=302D41"></a>
<a href="https://nixos.org/">
<img src="https://img.shields.io/badge/NixOS-23.11-informational.svg?style=for-the-badge&logo=nixos&color=F2CDCD&logoColor=D9E0EE&labelColor=302D41"></a>
<img src="https://img.shields.io/badge/NixOS-24.05-informational.svg?style=for-the-badge&logo=nixos&color=F2CDCD&logoColor=D9E0EE&labelColor=302D41"></a>
<a href="https://github.com/ryan4yin/nixos-and-flakes-book">
<img src="https://img.shields.io/static/v1?label=Nix Flakes&message=learning&style=for-the-badge&logo=nixos&color=DDB6F2&logoColor=D9E0EE&labelColor=302D41"></a>
</a>
</p>
> My configuration is becoming more and more complex, and it may be difficult for beginners to read
> it. If you are new to NixOS and want to know how I use NixOS, I would recommend you to take a look
> at the [ryan4yin/nix-config/releases](https://github.com/ryan4yin/nix-config/releases) first,
> **checkout to some simpler older versions**, which will be much easier to understand.
> My configuration is becoming more and more complex, and **it will be difficult for beginners to
> read**. If you are new to NixOS and want to know how I use NixOS, I would recommend you to take a
> look at the [ryan4yin/nix-config/releases](https://github.com/ryan4yin/nix-config/releases) first,
> **checkout to some simpler older versions, such as
> [i3-kickstarter](https://github.com/ryan4yin/nix-config/tree/i3-kickstarter), which will be much
> easier to understand**.
This repository is home to the nix code that builds my systems:
@@ -89,11 +91,11 @@ Wallpapers: https://github.com/ryan4yin/wallpapers
## Neovim
See [./home/base/desktop/editors/neovim/](./home/base/desktop/editors/neovim/) for details.
See [./home/base/tui/editors/neovim/](./home/base/tui/editors/neovim/) for details.
## Emacs
See [./home/base/desktop/editors/emacs/](./home/base/desktop/editors/emacs/) for details.
See [./home/base/tui/editors/emacs/](./home/base/tui/editors/emacs/) for details.
## Secrets Management
Generated
+214 -558
View File
File diff suppressed because it is too large Load Diff
+7 -14
View File
@@ -12,18 +12,16 @@
# the nixConfig here only affects the flake itself, not the system configuration!
# for more information, see:
# https://nixos-and-flakes.thiscute.world/nixos-with-flakes/add-custom-cache-servers
# https://nixos-and-flakes.thiscute.world/nix-store/add-binary-cache-servers
nixConfig = {
# substituers will be appended to the default substituters when fetching packages
extra-substituters = [
"https://anyrun.cachix.org"
"https://hyprland.cachix.org"
"https://nix-gaming.cachix.org"
# "https://nixpkgs-wayland.cachix.org"
];
extra-trusted-public-keys = [
"anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="
# "nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
];
@@ -37,11 +35,11 @@
# Official NixOS package source, using nixos's unstable branch by default
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable-small";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05";
# for macos
nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-23.11-darwin";
nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-24.05-darwin";
nix-darwin = {
url = "github:lnl7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs-darwin";
@@ -50,8 +48,8 @@
# home-manager, used for managing user configuration
home-manager = {
# url = "github:nix-community/home-manager/release-23.11";
url = "github:nix-community/home-manager/master";
# url = "github:nix-community/home-manager/release-24.05";
# The `follows` keyword in inputs is used for inheritance.
# Here, `inputs.nixpkgs` of home-manager is kept consistent with the `inputs.nixpkgs` of the current flake,
@@ -60,17 +58,12 @@
};
lanzaboote = {
url = "github:nix-community/lanzaboote/v0.3.0";
url = "github:nix-community/lanzaboote/v0.4.1";
inputs.nixpkgs.follows = "nixpkgs";
};
impermanence.url = "github:nix-community/impermanence";
hyprland = {
url = "github:hyprwm/Hyprland/v0.38.1";
inputs.nixpkgs.follows = "nixpkgs";
};
# community wayland nixpkgs
# nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
# anyrun - a wayland launcher
@@ -96,7 +89,7 @@
nix-gaming.url = "github:fufexan/nix-gaming";
disko = {
url = "github:nix-community/disko";
url = "github:nix-community/disko/v1.6.1";
inputs.nixpkgs.follows = "nixpkgs";
};
+6 -1
View File
@@ -5,17 +5,22 @@
...
}: {
home.packages = with pkgs; [
skopeo
docker-compose
dive # explore docker layers
lazydocker # Docker terminal UI.
skopeo # copy/sync images between registries and local storage
go-containerregistry # provides `crane` & `gcrane`, it's similar to skopeo
kubectl
kubebuilder
istioctl
clusterctl # for kubernetes cluster-api
kubevirt # virtctl
kubernetes-helm
fluxcd
argocd
ko # build go project to container image
];
programs = {
+1 -1
View File
@@ -134,7 +134,7 @@
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
enableNushellIntegration = false;
enableNushellIntegration = true;
};
};
}
+2 -1
View File
@@ -25,7 +25,7 @@
includes = [
{
# use diffrent email & name for work
# use different email & name for work
path = "~/work/.gitconfig";
condition = "gitdir:~/work/";
}
@@ -33,6 +33,7 @@
extraConfig = {
init.defaultBranch = "main";
trim.bases = "develop,master,main"; # for git-trim
push.autoSetupRemote = true;
pull.rebase = true;
+28 -1
View File
@@ -115,6 +115,33 @@ $env.config = {
# buffer_editor: "emacs" # command that will be used to edit the current line buffer with ctrl+o, if unset fallback to $env.EDITOR and $env.VISUAL
bracketed_paste: true # enable bracketed paste, currently useless on windows
edit_mode: emacs # emacs, vi
shell_integration: true # enables terminal markers and a workaround to arrow keys stop working issue
shell_integration: {
# osc2 abbreviates the path if in the home_dir, sets the tab/window title, shows the running command in the tab/window title
osc2: true
# osc7 is a way to communicate the path to the terminal, this is helpful for spawning new tabs in the same directory
osc7: true
# osc8 is also implemented as the deprecated setting ls.show_clickable_links, it shows clickable links in ls output if your terminal supports it. show_clickable_links is deprecated in favor of osc8
osc8: true
# osc9_9 is from ConEmu and is starting to get wider support. It's similar to osc7 in that it communicates the path to the terminal
osc9_9: false
# osc133 is several escapes invented by Final Term which include the supported ones below.
# 133;A - Mark prompt start
# 133;B - Mark prompt end
# 133;C - Mark pre-execution
# 133;D;exit - Mark execution finished with exit code
# This is used to enable terminals to know where the prompt is, the command is, where the command finishes, and where the output of the command is
osc133: true
# osc633 is closely related to osc133 but only exists in visual studio code (vscode) and supports their shell integration features
# 633;A - Mark prompt start
# 633;B - Mark prompt end
# 633;C - Mark pre-execution
# 633;D;exit - Mark execution finished with exit code
# 633;E - NOT IMPLEMENTED - Explicitly set the command line with an optional nonce
# 633;P;Cwd=<path> - Mark the current working directory and communicate it to the terminal
# and also helps with the run recent menu in vscode
osc633: true
# reset_application_mode is escape \x1b[?1l and was added to help ssh work better
reset_application_mode: true
}
render_right_prompt_on_last_line: false # true or false to enable or disable right prompt to be rendered on last line of the prompt.
}
+2 -1
View File
@@ -1,4 +1,4 @@
let
{pkgs-unstable, ...}: let
shellAliases = {
k = "kubectl";
@@ -11,6 +11,7 @@ in {
programs.nushell = {
enable = true;
package = pkgs-unstable.nushell;
configFile.source = ./config.nu;
inherit shellAliases;
};
+1 -2
View File
@@ -10,8 +10,7 @@
package = pkgs-unstable.yazi;
# Changing working directory when exiting Yazi
enableBashIntegration = true;
# TODO: nushellIntegration is broken on release-23.11, wait for master's fix to be released
enableNushellIntegration = false;
enableNushellIntegration = true;
};
xdg.configFile."yazi/theme.toml".source = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-yazi}/mocha.toml";
+3 -3
View File
@@ -1,10 +1,10 @@
{pkgs, ...}: {
home.packages = with pkgs; [
# db related
dbeaver
mitmproxy # http/https proxy tool
insomnia # REST client
wireshark # network analyzer
# IDEs
jetbrains.idea-community
];
}
+1 -1
View File
@@ -54,7 +54,7 @@ Error opening terminal: xterm-kitty.
NixOS preserve the `TERMINFO` and `TERMINFO_DIRS` environment variables, for `root` and the `wheel`
group:
[nixpkgs/nixos/modules/config/terminfo.nix](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/config/terminfo.nix#L18)
[nixpkgs/nixos/modules/config/terminfo.nix](https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/config/terminfo.nix#L18)
For nix-darwin, take a look at <https://github.com/LnL7/nix-darwin/wiki/Terminfo-issues>
+1 -1
View File
@@ -12,7 +12,7 @@
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
stateVersion = "23.11";
stateVersion = "24.05";
};
# Let Home Manager install and manage itself.
+5
View File
@@ -24,6 +24,11 @@
# aliyun
aliyun-cli
# digitalocean
doctl
# google cloud
google-cloud-sdk
# cloud tools that nix do not have cache for.
terraform
terraformer # generate terraform configs from existing cloud resources
+4 -3
View File
@@ -18,8 +18,8 @@
colmena # nixos's remote deployment tool
# db related
mycli
pgcli
pkgs-unstable.mycli
pkgs-unstable.pgcli
mongosh
sqlite
@@ -27,7 +27,7 @@
minicom
# ai related
python311Packages.huggingface-hub # huggingface-cli
pkgs-unstable.python312Packages.huggingface-hub # huggingface-cli
# misc
pkgs-unstable.devbox
@@ -41,6 +41,7 @@
# Automatically trims your branches whose tracking remote refs are merged or gone
# It's really useful when you work on a project for a long time.
git-trim
gitleaks
# need to run `conda-install` before using it
# need to run `conda-shell` before using command `conda`
+1 -1
View File
@@ -30,7 +30,7 @@ Use `:tutor` in helix to start the tutorial.
1. Personally I'm glad to take a look at a Rust codebase, but not a VimScript/Lua codebase.
1. Neovim have a very activate plugin ecosystem, and it's easy to find plugins for almost
everything.
1. Helix is still new, and it even do have a stable plugin system yet. A PR to add a plugin
1. Helix is still new, and it even don't have a stable plugin system yet. A PR to add a plugin
system is still envolving: <https://github.com/helix-editor/helix/pull/8675>
1. Neovim has integrated terminal, and it's very powerful. It's quite similar to VSCode's integrated
terminal. I use it a lot.
+6 -5
View File
@@ -88,7 +88,7 @@ plugin.
### Window Navigation
- Switch between windows: `<Ctrl> + h/j/k/l`
- Resize windows: `<Ctrl> + Up/Down/Left/Right`
- Resize windows: `<Ctrl> + Up/Down/Left/Right` (`<Ctrl-w> + -/+/</>`)
- Note: On macOS, conflicts with system shortcuts
- Disable in System Preferences -> Keyboard -> Shortcuts -> Mission Control
@@ -159,10 +159,11 @@ Provided by mini.surround plugin.
### Miscellaneous
| Action | |
| --------------------- | --------------- |
| Show all Yank History | `:<Space> + yh` |
| Show undo history | `:<Space> + uh` |
| Action | |
| --------------------------------- | --------------- |
| Show all Yank History | `:<Space> + yh` |
| Show undo history | `:<Space> + uh` |
| Show the path of the current file | `:!echo $%` |
## Additional Resources
+6 -2
View File
@@ -30,8 +30,10 @@ in {
viAlias = true;
vimAlias = true;
# currently we use lazy.nvim as neovim's package manager, so comment this one.
# Install packages that will compile locally or download FHS binaries via Nix!
# Currently we use lazy.nvim as neovim's package manager, so comment this one.
#
# NOTE: These plugins will not be used by astronvim by default!
# We should install packages that will compile locally or download FHS binaries via Nix!
# and use lazy.nvim's `dir` option to specify the package directory in nix store.
# so that these plugins can work on NixOS.
#
@@ -40,6 +42,8 @@ in {
plugins = with pkgs.vimPlugins; [
# search all the plugins using https://search.nixos.org/packages
telescope-fzf-native-nvim
nvim-treesitter.withAllGrammars
];
};
};
@@ -3,7 +3,6 @@
-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`)
-- as this provides autocomplete and documentation while editing
---@type LazySpec
return {
"AstroNvim/astrolsp",
@@ -42,40 +41,51 @@ return {
-- end
},
-- enable servers that you already have installed without mason
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
servers = {
---- Frontend & NodeJS
---- Data & Configuration Languages
"jsonls", -- json language server
"jsonnet_ls", -- jsonnet language server
"yamlls", -- yaml language server
"taplo", -- toml language server
"dagger", -- cuelsp - cue language server
"terraformls", -- terraform hcl
"marksman", -- markdown ls
"nickel_ls", -- nickel language server
"nil_ls", -- nix language server
"bufls", -- protocol buffer language server
"dockerls", -- dockerfile
"cmake", -- cmake language server
"sqls", -- sql language server
---- General Purpose Languages
"clangd", -- c/c++
"gopls", -- go
"jdtls", -- java language server, provides only basic features
"rust_analyzer", -- rust
"pyright", -- python
"ruff_lsp", -- extremely fast Python linter and code transformation
-- "julials", -- julia language server
-- "zls", -- zig language server
"lua_ls", -- lua
"bashls", -- bash
"nushell", -- nushell language server
---- Web Development
"tsserver", -- typescript/javascript language server
"tailwindcss", -- tailwindcss language server
"html", -- html language server
"cssls", -- css language server
"prismals", -- prisma language server
"volar", -- vue language server
---- Configuration Language
"marksman", -- markdown ls
"jsonls", -- json language server
"yamlls", -- yaml language server
"taplo", -- toml language server
---- Backend
"lua_ls", -- lua
"gopls", -- go
"rust_analyzer", -- rust
"pyright", -- python
"ruff_lsp", -- extremely fast Python linter and code transformation
"jdtls", -- java
"nil_ls", -- nix language server
"bufls", -- protocol buffer language server
"zls", -- zig language server
---- HDL
"verible", -- verilog language server
---- Operation & Cloud Nativautoindente
"bashls", -- bash
"cmake", -- cmake language server
"clangd", -- c/c++
"dockerls", -- dockerfile
"jsonnet_ls", -- jsonnet language server
"terraformls", -- terraform hcl
"nushell", -- nushell language server
---- Lisp Like
"scheme_langserver", -- scheme language server
"elixirls", -- elixir language server
-- "clojure_lsp", -- clojure language server"
---- Circuit Design
"verible", -- verilog language server
},
-- customize language server configuration options passed to `lspconfig`
---@diagnostic disable: missing-fields
@@ -42,13 +42,14 @@ return {
-- end,
},
{
-- https://docs.astronvim.com/recipes/dap/
"jay-babu/mason-nvim-dap.nvim",
-- mason is unusable on NixOS, disable it.
-- ensure_installed nothing
opts = function(_, opts)
opts.ensure_installed = nil
opts.automatic_installation = false
end,
-- opts = function(_, opts)
-- opts.ensure_installed = nil
-- opts.automatic_installation = false
-- end,
-- overrides `require("mason-nvim-dap").setup(...)`
-- opts = function(_, opts)
@@ -1,26 +1,19 @@
return {
"nvim-orgmode/orgmode",
dependencies = {
{ "nvim-treesitter/nvim-treesitter", lazy = true },
},
event = "VeryLazy",
'nvim-orgmode/orgmode',
event = 'VeryLazy',
ft = { 'org' },
config = function()
-- Load treesitter grammar for org
require("orgmode").setup_ts_grammar()
-- Setup treesitter
require("nvim-treesitter.configs").setup {
highlight = {
enable = true,
additional_vim_regex_highlighting = { "org" },
},
ensure_installed = { "org" },
}
-- Setup orgmode
require("orgmode").setup {
require('orgmode').setup({
org_agenda_files = "~/org/**/*",
org_default_notes_file = "~/org/refile.org",
}
})
-- NOTE: If you are using nvim-treesitter with ~ensure_installed = "all"~ option
-- add ~org~ to ignore_install
require('nvim-treesitter.configs').setup({
ensure_installed = 'all',
ignore_install = { 'org' },
})
end,
}
@@ -3,6 +3,10 @@
---@type LazySpec
return {
"nvim-treesitter/nvim-treesitter",
dependencies = {
-- NOTE: additional parser
{ "nushell/tree-sitter-nu" }, -- nushell scripts
},
opts = function(_, opts)
opts.incremental_selection = {
enable = true,
@@ -13,48 +17,25 @@ return {
node_decremental = "<bs>", -- Backspace
},
}
opts.ignore_install = { "gotmpl" }
opts.ignore_install = { "gotmpl", "wing" }
-- add more things to the ensure_installed table protecting against community packs modifying it
-- https://github.com/nvim-treesitter/nvim-treesitter/tree/master
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, {
-- neovim
"vim",
"lua",
-- operation & cloud native
"dockerfile",
"hcl",
"jsonnet",
"regex",
"terraform",
"nix",
-- please add only the tree-sitters that are not available in nixpkgs here
"kdl",
"csv",
-- other programming language
"xml",
---- Misc
"diff",
"git_config",
"git_rebase",
"gitignore",
"gitcommit",
"latex",
"sql",
-- Lisp like
"fennel",
"clojure",
"commonlisp",
-- customized languages:
"scheme",
"gitattributes",
"ssh_config",
})
-- add support for scheme
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.scheme = {
install_info = {
url = "https://github.com/6cdh/tree-sitter-scheme", -- local path or git repo
files = { "src/parser.c" },
-- optional entries:
branch = "main", -- default branch in case of git repo if different from master
generate_requires_npm = false, -- if stand-alone parser without npm dependencies
requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c
},
}
-- use scheme parser for filetypes: scm
vim.treesitter.language.register("scheme", "scm")
end,
}
+131 -109
View File
@@ -5,129 +5,151 @@
'';
};
home.packages = with pkgs; [
#-- c/c++
cmake
cmake-language-server
gnumake
checkmake
# c/c++ compiler, required by nvim-treesitter!
gcc
# c/c++ tools with clang-tools, the unwrapped version won't
# add alias like `cc` and `c++`, so that it won't conflict with gcc
llvmPackages.clang-unwrapped
lldb
home.packages = with pkgs; (
# -*- Data & Configuration Languages -*-#
[
#-- nix
nil
# rnix-lsp
# nixd
statix # Lints and suggestions for the nix programming language
deadnix # Find and remove unused code in .nix source files
alejandra # Nix Code Formatter
#-- python
nodePackages.pyright # python language server
(python311.withPackages (
ps:
with ps; [
ruff-lsp
black # python formatter
#-- nickel lang
nickel
jupyter
ipython
pandas
requests
pyquery
pyyaml
#-- json like
# terraform # install via brew on macOS
terraform-ls
jsonnet
jsonnet-language-server
taplo # TOML language server / formatter / validator
nodePackages.yaml-language-server
actionlint # GitHub Actions linter
## emacs's lsp-bridge dependenciesge
epc
orjson
sexpdata
six
setuptools
paramiko
rapidfuzz
]
))
#-- dockerfile
hadolint # Dockerfile linter
nodePackages.dockerfile-language-server-nodejs
#-- rust
rust-analyzer
cargo # rust package manager
rustfmt
#-- markdown
marksman # language server for markdown
glow # markdown previewer
pandoc # document converter
hugo # static site generator
#-- nix
nil
# rnix-lsp
# nixd
statix # Lints and suggestions for the nix programming language
deadnix # Find and remove unused code in .nix source files
alejandra # Nix Code Formatter
#-- sql
sqlfluff
#-- golang
go
gomodifytags
iferr # generate error handling code for go
impl # generate function implementation for go
gotools # contains tools like: godoc, goimports, etc.
gopls # go language server
delve # go debugger
#-- protocol buffer
buf # linting and formatting
]
++
#-*- General Purpose Languages -*-#
[
#-- c/c++
cmake
cmake-language-server
gnumake
checkmake
# c/c++ compiler, required by nvim-treesitter!
gcc
gdb
# c/c++ tools with clang-tools, the unwrapped version won't
# add alias like `cc` and `c++`, so that it won't conflict with gcc
# llvmPackages.clang-unwrapped
clang-tools
lldb
# -- java
jdk17
gradle
maven
spring-boot-cli
#-- python
pyright # python language server
(python311.withPackages (
ps:
with ps; [
ruff-lsp
black # python formatter
# debugpy
#-- lua
stylua
lua-language-server
# my commonly used python packages
jupyter
ipython
pandas
requests
pyquery
pyyaml
boto3
#-- bash
nodePackages.bash-language-server
shellcheck
shfmt
## emacs's lsp-bridge dependenciesge
# epc
# orjson
# sexpdata
# six
# setuptools
# paramiko
# rapidfuzz
]
))
#-- javascript/typescript --#
nodePackages.nodejs
nodePackages.typescript
nodePackages.typescript-language-server
# HTML/CSS/JSON/ESLint language servers extracted from vscode
nodePackages.vscode-langservers-extracted
nodePackages."@tailwindcss/language-server"
emmet-ls
#-- rust
rust-analyzer
cargo # rust package manager
rustfmt
# -- Lisp like Languages
guile
racket-minimal
fnlfmt # fennel
#-- golang
go
gomodifytags
iferr # generate error handling code for go
impl # generate function implementation for go
gotools # contains tools like: godoc, goimports, etc.
gopls # go language server
delve # go debugger
#-- Others
taplo # TOML language server / formatter / validator
nodePackages.yaml-language-server
sqlfluff # SQL linter
actionlint # GitHub Actions linter
buf # protoc plugin for linting and formatting
proselint # English prose linter
# -- java
jdk17
gradle
maven
spring-boot-cli
jdt-language-server
#-- Misc
tree-sitter # common language parser/highlighter
nodePackages.prettier # common code formatter
marksman # language server for markdown
glow # markdown previewer
fzf
pandoc # document converter
hugo # static site generator
#-- zig
zls
#-- Optional Requirements:
gdu # disk usage analyzer, required by AstroNvim
(ripgrep.override {withPCRE2 = true;}) # recursively searches directories for a regex pattern
#-- lua
stylua
lua-language-server
#-- CloudNative
nodePackages.dockerfile-language-server-nodejs
# terraform # install via brew on macOS
terraform-ls
jsonnet
jsonnet-language-server
hadolint # Dockerfile linter
#-- bash
nodePackages.bash-language-server
shellcheck
shfmt
]
#-*- Web Development -*-#
++ [
nodePackages.nodejs
nodePackages.typescript
nodePackages.typescript-language-server
# HTML/CSS/JSON/ESLint language servers extracted from vscode
nodePackages.vscode-langservers-extracted
nodePackages."@tailwindcss/language-server"
emmet-ls
]
# -*- Lisp like Languages -*-#
++ [
guile
racket-minimal
fnlfmt # fennel
]
++ [
proselint # English prose linter
#-- zig
zls
#-- verilog / systemverilog
verible
gdb
];
#-- verilog / systemverilog
verible
#-- Optional Requirements:
nodePackages.prettier # common code formatter
fzf
gdu # disk usage analyzer, required by AstroNvim
(ripgrep.override {withPCRE2 = true;}) # recursively searches directories for a regex pattern
]
);
}
+2 -2
View File
@@ -31,9 +31,9 @@ in {
use ${nu_scripts}/share/nu_scripts/custom-completions/cargo/cargo-completions.nu *
use ${nu_scripts}/share/nu_scripts/custom-completions/zellij/zellij-completions.nu *
# alias
use ${nu_scripts}/share/nu_scripts/aliases/git/git-aliases.nu *
# use ${nu_scripts}/share/nu_scripts/aliases/git/git-aliases.nu *
use ${nu_scripts}/share/nu_scripts/aliases/eza/eza-aliases.nu *
# use ${nu_scripts}/share/nu_scripts/aliases/bat/bat-aliases.nu *
use ${nu_scripts}/share/nu_scripts/aliases/bat/bat-aliases.nu *
'';
};
}
-3
View File
@@ -1,3 +0,0 @@
{myvars, ...}: {
home.homeDirectory = "/Users/${myvars.username}";
}
+6 -1
View File
@@ -1,4 +1,9 @@
{mylib, ...}: {
{
mylib,
myvars,
...
}: {
home.homeDirectory = "/Users/${myvars.username}";
imports =
(mylib.scanPaths ./.)
++ [
+3 -3
View File
@@ -1,7 +1,7 @@
{
pkgs,
pkgs-unstable,
pkgs-stable,
# pkgs-stable,
nur-ryan4yin,
...
}: {
@@ -19,7 +19,7 @@
# kicad # 3d printing, eletrical engineering
# fpga
pkgs-unstable.python311Packages.apycula # gowin fpga
pkgs-unstable.python312Packages.apycula # gowin fpga
pkgs-unstable.yosys # fpga synthesis
pkgs-unstable.nextpnr # fpga place and route
pkgs-unstable.openfpgaloader # fpga programming
@@ -30,7 +30,7 @@
# live streaming
obs-studio = {
enable = true;
plugins = with pkgs-stable.obs-studio-plugins; [
plugins = with pkgs.obs-studio-plugins; [
# screen capture
wlrobs
# obs-ndi
+2 -2
View File
@@ -1,5 +1,5 @@
{pkgs, ...}: {
home.packages = with pkgs; [
{pkgs-stable, ...}: {
home.packages = with pkgs-stable; [
# https://joplinapp.org/help/
joplin # joplin-cli
joplin-desktop
+1 -1
View File
@@ -68,7 +68,7 @@
"x-scheme-handler/tg" = ["org.telegram.desktop.desktop "];
"audio/*" = ["mpv.desktop"];
"video/*" = ["mpv.dekstop"];
"video/*" = ["mpv.desktop"];
"image/*" = ["imv-dir.desktop"];
"image/gif" = ["imv-dir.desktop"];
"image/jpeg" = ["imv-dir.desktop"];
@@ -1,5 +1,9 @@
#!/usr/bin/env bash
## Fix anyrun
## https://github.com/anyrun-org/anyrun/issues/153
ln -s $XDG_RUNTIME_DIR/hypr /tmp/hypr
## Autostart Programs
# Kill already running process
+5 -3
View File
@@ -1,11 +1,10 @@
{
pkgs,
lib,
hyprland,
nur-ryan4yin,
...
}: let
package = hyprland.packages.${pkgs.system}.hyprland;
package = pkgs.hyprland;
in {
# NOTE:
# We have to enable hyprland/i3's systemd user service in home-manager,
@@ -30,7 +29,10 @@ in {
};
extraConfig = builtins.readFile ../conf/hyprland.conf;
# gammastep/wallpaper-switcher need this to be enabled.
systemd.enable = true;
systemd = {
enable = true;
variables = ["--all"];
};
};
# NOTE: this executable is used by greetd to start a wayland session when system boot up
@@ -138,6 +138,20 @@ sudo nix --experimental-features "nix-command flakes" run github:nix-community/d
cd ~/nix-config
# install nixos
# NOTE: the root password you set here will be discarded when reboot
sudo nixos-install --root /mnt --flake .#rakushun --no-root-password --show-trace --verbose
# enter into the installed system, check password & users
# `su ryan` => `sudo -i` => enter ryan's password => successfully login
# if login failed, check the password you set in install-1, and try again
nixos-enter
# NOTE: DO NOT skip this step!!!
# copy the essential files into /persistent
# otherwise the / will be cleared and data will lost
## NOTE: impermanence just create links from / to /persistent
## We need to copy files into /persistent manually!!!
mv /etc/machine-id /persistent/etc/
mv /etc/ssh /persistent/etc/
mkdir -p /persistent/home/ryan
chown -R ryan:ryan /persistent/home/ryan
```
+8 -1
View File
@@ -2,7 +2,7 @@
LUKS encrypted SSD for NixOS, on Orange Pi 5 Plus.
Host running storage, operation and maintenance related services:
Storage, operation and maintenance related services are running on this host:
1. Storage such as git server, file server/browser, torrent downloader,, etc.
1. Backup or sync my personal data to cloud or NAS.
@@ -31,3 +31,10 @@ the services.
TODO: create a private PKI for caddy, to achieve end-to-end encryption between caddy and the
services.
## Misc
```bash
# copy closure to another arm64 machine
nix-copy-closure --to root@suzu /run/current-system
```
+13 -1
View File
@@ -1,4 +1,9 @@
{config, ...}: let
{
pkgs,
config,
wallpapers,
...
}: let
hostCommonConfig = ''
encode zstd gzip
tls ${../../certs/ecc-server.crt} ${config.age.secrets."certs/ecc-server.key".path} {
@@ -82,4 +87,11 @@ in {
# directory for virtual machine's images
"d /var/lib/caddy/fileserver/vms 0755 caddy caddy"
];
# Add all my wallpapers into /var/lib/caddy/fileserver/wallpapers
# Install the homepage-dashboard configuration files
system.activationScripts.installCaddyWallpapers = ''
mkdir -p /var/lib/caddy/fileserver/wallpapers
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F644 ${wallpapers}/ /var/lib/caddy/fileserver/wallpapers/
'';
}
+1 -1
View File
@@ -34,5 +34,5 @@ in {
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
system.stateVersion = "24.05"; # Did you read the comment?
}
+2 -1
View File
@@ -43,7 +43,8 @@
name = "encrypted";
settings = {
keyFile = "/dev/disk/by-label/OPI5P_DSC"; # The keyfile is stored on a USB stick
# The maximum size of the keyfile is 8192 bytes
# The maximum size of the keyfile is 8192 KiB
# type `cryptsetup --help` to see the compiled-in key and passphrase maximum sizes
keyFileSize = 512 * 64; # match the `bs * count` of the `dd` command
keyFileOffset = 512 * 128; # match the `bs * skip` of the `dd` command
fallbackToPassword = true;
+1 -1
View File
@@ -1,6 +1,6 @@
{pkgs, ...}: let
in {
# https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/services/misc/gitea.nix
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/misc/gitea.nix
services.gitea = {
enable = true;
user = "gitea";
@@ -1,3 +1 @@
# Homepage for my Homelab
> WIP, just a demo for now
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 MiB

@@ -3,12 +3,12 @@
# https://gethomepage.dev/latest/configs/settings
title: Ryan Yin's Homelab
base: http://home.writefor.fun/
base: https://home.writefor.fun/
favicon: https://thiscute.world/favicon.ico
# https://developer.mozilla.org/en-US/docs/Web/Manifest/start_url
# Used by some browsers to determine the start page of the web application
startUrl: http://home.writefor.fun/
startUrl: https://home.writefor.fun/
language: zh
@@ -20,11 +20,11 @@ providers:
weatherapi: { { HOMEPAGE_VAR_WEATHERAPI_APIKEY } }
background:
image: /images/rolling-girls.png
image: https://file.writefor.fun/wallpapers/rolling-girls.png
blur: sm # sm, "", md, xl... see https://tailwindcss.com/docs/backdrop-blur
saturate: 50 # 0, 50, 100... see https://tailwindcss.com/docs/backdrop-saturate
brightness: 50 # 0, 50, 75... see https://tailwindcss.com/docs/backdrop-brightness
opacity: 50 # 0-100
saturate: 90 # 0, 50, 100... see https://tailwindcss.com/docs/backdrop-saturate
brightness: 90 # 0, 50, 75... see https://tailwindcss.com/docs/backdrop-brightness
opacity: 85 # 0-100
theme: dark # or light
@@ -6,7 +6,7 @@
# install -Dm 600 ${./dashy_conf.yml} /etc/dashy/dashy_conf.yml
# '';
#
# # https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/virtualisation/oci-containers.nix
# # https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/virtualisation/oci-containers.nix
# virtualisation.oci-containers.containers = {
# # check its logs via `journalctl -u podman-dashy`
# dashy = {
+1 -1
View File
@@ -78,7 +78,7 @@
};
};
# https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/services/monitoring/prometheus/exporters/v2ray.nix
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/monitoring/prometheus/exporters/v2ray.nix
# https://github.com/wi1dcard/v2ray-exporter
services.prometheus.exporters.v2ray = {
enable = true;
+1 -1
View File
@@ -3,7 +3,7 @@
sshKeyPath = "/etc/agenix/ssh-key-for-restic-backup";
rcloneConfigFile = "/etc/agenix/rclone-conf-for-restic-backup";
in {
# https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/services/backup/restic.nix
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/backup/restic.nix
services.restic.backups = {
homelab-backup = {
inherit passwordFile;
+2 -2
View File
@@ -7,7 +7,7 @@
name = "transmission";
in {
# the headless Transmission BitTorrent daemon
# https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/services/torrent/transmission.nix
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/torrent/transmission.nix
# https://wiki.archlinux.org/title/transmission
services.transmission = {
enable = true;
@@ -81,7 +81,7 @@ in {
lpd-enabled = true;
# The peer port to listen for incoming connections.
peer-port = 51413;
# Enable UPnP or NAT-PMP to forward a port through your firewall(NAT).
# Enable UOnP or NAT-PMP to forward a port through your firewall(NAT).
# https://github.com/transmission/transmission/blob/main/docs/Port-Forwarding-Guide.md
port-forwarding-enabled = true;
+1 -1
View File
@@ -1,5 +1,5 @@
{
# https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/services/monitoring/uptime-kuma.nix
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/monitoring/uptime-kuma.nix
services.uptime-kuma = {
enable = true;
# https://github.com/louislam/uptime-kuma/wiki/Environment-Variables
+1 -1
View File
@@ -11,7 +11,7 @@
},
"original": {
"owner": "nixos",
"ref": "nixos-23.11",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
@@ -1,6 +1,6 @@
{
# a flake for testing
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
outputs = {nixpkgs, ...}: let
system = "x86_64-linux";
pkgs = import nixpkgs {inherit system;};
+1 -1
View File
@@ -38,5 +38,5 @@ in {
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
system.stateVersion = "24.05"; # Did you read the comment?
}
@@ -37,13 +37,14 @@
"ntfs"
"fat"
"vfat"
"exfat"
];
# clear /tmp on boot to get a stateless /tmp directory.
boot.tmp.cleanOnBoot = true;
boot.initrd = {
# unlocked luks devices via a keyfile or prompt a passphrase.
luks.devices."encrypted-nixos" = {
luks.devices."crypted-nixos" = {
device = "/dev/nvme0n1p4";
# the keyfile(or device partition) that should be used as the decryption key for the encrypted device.
# if not specified, you will be prompted for a passphrase instead.
+15 -1
View File
@@ -137,6 +137,20 @@ sudo nix --experimental-features "nix-command flakes" run github:nix-community/d
cd ~/nix-config
# install nixos
# NOTE: the root password you set here will be discarded when reboot
sudo nixos-install --root /mnt --flake .#suzu --no-root-password --show-trace --verbose
# enter into the installed system, check password & users
# `su ryan` => `sudo -i` => enter ryan's password => successfully login
# if login failed, check the password you set in install-1, and try again
nixos-enter
# NOTE: DO NOT skip this step!!!
# copy the essential files into /persistent
# otherwise the / will be cleared and data will lost
## NOTE: impermanence just create links from / to /persistent
## We need to copy files into /persistent manually!!!
mv /etc/machine-id /persistent/etc/
mv /etc/ssh /persistent/etc/
mkdir -p /persistent/home/ryan
chown -R ryan:ryan /persistent/home/ryan
```
+1 -1
View File
@@ -30,5 +30,5 @@ in {
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
system.stateVersion = "24.05"; # Did you read the comment?
}
+2 -1
View File
@@ -43,7 +43,8 @@
name = "encrypted";
settings = {
keyFile = "/dev/disk/by-label/OPI5_DSC"; # The keyfile is stored on a USB stick
# The maximum size of the keyfile is 8192 bytes
# The maximum size of the keyfile is 8192 KiB
# type `cryptsetup --help` to see the compiled-in key and passphrase maximum sizes
keyFileSize = 512 * 64; # match the `bs * count` of the `dd` command
keyFileOffset = 512 * 128; # match the `bs * skip` of the `dd` command
fallbackToPassword = true;
@@ -63,5 +63,5 @@
socket = "control.socket";
};
system.stateVersion = "23.11";
system.stateVersion = "24.05";
}
@@ -21,7 +21,7 @@
# which is already persistent across reboots(via impermanence.nix)
#
# References:
# https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/services/networking/tailscale.nix
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/networking/tailscale.nix
#
# =============================================================
{
@@ -272,6 +272,12 @@ routing {
domain(geosite:openai) -> sg
domain(regex:'.+\.openai$') -> sg
# Steam
domain(suffix: steampowered.com) -> direct
domain(suffix: steamserver.net) -> direct
domain(geosite:steam@cn) -> direct
domain(geosite:steam) -> proxy
### Media
domain(geosite:netflix) -> media
@@ -66,5 +66,5 @@
socket = "control.socket";
};
system.stateVersion = "23.11";
system.stateVersion = "24.05";
}
@@ -37,7 +37,7 @@ in {
nat.enable = false;
firewall.enable = false;
# https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/services/networking/nftables.nix
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/networking/nftables.nix
nftables = {
enable = true;
# Check the applied rules with `nft -a list ruleset`.
@@ -164,7 +164,7 @@ in {
};
# monitoring with prometheus
# https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/services/monitoring/prometheus/exporters/dnsmasq.nix
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/monitoring/prometheus/exporters/dnsmasq.nix
services.prometheus.exporters.dnsmasq = {
enable = true;
listenAddress = "0.0.0.0";
+1 -1
View File
@@ -40,7 +40,7 @@ zram0 253:0 0 15.6G 0 disk [SWAP]
nvme0n1 259:0 0 1.8T 0 disk
├─nvme0n1p1 259:2 0 598M 0 part /boot
└─nvme0n1p2 259:3 0 1.8T 0 part
└─encrypted-nixos 254:0 0 1.8T 0 crypt /tmp
└─crypted-nixos 254:0 0 1.8T 0 crypt /tmp
/swap/swapfile
/swap
/snapshots
+7 -6
View File
@@ -20,7 +20,9 @@ in {
inherit hostName;
inherit (myvars.networking) defaultGateway nameservers;
inherit (myvars.networking.hostsInterface.${hostName}) interfaces;
networkmanager.enable = false;
# desktop need its cli for status bar
networkmanager.enable = true;
};
# conflict with feature: containerd-snapshotter
@@ -30,6 +32,7 @@ in {
services.xserver.videoDrivers = ["nvidia"]; # will install nvidia-vaapi-driver by default
hardware.nvidia = {
# Optionally, you may need to select the appropriate driver version for your specific GPU.
# https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/os-specific/linux/nvidia-x11/default.nix
# package = config.boot.kernelPackages.nvidiaPackages.stable;
# required by most wayland compositors!
@@ -38,12 +41,10 @@ in {
};
virtualisation.docker.enableNvidia = true; # for nvidia-docker
hardware.opengl = {
hardware.graphics = {
enable = true;
# if hardware.opengl.driSupport is enabled, mesa is installed and provides Vulkan for supported hardware.
driSupport = true;
# needed by nvidia-docker
driSupport32Bit = true;
enable32Bit = true;
};
# This value determines the NixOS release from which the default
@@ -52,5 +53,5 @@ in {
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
system.stateVersion = "24.05"; # Did you read the comment?
}
+2 -1
View File
@@ -40,11 +40,12 @@
"ntfs"
"fat"
"vfat"
"exfat"
];
boot.initrd = {
# unlocked luks devices via a keyfile or prompt a passphrase.
luks.devices."encrypted-nixos" = {
luks.devices."crypted-nixos" = {
# NOTE: DO NOT use device name here(like /dev/sda, /dev/nvme0n1p2, etc), use UUID instead.
# https://github.com/ryan4yin/nix-config/issues/43
device = "/dev/disk/by-uuid/a21ca82a-9ee6-4e5c-9d3f-a93e84e4e0f4";
+1 -1
View File
@@ -34,5 +34,5 @@ in {
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
system.stateVersion = "24.05"; # Did you read the comment?
}
+1 -1
View File
@@ -41,5 +41,5 @@ in {
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
system.stateVersion = "24.05"; # Did you read the comment?
}
+1 -1
View File
@@ -43,5 +43,5 @@ in {
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
system.stateVersion = "24.05"; # Did you read the comment?
}
+5 -2
View File
@@ -50,10 +50,11 @@ sudo nix run --experimental-features "nix-command flakes" 'github:nix-community/
## 1. partition & format the disk via disko
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko hosts/k8s/disko-config/kukubevirt-disko-fs.nix
## 2. install nixos
# NOTE: the root password you set here will be discarded when reboot
sudo nixos-install --root /mnt --no-root-password --show-trace --verbose --flake .#kubevirt-shoryu
# move the essential files into /persistent
# enter into the installed system, check password & users
# `su ryan` => `sudo -i` => enter ryan's password => successfully login
# if login failed, check the password you set in install-1, and try again
nixos-enter
# NOTE: DO NOT skip this step!!!
@@ -63,4 +64,6 @@ nixos-enter
## We need to copy files into /persistent manually!!!
mv /etc/machine-id /persistent/etc/
mv /etc/ssh /persistent/etc/
mkdir -p /persistent/home/ryan
chown -R ryan:ryan /persistent/home/ryan
```
+2 -1
View File
@@ -49,7 +49,8 @@
name = "encrypted";
settings = {
keyFile = "/dev/disk/by-label/NIXOS_DSC"; # The keyfile is stored on a USB stick
# The maximum size of the keyfile is 8192 bytes
# The maximum size of the keyfile is 8192 KiB
# type `cryptsetup --help` to see the compiled-in key and passphrase maximum sizes
keyFileSize = 512 * 64; # match the `bs * count` of the `dd` command
keyFileOffset = 512 * 128; # match the `bs * skip` of the `dd` command
fallbackToPassword = true;
+3 -1
View File
@@ -27,8 +27,10 @@ in {
kubernetes-helm
cilium-cli
fluxcd
clusterctl # for kubernetes cluster-api
skopeo
skopeo # copy/sync images between registries and local storage
go-containerregistry # provides `crane` & `gcrane`, it's similar to skopeo
dive # explore docker layers
];
+1 -1
View File
@@ -40,5 +40,5 @@ in {
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
system.stateVersion = "24.05"; # Did you read the comment?
}
+1 -1
View File
@@ -99,5 +99,5 @@ in {
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
system.stateVersion = "24.05"; # Did you read the comment?
}
+2 -9
View File
@@ -9,7 +9,7 @@
specialArgs ? (genSpecialArgs system),
...
}: let
inherit (inputs) nixpkgs home-manager nix-darwin;
inherit (inputs) nixpkgs-darwin home-manager nix-darwin;
in
nix-darwin.lib.darwinSystem {
inherit system specialArgs;
@@ -17,14 +17,7 @@ in
darwin-modules
++ [
({lib, ...}: {
nixpkgs.pkgs = import nixpkgs {inherit system;};
# make `nix run nixpkgs#nixpkgs` use the same nixpkgs as the one used by this flake.
nix.registry.nixpkgs.flake = nixpkgs;
environment.etc."nix/inputs/nixpkgs".source = "${nixpkgs}";
# make `nix repl '<nixpkgs>'` use the same nixpkgs as the one used by this flake.
# discard all the default paths, and only use the one from this flake.
nix.nixPath = lib.mkForce ["/etc/nix/inputs"];
nixpkgs.pkgs = import nixpkgs-darwin {inherit system;};
})
]
++ (
+10 -2
View File
@@ -15,6 +15,10 @@
../certs/ecc-ca.crt
];
# auto upgrade nix to the unstable version
# https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/tools/package-management/nix/default.nix#L284
nix.package = pkgs.nixVersions.latest;
environment.systemPackages = with pkgs; [
git # used by nix flakes
git-lfs # used by huggingface models
@@ -23,7 +27,7 @@
zip
xz
zstd
unzip
unzipNLS
p7zip
# Text Processing
@@ -88,18 +92,22 @@
substituters = [
# cache mirror located in China
# status: https://mirror.sjtu.edu.cn/
# "https://mirror.sjtu.edu.cn/nix-channels/store"
"https://mirror.sjtu.edu.cn/nix-channels/store"
# status: https://mirrors.ustc.edu.cn/status/
"https://mirrors.ustc.edu.cn/nix-channels/store"
"https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store"
"https://nix-community.cachix.org"
# my own cache server
"https://ryan4yin.cachix.org"
# cuda-maintainer's cache server
"https://cuda-maintainers.cachix.org"
];
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"ryan4yin.cachix.org-1:Gbk27ZU5AYpGS9i3ssoLlwdvMIh0NxG0w8it/cv9kbU="
"cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
];
builders-use-substitutes = true;
};
+4 -3
View File
@@ -2,6 +2,7 @@
config,
lib,
pkgs,
pkgs-unstable,
...
}:
##########################################################################
@@ -80,7 +81,7 @@ in {
programs.zsh.enable = true;
environment.shells = [
pkgs.zsh
pkgs.nushellFull # my custom shell
pkgs-unstable.nushell # my custom shell
];
# homebrew need to be installed manually, see https://brew.sh
@@ -103,7 +104,7 @@ in {
Wechat = 836500024;
QQ = 451108668;
WeCom = 1189898970; # Wechat for Work
TecentMetting = 1484048379;
TecentMeeting = 1484048379;
QQMusic = 595615424;
};
@@ -164,7 +165,7 @@ in {
# Misc
"shadowsocksx-ng" # proxy tool
"iina" # video player
"raycast" # (HotKey: alt/option + space)search, caculate and run scripts(with many plugins)
"raycast" # (HotKey: alt/option + space)search, calculate and run scripts(with many plugins)
"stats" # beautiful system status monitor in menu bar
# "reaper" # audio editor
"sonic-pi" # music programming
+15 -4
View File
@@ -1,4 +1,8 @@
{pkgs, ...}: {
{
lib,
nixpkgs,
...
}: {
###################################################################################
#
# Core configuration for nix-darwin
@@ -7,7 +11,7 @@
# https://daiderd.com/nix-darwin/manual/index.html#sec-options
#
# History Issues:
# 1. Fixed by replace the determinated nix-installer by the official one:
# 1. Fixed by replace the determined nix-installer by the official one:
# https://github.com/LnL7/nix-darwin/issues/149#issuecomment-1741720259
#
###################################################################################
@@ -15,9 +19,8 @@
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# Auto upgrade nix package and the daemon service.
# Auto upgrade the nix-daemon service.
services.nix-daemon.enable = true;
nix.package = pkgs.nix;
# Disable auto-optimise-store because of this issue:
# https://github.com/NixOS/nix/issues/7273
@@ -25,4 +28,12 @@
nix.settings.auto-optimise-store = false;
nix.gc.automatic = false;
# make `nix run nixpkgs#nixpkgs` use the same nixpkgs as the one used by this flake.
nix.registry.nixpkgs.flake = nixpkgs;
environment.etc."nix/inputs/nixpkgs".source = "${nixpkgs}";
# make `nix repl '<nixpkgs>'` use the same nixpkgs as the one used by this flake.
# discard all the default paths, and only use the one from this flake.
nix.nixPath = lib.mkForce ["/etc/nix/inputs"];
}
+6 -10
View File
@@ -13,12 +13,14 @@
# 1. To avoid conflicts with neovim, disable ctrl + up/down/left/right to switch spaces in:
# [System Preferences] -> [Keyboard] -> [Keyboard Shortcuts] -> [Mission Control]
# 2. Disable use Caps Lock as 中/英 switch in:
# [System Preferences] -> [Keyboard] -> [Input Sources] -> [Edit] -> [Use 中/英 key to switch ] -> [Disble]
# [System Preferences] -> [Keyboard] -> [Input Sources] -> [Edit] -> [Use 中/英 key to switch ] -> [Disable]
###################################################################################
{
# Add ability to used TouchID for sudo authentication
security.pam.enableSudoTouchIdAuth = true;
time.timeZone = "Asia/Shanghai";
system = {
# activationScripts are executed every time you boot the system or run `nixos-rebuild` / `darwin-rebuild`.
activationScripts.postUserActivation.text = ''
@@ -118,7 +120,7 @@
DSDontWriteUSBStores = true;
};
"com.apple.spaces" = {
"spans-displays" = 0; # Display have seperate spaces
"spans-displays" = 0; # Display have separate spaces
};
"com.apple.WindowManager" = {
EnableStandardClickToShowDesktop = 0; # Click wallpaper to reveal desktop
@@ -183,13 +185,7 @@
# Fonts
fonts = {
# will be removed after this PR is merged:
# https://github.com/LnL7/nix-darwin/pull/754
fontDir.enable = true;
# will change to `fonts.packages` after this PR is merged:
# https://github.com/LnL7/nix-darwin/pull/754
fonts = with pkgs; [
packages = with pkgs; [
# packages = with pkgs; [
# icon fonts
material-design-icons
@@ -202,7 +198,7 @@
source-han-serif # 思源宋体
# nerdfonts
# https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/data/fonts/nerdfonts/shas.nix
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/pkgs/data/fonts/nerdfonts/shas.nix
(nerdfonts.override {
fonts = [
# symbols icon only
+1 -22
View File
@@ -1,34 +1,13 @@
{
pkgs,
config,
lib,
myvars,
pkgs-unstable,
...
}: let
homeDir = config.users.users."${myvars.username}".home;
in {
# https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/os-specific/darwin/yabai/default.nix
# https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/by-name/ya/yabai/package.nix
services.yabai = {
enable = true;
# temporary workaround for https://github.com/ryan4yin/nix-config/issues/51
package = pkgs-unstable.yabai.overrideAttrs (oldAttrs: rec {
version = "6.0.7";
src =
if pkgs.stdenv.isAarch64
then
(pkgs.fetchzip {
url = "https://github.com/koekeishiya/yabai/releases/download/v${version}/yabai-v${version}.tar.gz";
hash = "sha256-hZMBXSCiTlx/37jt2yLquCQ8AZ2LS3heIFPKolLub1c=";
})
else
(pkgs.fetchFromGitHub {
owner = "koekeishiya";
repo = "yabai";
rev = "v${version}";
hash = "sha256-vWL2KA+Rhj78I2J1kGItJK+OdvhVo1ts0NoOHIK65Hg=";
});
});
# Whether to enable yabai's scripting-addition.
# SIP must be disabled for this to work.
+15 -5
View File
@@ -18,12 +18,19 @@
services.btrbk.instances.btrbk = {
# How often this btrbk instance is started. See systemd.time(7) for more information about the format.
onCalendar = "daily";
onCalendar = "Tue,Fri,Sat,Sun *-*-* 3:45:20"; # daily at 3:45, except on Monday, Wednesday, and Thursday
settings = {
# keep daily snapshots for 14 days
snapshot_preserve = "14d";
# keep all snapshots for 2 days, no matter how frequently you (or your cron job) run btrbk
# how to prune local snapshots:
# 1. keep daily snapshots for xx days
snapshot_preserve = "9d";
# 2. keep all snapshots for 2 days, no matter how frequently you (or your cron job) run btrbk
snapshot_preserve_min = "2d";
# hot to prune remote incremental baqckups:
# keep daily backups for 9 days, weekly backups for 4 weeks, and monthly backups for 2 months
target_preserve = "9d 4w 2m";
target_preserve_min = "no";
volume = {
"/btr_pool" = {
subvolume = {
@@ -31,7 +38,10 @@
snapshot_create = "always";
};
};
target = "/snapshots";
# backup to a remote server or a local directory
# its prune policy is defined by `target_preserve` and `target_preserve_min`
# target = "/snapshots";
};
};
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
# enable the node exporter on all nixos hosts
# https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/services/monitoring/prometheus/exporters/node.nix
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/monitoring/prometheus/exporters/node.nix
services.prometheus.exporters.node = {
enable = true;
listenAddress = "0.0.0.0";
-8
View File
@@ -17,13 +17,5 @@
# https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-auto-optimise-store
nix.settings.auto-optimise-store = true;
# make `nix run nixpkgs#nixpkgs` use the same nixpkgs as the one used by this flake.
nix.registry.nixpkgs.flake = nixpkgs;
nix.channel.enable = false; # remove nix-channel related tools & configs, we use flakes instead.
# but NIX_PATH is still used by many useful tools, so we set it to the same value as the one used by this flake.
# Make `nix repl '<nixpkgs>'` use the same nixpkgs as the one used by this flake.
environment.etc."nix/inputs/nixpkgs".source = "${nixpkgs}";
# https://github.com/NixOS/nix/issues/9574
nix.settings.nix-path = lib.mkForce "nixpkgs=/etc/nix/inputs/nixpkgs";
}
+1 -1
View File
@@ -23,6 +23,6 @@
};
# Add terminfo database of all known terminals to the system profile.
# https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/config/terminfo.nix
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/config/terminfo.nix
environment.enableAllTerminfo = true;
}
+1 -1
View File
@@ -25,7 +25,7 @@
source-han-serif # 思源宋体
# nerdfonts
# https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/data/fonts/nerdfonts/shas.nix
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/pkgs/data/fonts/nerdfonts/shas.nix
(nerdfonts.override {
fonts = [
# symbols icon only
+2 -1
View File
@@ -2,12 +2,13 @@
config,
lib,
pkgs,
pkgs-unstable,
...
}: {
# add user's shell into /etc/shells
environment.shells = with pkgs; [
bashInteractive
nushellFull
pkgs-unstable.nushell
];
# set user's default shell system-wide
users.defaultUserShell = pkgs.bashInteractive;
-2
View File
@@ -24,8 +24,6 @@
};
# rtkit is optional but recommended
security.rtkit.enable = true;
# Remove sound.enable or turn it off if you had it set previously, it seems to cause conflicts with pipewire
sound.enable = false;
# Disable pulseaudio, it conflicts with pipewire too.
hardware.pulseaudio.enable = false;
@@ -3,11 +3,11 @@
mylib,
...
}: {
imports = mylib.scanPaths ./.;
environment.systemPackages = with pkgs; [
waypipe
moonlight-qt # moonlight client, for streaming games/desktop from a PC
rustdesk # p2p remote desktop
];
# imports = mylib.scanPaths ./.;
#
# environment.systemPackages = with pkgs; [
# waypipe
# moonlight-qt # moonlight client, for streaming games/desktop from a PC
# rustdesk # p2p remote desktop
# ];
}
@@ -25,7 +25,7 @@
# which is already persistent across reboots(via impermanence.nix)
#
# References:
# https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/services/networking/tailscale.nix
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/networking/tailscale.nix
#
# =============================================================
{
+4 -4
View File
@@ -98,7 +98,7 @@ cryptsetup luksFormat --type luks2 --cipher aes-xts-plain64 --hash sha512 --iter
cryptsetup luksDump /dev/nvme0n1p2
# open(unlock) the device with the passphrase you just set
cryptsetup luksOpen /dev/nvme0n1p2 encrypted-nixos
cryptsetup luksOpen /dev/nvme0n1p2 crypted-nixos
# show disk status
lsblk
@@ -110,7 +110,7 @@ Formatting the root partition:
# NOTE: `cat shoukei.md | grep create-btrfs > btrfs.sh` to generate this script
mkfs.fat -F 32 -n ESP /dev/nvme0n1p1 # create-btrfs
# format the root partition with btrfs and label it
mkfs.btrfs -L encrypted-nixos /dev/mapper/crypted-nixos # create-btrfs
mkfs.btrfs -L crypted-nixos /dev/mapper/crypted-nixos # create-btrfs
# mount the root partition and create subvolumes
mount /dev/mapper/crypted-nixos /mnt # create-btrfs
@@ -130,7 +130,7 @@ umount /mnt # create-btrfs
# 1. Extend the life of the SSD.
# 2. improve the performance of disks with low IOPS / RW throughput, such as HDD and SATA SSD.
# 2. Save the disk space.
mkdir /mnt/{nix,tmp,swap,persistent,snapshots,boot} # mount-1
mkdir /mnt/{nix,gnu,tmp,swap,persistent,snapshots,boot} # mount-1
mount -o compress-force=zstd:1,noatime,subvol=@nix /dev/mapper/crypted-nixos /mnt/nix # mount-1
mount -o compress-force=zstd:1,noatime,subvol=@guix /dev/mapper/crypted-nixos /mnt/gnu # mount-1
mount -o compress-force=zstd:1,subvol=@tmp /dev/mapper/crypted-nixos /mnt/tmp # mount-1
@@ -162,7 +162,7 @@ $ lsblk
nvme0n1 259:0 0 1.8T 0 disk
├─nvme0n1p1 259:2 0 600M 0 part /mnt/boot
└─nvme0n1p2 259:3 0 1.8T 0 part
└─encrypted-nixos 254:0 0 1.8T 0 crypt /mnt/swap
└─crypted-nixos 254:0 0 1.8T 0 crypt /mnt/swap
/mnt/persistent
/mnt/snapshots
/mnt/nix
+3 -3
View File
@@ -79,7 +79,7 @@ cryptsetup luksFormat --type luks2 --cipher aes-xts-plain64 --hash sha512 --iter
cryptsetup luksDump /dev/nvme0n1p4
# open(unlock) the device with the passphrase you just set
cryptsetup luksOpen /dev/nvme0n1p4 encrypted-nixos
cryptsetup luksOpen /dev/nvme0n1p4 crypted-nixos
# show disk status
lsblk
@@ -90,7 +90,7 @@ Formatting the root partition:
```bash
# NOTE: `cat shoukei.md | egrep "create-btrfs" > create-btrfs.sh` to generate this script
# format the root partition with btrfs and label it
mkfs.btrfs -L encrypted-nixos /dev/mapper/crypted-nixos # create-btrfs
mkfs.btrfs -L crypted-nixos /dev/mapper/crypted-nixos # create-btrfs
# mount the root partition and create subvolumes
mount /dev/mapper/crypted-nixos /mnt # create-btrfs
btrfs subvolume create /mnt/@nix # create-btrfs
@@ -139,7 +139,7 @@ $ lsblk
nvme0n1 259:0 0 1.8T 0 disk
├─nvme0n1p1 259:2 0 600M 0 part /mnt/boot
└─nvme0n1p4 259:3 0 1.8T 0 part
└─encrypted-nixos 254:0 0 1.8T 0 crypt /mnt/swap
└─crypted-nixos 254:0 0 1.8T 0 crypt /mnt/swap
/mnt/persistent
/mnt/snapshots
/mnt/nix
+1 -1
View File
@@ -18,5 +18,5 @@
networkmanager.enable = true;
defaultGateway = "192.168.5.101";
};
system.stateVersion = "23.11";
system.stateVersion = "24.05";
}
+1 -1
View File
@@ -40,7 +40,7 @@
},
"original": {
"owner": "nixos",
"ref": "nixos-23.11",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
+15 -3
View File
@@ -2,20 +2,27 @@
description = "NixOS configuration of Ryan Yin";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
impermanence.url = "github:nix-community/impermanence";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
nuenv.url = "github:DeterminateSystems/nuenv";
};
outputs = inputs @ {
nixpkgs,
nixos-hardware,
nuenv,
...
}: {
nixosConfigurations = {
ai = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = inputs // {myvars.username = "ryan";};
specialArgs =
inputs
// {
myvars.username = "ryan";
myvars.userfullname = "Ryan Yin";
};
modules = [
{networking.hostName = "ai";}
@@ -33,7 +40,12 @@
shoukei = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = inputs // {myvars.username = "ryan";};
specialArgs =
inputs
// {
myvars.username = "ryan";
myvars.userfullname = "Ryan Yin";
};
modules = [
# Building on a USB installer is buggy, lack of disk space, memory, trublesome to setup substituteers, etc.
# so we disable apple-t2 module here to avoid build kernel during the initial installation, and enable it after the first boot.
+42 -25
View File
@@ -4,39 +4,56 @@
https://github.com/NixOS/nix/issues/1472#issuecomment-1532955973
"""
import os
import plistlib
import shlex
import subprocess
from pathlib import Path
NIX_DAEMON_PLIST = Path("/Library/LaunchDaemons/org.nixos.nix-daemon.plist")
NIX_DAEMON_NAME = "org.nixos.nix-daemon"
# http proxy provided by my homelab's bypass router
HTTP_PROXY = "http://192.168.5.103:7890"
pl = plistlib.loads(NIX_DAEMON_PLIST.read_bytes())
# set http/https proxy
# NOTE: curl only accept the lowercase of `http_proxy`!
# NOTE: https://curl.se/libcurl/c/libcurl-env.html
# pl["EnvironmentVariables"]["http_proxy"] = HTTP_PROXY
# pl["EnvironmentVariables"]["https_proxy"] = HTTP_PROXY
# remove http proxy
pl["EnvironmentVariables"].pop("http_proxy", None)
pl["EnvironmentVariables"].pop("https_proxy", None)
os.chmod(NIX_DAEMON_PLIST, 0o644)
NIX_DAEMON_PLIST.write_bytes(plistlib.dumps(pl))
os.chmod(NIX_DAEMON_PLIST, 0o444)
# reload the plist
for cmd in (
HTTP_PROXY = "http://192.168.5.179:7890"
PLIST = plistlib.loads(NIX_DAEMON_PLIST.read_bytes())
def update_plist():
os.chmod(NIX_DAEMON_PLIST, 0o644)
NIX_DAEMON_PLIST.write_bytes(plistlib.dumps(PLIST))
os.chmod(NIX_DAEMON_PLIST, 0o444)
def reload_daemon():
# reload the plist
for cmd in (
f"launchctl unload {NIX_DAEMON_PLIST}",
f"launchctl load {NIX_DAEMON_PLIST}",
):
print(cmd)
subprocess.run(shlex.split(cmd), capture_output=False)
):
print(cmd)
subprocess.run(shlex.split(cmd), capture_output=False)
def set_proxy():
# set http/https proxy
# NOTE: curl only accept the lowercase of `http_proxy`!
# NOTE: https://curl.se/libcurl/c/libcurl-env.html
PLIST["EnvironmentVariables"]["http_proxy"] = HTTP_PROXY
PLIST["EnvironmentVariables"]["https_proxy"] = HTTP_PROXY
update_plist()
reload_daemon()
def unset_proxy():
# remove http proxy
PLIST["EnvironmentVariables"].pop("http_proxy", None)
PLIST["EnvironmentVariables"].pop("https_proxy", None)
update_plist()
reload_daemon()
if __name__ == "__main__":
# set_proxy()
unset_proxy()
+7 -1
View File
@@ -30,7 +30,13 @@ This task is accomplished using the [agenix](https://github.com/ryantm/agenix) C
To use agenix temporarily, run:
```bash
nix shell nixpkgs#agenix
nix shell github:ryantm/agenix#agenix
```
or agenix provided by ragenix, run:
```bash
nix shell github:ryan4yin/ragenix#ragenix
```
Suppose you want to add a new secret file `xxx.age`. Follow these steps:
+1 -1
View File
@@ -54,7 +54,7 @@ export def darwin-rollback [] {
./result/sw/bin/darwin-rebuild --rollback
}
# ==================== Virutal Machines related =====================
# ==================== Virtual Machines related =====================
# Build and upload a VM image
export def upload-vm [