diff --git a/.gitignore b/.gitignore index 249099f..66ecee4 100644 --- a/.gitignore +++ b/.gitignore @@ -16,5 +16,6 @@ !profiles/ !modules/ !docs/ +!images/ !/flake/ diff --git a/AGENTS.md b/AGENTS.md index 6b39828..9611f51 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -17,3 +17,94 @@ nix fmt - User: `moons`, locale: `ja_JP.UTF-8`, timezone: `Asia/Tokyo` - Commits: conventional commits (`feat:`, `chore:`, `fix:`, etc.) - リモート: `git@github.com:moons-14/dotfiles.git` +- `modules/system/` や `modules/applications/` に新しいファイルを追加した際は、必ず同ディレクトリの `default.nix` の `imports` に追加する +- `environment.systemPackages` にパッケージを追加する際は、パッケージ名の横に簡単な説明をコメントで追加する + +## Module Structure + +### `modules/system/` + +システムレベル(NixOS)の設定。OS 全体に影響する設定を配置する。 + +- 例: boot, hardware, network, user, locale, fonts, power, secure-boot, caches, gc, version + +### `modules/applications/` + +アプリケーション固有の設定。ユーザーが個別に有効/無効を切り替えたいアプリケーションを配置する。 + +- 例: niri, noctalia, greetd, fcitx5, kde, wayland + +### Module Pattern + +`modules/system/` と `modules/applications/` のモジュールは、デフォルトで `config.my.*` namespace で有効/無効を切り替えられる仕組みにする。 + +#### Simple Module (NixOS のみ) + +home-manager の設定を含まないモジュール: + +```nix +{ + lib, + config, + ... +}: +let + cfg = config.my..; +in +{ + options.my.. = { + enable = lib.mkEnableOption ""; + }; + + config = lib.mkIf cfg.enable { + # configuration here + }; +} +``` + +- `my.system.*` — system モジュール用 +- `my.applications.*` — applications モジュール用 + +#### Complex Module (NixOS + Home Manager) + +home-manager の設定も含むモジュールは3つのフラグを設定する: + +``` +modules/applications// +├── default.nix # my.applications..enable (マスター) +├── system.nix # my.applications..system.enable +├── home.nix # my.applications..homeManager.enable +└── (other files) # 設定ファイル等 +``` + +`default.nix`: + +```nix +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.; +in +{ + options.my.applications. = { + enable = lib.mkEnableOption ""; + system.enable = lib.mkEnableOption " system configuration"; + homeManager.enable = lib.mkEnableOption " home-manager configuration"; + }; + + imports = [ + ./system.nix + ./home.nix + ]; + + config = lib.mkIf cfg.enable { + my.applications..system.enable = lib.mkDefault true; + my.applications..homeManager.enable = lib.mkDefault true; + }; +} +``` + +マスターの `enable` を有効にすると、`lib.mkDefault` で system と homeManager の両方が有効化される。個別に無効化も可能。 diff --git a/flake.lock b/flake.lock index e3d50e1..1160ba5 100644 --- a/flake.lock +++ b/flake.lock @@ -68,6 +68,64 @@ "type": "github" } }, + "blueprint": { + "inputs": { + "nixpkgs": [ + "llm-agents", + "nixpkgs" + ], + "systems": [ + "llm-agents", + "systems" + ] + }, + "locked": { + "lastModified": 1776249299, + "narHash": "sha256-Dt9t1TGRmJFc0xVYhttNBD6QsAgHOHCArqGa0AyjrJY=", + "owner": "numtide", + "repo": "blueprint", + "rev": "56131e8628f173d24a27f6d27c0215eff57e40dd", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "blueprint", + "type": "github" + } + }, + "bun2nix": { + "inputs": { + "flake-parts": [ + "llm-agents", + "flake-parts" + ], + "nixpkgs": [ + "llm-agents", + "nixpkgs" + ], + "systems": [ + "llm-agents", + "systems" + ], + "treefmt-nix": [ + "llm-agents", + "treefmt-nix" + ] + }, + "locked": { + "lastModified": 1778446047, + "narHash": "sha256-oQvcadh2BCkrog+SGrG6YffKJrveYpjj3TdQJWaKhaM=", + "owner": "nix-community", + "repo": "bun2nix", + "rev": "f2bc12af1a6369648aac41041ceeaa0b866599c6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "bun2nix", + "type": "github" + } + }, "crane": { "locked": { "lastModified": 1779130139, @@ -200,7 +258,7 @@ "flake-parts_2": { "inputs": { "nixpkgs-lib": [ - "nixvim", + "llm-agents", "nixpkgs" ] }, @@ -219,6 +277,27 @@ } }, "flake-parts_3": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1778716662, + "narHash": "sha256-m1Yf0wZ8j1OHjTc2UwHwyQRSnNeSgLJOd7q5Y45hzi4=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f7c1a2d347e4c52d5fb8d10cb4d94b5884e546fb", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_4": { "inputs": { "nixpkgs-lib": [ "stylix", @@ -422,11 +501,34 @@ "type": "github" } }, + "llm-agents": { + "inputs": { + "blueprint": "blueprint", + "bun2nix": "bun2nix", + "flake-parts": "flake-parts_2", + "nixpkgs": "nixpkgs_3", + "systems": "systems_2", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1780119579, + "narHash": "sha256-EnWR9fQzTfmIkyWD8ynYdAM573x3wzkOzZuMagrEosQ=", + "owner": "numtide", + "repo": "llm-agents.nix", + "rev": "b8adcd1a8e45e6d84f511c1a3b12998634481204", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "llm-agents.nix", + "type": "github" + } + }, "niri-flake": { "inputs": { "niri-stable": "niri-stable", "niri-unstable": "niri-unstable", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_4", "nixpkgs-stable": "nixpkgs-stable", "xwayland-satellite-stable": "xwayland-satellite-stable", "xwayland-satellite-unstable": "xwayland-satellite-unstable" @@ -497,7 +599,7 @@ "nixos-wsl": { "inputs": { "flake-compat": "flake-compat_4", - "nixpkgs": "nixpkgs_4" + "nixpkgs": "nixpkgs_5" }, "locked": { "lastModified": 1777732699, @@ -590,6 +692,22 @@ } }, "nixpkgs_3": { + "locked": { + "lastModified": 1779955849, + "narHash": "sha256-31mhzm2HpzRr/rupWAFfWBmt9SUjzwr5+giv5Nmb/rA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a2c6938835fca96e4a10c8561d461efd2f91d04f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { "locked": { "lastModified": 1779560665, "narHash": "sha256-tpyBcxPpcQb8ukyNF7DoCwfSY3VPsxHoYwj00Cayv5o=", @@ -605,7 +723,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_5": { "locked": { "lastModified": 1776169885, "narHash": "sha256-l/iNYDZ4bGOAFQY2q8y5OAfBBtrDAaPuRQqWaFHVRXM=", @@ -621,7 +739,7 @@ "type": "github" } }, - "nixpkgs_5": { + "nixpkgs_6": { "locked": { "lastModified": 1779622335, "narHash": "sha256-ViA62qtL5za7V3d5I8OA9q9JcFhsVAiL5jVHwEclWqk=", @@ -637,7 +755,7 @@ "type": "github" } }, - "nixpkgs_6": { + "nixpkgs_7": { "locked": { "lastModified": 1770107345, "narHash": "sha256-tbS0Ebx2PiA1FRW8mt8oejR0qMXmziJmPaU1d4kYY9g=", @@ -653,7 +771,7 @@ "type": "github" } }, - "nixpkgs_7": { + "nixpkgs_8": { "locked": { "lastModified": 1772542754, "narHash": "sha256-WGV2hy+VIeQsYXpsLjdr4GvHv5eECMISX1zKLTedhdg=", @@ -671,11 +789,11 @@ }, "nixvim": { "inputs": { - "flake-parts": "flake-parts_2", + "flake-parts": "flake-parts_3", "nixpkgs": [ "nixpkgs" ], - "systems": "systems_2" + "systems": "systems_3" }, "locked": { "lastModified": 1779816597, @@ -718,8 +836,8 @@ "noctalia", "nixpkgs" ], - "systems": "systems_3", - "treefmt-nix": "treefmt-nix" + "systems": "systems_4", + "treefmt-nix": "treefmt-nix_2" }, "locked": { "lastModified": 1779588472, @@ -810,18 +928,19 @@ "git-hooks-nix": "git-hooks-nix", "home-manager": "home-manager_2", "lanzaboote": "lanzaboote", + "llm-agents": "llm-agents", "niri-flake": "niri-flake", "nixos-hardware": "nixos-hardware", "nixos-wsl": "nixos-wsl", - "nixpkgs": "nixpkgs_5", + "nixpkgs": "nixpkgs_6", "nixpkgs-unstable": "nixpkgs-unstable", "nixvim": "nixvim", "noctalia": "noctalia", "quickshell": "quickshell", "services-flake": "services-flake", "stylix": "stylix", - "systems": "systems_5", - "treefmt-nix": "treefmt-nix_2", + "systems": "systems_6", + "treefmt-nix": "treefmt-nix_3", "vicinae": "vicinae", "vicinae-extensions": "vicinae-extensions" } @@ -869,13 +988,13 @@ "base16-helix": "base16-helix", "base16-vim": "base16-vim", "firefox-gnome-theme": "firefox-gnome-theme", - "flake-parts": "flake-parts_3", + "flake-parts": "flake-parts_4", "gnome-shell": "gnome-shell", "nixpkgs": [ "nixpkgs" ], "nur": "nur", - "systems": "systems_4", + "systems": "systems_5", "tinted-kitty": "tinted-kitty", "tinted-schemes": "tinted-schemes", "tinted-tmux": "tinted-tmux", @@ -928,20 +1047,35 @@ }, "systems_3": { "locked": { - "lastModified": 1689347949, - "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", "owner": "nix-systems", - "repo": "default-linux", - "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", "type": "github" }, "original": { "owner": "nix-systems", - "repo": "default-linux", + "repo": "default", "type": "github" } }, "systems_4": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "systems_5": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -956,7 +1090,7 @@ "type": "github" } }, - "systems_5": { + "systems_6": { "locked": { "lastModified": 1689347949, "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", @@ -971,7 +1105,7 @@ "type": "github" } }, - "systems_6": { + "systems_7": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -986,7 +1120,7 @@ "type": "github" } }, - "systems_7": { + "systems_8": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -1068,8 +1202,7 @@ "treefmt-nix": { "inputs": { "nixpkgs": [ - "noctalia", - "noctalia-qs", + "llm-agents", "nixpkgs" ] }, @@ -1089,7 +1222,29 @@ }, "treefmt-nix_2": { "inputs": { - "nixpkgs": "nixpkgs_6" + "nixpkgs": [ + "noctalia", + "noctalia-qs", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1775636079, + "narHash": "sha256-pc20NRoMdiar8oPQceQT47UUZMBTiMdUuWrYu2obUP0=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "790751ff7fd3801feeaf96d7dc416a8d581265ba", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "treefmt-nix_3": { + "inputs": { + "nixpkgs": "nixpkgs_7" }, "locked": { "lastModified": 1775636079, @@ -1107,8 +1262,8 @@ }, "vicinae": { "inputs": { - "nixpkgs": "nixpkgs_7", - "systems": "systems_6" + "nixpkgs": "nixpkgs_8", + "systems": "systems_7" }, "locked": { "lastModified": 1779832601, @@ -1130,7 +1285,7 @@ "nixpkgs": [ "nixpkgs" ], - "systems": "systems_7", + "systems": "systems_8", "vicinae": "vicinae_2" }, "locked": { diff --git a/flake.nix b/flake.nix index 229377e..3e4b271 100644 --- a/flake.nix +++ b/flake.nix @@ -67,6 +67,9 @@ # Dev services services-flake.url = "github:juspay/services-flake"; + # LLM agents + llm-agents.url = "github:numtide/llm-agents.nix"; + # Systems systems.url = "github:nix-systems/default-linux"; }; diff --git a/hosts/default.nix b/hosts/default.nix index 3000923..7d824a3 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -8,7 +8,7 @@ let inherit (inputs.nixpkgs.lib) nixosSystem; - userName = "moons"; + username = "moons"; unstable = import inputs.nixpkgs-unstable { inherit (pkgs) system; @@ -36,7 +36,7 @@ let ./${host}/default.nix ] ++ extraModules; - specialArgs = { inherit inputs userName unstable; }; + specialArgs = { inherit inputs username unstable; }; }; in { diff --git a/images/avatar.jpg b/images/avatar.jpg new file mode 100644 index 0000000..98cde4e Binary files /dev/null and b/images/avatar.jpg differ diff --git a/modules/applications/btop/default.nix b/modules/applications/btop/default.nix new file mode 100644 index 0000000..6f87dd3 --- /dev/null +++ b/modules/applications/btop/default.nix @@ -0,0 +1,23 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.btop; +in +{ + imports = [ + ./system.nix + ./home.nix + ]; + + options.my.applications.btop = { + enable = lib.mkEnableOption "btop system monitor"; + }; + + config = lib.mkIf cfg.enable { + my.applications.btop.system.enable = lib.mkDefault true; + my.applications.btop.homeManager.enable = lib.mkDefault true; + }; +} diff --git a/modules/applications/btop/dracula.theme b/modules/applications/btop/dracula.theme new file mode 100644 index 0000000..a0355f3 --- /dev/null +++ b/modules/applications/btop/dracula.theme @@ -0,0 +1,89 @@ +#Bashtop theme with nord palette (https://www.nordtheme.com) +#by Justin Zobel + +# Colors should be in 6 or 2 character hexadecimal or single spaced rgb decimal: "#RRGGBB", "#BW" or "0-255 0-255 0-255" +# example for white: "#ffffff", "#ff" or "255 255 255". + +# All graphs and meters can be gradients +# For single color graphs leave "mid" and "end" variable empty. +# Use "start" and "end" variables for two color gradient +# Use "start", "mid" and "end" for three color gradient + +# Main background, empty for terminal default, need to be empty if you want transparent background +theme[main_bg]="#282A36" + +# Main text color +theme[main_fg]="#BD93F9" + +# Title color for boxes +theme[title]="#f8f8f2" + +# Higlight color for keyboard shortcuts +theme[hi_fg]="#ff79c6" + +# Background color of selected item in processes box +theme[selected_bg]="#44475A" + +# Foreground color of selected item in processes box +theme[selected_fg]="#ECEFF4" + +# Color of inactive/disabled text +theme[inactive_fg]="#6272a4" + +# Misc colors for processes box including mini cpu graphs, details memory graph and details status text +theme[proc_misc]="#BD93F9" + +# Cpu box outline color +theme[cpu_box]="#ff79c6" + +# Memory/disks box outline color +theme[mem_box]="#ff79c6" + +# Net up/down box outline color +theme[net_box]="#ff79c6" + +# Processes box outline color +theme[proc_box]="#ff79c6" + +# Box divider line and small boxes line color +theme[div_line]="#ff79c6" + +# Temperature graph colors +theme[temp_start]="#bd93f9" +theme[temp_mid]="#bd93f9" +theme[temp_end]="#bd93f9" + +# CPU graph colors +theme[cpu_start]="#bd93f9" +theme[cpu_mid]="#bd93f9" +theme[cpu_end]="#bd93f9" + +# Mem/Disk free meter +theme[free_start]="#bd93f9" +theme[free_mid]="#bd93f9" +theme[free_end]="#bd93f9" + +# Mem/Disk cached meter +theme[cached_start]="#bd93f9" +theme[cached_mid]="#bd93f9" +theme[cached_end]="#bd93f9" + +# Mem/Disk available meter +theme[available_start]="#bd93f9" +theme[available_mid]="#bd93f9" +theme[available_end]="#bd93f9" + +# Mem/Disk used meter +theme[used_start]="#bd93f9" +theme[used_mid]="#bd93f9" +theme[used_end]="#bd93f9" + +# Download graph colors +theme[download_start]="#bd93f9" +theme[download_mid]="#bd93f9" +theme[download_end]="#bd93f9" + +# Upload graph colors +theme[upload_start]="#bd93f9" +theme[upload_mid]="#bd93f9" +theme[upload_end]="#bd93f9" diff --git a/modules/applications/btop/home.nix b/modules/applications/btop/home.nix new file mode 100644 index 0000000..41ee0cc --- /dev/null +++ b/modules/applications/btop/home.nix @@ -0,0 +1,25 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.btop.homeManager; +in +{ + options.my.applications.btop.homeManager = { + enable = lib.mkEnableOption "btop home-manager configuration"; + }; + + config.home-manager.sharedModules = [ + { + config = lib.mkIf cfg.enable { + programs.btop = { + enable = true; + settings.color_theme = "dracula"; + themes.dracula = builtins.readFile ./dracula.theme; + }; + }; + } + ]; +} diff --git a/modules/applications/btop/system.nix b/modules/applications/btop/system.nix new file mode 100644 index 0000000..ae68aee --- /dev/null +++ b/modules/applications/btop/system.nix @@ -0,0 +1,20 @@ +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.applications.btop.system; +in +{ + options.my.applications.btop.system = { + enable = lib.mkEnableOption "btop system configuration"; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + btop # Resource monitor that shows usage and stats + ]; + }; +} diff --git a/modules/applications/chrome.nix b/modules/applications/chrome.nix new file mode 100644 index 0000000..29a22e1 --- /dev/null +++ b/modules/applications/chrome.nix @@ -0,0 +1,46 @@ +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.applications.chrome; +in +{ + options.my.applications.chrome = { + enable = lib.mkEnableOption "Google Chrome browser"; + }; + + config = lib.mkIf cfg.enable { + nixpkgs.config.allowUnfree = true; + + home-manager.sharedModules = [ + { + home.packages = with pkgs; [ + google-chrome # Popular web browser from Google + ]; + + xdg.desktopEntries."google-chrome" = { + name = "Google Chrome"; + genericName = "Web Browser"; + exec = "${pkgs.google-chrome}/bin/google-chrome-stable --enable-features=TouchpadOverscrollHistoryNavigation %U"; + terminal = false; + icon = "google-chrome"; + categories = [ + "Network" + "WebBrowser" + ]; + startupNotify = true; + type = "Application"; + }; + + xdg.mimeApps.defaultApplications = { + "text/html" = "google-chrome.desktop"; + "x-scheme-handler/http" = "google-chrome.desktop"; + "x-scheme-handler/https" = "google-chrome.desktop"; + }; + } + ]; + }; +} diff --git a/modules/applications/claude/default.nix b/modules/applications/claude/default.nix new file mode 100644 index 0000000..aaec6a9 --- /dev/null +++ b/modules/applications/claude/default.nix @@ -0,0 +1,23 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.claude; +in +{ + imports = [ + ./system.nix + ./home.nix + ]; + + options.my.applications.claude = { + enable = lib.mkEnableOption "Claude Code AI assistant"; + }; + + config = lib.mkIf cfg.enable { + my.applications.claude.system.enable = lib.mkDefault true; + my.applications.claude.homeManager.enable = lib.mkDefault true; + }; +} diff --git a/modules/applications/claude/home.nix b/modules/applications/claude/home.nix new file mode 100644 index 0000000..0afcdca --- /dev/null +++ b/modules/applications/claude/home.nix @@ -0,0 +1,27 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.claude.homeManager; +in +{ + options.my.applications.claude.homeManager = { + enable = lib.mkEnableOption "Claude Code home-manager configuration"; + }; + + config.home-manager.sharedModules = [ + { + config = lib.mkIf cfg.enable { + home.file.".claude/settings.json".text = builtins.toJSON { + statusLine = { + type = "command"; + command = "bun x ccusage statusline --no-offline"; + padding = 0; + }; + }; + }; + } + ]; +} diff --git a/modules/applications/claude/system.nix b/modules/applications/claude/system.nix new file mode 100644 index 0000000..7eaee9d --- /dev/null +++ b/modules/applications/claude/system.nix @@ -0,0 +1,21 @@ +{ + pkgs, + inputs, + lib, + config, + ... +}: +let + cfg = config.my.applications.claude.system; +in +{ + options.my.applications.claude.system = { + enable = lib.mkEnableOption "Claude Code system configuration"; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = [ + inputs.llm-agents.packages.${pkgs.stdenv.hostPlatform.system}.claude-code # AI coding assistant + ]; + }; +} diff --git a/modules/applications/default.nix b/modules/applications/default.nix new file mode 100644 index 0000000..3e55634 --- /dev/null +++ b/modules/applications/default.nix @@ -0,0 +1,32 @@ +{ + imports = [ + ./btop + ./chrome.nix + ./claude + ./direnv.nix + ./discord.nix + ./docker.nix + ./fcitx5 + ./ghostty + ./git + ./gnupg.nix + ./greetd.nix + ./gtk + ./java.nix + ./kde.nix + ./nautilus.nix + ./niri + ./noctalia + ./openssh.nix + ./ssh + ./swayidle.nix + ./tailscale.nix + ./vicinae.nix + ./vim + ./vscode + ./wayland.nix + ./zellij + ./zoom.nix + ./zsh + ]; +} diff --git a/modules/applications/direnv.nix b/modules/applications/direnv.nix new file mode 100644 index 0000000..75d1009 --- /dev/null +++ b/modules/applications/direnv.nix @@ -0,0 +1,16 @@ +{ lib, config, ... }: +let + cfg = config.my.applications.direnv; +in +{ + options.my.applications.direnv = { + enable = lib.mkEnableOption "direnv environment variable manager"; + }; + + config = lib.mkIf cfg.enable { + programs.direnv = { + enable = true; + nix-direnv.enable = true; + }; + }; +} diff --git a/modules/applications/discord.nix b/modules/applications/discord.nix new file mode 100644 index 0000000..28b121c --- /dev/null +++ b/modules/applications/discord.nix @@ -0,0 +1,23 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.discord; +in +{ + options.my.applications.discord = { + enable = lib.mkEnableOption "Discord (Vesktop)"; + }; + + config = lib.mkIf cfg.enable { + home-manager.sharedModules = [ + { + programs.vesktop = { + enable = true; + }; + } + ]; + }; +} diff --git a/modules/applications/docker.nix b/modules/applications/docker.nix new file mode 100644 index 0000000..e6f4ba7 --- /dev/null +++ b/modules/applications/docker.nix @@ -0,0 +1,34 @@ +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.applications.docker; +in +{ + options.my.applications.docker = { + enable = lib.mkEnableOption "Docker container runtime"; + }; + + config = lib.mkIf cfg.enable { + virtualisation.docker = { + enable = true; + autoPrune = { + enable = true; + dates = "weekly"; + }; + daemon.settings = { + ipv6 = true; + "fixed-cidr-v6" = "fd00:30::/64"; + ip6tables = true; + }; + }; + + environment.systemPackages = with pkgs; [ + docker # Container runtime + oxker # Docker TUI Tool + ]; + }; +} diff --git a/modules/applications/fcitx5/config b/modules/applications/fcitx5/config new file mode 100644 index 0000000..a11fae8 --- /dev/null +++ b/modules/applications/fcitx5/config @@ -0,0 +1,69 @@ +[Hotkey] +# トリガーキーを押すたびに切り替える +EnumerateWithTriggerKeys=False +# 一時的に第1入力メソッドに切り替える +AltTriggerKeys= +# 切り替え時は第1入力メソッドをスキップする +EnumerateSkipFirst=False +# Time limit in milliseconds for triggering modifier key shortcuts +ModifierOnlyKeyTimeout=250 + +[Hotkey/TriggerKeys] +1=Zenkaku_Hankaku + +[Hotkey/ActivateKeys] +0=Henkan + +[Hotkey/DeactivateKeys] +0=Muhenkan + +[Hotkey/PrevPage] +0=Up + +[Hotkey/NextPage] +0=Down + +[Hotkey/PrevCandidate] +0=Shift+Tab + +[Hotkey/NextCandidate] +0=Tab + +[Hotkey/TogglePreedit] +0=Control+Alt+P + +[Behavior] +# デフォルトで有効にする +ActiveByDefault=False +# フォーカス時に状態をリセット +resetStateWhenFocusIn=No +# 入力状態を共有する +ShareInputState=No +# アプリケーションにプリエディットを表示する +PreeditEnabledByDefault=True +# 入力メソッドを切り替える際に入力メソッドの情報を表示する +ShowInputMethodInformation=True +# フォーカスを変更する際に入力メソッドの情報を表示する +showInputMethodInformationWhenFocusIn=False +# 入力メソッドの情報をコンパクトに表示する +CompactInputMethodInformation=True +# 第1入力メソッドの情報を表示する +ShowFirstInputMethodInformation=True +# デフォルトのページサイズ +DefaultPageSize=5 +# XKB オプションより優先する +OverrideXkbOption=False +# カスタム XKB オプション +CustomXkbOption= +# Force Enabled Addons +EnabledAddons= +# Force Disabled Addons +DisabledAddons= +# Preload input method to be used by default +PreloadInputMethod=True +# パスワード欄に入力メソッドを許可する +AllowInputMethodForPassword=False +# パスワード入力時にプリエディットテキストを表示する +ShowPreeditForPassword=False +# ユーザーデータを保存する間隔(分) +AutoSavePeriod=30 diff --git a/modules/applications/fcitx5/default.nix b/modules/applications/fcitx5/default.nix new file mode 100644 index 0000000..7becf6f --- /dev/null +++ b/modules/applications/fcitx5/default.nix @@ -0,0 +1,23 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.fcitx5; +in +{ + imports = [ + ./system.nix + ./home.nix + ]; + + options.my.applications.fcitx5 = { + enable = lib.mkEnableOption "fcitx5 input method"; + }; + + config = lib.mkIf cfg.enable { + my.applications.fcitx5.system.enable = lib.mkDefault true; + my.applications.fcitx5.homeManager.enable = lib.mkDefault true; + }; +} diff --git a/modules/applications/fcitx5/home.nix b/modules/applications/fcitx5/home.nix new file mode 100644 index 0000000..94f5452 --- /dev/null +++ b/modules/applications/fcitx5/home.nix @@ -0,0 +1,24 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.fcitx5.homeManager; +in +{ + options.my.applications.fcitx5.homeManager = { + enable = lib.mkEnableOption "fcitx5 home-manager configuration"; + }; + + config.home-manager.sharedModules = [ + { + config = lib.mkIf cfg.enable { + home.file.".config/fcitx5/config" = { + recursive = true; + source = ./config; + }; + }; + } + ]; +} diff --git a/modules/applications/fcitx5/system.nix b/modules/applications/fcitx5/system.nix new file mode 100644 index 0000000..03ef957 --- /dev/null +++ b/modules/applications/fcitx5/system.nix @@ -0,0 +1,48 @@ +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.applications.fcitx5.system; +in +{ + options.my.applications.fcitx5.system = { + enable = lib.mkEnableOption "fcitx5 system configuration"; + }; + + config = lib.mkIf cfg.enable { + i18n.inputMethod = { + enable = true; + type = "fcitx5"; + fcitx5 = { + waylandFrontend = true; + addons = with pkgs; [ + fcitx5-mozc-ut + fcitx5-gtk + kdePackages.fcitx5-qt + qt6Packages.fcitx5-configtool + ]; + settings.inputMethod = { + GroupOrder = { + "0" = "Default"; + }; + "Groups/0" = { + Name = "Default"; + "Default Layout" = "jp"; + DefaultIM = "mozc"; + }; + "Groups/0/Items/0" = { + Name = "keyboard-jp"; + Layout = ""; + }; + "Groups/0/Items/1" = { + Name = "mozc"; + Layout = ""; + }; + }; + }; + }; + }; +} diff --git a/modules/applications/ghostty/config b/modules/applications/ghostty/config new file mode 100644 index 0000000..0280dd4 --- /dev/null +++ b/modules/applications/ghostty/config @@ -0,0 +1,31 @@ +theme = dracula +background-blur-radius = 20 +background-opacity = 0.9 +font-family = BlexMono Nerd Font Mono +mouse-hide-while-typing = true +window-decoration = true + + +# keybind + +# Copy/Paste +keybind = ctrl+shift+c=copy_to_clipboard +keybind = ctrl+shift+v=paste_from_clipboard + +# create new tab +keybind = ctrl+shift+t=new_tab + +# move tabs +keybind = ctrl+alt+left_bracket=previous_tab +keybind = ctrl+alt+right_bracket=next_tab + +# close tab +keybind = ctrl+alt+q=close_window + +# font size +keybind = ctrl+shift+semicolon=increase_font_size:1 +keybind = ctrl+shift+minus=increase_font_size:1 + + +shell-integration-features = ssh-terminfo,ssh-env + diff --git a/modules/applications/ghostty/default.nix b/modules/applications/ghostty/default.nix new file mode 100644 index 0000000..950c021 --- /dev/null +++ b/modules/applications/ghostty/default.nix @@ -0,0 +1,23 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.ghostty; +in +{ + imports = [ + ./system.nix + ./home.nix + ]; + + options.my.applications.ghostty = { + enable = lib.mkEnableOption "ghostty terminal emulator"; + }; + + config = lib.mkIf cfg.enable { + my.applications.ghostty.system.enable = lib.mkDefault true; + my.applications.ghostty.homeManager.enable = lib.mkDefault true; + }; +} diff --git a/modules/applications/ghostty/dracula.theme b/modules/applications/ghostty/dracula.theme new file mode 100644 index 0000000..413226e --- /dev/null +++ b/modules/applications/ghostty/dracula.theme @@ -0,0 +1,45 @@ +# MIT License +# +# Copyright (c) 2023 Dracula Theme +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +palette = 0=#21222c +palette = 1=#ff5555 +palette = 2=#50fa7b +palette = 3=#f1fa8c +palette = 4=#bd93f9 +palette = 5=#ff79c6 +palette = 6=#8be9fd +palette = 7=#f8f8f2 +palette = 8=#6272a4 +palette = 9=#ff6e6e +palette = 10=#69ff94 +palette = 11=#ffffa5 +palette = 12=#d6acff +palette = 13=#ff92df +palette = 14=#a4ffff +palette = 15=#ffffff +background = #282a36 +foreground = #f8f8f2 +cursor-color = #f8f8f2 +cursor-text = #282a36 +selection-foreground = #f8f8f2 +selection-background = #44475a + diff --git a/modules/applications/ghostty/home.nix b/modules/applications/ghostty/home.nix new file mode 100644 index 0000000..dda43d8 --- /dev/null +++ b/modules/applications/ghostty/home.nix @@ -0,0 +1,29 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.ghostty.homeManager; +in +{ + options.my.applications.ghostty.homeManager = { + enable = lib.mkEnableOption "ghostty home-manager configuration"; + }; + + config.home-manager.sharedModules = [ + { + config = lib.mkIf cfg.enable { + home.file.".config/ghostty/config" = { + recursive = true; + source = ./config; + }; + + home.file.".config/ghostty/themes/dracula" = { + recursive = true; + source = ./dracula.theme; + }; + }; + } + ]; +} diff --git a/modules/applications/ghostty/system.nix b/modules/applications/ghostty/system.nix new file mode 100644 index 0000000..97ada0b --- /dev/null +++ b/modules/applications/ghostty/system.nix @@ -0,0 +1,20 @@ +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.applications.ghostty.system; +in +{ + options.my.applications.ghostty.system = { + enable = lib.mkEnableOption "ghostty system configuration"; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + unstable.ghostty # A fast and minimal terminal emulator for Wayland + ]; + }; +} diff --git a/modules/applications/git/default.nix b/modules/applications/git/default.nix new file mode 100644 index 0000000..89243c6 --- /dev/null +++ b/modules/applications/git/default.nix @@ -0,0 +1,33 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.git; +in +{ + imports = [ + ./system.nix + ./home.nix + ]; + + options.my.applications.git = { + enable = lib.mkEnableOption "git version control"; + userName = lib.mkOption { + type = lib.types.str; + default = "moons-14"; + description = "Git user name"; + }; + userEmail = lib.mkOption { + type = lib.types.str; + default = "moons@moons14.com"; + description = "Git user email"; + }; + }; + + config = lib.mkIf cfg.enable { + my.applications.git.system.enable = lib.mkDefault true; + my.applications.git.homeManager.enable = lib.mkDefault true; + }; +} diff --git a/modules/applications/git/home.nix b/modules/applications/git/home.nix new file mode 100644 index 0000000..f16ce85 --- /dev/null +++ b/modules/applications/git/home.nix @@ -0,0 +1,59 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.git; + hmCfg = config.my.applications.git.homeManager; +in +{ + options.my.applications.git.homeManager = { + enable = lib.mkEnableOption "git home-manager configuration"; + }; + + config.home-manager.sharedModules = [ + { + config = lib.mkIf hmCfg.enable { + programs.git = { + enable = true; + ignores = [ + ".direnv/" + ".envrc" + "!.envrc.example" + ]; + + signing = { + key = "~/.ssh/id_ed25519.pub"; + signByDefault = true; + }; + + settings = { + user.name = cfg.userName; + user.email = cfg.userEmail; + push.default = "simple"; + credential.helper = "cache --timeout=7200"; + init.defaultBranch = "main"; + log.decorate = "full"; + log.date = "iso"; + merge.conflictStyle = "diff3"; + + gpg.format = "ssh"; + tag.gpgSign = true; + + alias = { + br = "branch --sort=-committerdate"; + co = "checkout"; + df = "diff"; + com = "commit -a"; + gs = "stash"; + gp = "pull"; + lg = "log --graph --pretty=format:'%Cred%h%Creset - %C(yellow)%d%Creset %s %C(green)(%cr)%C(bold blue) <%an>%Creset' --abbrev-commit"; + st = "status"; + }; + }; + }; + }; + } + ]; +} diff --git a/modules/applications/git/system.nix b/modules/applications/git/system.nix new file mode 100644 index 0000000..3d32726 --- /dev/null +++ b/modules/applications/git/system.nix @@ -0,0 +1,20 @@ +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.applications.git.system; +in +{ + options.my.applications.git.system = { + enable = lib.mkEnableOption "git system configuration"; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + git # Distributed version control system + ]; + }; +} diff --git a/modules/applications/gnupg.nix b/modules/applications/gnupg.nix new file mode 100644 index 0000000..d6cc900 --- /dev/null +++ b/modules/applications/gnupg.nix @@ -0,0 +1,16 @@ +{ lib, config, ... }: +let + cfg = config.my.applications.gnupg; +in +{ + options.my.applications.gnupg = { + enable = lib.mkEnableOption "GnuPG agent"; + }; + + config = lib.mkIf cfg.enable { + programs.gnupg.agent = { + enable = true; + enableSSHSupport = false; + }; + }; +} diff --git a/modules/applications/greetd.nix b/modules/applications/greetd.nix new file mode 100644 index 0000000..09f00e4 --- /dev/null +++ b/modules/applications/greetd.nix @@ -0,0 +1,26 @@ +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.applications.greetd; +in +{ + options.my.applications.greetd = { + enable = lib.mkEnableOption "greetd login manager"; + }; + + config = lib.mkIf cfg.enable { + services.greetd = { + enable = true; + settings = { + default_session = { + user = "greeter"; + command = "${pkgs.tuigreet}/bin/tuigreet --time --remember --cmd niri-session"; + }; + }; + }; + }; +} diff --git a/modules/applications/gtk/default.nix b/modules/applications/gtk/default.nix new file mode 100644 index 0000000..f4e8f45 --- /dev/null +++ b/modules/applications/gtk/default.nix @@ -0,0 +1,25 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.gtk; +in +{ + imports = [ + ./system.nix + ./home.nix + ]; + + options.my.applications.gtk = { + enable = lib.mkEnableOption "GTK theme configuration"; + system.enable = lib.mkEnableOption "GTK system configuration"; + homeManager.enable = lib.mkEnableOption "GTK home-manager configuration"; + }; + + config = lib.mkIf cfg.enable { + my.applications.gtk.system.enable = lib.mkDefault true; + my.applications.gtk.homeManager.enable = lib.mkDefault true; + }; +} diff --git a/modules/applications/gtk/home.nix b/modules/applications/gtk/home.nix new file mode 100644 index 0000000..58cfdce --- /dev/null +++ b/modules/applications/gtk/home.nix @@ -0,0 +1,36 @@ +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.applications.gtk.homeManager; +in +{ + options.my.applications.gtk.homeManager = { + enable = lib.mkEnableOption "GTK home-manager configuration"; + }; + + config.home-manager.sharedModules = [ + { + config = lib.mkIf cfg.enable { + gtk = { + enable = true; + theme = { + name = "Dracula"; + package = pkgs.dracula-theme; + }; + cursorTheme = { + package = pkgs.adwaita-icon-theme; + name = "Adwaita"; + }; + iconTheme = { + package = pkgs.papirus-icon-theme; + name = "Papirus-Dark"; + }; + }; + }; + } + ]; +} diff --git a/modules/applications/gtk/system.nix b/modules/applications/gtk/system.nix new file mode 100644 index 0000000..bf89701 --- /dev/null +++ b/modules/applications/gtk/system.nix @@ -0,0 +1,14 @@ +{ lib, config, ... }: +let + cfg = config.my.applications.gtk.system; +in +{ + options.my.applications.gtk.system = { + enable = lib.mkEnableOption "GTK system configuration"; + }; + + config = lib.mkIf cfg.enable { + programs.dconf.enable = true; + programs.seahorse.enable = true; + }; +} diff --git a/modules/applications/java.nix b/modules/applications/java.nix new file mode 100644 index 0000000..d59d018 --- /dev/null +++ b/modules/applications/java.nix @@ -0,0 +1,21 @@ +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.applications.java; +in +{ + options.my.applications.java = { + enable = lib.mkEnableOption "Java runtime"; + }; + + config = lib.mkIf cfg.enable { + programs.java = { + enable = true; + package = pkgs.jdk25; + }; + }; +} diff --git a/modules/applications/kde.nix b/modules/applications/kde.nix new file mode 100644 index 0000000..b5f462e --- /dev/null +++ b/modules/applications/kde.nix @@ -0,0 +1,19 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.kde; +in +{ + options.my.applications.kde = { + enable = lib.mkEnableOption "KDE Connect"; + }; + + config = lib.mkIf cfg.enable { + programs.kdeconnect = { + enable = true; + }; + }; +} diff --git a/modules/applications/nautilus.nix b/modules/applications/nautilus.nix new file mode 100644 index 0000000..4293dd5 --- /dev/null +++ b/modules/applications/nautilus.nix @@ -0,0 +1,22 @@ +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.applications.nautilus; +in +{ + options.my.applications.nautilus = { + enable = lib.mkEnableOption "Nautilus file manager"; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + nautilus # GNOME file manager + gvfs # GNOME virtual file system + sushi # Nautilus file previewer + ]; + }; +} diff --git a/modules/applications/niri/default.nix b/modules/applications/niri/default.nix new file mode 100644 index 0000000..7858c87 --- /dev/null +++ b/modules/applications/niri/default.nix @@ -0,0 +1,23 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.niri; +in +{ + imports = [ + ./system.nix + ./home.nix + ]; + + options.my.applications.niri = { + enable = lib.mkEnableOption "niri window manager"; + }; + + config = lib.mkIf cfg.enable { + my.applications.niri.system.enable = lib.mkDefault true; + my.applications.niri.homeManager.enable = lib.mkDefault true; + }; +} diff --git a/modules/applications/niri/defaultKeyBind.nix b/modules/applications/niri/defaultKeyBind.nix new file mode 100644 index 0000000..e745297 --- /dev/null +++ b/modules/applications/niri/defaultKeyBind.nix @@ -0,0 +1,166 @@ +{ + "Mod+Shift+Slash".action.show-hotkey-overlay = { }; + + "XF86AudioRaiseVolume" = { + allow-when-locked = true; + action.spawn = [ + "wpctl" + "set-volume" + "@DEFAULT_AUDIO_SINK@" + "0.1+" + ]; + }; + "XF86AudioLowerVolume" = { + allow-when-locked = true; + action.spawn = [ + "wpctl" + "set-volume" + "@DEFAULT_AUDIO_SINK@" + "0.1-" + ]; + }; + "XF86AudioMute" = { + allow-when-locked = true; + action.spawn = [ + "wpctl" + "set-mute" + "@DEFAULT_AUDIO_SINK@" + "toggle" + ]; + }; + "XF86AudioMicMute" = { + allow-when-locked = true; + action.spawn = [ + "wpctl" + "set-mute" + "@DEFAULT_AUDIO_SOURCE@" + "toggle" + ]; + }; + + "Mod+Q".action.close-window = { }; + + "Mod+Left".action.focus-column-left = { }; + "Mod+Down".action.focus-window-down = { }; + "Mod+Up".action.focus-window-up = { }; + "Mod+Right".action.focus-column-right = { }; + "Mod+H".action.focus-column-left = { }; + "Mod+J".action.focus-window-down = { }; + "Mod+K".action.focus-window-up = { }; + "Mod+L".action.focus-column-right = { }; + + "Mod+Ctrl+Left".action.move-column-left = { }; + "Mod+Ctrl+Down".action.move-window-down = { }; + "Mod+Ctrl+Up".action.move-window-up = { }; + "Mod+Ctrl+Right".action.move-column-right = { }; + "Mod+Ctrl+H".action.move-column-left = { }; + "Mod+Ctrl+J".action.move-window-down = { }; + "Mod+Ctrl+K".action.move-window-up = { }; + "Mod+Ctrl+L".action.move-column-right = { }; + + "Mod+Home".action.focus-column-first = { }; + "Mod+End".action.focus-column-last = { }; + "Mod+Ctrl+Home".action.move-column-to-first = { }; + "Mod+Ctrl+End".action.move-column-to-last = { }; + + "Mod+Shift+Left".action.focus-monitor-left = { }; + "Mod+Shift+Down".action.focus-monitor-down = { }; + "Mod+Shift+Up".action.focus-monitor-up = { }; + "Mod+Shift+Right".action.focus-monitor-right = { }; + "Mod+Shift+H".action.focus-monitor-left = { }; + "Mod+Shift+J".action.focus-monitor-down = { }; + "Mod+Shift+K".action.focus-monitor-up = { }; + "Mod+Shift+L".action.focus-monitor-right = { }; + + "Mod+Shift+Ctrl+Left".action.move-column-to-monitor-left = { }; + "Mod+Shift+Ctrl+Down".action.move-column-to-monitor-down = { }; + "Mod+Shift+Ctrl+Up".action.move-column-to-monitor-up = { }; + "Mod+Shift+Ctrl+Right".action.move-column-to-monitor-right = { }; + "Mod+Shift+Ctrl+H".action.move-column-to-monitor-left = { }; + "Mod+Shift+Ctrl+J".action.move-column-to-monitor-down = { }; + "Mod+Shift+Ctrl+K".action.move-column-to-monitor-up = { }; + "Mod+Shift+Ctrl+L".action.move-column-to-monitor-right = { }; + + "Mod+Page_Down".action.focus-workspace-down = { }; + "Mod+Page_Up".action.focus-workspace-up = { }; + "Mod+U".action.focus-workspace-down = { }; + "Mod+I".action.focus-workspace-up = { }; + "Mod+Ctrl+Page_Down".action.move-column-to-workspace-down = { }; + "Mod+Ctrl+Page_Up".action.move-column-to-workspace-up = { }; + "Mod+Ctrl+U".action.move-column-to-workspace-down = { }; + "Mod+Ctrl+I".action.move-column-to-workspace-up = { }; + + "Mod+Shift+Page_Down".action.move-workspace-down = { }; + "Mod+Shift+Page_Up".action.move-workspace-up = { }; + "Mod+Shift+U".action.move-workspace-down = { }; + "Mod+Shift+I".action.move-workspace-up = { }; + + "Mod+WheelScrollDown" = { + cooldown-ms = 150; + action.focus-workspace-down = { }; + }; + "Mod+WheelScrollUp" = { + cooldown-ms = 150; + action.focus-workspace-up = { }; + }; + "Mod+Ctrl+WheelScrollDown" = { + cooldown-ms = 150; + action.move-column-to-workspace-down = { }; + }; + "Mod+Ctrl+WheelScrollUp" = { + cooldown-ms = 150; + action.move-column-to-workspace-up = { }; + }; + + "Mod+WheelScrollRight".action.focus-column-right = { }; + "Mod+WheelScrollLeft".action.focus-column-left = { }; + "Mod+Ctrl+WheelScrollRight".action.move-column-right = { }; + "Mod+Ctrl+WheelScrollLeft".action.move-column-left = { }; + + "Mod+Shift+WheelScrollDown".action.focus-column-right = { }; + "Mod+Shift+WheelScrollUp".action.focus-column-left = { }; + "Mod+Ctrl+Shift+WheelScrollDown".action.move-column-right = { }; + "Mod+Ctrl+Shift+WheelScrollUp".action.move-column-left = { }; + + "Mod+1".action.focus-workspace = 1; + "Mod+2".action.focus-workspace = 2; + "Mod+3".action.focus-workspace = 3; + "Mod+4".action.focus-workspace = 4; + "Mod+5".action.focus-workspace = 5; + "Mod+6".action.focus-workspace = 6; + "Mod+7".action.focus-workspace = 7; + "Mod+8".action.focus-workspace = 8; + "Mod+9".action.focus-workspace = 9; + "Mod+Ctrl+1".action.move-column-to-workspace = 1; + "Mod+Ctrl+2".action.move-column-to-workspace = 2; + "Mod+Ctrl+3".action.move-column-to-workspace = 3; + "Mod+Ctrl+4".action.move-column-to-workspace = 4; + "Mod+Ctrl+5".action.move-column-to-workspace = 5; + "Mod+Ctrl+6".action.move-column-to-workspace = 6; + "Mod+Ctrl+7".action.move-column-to-workspace = 7; + "Mod+Ctrl+8".action.move-column-to-workspace = 8; + "Mod+Ctrl+9".action.move-column-to-workspace = 9; + + "Mod+Comma".action.consume-window-into-column = { }; + "Mod+Period".action.expel-window-from-column = { }; + + "Mod+R".action.switch-preset-column-width = { }; + "Mod+Shift+R".action.reset-window-height = { }; + "Mod+F".action.maximize-column = { }; + "Mod+Shift+F".action.fullscreen-window = { }; + "Mod+C".action.center-column = { }; + + "Mod+Minus".action.set-column-width = "-10%"; + "Mod+Equal".action.set-column-width = "+10%"; + + "Mod+Shift+Minus".action.set-window-height = "-10%"; + "Mod+Shift+Equal".action.set-window-height = "+10%"; + + "Print".action.screenshot = { }; + "Ctrl+Print".action.screenshot-screen = { }; + "Alt+Print".action.screenshot-window = { }; + + "Mod+Shift+E".action.quit = { }; + + "Mod+Shift+P".action.power-off-monitors = { }; +} diff --git a/modules/applications/niri/home.nix b/modules/applications/niri/home.nix new file mode 100644 index 0000000..a893e63 --- /dev/null +++ b/modules/applications/niri/home.nix @@ -0,0 +1,164 @@ +{ + inputs, + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.applications.niri.homeManager; + defaultKeyBind = import ./defaultKeyBind.nix; +in +{ + options.my.applications.niri.homeManager = { + enable = lib.mkEnableOption "niri home-manager configuration"; + }; + + config.home-manager.sharedModules = [ + inputs.niri-flake.homeModules.niri + { + config = lib.mkIf cfg.enable { + programs.niri.package = pkgs.niri; + + programs.niri.settings = { + input.touchpad = { + natural-scroll = true; + scroll-factor = 4.0; + scroll-method = "two-finger"; + click-method = "clickfinger"; + drag = true; + drag-lock = true; + }; + + input.keyboard.xkb = { + layout = "jp"; + options = "ctrl:nocaps"; + }; + + spawn-at-startup = [ + { command = [ "noctalia-shell" ]; } + ]; + + outputs."eDP-1".scale = 1; + cursor.size = 16; + + layout = { + focus-ring = { + active.color = "#bd93f9"; + inactive.color = "#6272a4"; + }; + border = { + active.color = "#ffc87f"; + inactive.color = "#505050"; + urgent.color = "#9b0000"; + }; + shadow = { + color = "#0007"; + }; + }; + + binds = defaultKeyBind // { + "Mod+T" = { + action.spawn = "ghostty"; + hotkey-overlay.title = "Open a Terminal: ghostty"; + }; + "Mod+D" = { + action.spawn = [ + "vicinae" + "toggle" + ]; + hotkey-overlay.title = "Run an Application: vicinae"; + }; + "Mod+Space" = { + action.spawn = [ + "vicinae" + "toggle" + ]; + hotkey-overlay.title = "Run an Application: vicinae"; + }; + "Mod+E" = { + action.spawn = [ + "nautilus" + "--new-window" + ]; + hotkey-overlay.title = "Open File Manager: nautilus"; + }; + "Mod+L" = { + action.spawn = [ + "noctalia-shell" + "ipc" + "call" + "sessionMenu" + "lockAndSuspend" + ]; + hotkey-overlay.title = "Lock the Screen: noctalia"; + }; + "Mod+V" = { + action.spawn = [ + "vicinae" + "vicinae://extensions/vicinae/clipboard/history" + ]; + hotkey-overlay.title = "Clipboard History"; + }; + + "XF86AudioRaiseVolume" = { + action.spawn = [ + "noctalia-shell" + "ipc" + "call" + "volume" + "increase" + ]; + }; + "XF86AudioLowerVolume" = { + action.spawn = [ + "noctalia-shell" + "ipc" + "call" + "volume" + "decrease" + ]; + }; + "XF86AudioMute" = { + action.spawn = [ + "noctalia-shell" + "ipc" + "call" + "volume" + "muteOutput" + ]; + }; + "XF86AudioMicMute" = { + action.spawn = [ + "noctalia-shell" + "ipc" + "call" + "volume" + "muteInput" + ]; + }; + + "XF86MonBrightnessUp" = { + action.spawn = [ + "noctalia-shell" + "ipc" + "call" + "brightness" + "increase" + ]; + }; + "XF86MonBrightnessDown" = { + action.spawn = [ + "noctalia-shell" + "ipc" + "call" + "brightness" + "decrease" + ]; + }; + }; + }; + }; + } + ]; +} diff --git a/modules/applications/niri/system.nix b/modules/applications/niri/system.nix new file mode 100644 index 0000000..b9c52cb --- /dev/null +++ b/modules/applications/niri/system.nix @@ -0,0 +1,17 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.niri.system; +in +{ + options.my.applications.niri.system = { + enable = lib.mkEnableOption "niri system configuration"; + }; + + config = lib.mkIf cfg.enable { + programs.niri.enable = true; + }; +} diff --git a/modules/applications/noctalia/default.nix b/modules/applications/noctalia/default.nix new file mode 100644 index 0000000..c555310 --- /dev/null +++ b/modules/applications/noctalia/default.nix @@ -0,0 +1,23 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.noctalia; +in +{ + imports = [ + ./system.nix + ./home.nix + ]; + + options.my.applications.noctalia = { + enable = lib.mkEnableOption "noctalia-shell"; + }; + + config = lib.mkIf cfg.enable { + my.applications.noctalia.system.enable = lib.mkDefault true; + my.applications.noctalia.homeManager.enable = lib.mkDefault true; + }; +} diff --git a/modules/applications/noctalia/home.nix b/modules/applications/noctalia/home.nix new file mode 100644 index 0000000..3d69c7d --- /dev/null +++ b/modules/applications/noctalia/home.nix @@ -0,0 +1,178 @@ +{ + inputs, + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.applications.noctalia.homeManager; + walls = pkgs.fetchFromGitHub { + owner = "moons-14"; + repo = "wallpapers"; + rev = "cc3256f4aaf2c8e7d16fb000b1ee251af54085db"; + hash = "sha256-emQ/FqKqMq3YI5bLx8gBZg/ZE72OG9Ilh71ggq78WdQ="; + }; +in +{ + options.my.applications.noctalia.homeManager = { + enable = lib.mkEnableOption "noctalia-shell home-manager configuration"; + }; + + config.home-manager.sharedModules = [ + inputs.noctalia.homeModules.default + { + config = lib.mkIf cfg.enable { + home.file.".face" = { + recursive = true; + source = ../../../images/avatar.jpg; + }; + + home.file.".wallpapers" = { + source = walls; + recursive = true; + }; + + home.file.".cache/noctalia/wallpapers.json" = { + text = builtins.toJSON { + defaultWallpaper = "~/.wallpapers/1.jpg"; + wallpapers = { + "DP-1" = "~/.wallpapers/1.jpg"; + }; + }; + }; + + programs.noctalia-shell = { + enable = true; + settings = { + bar = { + density = "default"; + position = "top"; + showCapsule = true; + backgroundOpacity = 0.8; + floating = true; + widgets = { + left = [ + { id = "WiFi"; } + { + id = "CustomButton"; + icon = "access-point"; + leftClickExec = "nm-connection-editor"; + } + { id = "Bluetooth"; } + { id = "SystemMonitor"; } + { id = "Taskbar"; } + { id = "ActiveWindow"; } + ]; + center = [ + { + hideUnoccupied = false; + id = "Workspace"; + labelMode = "none"; + } + ]; + right = [ + { id = "MediaMini"; } + { id = "NotificationHistory"; } + { + displayMode = "alwaysShow"; + id = "Battery"; + warningThreshold = 30; + } + { + displayMode = "alwaysShow"; + id = "Volume"; + } + { + displayMode = "alwaysShow"; + id = "Brightness"; + } + { + formatHorizontal = "HH:mm"; + formatVertical = "HH mm"; + id = "Clock"; + useMonospacedFont = true; + usePrimaryColor = true; + } + { + id = "ControlCenter"; + useDistroLogo = true; + } + ]; + }; + }; + colorSchemes.predefinedScheme = "dracula"; + general = { + avatarImage = "~/.face"; + radiusRatio = 0.2; + }; + location = { + monthBeforeDay = true; + weatherEnabled = false; + name = "Tokyo"; + }; + wallpaper = { + enabled = true; + directory = "~/.wallpapers/"; + setWallpaperOnAllMonitors = true; + linkLightAndDarkWallpapers = true; + fillMode = "crop"; + randomEnabled = true; + randomIntervalSec = 60; + transitionDuration = 1500; + }; + dock = { + enabled = true; + displayMode = "auto_hide"; + backgroundOpacity = 0.8; + floatingRatio = 1; + size = 1; + onlySameOutput = true; + monitors = [ "eDP-1" ]; + pinnedApps = [ + "com.mitchellh.ghostty" + "org.gnome.Nautilus" + "google-chrome" + "code" + ]; + colorizeIcons = false; + }; + controlCenter = { + position = "close_to_bar_button"; + shortcuts = { + left = [ + { id = "WiFi"; } + { id = "Bluetooth"; } + { id = "ScreenRecorder"; } + { id = "WallpaperSelector"; } + ]; + right = [ + { id = "Notifications"; } + { id = "NightLight"; } + ]; + }; + cards = [ + { + enabled = true; + id = "profile-card"; + } + { + enabled = true; + id = "shortcuts-card"; + } + { + enabled = true; + id = "audio-card"; + } + { + enabled = true; + id = "media-sysmon-card"; + } + ]; + }; + }; + }; + }; + } + ]; +} diff --git a/modules/applications/noctalia/system.nix b/modules/applications/noctalia/system.nix new file mode 100644 index 0000000..6dec66e --- /dev/null +++ b/modules/applications/noctalia/system.nix @@ -0,0 +1,21 @@ +{ + pkgs, + inputs, + lib, + config, + ... +}: +let + cfg = config.my.applications.noctalia.system; +in +{ + options.my.applications.noctalia.system = { + enable = lib.mkEnableOption "noctalia-shell system package"; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + inputs.noctalia.packages.${system}.default + ]; + }; +} diff --git a/modules/applications/openssh.nix b/modules/applications/openssh.nix new file mode 100644 index 0000000..f45a857 --- /dev/null +++ b/modules/applications/openssh.nix @@ -0,0 +1,23 @@ +{ lib, config, ... }: +let + cfg = config.my.applications.openssh; +in +{ + options.my.applications.openssh = { + enable = lib.mkEnableOption "OpenSSH server"; + }; + + config = lib.mkIf cfg.enable { + services.openssh = { + enable = true; + openFirewall = true; + + settings = { + PermitRootLogin = "no"; + PasswordAuthentication = false; + KbdInteractiveAuthentication = false; + PubkeyAuthentication = "yes"; + }; + }; + }; +} diff --git a/modules/applications/ssh/default.nix b/modules/applications/ssh/default.nix new file mode 100644 index 0000000..caafc4e --- /dev/null +++ b/modules/applications/ssh/default.nix @@ -0,0 +1,43 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.ssh; +in +{ + imports = [ + ./system.nix + ./home.nix + ]; + + options.my.applications.ssh = { + enable = lib.mkEnableOption "OpenSSH client"; + system.enable = lib.mkEnableOption "SSH system configuration"; + homeManager.enable = lib.mkEnableOption "SSH home-manager configuration"; + + defaultIdentityFile = lib.mkOption { + type = lib.types.str; + default = "~/.ssh/id_ed25519"; + description = "Default SSH identity file"; + }; + + addKeysToAgent = lib.mkOption { + type = lib.types.str; + default = "yes"; + description = "Add keys to SSH agent"; + }; + + matchBlocks = lib.mkOption { + type = lib.types.attrs; + default = { }; + description = "SSH match blocks"; + }; + }; + + config = lib.mkIf cfg.enable { + my.applications.ssh.system.enable = lib.mkDefault true; + my.applications.ssh.homeManager.enable = lib.mkDefault true; + }; +} diff --git a/modules/applications/ssh/home.nix b/modules/applications/ssh/home.nix new file mode 100644 index 0000000..19f7233 --- /dev/null +++ b/modules/applications/ssh/home.nix @@ -0,0 +1,37 @@ +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.applications.ssh; + hmCfg = config.my.applications.ssh.homeManager; +in +{ + options.my.applications.ssh.homeManager = { + enable = lib.mkEnableOption "SSH home-manager configuration"; + }; + + config.home-manager.sharedModules = [ + { + config = lib.mkIf hmCfg.enable { + home.packages = [ + pkgs.openssh + ]; + + programs.ssh = { + enable = true; + enableDefaultConfig = false; + + matchBlocks = cfg.matchBlocks // { + "*" = { + identityFile = cfg.defaultIdentityFile; + extraOptions.AddKeysToAgent = cfg.addKeysToAgent; + }; + }; + }; + }; + } + ]; +} diff --git a/modules/applications/ssh/system.nix b/modules/applications/ssh/system.nix new file mode 100644 index 0000000..b53e372 --- /dev/null +++ b/modules/applications/ssh/system.nix @@ -0,0 +1,20 @@ +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.applications.ssh.system; +in +{ + options.my.applications.ssh.system = { + enable = lib.mkEnableOption "SSH system configuration"; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + openssh # OpenSSH client and server + ]; + }; +} diff --git a/modules/applications/swayidle.nix b/modules/applications/swayidle.nix new file mode 100644 index 0000000..135507f --- /dev/null +++ b/modules/applications/swayidle.nix @@ -0,0 +1,64 @@ +{ + pkgs, + lib, + config, + inputs, + ... +}: +let + cfg = config.my.applications.swayidle; + noctaliaPkg = inputs.noctalia.packages.${pkgs.system}.default; + noctaliaExe = lib.getExe noctaliaPkg; + + lockCmd = "${pkgs.bash}/bin/bash -lc '${noctaliaExe} ipc call lockScreen lock'"; + lockAndSuspendCmd = "${pkgs.bash}/bin/bash -lc '${noctaliaExe} ipc call sessionMenu lockAndSuspend'"; + dpmsOn = "${pkgs.niri}/bin/niri msg action power-on-monitors"; +in +{ + options.my.applications.swayidle = { + enable = lib.mkEnableOption "swayidle idle manager"; + }; + + config = lib.mkIf cfg.enable { + home-manager.sharedModules = [ + { + services.swayidle = { + enable = true; + systemdTarget = "graphical-session.target"; + + timeouts = [ + { + timeout = 300; + command = lockAndSuspendCmd; + } + ]; + + events = [ + { + event = "lock"; + command = lockCmd; + } + { + event = "before-sleep"; + command = lockCmd; + } + { + event = "after-resume"; + command = dpmsOn; + } + ]; + }; + + systemd.user.services.swayidle = { + Service = { + PassEnvironment = [ + "WAYLAND_DISPLAY" + "XDG_RUNTIME_DIR" + "DBUS_SESSION_BUS_ADDRESS" + ]; + }; + }; + } + ]; + }; +} diff --git a/modules/applications/tailscale.nix b/modules/applications/tailscale.nix new file mode 100644 index 0000000..8c9fc30 --- /dev/null +++ b/modules/applications/tailscale.nix @@ -0,0 +1,38 @@ +{ lib, config, ... }: +let + cfg = config.my.applications.tailscale; +in +{ + options.my.applications.tailscale = { + enable = lib.mkEnableOption "Tailscale VPN"; + + acceptDns = lib.mkOption { + type = lib.types.bool; + default = false; + description = "Accept DNS configuration from Tailscale"; + }; + + acceptRoutes = lib.mkOption { + type = lib.types.bool; + default = true; + description = "Accept subnet routes from Tailscale"; + }; + + extraUpFlags = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ ]; + description = "Additional flags to pass to tailscale up"; + }; + }; + + config = lib.mkIf cfg.enable { + services.tailscale = { + enable = true; + extraUpFlags = [ + "--accept-dns=${if cfg.acceptDns then "true" else "false"}" + ] + ++ lib.optional cfg.acceptRoutes "--accept-routes" + ++ cfg.extraUpFlags; + }; + }; +} diff --git a/modules/applications/vicinae.nix b/modules/applications/vicinae.nix new file mode 100644 index 0000000..2edfa33 --- /dev/null +++ b/modules/applications/vicinae.nix @@ -0,0 +1,62 @@ +{ + inputs, + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.applications.vicinae; +in +{ + options.my.applications.vicinae = { + enable = lib.mkEnableOption "Vicinae application launcher"; + }; + + config = lib.mkIf cfg.enable { + home-manager.sharedModules = [ + inputs.vicinae.homeManagerModules.default + { + services.vicinae = { + enable = true; + systemd = { + enable = true; + autoStart = true; + environment = { + USE_LAYER_SHELL = 1; + }; + }; + + settings = { + font.size = 11; + close_on_focus_loss = true; + consider_preedit = true; + pop_to_root_on_close = true; + favicon_service = "twenty"; + search_files_in_root = true; + theme = { + light = { + name = "dracula"; + icon_theme = "default"; + }; + dark = { + name = "vicinae-light"; + icon_theme = "default"; + }; + }; + window = { + csd = true; + opacity = 0.95; + rounding = 10; + }; + }; + extensions = with inputs.vicinae-extensions.packages.${pkgs.stdenv.hostPlatform.system}; [ + bluetooth + nix + power-profile + ]; + }; + } + ]; + }; +} diff --git a/modules/applications/vim/default.nix b/modules/applications/vim/default.nix new file mode 100644 index 0000000..ea5460e --- /dev/null +++ b/modules/applications/vim/default.nix @@ -0,0 +1,23 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.vim; +in +{ + imports = [ + ./system.nix + ./home + ]; + + options.my.applications.vim = { + enable = lib.mkEnableOption "vim text editor"; + }; + + config = lib.mkIf cfg.enable { + my.applications.vim.system.enable = lib.mkDefault true; + my.applications.vim.homeManager.enable = lib.mkDefault true; + }; +} diff --git a/modules/applications/vim/home/autocmds.nix b/modules/applications/vim/home/autocmds.nix new file mode 100644 index 0000000..5b98f8b --- /dev/null +++ b/modules/applications/vim/home/autocmds.nix @@ -0,0 +1,8 @@ +_: { + programs.nixvim.autoCmd = [ + { + event = "TextYankPost"; + callback.__raw = "function() vim.highlight.on_yank() end"; + } + ]; +} diff --git a/modules/applications/vim/home/colorscheme.nix b/modules/applications/vim/home/colorscheme.nix new file mode 100644 index 0000000..7a4049d --- /dev/null +++ b/modules/applications/vim/home/colorscheme.nix @@ -0,0 +1,6 @@ +_: { + programs.nixvim.colorschemes.catppuccin = { + enable = true; + settings.transparent_background = true; + }; +} diff --git a/modules/applications/vim/home/default.nix b/modules/applications/vim/home/default.nix new file mode 100644 index 0000000..59ab1f1 --- /dev/null +++ b/modules/applications/vim/home/default.nix @@ -0,0 +1,57 @@ +{ + pkgs, + inputs, + lib, + config, + ... +}: +let + cfg = config.my.applications.vim.homeManager; +in +{ + options.my.applications.vim.homeManager = { + enable = lib.mkEnableOption "vim home-manager configuration"; + }; + + config = lib.mkIf cfg.enable { + home-manager.sharedModules = [ + inputs.nixvim.homeModules.nixvim + ./options.nix + ./autocmds.nix + ./keymaps.nix + ./language.nix + ./colorscheme.nix + ./lsp.nix + ./plugins + { + programs.nixvim = { + enable = true; + vimAlias = true; + viAlias = true; + withNodeJs = true; + + extraPackages = with pkgs; [ + git + ripgrep + fd + nodejs + zellij + + # LSP / formatter / misc + vtsls + vscode-langservers-extracted + tailwindcss-language-server + prettierd + prettier + biome + stylua + shfmt + alejandra + lua-language-server + nixd + ]; + }; + } + ]; + }; +} diff --git a/modules/applications/vim/home/keymaps.nix b/modules/applications/vim/home/keymaps.nix new file mode 100644 index 0000000..f88c074 --- /dev/null +++ b/modules/applications/vim/home/keymaps.nix @@ -0,0 +1,179 @@ +_: +let + mk = key: action: desc: { + mode = "n"; + inherit key action; + options = { + silent = true; + inherit desc; + }; + }; + + mkRaw = key: raw: desc: { + mode = "n"; + inherit key; + action.__raw = raw; + options = { + silent = true; + inherit desc; + }; + }; + + mkExpr = key: raw: desc: { + mode = "n"; + inherit key; + action.__raw = raw; + options = { + silent = true; + expr = true; + inherit desc; + }; + }; +in +{ + programs.nixvim = { + opts = { + # ジャンプ履歴をスタック寄りに扱う + jumpoptions = "stack"; + + # 既に開いているバッファや直前のウィンドウを優先して再利用 + switchbuf = "useopen,uselast"; + }; + + keymaps = [ + # Search + (mk "" "nohlsearch" "検索ハイライトを解除") + + # Screen line movement + (mkExpr "j" "function() return vim.v.count == 0 and 'gj' or 'j' end" "下へ移動(画面行優先)") + (mkExpr "k" "function() return vim.v.count == 0 and 'gk' or 'k' end" "上へ移動(画面行優先)") + + # LSP: hover / direct jump + (mkRaw "K" "vim.lsp.buf.hover" "シンボル情報を表示") + (mkRaw "gd" "vim.lsp.buf.definition" "定義へジャンプ") + (mkRaw "grr" "vim.lsp.buf.references" "参照一覧を開く") + (mkRaw "gri" "vim.lsp.buf.implementation" "実装一覧を開く") + (mkRaw "grt" "vim.lsp.buf.type_definition" "型定義一覧を開く") + (mkRaw "grn" "vim.lsp.buf.rename" "シンボル名を一括変換") + (mkRaw "gra" "vim.lsp.buf.code_action" "コードアクション") + (mkRaw "gO" "vim.lsp.buf.document_symbol" "現在ファイルのシンボル一覧") + + # Glance: preview / peek + (mk "gD" "Glance definitions" "定義をプレビュー") + (mk "gR" "Glance references" "参照をプレビュー") + (mk "gM" "Glance implementations" "実装をプレビュー") + (mk "gY" "Glance type_definitions" "型定義をプレビュー") + (mk "g." "Glance resume" "直前のGlanceを再開") + + # Convenience aliases + (mkRaw "rn" "vim.lsp.buf.rename" "シンボル名を一括変換") + (mkRaw "cf" + "function() require('conform').format({ timeout_ms = 1000, lsp_format = 'fallback' }) end" + "コードをフォーマット" + ) + (mkRaw "ca" "vim.lsp.buf.code_action" "コードアクション") + + # Diagnostics + (mkRaw "]d" "vim.diagnostic.goto_next" "次の診断へ移動") + (mkRaw "[d" "vim.diagnostic.goto_prev" "前の診断へ移動") + (mkRaw "dl" "vim.diagnostic.open_float" "診断の詳細を表示") + + # File tree + (mk "e" "Neotree toggle left" "ファイルツリー") + + # Terminal + (mk "tt" "ToggleTerm direction=float" "ターミナル") + + # Trouble + (mk "xx" "Trouble diagnostics toggle" "診断一覧") + (mk "xq" "Trouble qflist toggle" "Quickfix一覧") + (mk "xl" "Trouble loclist toggle" "Location List一覧") + (mk "xs" "Trouble symbols toggle" "シンボル一覧") + (mk "xw" "Trouble lsp toggle" "LSP一覧") + + # Quickfix / Location list navigation + (mk "]q" "cnext" "次のQuickfixへ") + (mk "[q" "cprev" "前のQuickfixへ") + (mk "]l" "lnext" "次のLocation Listへ") + (mk "[l" "lprev" "前のLocation Listへ") + + # Window navigation + (mk "" "h" "左のウィンドウへ") + (mk "" "j" "下のウィンドウへ") + (mk "" "k" "上のウィンドウへ") + (mk "" "l" "右のウィンドウへ") + (mk "" "h" "左のウィンドウへ") + (mk "" "j" "下のウィンドウへ") + (mk "" "k" "上のウィンドウへ") + (mk "" "l" "右のウィンドウへ") + + # Alternate file / previous file + (mk "" "" "直前のファイルへ戻る") + (mk "w-" "" "直前のファイルをsplitで開く") + + # Buffer Bar + (mk "[b" "BufferPrevious" "前のバッファーに移動") + (mk "]b" "BufferNext" "次のバッファーに移動") + (mk "bc" "BufferClose" "バッファーを閉じる") + + # Git Conflict + (mk "gco" "GitConflictChooseOurs" "現在のブランチを選択") + (mk "gct" "GitConflictChooseTheirs" "相手のブランチを選択") + (mk "gcb" "GitConflictChooseBoth" "両方を選択") + (mk "gcx" "GitConflictListQf" "コンフリクト一覧") + (mk "]x" "GitConflictNextConflict" "次のコンフリクト") + (mk "[x" "GitConflictPrevConflict" "前のコンフリクト") + + # Git + (mk "gl" "LazyGit" "LazyGitを開く") + (mk "gd" "DiffviewOpen" "差分を開く") + (mk "gH" "DiffviewFileHistory" "リポジトリ履歴") + (mk "gh" "DiffviewFileHistory %" "現在ファイルの履歴") + (mk "gq" "DiffviewClose" "差分を閉じる") + + # Markview + (mk "mp" "Markview splitToggle" "Markdownプレビュー") + + # Zen Mode + (mk "zz" "ZenMode" "Zen Modeを開く/閉じる") + + # UFO (folding) + (mkRaw "zR" "require('ufo').openAllFolds" "全て展開") + (mkRaw "zM" "require('ufo').closeAllFolds" "全て折りたたむ") + + # Dropbar + (mkRaw "dp" "function() require('dropbar.api').pick() end" "dropbarでナビゲート") + + # Snacks + (mkRaw "sd" "function() Snacks.dim.toggle() end" "Dimモードをトグル") + + # Flash + (mkRaw "s" "function() require('flash').jump() end" "Flashジャンプ") + (mkRaw "S" "function() require('flash').treesitter() end" "Flashツリーシッタ選択") + + # Todo Comments + (mk "]t" "TodoNext" "次のTODO") + (mk "[t" "TodoPrev" "前のTODO") + (mkRaw "ft" "function() Snacks.picker.todo_comments() end" "TODO一覧") + + # Spectre + (mkRaw "sr" "function() require('spectre').toggle() end" "検索・置換") + + # Snacks Picker: generic + (mkRaw "ff" "function() Snacks.picker.files() end" "ファイルを探す") + (mkRaw "fg" "function() Snacks.picker.grep() end" "文字列を全文検索") + (mkRaw "fb" "function() Snacks.picker.buffers() end" "開いているバッファを探す") + (mkRaw "fh" "function() Snacks.picker.help() end" "ヘルプ項目を探す") + (mkRaw "fk" "function() Snacks.picker.keymaps() end" "キーマップを探す") + (mkRaw "fc" "function() Snacks.picker.commands() end" "コマンドを探す") + + # Snacks Picker: code navigation + (mkRaw "fs" "function() Snacks.picker.lsp_symbols() end" "現在ファイルのシンボルを探す") + (mkRaw "fS" "function() Snacks.picker.lsp_workspace_symbols() end" "ワークスペース全体のシンボルを探す") + (mkRaw "fr" "function() Snacks.picker.registers() end" "レジスタを探す") + (mkRaw "fj" "function() Snacks.picker.jumps() end" "ジャンプ履歴を探す") + (mkRaw "fq" "function() Snacks.picker.qflist() end" "Quickfixを探す") + (mkRaw "fl" "function() Snacks.picker.loclist() end" "Location Listを探す") + ]; + }; +} diff --git a/modules/applications/vim/home/language.nix b/modules/applications/vim/home/language.nix new file mode 100644 index 0000000..10faa21 --- /dev/null +++ b/modules/applications/vim/home/language.nix @@ -0,0 +1,13 @@ +_: { + programs.nixvim = { + env = { + LANG = "ja_JP.UTF-8"; + LC_MESSAGES = "ja_JP.UTF-8"; + }; + + extraConfigLua = '' + vim.cmd.language("ja_JP.utf8") + vim.opt.helplang = { "ja", "en" } + ''; + }; +} diff --git a/modules/applications/vim/home/lsp.nix b/modules/applications/vim/home/lsp.nix new file mode 100644 index 0000000..5761b87 --- /dev/null +++ b/modules/applications/vim/home/lsp.nix @@ -0,0 +1,65 @@ +_: { + programs.nixvim = { + plugins.lsp = { + enable = true; + + servers = { + # TypeScript / JavaScript + vtsls = { + enable = true; + packageFallback = true; + rootMarkers = [ + "pnpm-workspace.yaml" + "package.json" + "tsconfig.json" + "jsconfig.json" + ".git" + ]; + extraOptions.settings.typescript.locale = "ja"; + }; + + # Biome for lint / format + biome = { + enable = true; + packageFallback = true; + rootMarkers = [ + "biome.json" + "biome.jsonc" + "package.json" + "pnpm-workspace.yaml" + ".git" + ]; + }; + + # Frontend / config languages + tailwindcss.enable = true; + cssls.enable = true; + jsonls.enable = true; + yamlls.enable = true; + lua_ls.enable = true; + nixd.enable = true; + + # Other languages + rust_analyzer = { + enable = true; + installCargo = true; + installRustc = true; + }; + svelte.enable = true; + ty.enable = true; + ruff.enable = true; + astro.enable = true; + gopls.enable = true; + }; + }; + + # Diagnostic UI + diagnostic.settings = { + virtual_text = true; + float = { + border = "rounded"; + source = true; + }; + }; + }; +} diff --git a/modules/applications/vim/home/options.nix b/modules/applications/vim/home/options.nix new file mode 100644 index 0000000..2470b1c --- /dev/null +++ b/modules/applications/vim/home/options.nix @@ -0,0 +1,50 @@ +_: { + programs.nixvim = { + opts = { + # display + number = true; + relativenumber = true; + signcolumn = "yes"; + termguicolors = true; + + # action + mouse = "a"; + clipboard = "unnamedplus"; + updatetime = 200; + timeoutlen = 300; + undofile = true; + + # display + wrap = false; + scrolloff = 8; + + # search + ignorecase = true; + smartcase = true; + + # window split + splitright = true; + splitbelow = true; + + # indent + tabstop = 2; + shiftwidth = 2; + expandtab = true; + + # file encoding + encoding = "utf-8"; + fileencoding = "utf-8"; + fileencodings = "utf-8,sjis,euc-jp,iso-2022-jp"; + + # invisible characters + list = true; + listchars = "tab:»-,trail:-,extends:»,precedes:«,nbsp:%"; + }; + + globals = { + mapleader = " "; + maplocalleader = " "; + clipboard = "osc52"; + }; + }; +} diff --git a/modules/applications/vim/home/plugins/default.nix b/modules/applications/vim/home/plugins/default.nix new file mode 100644 index 0000000..d99031d --- /dev/null +++ b/modules/applications/vim/home/plugins/default.nix @@ -0,0 +1,7 @@ +{ ... }: +{ + imports = [ + ./ui + ./editor + ]; +} diff --git a/modules/applications/vim/home/plugins/editor/autopairs.nix b/modules/applications/vim/home/plugins/editor/autopairs.nix new file mode 100644 index 0000000..3802ad6 --- /dev/null +++ b/modules/applications/vim/home/plugins/editor/autopairs.nix @@ -0,0 +1,3 @@ +_: { + programs.nixvim.plugins.nvim-autopairs.enable = true; +} diff --git a/modules/applications/vim/home/plugins/editor/blink-cmp.nix b/modules/applications/vim/home/plugins/editor/blink-cmp.nix new file mode 100644 index 0000000..9d114cf --- /dev/null +++ b/modules/applications/vim/home/plugins/editor/blink-cmp.nix @@ -0,0 +1,56 @@ +_: { + programs.nixvim.plugins.blink-cmp = { + enable = true; + setupLspCapabilities = true; + + settings = { + keymap = { + preset = "enter"; + + "" = [ "show" ]; + "" = [ "scroll_documentation_up" ]; + "" = [ "hide" ]; + "" = [ "scroll_documentation_down" ]; + + "" = [ + "accept" + { + __raw = '' + function() + local ok, copilot = pcall(require, "copilot.suggestion") + if ok and copilot.is_visible() then + copilot.accept() + return true + end + end + ''; + } + "fallback" + ]; + "" = [ + "select_prev" + "fallback" + ]; + "" = [ + "select_next" + "fallback" + ]; + "" = [ + "select_prev" + "fallback" + ]; + }; + + completion.list.selection = { + preselect = true; + auto_insert = false; + }; + + sources.default = [ + "lsp" + "path" + "buffer" + ]; + }; + }; +} diff --git a/modules/applications/vim/home/plugins/editor/comment.nix b/modules/applications/vim/home/plugins/editor/comment.nix new file mode 100644 index 0000000..c6a216d --- /dev/null +++ b/modules/applications/vim/home/plugins/editor/comment.nix @@ -0,0 +1,3 @@ +_: { + programs.nixvim.plugins.comment.enable = true; +} diff --git a/modules/applications/vim/home/plugins/editor/conform.nix b/modules/applications/vim/home/plugins/editor/conform.nix new file mode 100644 index 0000000..40013ed --- /dev/null +++ b/modules/applications/vim/home/plugins/editor/conform.nix @@ -0,0 +1,24 @@ +_: { + programs.nixvim.plugins."conform-nvim" = { + enable = true; + settings = { + formatters_by_ft = { + javascript.__raw = ''{ "biome", "prettierd", "prettier", stop_after_first = true }''; + javascriptreact.__raw = ''{ "biome", "prettierd", "prettier", stop_after_first = true }''; + typescript.__raw = ''{ "biome", "prettierd", "prettier", stop_after_first = true }''; + typescriptreact.__raw = ''{ "biome", "prettierd", "prettier", stop_after_first = true }''; + json.__raw = ''{ "biome", "prettierd", "prettier", stop_after_first = true }''; + yaml.__raw = ''{ "prettierd", "prettier", stop_after_first = true }''; + markdown.__raw = ''{ "prettierd", "prettier", stop_after_first = true }''; + lua = [ "stylua" ]; + nix = [ "alejandra" ]; + sh = [ "shfmt" ]; + }; + format_on_save.__raw = '' + function(_) + return { timeout_ms = 1000, lsp_format = "fallback" } + end + ''; + }; + }; +} diff --git a/modules/applications/vim/home/plugins/editor/copilot.nix b/modules/applications/vim/home/plugins/editor/copilot.nix new file mode 100644 index 0000000..4bbb86f --- /dev/null +++ b/modules/applications/vim/home/plugins/editor/copilot.nix @@ -0,0 +1,11 @@ +_: { + programs.nixvim.plugins.copilot-lua = { + enable = true; + settings = { + suggestion = { + auto_trigger = true; + keymap.enabled = false; + }; + }; + }; +} diff --git a/modules/applications/vim/home/plugins/editor/default.nix b/modules/applications/vim/home/plugins/editor/default.nix new file mode 100644 index 0000000..ed0668a --- /dev/null +++ b/modules/applications/vim/home/plugins/editor/default.nix @@ -0,0 +1,23 @@ +{ ... }: +{ + imports = [ + ./snacks.nix + ./treesitter.nix + ./blink-cmp.nix + ./gitsigns.nix + ./comment.nix + ./autopairs.nix + ./lsp-signature.nix + ./copilot.nix + ./trouble.nix + ./conform.nix + ./surround.nix + ./git.nix + ./git-conflict.nix + ./glance.nix + ./flash.nix + ./todo-comments.nix + ./spectre.nix + ./wakatime.nix + ]; +} diff --git a/modules/applications/vim/home/plugins/editor/flash.nix b/modules/applications/vim/home/plugins/editor/flash.nix new file mode 100644 index 0000000..d899445 --- /dev/null +++ b/modules/applications/vim/home/plugins/editor/flash.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + extraPlugins = [ pkgs.vimPlugins.flash-nvim ]; + extraConfigLua = '' + require("flash").setup() + ''; + }; +} diff --git a/modules/applications/vim/home/plugins/editor/git-conflict.nix b/modules/applications/vim/home/plugins/editor/git-conflict.nix new file mode 100644 index 0000000..8c8663c --- /dev/null +++ b/modules/applications/vim/home/plugins/editor/git-conflict.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + extraPlugins = [ pkgs.vimPlugins.git-conflict-nvim ]; + extraConfigLua = '' + require("git-conflict").setup() + ''; + }; +} diff --git a/modules/applications/vim/home/plugins/editor/git.nix b/modules/applications/vim/home/plugins/editor/git.nix new file mode 100644 index 0000000..cd904cb --- /dev/null +++ b/modules/applications/vim/home/plugins/editor/git.nix @@ -0,0 +1,11 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + extraPackages = [ pkgs.lazygit ]; + + plugins = { + lazygit.enable = true; + diffview.enable = true; + }; + }; +} diff --git a/modules/applications/vim/home/plugins/editor/gitsigns.nix b/modules/applications/vim/home/plugins/editor/gitsigns.nix new file mode 100644 index 0000000..6a7e881 --- /dev/null +++ b/modules/applications/vim/home/plugins/editor/gitsigns.nix @@ -0,0 +1,25 @@ +_: { + # git change view + programs.nixvim.plugins.gitsigns = { + enable = true; + settings = { + signs = { + add = { + text = "+"; + }; + change = { + text = "~"; + }; + delete = { + text = "_"; + }; + topdelete = { + text = "‾"; + }; + changedelete = { + text = "~"; + }; + }; + }; + }; +} diff --git a/modules/applications/vim/home/plugins/editor/glance.nix b/modules/applications/vim/home/plugins/editor/glance.nix new file mode 100644 index 0000000..bea6bd3 --- /dev/null +++ b/modules/applications/vim/home/plugins/editor/glance.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + extraPlugins = [ pkgs.vimPlugins.glance-nvim ]; + extraConfigLua = '' + require("glance").setup() + ''; + }; +} diff --git a/modules/applications/vim/home/plugins/editor/lsp-signature.nix b/modules/applications/vim/home/plugins/editor/lsp-signature.nix new file mode 100644 index 0000000..361bb67 --- /dev/null +++ b/modules/applications/vim/home/plugins/editor/lsp-signature.nix @@ -0,0 +1,11 @@ +_: { + programs.nixvim.plugins.lsp-signature = { + enable = true; + settings = { + hint_enable = true; + hint_prefix = " "; + floating_window = true; + bind = true; + }; + }; +} diff --git a/modules/applications/vim/home/plugins/editor/snacks.nix b/modules/applications/vim/home/plugins/editor/snacks.nix new file mode 100644 index 0000000..86ace40 --- /dev/null +++ b/modules/applications/vim/home/plugins/editor/snacks.nix @@ -0,0 +1,32 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + extraPlugins = [ pkgs.vimPlugins.snacks-nvim ]; + + extraConfigLua = '' + require("snacks").setup({ + picker = { + enabled = true, + + actions = require("trouble.sources.snacks").actions, + + win = { + input = { + keys = { + [""] = { + "trouble_open", + mode = { "n", "i" }, + }, + }, + }, + }, + }, + + notifier = { enabled = true }, + words = { enabled = true }, + scroll = { enabled = true }, + dim = { enabled = true }, + }) + ''; + }; +} diff --git a/modules/applications/vim/home/plugins/editor/spectre.nix b/modules/applications/vim/home/plugins/editor/spectre.nix new file mode 100644 index 0000000..60c2e4c --- /dev/null +++ b/modules/applications/vim/home/plugins/editor/spectre.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + extraPackages = [ pkgs.ripgrep ]; + extraPlugins = [ pkgs.vimPlugins.nvim-spectre ]; + extraConfigLua = '' + require("spectre").setup() + ''; + }; +} diff --git a/modules/applications/vim/home/plugins/editor/surround.nix b/modules/applications/vim/home/plugins/editor/surround.nix new file mode 100644 index 0000000..83276b4 --- /dev/null +++ b/modules/applications/vim/home/plugins/editor/surround.nix @@ -0,0 +1,3 @@ +_: { + programs.nixvim.plugins.nvim-surround.enable = true; +} diff --git a/modules/applications/vim/home/plugins/editor/todo-comments.nix b/modules/applications/vim/home/plugins/editor/todo-comments.nix new file mode 100644 index 0000000..fa3303a --- /dev/null +++ b/modules/applications/vim/home/plugins/editor/todo-comments.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + extraPlugins = [ pkgs.vimPlugins.todo-comments-nvim ]; + extraConfigLua = '' + require("todo-comments").setup() + ''; + }; +} diff --git a/modules/applications/vim/home/plugins/editor/treesitter.nix b/modules/applications/vim/home/plugins/editor/treesitter.nix new file mode 100644 index 0000000..32208b1 --- /dev/null +++ b/modules/applications/vim/home/plugins/editor/treesitter.nix @@ -0,0 +1,17 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + plugins.treesitter = { + enable = true; + settings = { + highlight.enable = true; + indent.enable = true; + }; + }; + + extraPlugins = [ pkgs.vimPlugins.nvim-ts-autotag ]; + extraConfigLua = '' + require("nvim-ts-autotag").setup() + ''; + }; +} diff --git a/modules/applications/vim/home/plugins/editor/trouble.nix b/modules/applications/vim/home/plugins/editor/trouble.nix new file mode 100644 index 0000000..c7ce674 --- /dev/null +++ b/modules/applications/vim/home/plugins/editor/trouble.nix @@ -0,0 +1,3 @@ +_: { + programs.nixvim.plugins.trouble.enable = true; +} diff --git a/modules/applications/vim/home/plugins/editor/wakatime.nix b/modules/applications/vim/home/plugins/editor/wakatime.nix new file mode 100644 index 0000000..04dc233 --- /dev/null +++ b/modules/applications/vim/home/plugins/editor/wakatime.nix @@ -0,0 +1,4 @@ +{ pkgs, ... }: +{ + programs.nixvim.extraPlugins = [ pkgs.vimPlugins.vim-wakatime ]; +} diff --git a/modules/applications/vim/home/plugins/ui/barbar.nix b/modules/applications/vim/home/plugins/ui/barbar.nix new file mode 100644 index 0000000..474a5a0 --- /dev/null +++ b/modules/applications/vim/home/plugins/ui/barbar.nix @@ -0,0 +1,26 @@ +_: { + programs.nixvim.plugins.barbar = { + enable = true; + settings = { + animation = false; + auto_hide = 1; + tabpages = true; + clickable = true; + focus_on_close = "left"; + + icons = { + button = "󰅖"; + separator = { + left = "▎"; + right = ""; + }; + separator_at_end = false; + filetype.enabled = true; + }; + + sidebar_filetypes = { + neo-tree = true; + }; + }; + }; +} diff --git a/modules/applications/vim/home/plugins/ui/blankline.nix b/modules/applications/vim/home/plugins/ui/blankline.nix new file mode 100644 index 0000000..3439350 --- /dev/null +++ b/modules/applications/vim/home/plugins/ui/blankline.nix @@ -0,0 +1,20 @@ +_: { + programs.nixvim.plugins.indent-blankline = { + enable = true; + settings = { + scope = { + enabled = true; + show_start = true; + show_end = true; + }; + exclude = { + filetypes = [ + "help" + "neo-tree" + "toggleterm" + "lazy" + ]; + }; + }; + }; +} diff --git a/modules/applications/vim/home/plugins/ui/colorizer.nix b/modules/applications/vim/home/plugins/ui/colorizer.nix new file mode 100644 index 0000000..54b6c4e --- /dev/null +++ b/modules/applications/vim/home/plugins/ui/colorizer.nix @@ -0,0 +1,26 @@ +_: { + programs.nixvim.plugins.colorizer = { + enable = true; + + settings = { + filetypes = [ + "*" + "!markdown" + ]; + user_commands = true; + + options = { + parsers = { + css = true; + tailwind = { + enable = true; + lsp = true; + update_names = true; + }; + }; + + display.mode = "background"; + }; + }; + }; +} diff --git a/modules/applications/vim/home/plugins/ui/default.nix b/modules/applications/vim/home/plugins/ui/default.nix new file mode 100644 index 0000000..7709bc0 --- /dev/null +++ b/modules/applications/vim/home/plugins/ui/default.nix @@ -0,0 +1,20 @@ +{ ... }: +{ + imports = [ + ./lualine.nix + ./neo-tree.nix + ./blankline.nix + ./which-key.nix + ./web-devicons.nix + ./toggleterm.nix + ./treesitter.nix + ./barbar.nix + ./lightbulb.nix + ./colorizer.nix + ./dropbar.nix + ./scrollbar.nix + ./ufo.nix + ./zen-mode.nix + ./markview.nix + ]; +} diff --git a/modules/applications/vim/home/plugins/ui/dropbar.nix b/modules/applications/vim/home/plugins/ui/dropbar.nix new file mode 100644 index 0000000..d6eea7d --- /dev/null +++ b/modules/applications/vim/home/plugins/ui/dropbar.nix @@ -0,0 +1,3 @@ +_: { + programs.nixvim.plugins.dropbar.enable = true; +} diff --git a/modules/applications/vim/home/plugins/ui/lightbulb.nix b/modules/applications/vim/home/plugins/ui/lightbulb.nix new file mode 100644 index 0000000..fd887e3 --- /dev/null +++ b/modules/applications/vim/home/plugins/ui/lightbulb.nix @@ -0,0 +1,6 @@ +_: { + programs.nixvim.plugins.nvim-lightbulb = { + enable = true; + settings.autocmd.enabled = true; + }; +} diff --git a/modules/applications/vim/home/plugins/ui/lualine.nix b/modules/applications/vim/home/plugins/ui/lualine.nix new file mode 100644 index 0000000..8c7a508 --- /dev/null +++ b/modules/applications/vim/home/plugins/ui/lualine.nix @@ -0,0 +1,25 @@ +_: { + programs.nixvim.plugins.lualine = { + enable = true; + settings.sections.lualine_x = [ + { + __raw = '' + function() + local ok, conform = pcall(require, "conform") + if not ok then return "" end + local formatters = conform.list_formatters(0) + for _, f in ipairs(formatters) do + if f.available then + return "󰛖 " .. f.name + end + end + return "" + end + ''; + } + "encoding" + "fileformat" + "filetype" + ]; + }; +} diff --git a/modules/applications/vim/home/plugins/ui/markview.nix b/modules/applications/vim/home/plugins/ui/markview.nix new file mode 100644 index 0000000..a67adc1 --- /dev/null +++ b/modules/applications/vim/home/plugins/ui/markview.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + extraPlugins = [ pkgs.vimPlugins.markview-nvim ]; + extraConfigLua = '' + require("markview").setup({ initial_state = false }) + ''; + }; +} diff --git a/modules/applications/vim/home/plugins/ui/neo-tree.nix b/modules/applications/vim/home/plugins/ui/neo-tree.nix new file mode 100644 index 0000000..f3fe5e8 --- /dev/null +++ b/modules/applications/vim/home/plugins/ui/neo-tree.nix @@ -0,0 +1,37 @@ +_: { + programs.nixvim = { + plugins.neo-tree = { + enable = true; + settings = { + close_if_last_window = true; + + filesystem = { + follow_current_file = { + enabled = true; + leave_dirs_open = true; + }; + + filtered_items = { + visible = true; + hide_dotfiles = false; + hide_gitignored = true; + hide_ignored = false; + hide_hidden = false; + + hide_by_name = [ ]; + hide_by_pattern = [ ]; + + always_show = [ ]; + always_show_by_pattern = [ ]; + + never_show = [ + ".DS_Store" + "thumbs.db" + ]; + never_show_by_pattern = [ ]; + }; + }; + }; + }; + }; +} diff --git a/modules/applications/vim/home/plugins/ui/scrollbar.nix b/modules/applications/vim/home/plugins/ui/scrollbar.nix new file mode 100644 index 0000000..c7c53b5 --- /dev/null +++ b/modules/applications/vim/home/plugins/ui/scrollbar.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + extraPlugins = [ pkgs.vimPlugins.nvim-scrollbar ]; + extraConfigLua = '' + require("scrollbar").setup() + ''; + }; +} diff --git a/modules/applications/vim/home/plugins/ui/toggleterm.nix b/modules/applications/vim/home/plugins/ui/toggleterm.nix new file mode 100644 index 0000000..123dde3 --- /dev/null +++ b/modules/applications/vim/home/plugins/ui/toggleterm.nix @@ -0,0 +1,3 @@ +_: { + programs.nixvim.plugins.toggleterm.enable = true; +} diff --git a/modules/applications/vim/home/plugins/ui/treesitter.nix b/modules/applications/vim/home/plugins/ui/treesitter.nix new file mode 100644 index 0000000..9a3f85e --- /dev/null +++ b/modules/applications/vim/home/plugins/ui/treesitter.nix @@ -0,0 +1,3 @@ +_: { + programs.nixvim.plugins."treesitter-context".enable = true; +} diff --git a/modules/applications/vim/home/plugins/ui/ufo.nix b/modules/applications/vim/home/plugins/ui/ufo.nix new file mode 100644 index 0000000..d59f54c --- /dev/null +++ b/modules/applications/vim/home/plugins/ui/ufo.nix @@ -0,0 +1,24 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + opts = { + foldcolumn = "1"; + foldlevel = 99; + foldlevelstart = 99; + foldenable = true; + }; + + extraPlugins = [ + pkgs.vimPlugins.nvim-ufo + pkgs.vimPlugins.promise-async + ]; + + extraConfigLua = '' + require("ufo").setup({ + provider_selector = function() + return { "treesitter", "indent" } + end, + }) + ''; + }; +} diff --git a/modules/applications/vim/home/plugins/ui/web-devicons.nix b/modules/applications/vim/home/plugins/ui/web-devicons.nix new file mode 100644 index 0000000..12d195f --- /dev/null +++ b/modules/applications/vim/home/plugins/ui/web-devicons.nix @@ -0,0 +1,4 @@ +_: { + # icon set preview + programs.nixvim.plugins.web-devicons.enable = true; +} diff --git a/modules/applications/vim/home/plugins/ui/which-key.nix b/modules/applications/vim/home/plugins/ui/which-key.nix new file mode 100644 index 0000000..7f0441d --- /dev/null +++ b/modules/applications/vim/home/plugins/ui/which-key.nix @@ -0,0 +1,4 @@ +_: { + # key map help + programs.nixvim.plugins.which-key.enable = true; +} diff --git a/modules/applications/vim/home/plugins/ui/zen-mode.nix b/modules/applications/vim/home/plugins/ui/zen-mode.nix new file mode 100644 index 0000000..23c7a5f --- /dev/null +++ b/modules/applications/vim/home/plugins/ui/zen-mode.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + programs.nixvim = { + extraPlugins = [ pkgs.vimPlugins.zen-mode-nvim ]; + extraConfigLua = '' + require("zen-mode").setup() + ''; + }; +} diff --git a/modules/applications/vim/system.nix b/modules/applications/vim/system.nix new file mode 100644 index 0000000..8098b91 --- /dev/null +++ b/modules/applications/vim/system.nix @@ -0,0 +1,22 @@ +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.applications.vim.system; +in +{ + options.my.applications.vim.system = { + enable = lib.mkEnableOption "vim system configuration"; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + vim # Highly configurable text editor + ]; + + environment.variables.EDITOR = "nvim"; + }; +} diff --git a/modules/applications/vscode/default.nix b/modules/applications/vscode/default.nix new file mode 100644 index 0000000..6fe9147 --- /dev/null +++ b/modules/applications/vscode/default.nix @@ -0,0 +1,23 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.vscode; +in +{ + imports = [ + ./system.nix + ./home.nix + ]; + + options.my.applications.vscode = { + enable = lib.mkEnableOption "Visual Studio Code editor"; + }; + + config = lib.mkIf cfg.enable { + my.applications.vscode.system.enable = lib.mkDefault true; + my.applications.vscode.homeManager.enable = lib.mkDefault true; + }; +} diff --git a/modules/applications/vscode/home.nix b/modules/applications/vscode/home.nix new file mode 100644 index 0000000..d61a0b0 --- /dev/null +++ b/modules/applications/vscode/home.nix @@ -0,0 +1,296 @@ +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.applications.vscode.homeManager; + vsc = pkgs.vscode-extensions; + inherit (lib) recursiveUpdate; + + rustLibclangPath = pkgs.lib.makeLibraryPath [ pkgs.llvmPackages_latest.libclang.lib ]; + + rustBindgenExtraClangArgs = lib.concatStringsSep " " ( + (builtins.map (a: ''-I"${a}/include"'') [ + pkgs.glibc.dev + ]) + ++ [ + ''-I"${pkgs.llvmPackages_latest.libclang.lib}/lib/clang/${pkgs.llvmPackages_latest.libclang.version}/include"'' + ''-I"${pkgs.glib.dev}/include/glib-2.0"'' + "-I${pkgs.glib.out}/lib/glib-2.0/include/" + ] + ); + + layers = rec { + common = { + extensions = + (with vsc; [ + github.copilot + github.copilot-chat + dracula-theme.theme-dracula + ms-vscode-remote.vscode-remote-extensionpack + dbaeumer.vscode-eslint + ms-vscode-remote.remote-containers + ms-vscode-remote.remote-ssh + github.vscode-github-actions + github.vscode-pull-request-github + eamodio.gitlens + streetsidesoftware.code-spell-checker + ms-ceintl.vscode-language-pack-ja + ]) + ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ + { + name = "hadolint"; + publisher = "exiasr"; + version = "1.1.2"; + hash = "sha256-6GO1f8SP4CE8yYl87/tm60FdGHqHsJA4c2B6ukVdpgM="; + } + { + name = "chatgpt"; + publisher = "openai"; + version = "0.4.71"; + hash = "sha256-Q0le5rhVRgTDQXjIlhbzJOv/7+xC6JXwTp6fxZCP4ak="; + } + ]; + userSettings = { + "workbench.colorTheme" = "Dracula"; + "window.autoDetectColorScheme" = false; + "editor.formatOnSave" = true; + "editor.defaultFormatter" = "esbenp.prettier-vscode"; + "git.enableSmartCommit" = true; + "files.autoSave" = "onFocusChange"; + "git.confirmSync" = false; + "github.copilot.nextEditSuggestions.enabled" = true; + "editor.suggestOnTriggerCharacters" = true; + "editor.quickSuggestions" = { + other = true; + comments = false; + strings = true; + }; + "git.autofetch" = true; + "workbench.editor.enablePreview" = false; + }; + }; + + web = { + extensions = + (with vsc; [ + lokalise.i18n-ally + bradlc.vscode-tailwindcss + prisma.prisma + hashicorp.terraform + yoavbls.pretty-ts-errors + ]) + ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ + { + name = "pnpm-catalog-lens"; + publisher = "antfu"; + version = "1.0.0"; + hash = "sha256-mCMBVxZRIb3Jao1XSS7EQRQX3Y2vrkpAmy6ldSqZa9c="; + } + { + name = "explorer"; + publisher = "vitest"; + version = "1.32.1"; + hash = "sha256-MAfjS/oFfFuiE+Q2w6leSlao436QSw2fKjd7/BE/Q8Y="; + } + ]; + userSettings = { }; + }; + + web-biome = { + extensions = with vsc; [ + biomejs.biome + ]; + userSettings = { + "editor.defaultFormatter" = "biomejs.biome"; + "[typescript].editor.defaultFormatter" = "biomejs.biome"; + "[typescriptreact].editor.defaultFormatter" = "biomejs.biome"; + }; + }; + + web-oxc = { + extensions = pkgs.vscode-utils.extensionsFromVscodeMarketplace [ + { + name = "oxc-vscode"; + publisher = "oxc"; + version = "1.48.0"; + hash = "sha256-RZ7mLcLJyn7lR6w6Au6fZeguB3wtk8sIXb67lPnPnrc="; + } + ]; + userSettings = { + "editor.defaultFormatter" = "oxc.oxc-vscode"; + "[typescript].editor.defaultFormatter" = "oxc.oxc-vscode"; + "[typescriptreact].editor.defaultFormatter" = "oxc.oxc-vscode"; + }; + }; + + nix = { + extensions = with vsc; [ + bbenoist.nix + jnoortheen.nix-ide + ]; + userSettings = { + "nix.enableLanguageServer" = true; + "nix.serverPath" = "nil"; + "[nix]" = { + "editor.defaultFormatter" = "jnoortheen.nix-ide"; + }; + }; + }; + + jupyter = { + extensions = with vsc; [ + ms-toolsai.jupyter + ms-python.python + ]; + userSettings = { }; + }; + + java = { + extensions = with vsc; [ + vscjava.vscode-java-pack + sonarsource.sonarlint-vscode + vscjava.vscode-java-debug + redhat.java + ]; + + userSettings = { + "java.jdt.ls.java.home" = "${pkgs.jdk25.home}"; + "java.configuration.runtimes" = [ + { + "name" = "JavaSE-25"; + "path" = "${pkgs.jdk25.home}"; + "default" = true; + } + ]; + + "editor.codeLens" = true; + "java.debug.settings.enableRunDebugCodeLens" = true; + + "java.jdt.ls.vmargs" = "-Xms256m -Xmx2G -XX:+UseG1GC -XX:+UseStringDeduplication"; + + "java.configuration.updateBuildConfiguration" = "interactive"; + + "java.maven.downloadSources" = true; + "java.eclipse.downloadSources" = true; + + "maven.executable.path" = "${pkgs.maven}/bin/mvn"; + + "[java]" = { + "editor.defaultFormatter" = "redhat.java"; + }; + }; + }; + + rust = { + extensions = with vsc; [ + rust-lang.rust-analyzer + vadimcn.vscode-lldb + serayuzgur.crates + tamasfe.even-better-toml + ]; + + userSettings = { + "[rust]" = { + "editor.defaultFormatter" = "rust-lang.rust-analyzer"; + "editor.formatOnSave" = true; + "editor.codeActionsOnSave" = { + "source.organizeImports" = true; + "source.fixAll" = true; + }; + }; + + "rust-analyzer.checkOnSave" = true; + "rust-analyzer.check.command" = "clippy"; + + "rust-analyzer.cargo.buildScripts.enable" = true; + "rust-analyzer.procMacro.enable" = true; + + "rust-analyzer.cargo.targetDir" = true; + + "rust-analyzer.cargo.extraEnv" = { + "LIBCLANG_PATH" = rustLibclangPath; + "BINDGEN_EXTRA_CLANG_ARGS" = rustBindgenExtraClangArgs; + }; + + "rust-analyzer.lens.enable" = true; + "rust-analyzer.lens.implementations.enable" = true; + "rust-analyzer.lens.references.adt.enable" = true; + "rust-analyzer.lens.references.enumVariant.enable" = true; + "rust-analyzer.lens.references.method.enable" = true; + "rust-analyzer.lens.references.trait.enable" = true; + + "files.watcherExclude" = { + "**/target/**" = true; + }; + "search.exclude" = { + "**/target/**" = true; + }; + }; + }; + }; + + combine = + ls: + builtins.foldl' + (acc: l: { + extensions = acc.extensions ++ (l.extensions or [ ]); + userSettings = recursiveUpdate acc.userSettings (l.userSettings or { }); + }) + { + extensions = [ ]; + userSettings = { }; + } + ls; + + mkProfile = + layersList: extras: + let + base = combine layersList; + in + { + extensions = base.extensions ++ (extras.extensions or [ ]); + userSettings = recursiveUpdate base.userSettings (extras.userSettings or { }); + }; +in +{ + options.my.applications.vscode.homeManager = { + enable = lib.mkEnableOption "VSCode home-manager configuration"; + }; + + config = lib.mkIf cfg.enable { + nixpkgs.config.allowUnfree = true; + + home-manager.sharedModules = [ + { + programs.vscode = { + enable = true; + + profiles = { + default = mkProfile [ layers.common ] { }; + + nix = mkProfile [ layers.common layers.nix ] { }; + + web = mkProfile [ layers.common layers.web layers.web-biome ] { }; + + web-oxc = mkProfile [ layers.common layers.web layers.web-oxc ] { }; + + jupyter = mkProfile [ layers.common layers.jupyter ] { }; + + java = mkProfile [ layers.common layers.java ] { }; + + rust = mkProfile [ layers.common layers.rust ] { }; + }; + }; + + xdg.configFile."Code/User/locale.json".text = '' + { + "locale": "ja" + } + ''; + } + ]; + }; +} diff --git a/modules/applications/vscode/system.nix b/modules/applications/vscode/system.nix new file mode 100644 index 0000000..99f05d7 --- /dev/null +++ b/modules/applications/vscode/system.nix @@ -0,0 +1,20 @@ +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.applications.vscode.system; +in +{ + options.my.applications.vscode.system = { + enable = lib.mkEnableOption "VSCode system configuration"; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + sqlite # SQLite database library (VSCode dependency) + ]; + }; +} diff --git a/modules/applications/wayland.nix b/modules/applications/wayland.nix new file mode 100644 index 0000000..19d88f3 --- /dev/null +++ b/modules/applications/wayland.nix @@ -0,0 +1,53 @@ +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.applications.wayland; +in +{ + options.my.applications.wayland = { + enable = lib.mkEnableOption "Wayland session support"; + }; + + config = lib.mkIf cfg.enable { + programs.xwayland.enable = true; + + xdg.portal = { + enable = true; + wlr.enable = true; + extraPortals = [ + pkgs.xdg-desktop-portal-wlr + pkgs.xdg-desktop-portal-gtk + ]; + xdgOpenUsePortal = true; + config = { + common.default = [ + "wlr" + "gtk" + ]; + niri.default = [ + "wlr" + "gtk" + ]; + }; + }; + + environment.variables = { + NIXOS_OZONE_WL = "1"; + }; + + environment.sessionVariables = { + ELECTRON_OZONE_PLATFORM_HINT = "wayland"; + QT_QPA_PLATFORM = "wayland;xcb"; + NIXOS_OZONE_WL = "1"; + }; + + environment.systemPackages = with pkgs; [ + xwayland-satellite # X11 compatibility layer for Wayland + uwsm # Universal Wayland Session Manager + ]; + }; +} diff --git a/modules/applications/zellij/default.nix b/modules/applications/zellij/default.nix new file mode 100644 index 0000000..69a4d65 --- /dev/null +++ b/modules/applications/zellij/default.nix @@ -0,0 +1,23 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.zellij; +in +{ + imports = [ + ./system.nix + ./home.nix + ]; + + options.my.applications.zellij = { + enable = lib.mkEnableOption "Zellij terminal multiplexer"; + }; + + config = lib.mkIf cfg.enable { + my.applications.zellij.system.enable = lib.mkDefault true; + my.applications.zellij.homeManager.enable = lib.mkDefault true; + }; +} diff --git a/modules/applications/zellij/home.nix b/modules/applications/zellij/home.nix new file mode 100644 index 0000000..3a4dbe4 --- /dev/null +++ b/modules/applications/zellij/home.nix @@ -0,0 +1,81 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.zellij.homeManager; +in +{ + options.my.applications.zellij.homeManager = { + enable = lib.mkEnableOption "Zellij home-manager configuration"; + }; + + config.home-manager.sharedModules = [ + { + config = lib.mkIf cfg.enable { + programs.zellij = { + enable = true; + + enableZshIntegration = false; + + settings = { + pane_frames = true; + copy_on_select = false; + default_mode = "locked"; + default_shell = "/run/current-system/sw/bin/zsh"; + }; + + extraConfig = '' + keybinds { + locked { + bind "Ctrl g" { SwitchToMode "normal"; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt n" { NewPane; } + bind "Alt t" { NewTab; } + bind "Alt H" { Resize "Increase Left"; } + bind "Alt J" { Resize "Increase Down"; } + bind "Alt K" { Resize "Increase Up"; } + bind "Alt L" { Resize "Increase Right"; } + bind "Alt c" { Copy; } + } + normal { + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + bind "Alt j" "Alt Down" { MoveFocus "Down"; } + bind "Alt k" "Alt Up" { MoveFocus "Up"; } + bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } + bind "Alt n" { NewPane; } + bind "Alt t" { NewTab; } + bind "Alt H" { Resize "Increase Left"; } + bind "Alt J" { Resize "Increase Down"; } + bind "Alt K" { Resize "Increase Up"; } + bind "Alt L" { Resize "Increase Right"; } + } + } + ''; + + layouts.dev = '' + layout { + pane split_direction="vertical" { + pane { + pane command="nvim" + pane stacked=true size="30%" { + pane expanded=true + pane + } + } + + pane size=1 borderless=true { + plugin location="zellij:compact-bar" + } + } + } + ''; + }; + }; + } + ]; +} diff --git a/modules/applications/zellij/system.nix b/modules/applications/zellij/system.nix new file mode 100644 index 0000000..65a6cb3 --- /dev/null +++ b/modules/applications/zellij/system.nix @@ -0,0 +1,20 @@ +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.applications.zellij.system; +in +{ + options.my.applications.zellij.system = { + enable = lib.mkEnableOption "Zellij system configuration"; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + zellij # Terminal multiplexer with batteries included + ]; + }; +} diff --git a/modules/applications/zoom.nix b/modules/applications/zoom.nix new file mode 100644 index 0000000..ce74f17 --- /dev/null +++ b/modules/applications/zoom.nix @@ -0,0 +1,26 @@ +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.applications.zoom; +in +{ + options.my.applications.zoom = { + enable = lib.mkEnableOption "Zoom video conferencing"; + }; + + config = lib.mkIf cfg.enable { + nixpkgs.config.allowUnfreePredicate = pkg: lib.getName pkg == "zoom-us"; + + home-manager.sharedModules = [ + { + home.packages = with pkgs; [ + zoom-us # Video conferencing application + ]; + } + ]; + }; +} diff --git a/modules/applications/zsh/default.nix b/modules/applications/zsh/default.nix new file mode 100644 index 0000000..1d7b07b --- /dev/null +++ b/modules/applications/zsh/default.nix @@ -0,0 +1,25 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.applications.zsh; +in +{ + imports = [ + ./system.nix + ./home.nix + ]; + + options.my.applications.zsh = { + enable = lib.mkEnableOption "Zsh shell"; + system.enable = lib.mkEnableOption "Zsh system configuration"; + homeManager.enable = lib.mkEnableOption "Zsh home-manager configuration"; + }; + + config = lib.mkIf cfg.enable { + my.applications.zsh.system.enable = lib.mkDefault true; + my.applications.zsh.homeManager.enable = lib.mkDefault true; + }; +} diff --git a/modules/applications/zsh/home.nix b/modules/applications/zsh/home.nix new file mode 100644 index 0000000..529edc1 --- /dev/null +++ b/modules/applications/zsh/home.nix @@ -0,0 +1,58 @@ +{ lib, config, ... }: +let + cfg = config.my.applications.zsh.homeManager; +in +{ + options.my.applications.zsh.homeManager = { + enable = lib.mkEnableOption "Zsh home-manager configuration"; + }; + + config.home-manager.sharedModules = [ + { + config = lib.mkIf cfg.enable { + programs.zsh = { + enable = true; + enableCompletion = true; + + oh-my-zsh = { + enable = true; + theme = "robbyrussell"; + plugins = [ "git" ]; + }; + + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + + initContent = '' + # ---- from gist: export / history size ---- + export HISTSIZE=999999999 + export HISTFILESIZE=999999999 + + # ---- from gist: setopt ---- + setopt extended_history + setopt hist_allow_clobber + setopt hist_fcntl_lock + setopt hist_find_no_dups + setopt hist_ignore_all_dups + setopt hist_ignore_dups + setopt hist_ignore_space + # setopt hist_no_functions + # setopt hist_no_store + setopt hist_reduce_blanks + setopt hist_save_no_dups + setopt hist_verify + setopt inc_append_history_time + + unsetopt SHARE_HISTORY + setopt APPEND_HISTORY + setopt INC_APPEND_HISTORY_TIME + + # ---- from gist: aliases ---- + alias docker-compose="docker compose" + alias clearsign='export GPG_TTY=$(tty) && openssl rand -hex 16 | gpg --clearsign' + ''; + }; + }; + } + ]; +} diff --git a/modules/applications/zsh/system.nix b/modules/applications/zsh/system.nix new file mode 100644 index 0000000..ef4a98d --- /dev/null +++ b/modules/applications/zsh/system.nix @@ -0,0 +1,13 @@ +{ lib, config, ... }: +let + cfg = config.my.applications.zsh.system; +in +{ + options.my.applications.zsh.system = { + enable = lib.mkEnableOption "Zsh system configuration"; + }; + + config = lib.mkIf cfg.enable { + programs.zsh.enable = true; + }; +} diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..e69de29 diff --git a/modules/drivers/default.nix b/modules/drivers/default.nix new file mode 100644 index 0000000..812230f --- /dev/null +++ b/modules/drivers/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ./intel-drivers.nix + ]; +} diff --git a/modules/drivers/intel-drivers.nix b/modules/drivers/intel-drivers.nix index fb24fd6..cc3ae16 100644 --- a/modules/drivers/intel-drivers.nix +++ b/modules/drivers/intel-drivers.nix @@ -4,23 +4,21 @@ config, ... }: -with lib; let - cfg = config.drivers.intel; + cfg = config.my.drivers.intel; in { - options.drivers.intel = { - enable = mkEnableOption "Enable Intel Graphics Drivers"; + options.my.drivers.intel = { + enable = lib.mkEnableOption "Intel Graphics Drivers"; }; - config = mkIf cfg.enable { - # OpenGL + config = lib.mkIf cfg.enable { hardware.graphics = { extraPackages = with pkgs; [ - intel-media-driver - vaapiIntel - vaapiVdpau - libvdpau-va-gl + intel-media-driver # Intel Media Driver for VA-API + vaapiIntel # VA-API Intel driver + vaapiVdpau # VA-API to VDPAU adapter + libvdpau-va-gl # VDPAU driver with OpenGL/VAAPI backend ]; }; }; diff --git a/modules/integrations/default.nix b/modules/integrations/default.nix new file mode 100644 index 0000000..1e9a5a4 --- /dev/null +++ b/modules/integrations/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ./home-manager.nix + ]; +} diff --git a/modules/integrations/home-manager.nix b/modules/integrations/home-manager.nix new file mode 100644 index 0000000..8dde697 --- /dev/null +++ b/modules/integrations/home-manager.nix @@ -0,0 +1,25 @@ +{ + username, + inputs, + config, + ... +}: +{ + imports = [ + inputs.home-manager.nixosModules.home-manager + ]; + + home-manager = { + useUserPackages = true; + useGlobalPkgs = true; + backupFileExtension = "backup"; + + users.${username} = { + home = { + inherit username; + homeDirectory = "/home/${username}"; + stateVersion = config.my.stateVersions.homeManager; + }; + }; + }; +} diff --git a/modules/nix/boot/nfs.nix b/modules/nix/boot/nfs.nix deleted file mode 100644 index 26b609b..0000000 --- a/modules/nix/boot/nfs.nix +++ /dev/null @@ -1,4 +0,0 @@ -_: { - boot.supportedFilesystems = [ "nfs" ]; - fuse.userAllowOther = true; -} diff --git a/modules/nix/boot/uefi.nix b/modules/nix/boot/uefi.nix deleted file mode 100644 index 9fca7d0..0000000 --- a/modules/nix/boot/uefi.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ lib, ... }: -{ - boot.loader = { - systemd-boot.enable = lib.mkDefault true; - efi.canTouchEfiVariables = lib.mkDefault true; - }; -} diff --git a/modules/nix/camera.nix b/modules/nix/camera.nix deleted file mode 100644 index 9ad501f..0000000 --- a/modules/nix/camera.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ pkgs, ... }: -{ - boot.kernelModules = [ "uvcvideo" ]; - - environment.systemPackages = with pkgs; [ - v4l-utils - ffmpeg-full - ]; - - services.pipewire = { - enable = true; - alsa.enable = true; - pulse.enable = true; - }; - security.rtkit.enable = true; - - xdg.portal = { - enable = true; - extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; - }; -} diff --git a/modules/nix/fingerprint.nix b/modules/nix/fingerprint.nix deleted file mode 100644 index f4cab3b..0000000 --- a/modules/nix/fingerprint.nix +++ /dev/null @@ -1,14 +0,0 @@ -# Documentation : /docs/fingerprint.md -_: { - services.fprintd.enable = true; - - security.pam.services = { - login.fprintAuth = true; - - # sudo - sudo.fprintAuth = true; - - # greetd (tuigreet / ReGreet) - greetd.fprintAuth = true; - }; -} diff --git a/modules/nix/fonts.nix b/modules/nix/fonts.nix deleted file mode 100644 index 505d601..0000000 --- a/modules/nix/fonts.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ pkgs, ... }: -{ - fonts = { - packages = with pkgs; [ - noto-fonts - noto-fonts-cjk-sans - noto-fonts-color-emoji - terminus_font - cantarell-fonts - font-awesome - nerd-fonts.blex-mono - ]; - - fontDir.enable = true; - fontconfig = { - defaultFonts = { - serif = [ - "Noto Serif CJK JP" - "Noto Color Emoji" - ]; - sansSerif = [ - "Noto Sans CJK JP" - "Noto Clor Emoji" - ]; - emoji = [ "Noto Color Emoji" ]; - }; - }; - }; -} diff --git a/modules/nix/greetd.nix b/modules/nix/greetd.nix deleted file mode 100644 index 22f1bee..0000000 --- a/modules/nix/greetd.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ pkgs, ... }: -{ - services.greetd = { - enable = true; - settings = { - default_session = { - user = "greeter"; - command = "${pkgs.tuigreet}/bin/tuigreet --time --remember --cmd niri-session"; - }; - }; - }; -} diff --git a/modules/nix/hardware/bluetooth.nix b/modules/nix/hardware/bluetooth.nix deleted file mode 100644 index e3b8d15..0000000 --- a/modules/nix/hardware/bluetooth.nix +++ /dev/null @@ -1,6 +0,0 @@ -_: { - hardware = { - bluetooth.enable = true; - bluetooth.powerOnBoot = true; - }; -} diff --git a/modules/nix/hardware/gui.nix b/modules/nix/hardware/gui.nix deleted file mode 100644 index 1f17346..0000000 --- a/modules/nix/hardware/gui.nix +++ /dev/null @@ -1,5 +0,0 @@ -_: { - hardware = { - graphics.enable = true; - }; -} diff --git a/modules/nix/i18n.nix b/modules/nix/i18n.nix deleted file mode 100644 index ccb21e4..0000000 --- a/modules/nix/i18n.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ pkgs, ... }: -{ - i18n.inputMethod = { - enable = true; - type = "fcitx5"; - fcitx5 = { - waylandFrontend = true; - addons = with pkgs; [ - fcitx5-mozc-ut - fcitx5-gtk - kdePackages.fcitx5-qt - qt6Packages.fcitx5-configtool - ]; - settings.inputMethod = { - GroupOrder = { - "0" = "Default"; - }; - "Groups/0" = { - Name = "Default"; - "Default Layout" = "jp"; - DefaultIM = "mozc"; - }; - "Groups/0/Items/0" = { - Name = "keyboard-jp"; - Layout = ""; - }; - "Groups/0/Items/1" = { - Name = "mozc"; - Layout = ""; - }; - }; - }; - }; -} diff --git a/modules/nix/kde.nix b/modules/nix/kde.nix deleted file mode 100644 index 7e989e2..0000000 --- a/modules/nix/kde.nix +++ /dev/null @@ -1,5 +0,0 @@ -_: { - programs.kdeconnect = { - enable = true; - }; -} diff --git a/modules/nix/network/wifi.nix b/modules/nix/network/wifi.nix deleted file mode 100644 index dd6281c..0000000 --- a/modules/nix/network/wifi.nix +++ /dev/null @@ -1,24 +0,0 @@ -_: { - networking = { - networkmanager = { - enable = true; - - dns = "none"; - wifi.powersave = false; - wifi.backend = "wpa_supplicant"; - settings = { - "device"."wifi.scan-rand-mac-address" = "no"; - "connection"."wifi.cloned-mac-address" = "permanent"; - }; - }; - wireless.iwd.enable = false; - }; - - boot.extraModprobeConfig = '' - options cfg80211 ieee80211_regdom=JP - options iwlwifi power_save=0 - options iwlwifi uapsd_disable=1 - ''; - - programs.nm-applet.enable = true; -} diff --git a/modules/nix/noctalia.nix b/modules/nix/noctalia.nix deleted file mode 100644 index e2d3efb..0000000 --- a/modules/nix/noctalia.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - pkgs, - inputs, - ... -}: -{ - environment.systemPackages = with pkgs; [ - inputs.noctalia.packages.${system}.default - ]; -} diff --git a/modules/nix/power.nix b/modules/nix/power.nix deleted file mode 100644 index c64097d..0000000 --- a/modules/nix/power.nix +++ /dev/null @@ -1,14 +0,0 @@ -_: { - boot.kernelParams = [ - "mem_sleep_default=deep" - ]; - - powerManagement = { - enable = true; - powertop.enable = true; - }; - - services.power-profiles-daemon.enable = true; - services.tlp.enable = false; - services.upower.enable = true; -} diff --git a/modules/nix/secure-boot.nix b/modules/nix/secure-boot.nix deleted file mode 100644 index 97f7656..0000000 --- a/modules/nix/secure-boot.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ - inputs, - lib, - ... -}: -{ - imports = [ - inputs.lanzaboote.nixosModules.lanzaboote - ]; - - boot.loader = { - systemd-boot.enable = lib.mkForce false; - efi.canTouchEfiVariables = true; - efi.efiSysMountPoint = "/boot"; - }; - - boot.lanzaboote = { - enable = true; - pkiBundle = "/var/lib/sbctl"; - }; -} diff --git a/modules/nix/user.nix b/modules/nix/user.nix deleted file mode 100644 index ee24a2c..0000000 --- a/modules/nix/user.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ - userName, - inputs, - ... -}: -{ - imports = [ inputs.home-manager.nixosModules.home-manager ]; - - home-manager = { - useUserPackages = true; - useGlobalPkgs = true; - backupFileExtension = "backup"; - users.moons = { - home = { - username = userName; - homeDirectory = "/home/${userName}"; - stateVersion = "26.05"; - }; - }; - }; -} diff --git a/modules/nix/boot/default.nix b/modules/system/boot/default.nix similarity index 100% rename from modules/nix/boot/default.nix rename to modules/system/boot/default.nix diff --git a/modules/system/boot/nfs.nix b/modules/system/boot/nfs.nix new file mode 100644 index 0000000..023ebd8 --- /dev/null +++ b/modules/system/boot/nfs.nix @@ -0,0 +1,18 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.system.boot.nfs; +in +{ + options.my.system.boot.nfs = { + enable = lib.mkEnableOption "NFS boot support"; + }; + + config = lib.mkIf cfg.enable { + boot.supportedFilesystems = [ "nfs" ]; + fuse.userAllowOther = true; + }; +} diff --git a/modules/system/boot/uefi.nix b/modules/system/boot/uefi.nix new file mode 100644 index 0000000..6ad8e92 --- /dev/null +++ b/modules/system/boot/uefi.nix @@ -0,0 +1,20 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.system.boot.uefi; +in +{ + options.my.system.boot.uefi = { + enable = lib.mkEnableOption "UEFI boot support"; + }; + + config = lib.mkIf cfg.enable { + boot.loader = { + systemd-boot.enable = lib.mkDefault true; + efi.canTouchEfiVariables = lib.mkDefault true; + }; + }; +} diff --git a/modules/system/camera.nix b/modules/system/camera.nix new file mode 100644 index 0000000..9419576 --- /dev/null +++ b/modules/system/camera.nix @@ -0,0 +1,35 @@ +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.system.camera; +in +{ + options.my.system.camera = { + enable = lib.mkEnableOption "camera support"; + }; + + config = lib.mkIf cfg.enable { + boot.kernelModules = [ "uvcvideo" ]; + + environment.systemPackages = with pkgs; [ + v4l-utils + ffmpeg-full + ]; + + services.pipewire = { + enable = true; + alsa.enable = true; + pulse.enable = true; + }; + security.rtkit.enable = true; + + xdg.portal = { + enable = true; + extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + }; + }; +} diff --git a/modules/system/default.nix b/modules/system/default.nix new file mode 100644 index 0000000..282b3f6 --- /dev/null +++ b/modules/system/default.nix @@ -0,0 +1,17 @@ +{ + imports = [ + ./boot + ./nix.nix + ./camera.nix + ./fingerprint.nix + ./fonts.nix + ./gc.nix + ./locale.nix + ./hardware + ./network + ./power.nix + ./secure-boot.nix + ./user + ./version.nix + ]; +} diff --git a/modules/system/fingerprint.nix b/modules/system/fingerprint.nix new file mode 100644 index 0000000..20450b3 --- /dev/null +++ b/modules/system/fingerprint.nix @@ -0,0 +1,23 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.system.fingerprint; +in +{ + options.my.system.fingerprint = { + enable = lib.mkEnableOption "fingerprint authentication"; + }; + + config = lib.mkIf cfg.enable { + services.fprintd.enable = true; + + security.pam.services = { + login.fprintAuth = true; + sudo.fprintAuth = true; + greetd.fprintAuth = true; + }; + }; +} diff --git a/modules/system/fonts.nix b/modules/system/fonts.nix new file mode 100644 index 0000000..12654a5 --- /dev/null +++ b/modules/system/fonts.nix @@ -0,0 +1,43 @@ +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.my.system.fonts; +in +{ + options.my.system.fonts = { + enable = lib.mkEnableOption "system font configuration"; + }; + + config = lib.mkIf cfg.enable { + fonts = { + packages = with pkgs; [ + noto-fonts + noto-fonts-cjk-sans + noto-fonts-color-emoji + terminus_font + cantarell-fonts + font-awesome + nerd-fonts.blex-mono + ]; + + fontDir.enable = true; + fontconfig = { + defaultFonts = { + serif = [ + "Noto Serif CJK JP" + "Noto Color Emoji" + ]; + sansSerif = [ + "Noto Sans CJK JP" + "Noto Clor Emoji" + ]; + emoji = [ "Noto Color Emoji" ]; + }; + }; + }; + }; +} diff --git a/modules/nix/gc.nix b/modules/system/gc.nix similarity index 100% rename from modules/nix/gc.nix rename to modules/system/gc.nix diff --git a/modules/system/hardware/bluetooth.nix b/modules/system/hardware/bluetooth.nix new file mode 100644 index 0000000..f3685b7 --- /dev/null +++ b/modules/system/hardware/bluetooth.nix @@ -0,0 +1,26 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.system.hardware.bluetooth; +in +{ + options.my.system.hardware.bluetooth = { + enable = lib.mkEnableOption "Bluetooth support"; + }; + + config = lib.mkIf cfg.enable { + hardware = { + bluetooth.enable = true; + bluetooth.powerOnBoot = true; + }; + + services = { + bluetooth.enable = true; + bluetooth.startWhenNeeded = true; + blueman.enable = true; + }; + }; +} diff --git a/modules/nix/hardware/default.nix b/modules/system/hardware/default.nix similarity index 100% rename from modules/nix/hardware/default.nix rename to modules/system/hardware/default.nix diff --git a/modules/system/hardware/gui.nix b/modules/system/hardware/gui.nix new file mode 100644 index 0000000..19ed7ef --- /dev/null +++ b/modules/system/hardware/gui.nix @@ -0,0 +1,19 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.system.hardware.gui; +in +{ + options.my.system.hardware.gui = { + enable = lib.mkEnableOption "GPU/graphics hardware acceleration"; + }; + + config = lib.mkIf cfg.enable { + hardware = { + graphics.enable = true; + }; + }; +} diff --git a/modules/system/locale.nix b/modules/system/locale.nix new file mode 100644 index 0000000..85aa356 --- /dev/null +++ b/modules/system/locale.nix @@ -0,0 +1,18 @@ +_: { + time.timeZone = "Asia/Tokyo"; + + i18n.defaultLocale = "ja_JP.UTF-8"; + i18n.extraLocaleSettings = { + LC_ADDRESS = "ja_JP.UTF-8"; + LC_IDENTIFICATION = "ja_JP.UTF-8"; + LC_MEASUREMENT = "ja_JP.UTF-8"; + LC_MONETARY = "ja_JP.UTF-8"; + LC_NAME = "ja_JP.UTF-8"; + LC_NUMERIC = "ja_JP.UTF-8"; + LC_PAPER = "ja_JP.UTF-8"; + LC_TELEPHONE = "ja_JP.UTF-8"; + LC_TIME = "ja_JP.UTF-8"; + }; + + console.keyMap = "jp106"; +} diff --git a/modules/nix/network/default.nix b/modules/system/network/default.nix similarity index 100% rename from modules/nix/network/default.nix rename to modules/system/network/default.nix diff --git a/modules/nix/network/root_ca.crt b/modules/system/network/root_ca.crt similarity index 100% rename from modules/nix/network/root_ca.crt rename to modules/system/network/root_ca.crt diff --git a/modules/system/network/wifi.nix b/modules/system/network/wifi.nix new file mode 100644 index 0000000..8b55002 --- /dev/null +++ b/modules/system/network/wifi.nix @@ -0,0 +1,38 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.system.network.wifi; +in +{ + options.my.system.network.wifi = { + enable = lib.mkEnableOption "WiFi (NetworkManager) support"; + }; + + config = lib.mkIf cfg.enable { + networking = { + networkmanager = { + enable = true; + + dns = "none"; + wifi.powersave = false; + wifi.backend = "wpa_supplicant"; + settings = { + "device"."wifi.scan-rand-mac-address" = "no"; + "connection"."wifi.cloned-mac-address" = "permanent"; + }; + }; + wireless.iwd.enable = false; + }; + + boot.extraModprobeConfig = '' + options cfg80211 ieee80211_regdom=JP + options iwlwifi power_save=0 + options iwlwifi uapsd_disable=1 + ''; + + programs.nm-applet.enable = true; + }; +} diff --git a/modules/nix/caches.nix b/modules/system/nix.nix similarity index 90% rename from modules/nix/caches.nix rename to modules/system/nix.nix index 8802174..0c5af08 100644 --- a/modules/nix/caches.nix +++ b/modules/system/nix.nix @@ -15,5 +15,10 @@ _: { "noctalia.cachix.org-1:pCOR47nnMEo5thcxNDtzWpOxNFQsBRglJzxWPp3dkU4=" "vicinae.cachix.org-1:1kDrfienkGHPYbkpNj1mWTr7Fm1+zcenzgTizIcI3oc=" ]; + + experimental-features = [ + "nix-command" + "flakes" + ]; }; } diff --git a/modules/system/power.nix b/modules/system/power.nix new file mode 100644 index 0000000..c99e6b1 --- /dev/null +++ b/modules/system/power.nix @@ -0,0 +1,28 @@ +{ + lib, + config, + ... +}: +let + cfg = config.my.system.power; +in +{ + options.my.system.power = { + enable = lib.mkEnableOption "power management"; + }; + + config = lib.mkIf cfg.enable { + boot.kernelParams = [ + "mem_sleep_default=deep" + ]; + + powerManagement = { + enable = true; + powertop.enable = true; + }; + + services.power-profiles-daemon.enable = true; + services.tlp.enable = false; + services.upower.enable = true; + }; +} diff --git a/modules/system/secure-boot.nix b/modules/system/secure-boot.nix new file mode 100644 index 0000000..0d393f2 --- /dev/null +++ b/modules/system/secure-boot.nix @@ -0,0 +1,31 @@ +{ + inputs, + lib, + config, + ... +}: +let + cfg = config.my.system.secure-boot; +in +{ + imports = [ + inputs.lanzaboote.nixosModules.lanzaboote + ]; + + options.my.system.secure-boot = { + enable = lib.mkEnableOption "secure boot (lanzaboote)"; + }; + + config = lib.mkIf cfg.enable { + boot.loader = { + systemd-boot.enable = lib.mkForce false; + efi.canTouchEfiVariables = true; + efi.efiSysMountPoint = "/boot"; + }; + + boot.lanzaboote = { + enable = true; + pkiBundle = "/var/lib/sbctl"; + }; + }; +} diff --git a/modules/system/user/default.nix b/modules/system/user/default.nix new file mode 100644 index 0000000..3882832 --- /dev/null +++ b/modules/system/user/default.nix @@ -0,0 +1,13 @@ +{ + imports = [ + ./moons.nix + ]; + + users.mutableUsers = true; + + nix.settings.allowed-users = [ "moons" ]; + nix.settings.trusted-users = [ + "root" + "moons" + ]; +} diff --git a/modules/system/user/moons.nix b/modules/system/user/moons.nix new file mode 100644 index 0000000..c4c2f76 --- /dev/null +++ b/modules/system/user/moons.nix @@ -0,0 +1,25 @@ +{ pkgs, ... }: +{ + users.users.moons = { + isNormalUser = true; + description = "moons-14"; + extraGroups = [ + "adbusers" + "docker" + "libvirtd" + "lp" + "networkmanager" + "scanner" + "wheel" + "vboxusers" + "dialout" + ]; + shell = pkgs.zsh; + ignoreShellProgramCheck = true; + + openssh.authorizedKeys.keys = [ + "sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIKhxDkucmeCor6CKoXAua7DgDSzuXrZOtpdkyzQxz5+aAAAABHNzaDo= moons@moons14.com" + "sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIN6hZJyng/5LgFKPjR6uZAd/00UkO0vN0uQOoIvfSELdAAAABHNzaDo= moons@moons14.com" + ]; + }; +} diff --git a/modules/system/version.nix b/modules/system/version.nix new file mode 100644 index 0000000..cc8f061 --- /dev/null +++ b/modules/system/version.nix @@ -0,0 +1,22 @@ +{ + config, + lib, + ... +}: +{ + options.my.stateVersions = { + nixos = lib.mkOption { + type = lib.types.str; + default = "25.11"; + }; + + homeManager = lib.mkOption { + type = lib.types.str; + default = "25.11"; + }; + }; + + config = { + system.stateVersion = lib.mkDefault config.my.stateVersions.nixos; + }; +} diff --git a/profiles/base.nix b/profiles/base.nix index 6590473..de6a54b 100644 --- a/profiles/base.nix +++ b/profiles/base.nix @@ -1,16 +1,15 @@ { pkgs, - userName, + username, ... }: { imports = [ - ../modules/nix/boot - ../modules/nix/caches.nix - ../modules/nix/gc.nix - ../modules/nix/hardware - ../modules/nix/user.nix - ../modules/nix/network + ../modules/system/boot + ../modules/system/caches.nix + ../modules/system/gc.nix + ../modules/system/hardware + ../modules/system/network ]; programs = { @@ -32,6 +31,6 @@ unstable.msedit # Microsoft Editor ]; - home-manager.users.${userName}.imports = [ + home-manager.users.${username}.imports = [ ]; } diff --git a/profiles/cli-minimal.nix b/profiles/cli-minimal.nix index d91ace9..958f762 100644 --- a/profiles/cli-minimal.nix +++ b/profiles/cli-minimal.nix @@ -1,6 +1,6 @@ { pkgs, - userName, + username, ... }: { @@ -31,5 +31,5 @@ unstable.opencode # Coding AI Assistant ]; - home-manager.users.${userName}.imports = [ ]; + home-manager.users.${username}.imports = [ ]; } diff --git a/profiles/cli-vm.nix b/profiles/cli-vm.nix index 9f62175..db2bd7e 100644 --- a/profiles/cli-vm.nix +++ b/profiles/cli-vm.nix @@ -1,7 +1,7 @@ -{ userName, ... }: +{ username, ... }: { imports = [ ./cli-minimal.nix ]; - home-manager.users.${userName}.imports = [ ]; + home-manager.users.${username}.imports = [ ]; } diff --git a/profiles/desktop.nix b/profiles/desktop.nix index a2adab2..d105aab 100644 --- a/profiles/desktop.nix +++ b/profiles/desktop.nix @@ -1,7 +1,7 @@ -{ userName, ... }: +{ username, ... }: { imports = [ ./gui.nix ]; - home-manager.users.${userName}.imports = [ ]; + home-manager.users.${username}.imports = [ ]; } diff --git a/profiles/gui.nix b/profiles/gui.nix index f2f666d..b0f2026 100644 --- a/profiles/gui.nix +++ b/profiles/gui.nix @@ -1,23 +1,26 @@ { pkgs, - userName, + username, ... }: { imports = [ ./cli-minimal.nix - ../modules/nix/hardware/gui.nix - ../modules/nix/camera.nix - ../modules/nix/fonts.nix - ../modules/nix/greetd.nix - ../modules/nix/i18n.nix - ../modules/nix/kde.nix - ../modules/nix/noctalia.nix + ../modules/system/hardware/gui.nix + ../modules/system/camera.nix + ../modules/system/fonts.nix + ../modules/applications/greetd.nix + ../modules/applications/fcitx5.nix + ../modules/applications/kde.nix ]; - programs = { + my.applications = { niri.enable = true; - xwayland.enable = true; + noctalia.enable = true; + wayland.enable = true; + }; + + programs = { dconf.enable = true; seahorse.enable = true; }; @@ -34,5 +37,5 @@ wf-recorder # A Screen Recorder For Wayland ]; - home-manager.users.${userName}.imports = [ ]; + home-manager.users.${username}.imports = [ ]; } diff --git a/profiles/laptop.nix b/profiles/laptop.nix index f23890a..3dde5db 100644 --- a/profiles/laptop.nix +++ b/profiles/laptop.nix @@ -1,15 +1,15 @@ { pkgs, - userName, + username, ... }: { imports = [ ./gui.nix - ../modules/nix/bluetooth.nix - ../modules/nix/fingerprint.nix - ../modules/nix/network/wifi.nix - ../modules/nix/power.nix + ../modules/system/hardware/bluetooth.nix + ../modules/system/fingerprint.nix + ../modules/system/network/wifi.nix + ../modules/system/power.nix ]; environment.systemPackages = with pkgs; [ @@ -17,5 +17,5 @@ sbctl # Secure Boot Key Management Tool ]; - home-manager.users.${userName}.imports = [ ]; + home-manager.users.${username}.imports = [ ]; }