Merge pull request #14 from moons-14/v2

V2
This commit is contained in:
2026-06-17 23:56:31 +09:00
committed by GitHub
288 changed files with 5693 additions and 2938 deletions
+2
View File
@@ -0,0 +1,2 @@
# shellcheck shell=bash
use flake .#dotnix
-71
View File
@@ -1,71 +0,0 @@
name: nix-build-and-cache
on:
pull_request:
paths:
- "flake.nix"
- "flake.lock"
- "hosts/**"
- "modules/**"
- "profiles/**"
- "overlays/**"
- ".github/workflows/nix-cache.yml"
push:
branches:
- main
paths:
- "flake.nix"
- "flake.lock"
- "hosts/**"
- "modules/**"
- "profiles/**"
- "overlays/**"
- ".github/workflows/nix-cache.yml"
workflow_dispatch:
concurrency:
group: nix-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
host:
- x1g9
- x1g13-wsl
- x1g13
- monitor
- dev-1
- service-1
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
extra_nix_config: |
accept-flake-config = true
- name: Setup Cachix for PR
if: github.event_name == 'pull_request'
uses: cachix/cachix-action@v17
with:
name: moons-dotfiles
skipPush: true
- name: Setup Cachix for main push
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: cachix/cachix-action@v17
with:
name: moons-dotfiles
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Build host
run: |
nix build -L .#nixosConfigurations.${{ matrix.host }}.config.system.build.toplevel
+14 -9
View File
@@ -3,17 +3,22 @@
!.gitignore !.gitignore
!README.md !README.md
!LICENSE !LICENSE
!AGENTS.md
!.envrc
!.sops.yaml
!/flake.nix !/flake.nix
!/flake.lock !/flake.lock
!/hosts/ !shells/
!/modules/ !hosts/
!/home-manager/ !overlays/
!/shells/ !profiles/
!/images/ !modules/
!/profiles/ !docs/
!/overlays/ !images/
!secrets/
!renovate.json !/flake/
!.github/
+14
View File
@@ -0,0 +1,14 @@
keys:
- &admin_yubikey1 age1yubikey1qvy5y8kxqc63y7fk0tfv43u499a8z8q332ff087lythry9cc6hdxxkznc6t
- &host_x1g13_old age1xfc7ksg69l5kwsxxgtynsuxgpwltcf9gmqlhfl7efq0clc8lwspqnveyx3
creation_rules:
- path_regex: ^secrets/common/[^/]+\.ya?ml$
key_groups:
- age:
- *admin_yubikey1
- *host_x1g13_old
- path_regex: ^secrets/hosts/x1g13/[^/]+\.ya?ml$
key_groups:
- age:
- *admin_yubikey1
- *host_x1g13_old
+400
View File
@@ -0,0 +1,400 @@
# AGENTS.md
NixOS + Home Manager flake (v2)。flake-parts ベース。
## Commands
```sh
nix flake update # flake の更新
nix fmt # フォーマット
sudo nixos-rebuild build --flake .#<host> # ビルド確認
sudo nixos-rebuild switch --flake .#<host> # 適用
```
## Conventions
- User: `moons`, locale: `ja_JP.UTF-8`, timezone: `Asia/Tokyo`
- Commits: conventional commits (`feat:`, `chore:`, `fix:`, etc.)
- リモート: `[email protected]:moons-14/dotfiles.git`
- `environment.systemPackages` にパッケージを追加する際はパッケージ名の横に簡単な説明をコメントで追加する
- 警告を抑制する設定は書かない。根本原因を調査して修正する
- home-manager の `sharedModules` 内で `lib.hm.*` を使う場合は、そのモジュール関数の引数で `lib` を受け取る必要がある(NixOSモジュールの `lib` とは別スコープ)
- `useGlobalPkgs = true` なので、home-manager 内で `nixpkgs.config` を設定しない(NixOSレベルで一括設定)
- `allowUnfree` は `hosts/default.nix` でグローバルに設定済み。各モジュールで個別設定しない
## Architecture
```
flake.nix
└── hosts/default.nix # mkSystem でホスト構成を生成
├── modules/ # 全モジュール(常にインポートされる)
│ ├── applications/ # アプリケーション設定
│ ├── system/ # システム設定
│ ├── drivers/ # ドライバ設定
│ ├── features/ # 機能バンドル(application/systemを束ねる)
│ └── integrations/ # home-manager 統合
└── profiles/ # ホストごとに有効化するfeaturesの組み合わせ
├── interfaces/ # 操作インターフェース (CLI/GUI)
├── platforms/ # ハードウェア (desktop/laptop/vm)
└── workloads/ # 用途 (dev/personal/srv)
```
### 評価の流れ
```
profile (featuresの有効化)
→ features (application/systemの有効化 + パッケージ追加)
→ applications (system.nix + home.nix)
→ system (NixOS設定)
```
## Layer Design
### `modules/system/` — NixOS システム設定
OS全体に影響する設定。`config.my.system.*` namespace。
- boot, hardware, network, user, locale, fonts, power, secure-boot, gc, version
- 常にインポートされるが、`enable` オプションで実効性を制御
- home-manager の設定は含めない
### `modules/applications/` — アプリケーション設定
個別に有効/無効を切り替えたいアプリケーション。`config.my.applications.*` namespace。
- NixOS設定のみ、または NixOS + Home Manager の両方
- Complex Module は system.nix と home.nix に分離
### `modules/features/` — 機能バンドル
application や system より抽象度の高い「機能」単位で、複数の application/system を束ねて有効化する層。`config.my.features.*` namespace。
**features がやること:**
1. 複数の `my.applications.*.enable` / `my.system.*.enable` をまとめて有効化
2. application/system に属さないパッケージや設定を直接記述(`environment.systemPackages`、`home.activation` 等)
3. 追加オプションの受け渡し(例: tailscale の `acceptDns` を feature から application に passthrough)
**features がやらないこと:**
- 個別アプリケーションの詳細設定(それは applications 層の責務)
### `profiles/` — ホスト構成
features の `enable` を指定するだけの薄い層。ロジックは書かない。
| カテゴリ | 役割 | 例 |
| ------------- | -------------------- | --------------------------------- |
| `interfaces/` | 操作インターフェース | cli-minimal, cli-interactive, gui |
| `platforms/` | ハードウェア固有設定 | desktop, laptop, thinkpad, vm |
| `workloads/` | 用途・ワークロード | dev, personal, srv |
profiles は継承可能:
```nix
# cli-interactive.nix
{
imports = [ ./cli-minimal.nix ];
my.features.cli.interactive.enable = true;
}
```
### `hosts/` — ホスト定義
`mkSystem` でホストを定義。profiles のリストを指定:
```nix
nix-example = mkSystem {
host = "nix-example";
system = "x86_64-linux";
profiles = [
"interfaces/cli-interactive"
"platforms/vm"
"workloads/dev"
];
};
```
`specialArgs` で `inputs`, `username`, `unstable`, `host` が全モジュールに渡される。
## Module Patterns
### Simple Module(NixOS のみ)
home-manager の設定を含まない。1ファイルで完結:
```nix
# modules/system/audio.nix
{ lib, config, ... }:
let
cfg = config.my.system.audio;
in
{
options.my.system.audio = {
enable = lib.mkEnableOption "Audio support (PipeWire)";
};
config = lib.mkIf cfg.enable {
# NixOS設定をここに書く
};
}
```
### Simple Module(Home Manager のみ)
NixOS設定を含まず、home-manager のみ:
```nix
# modules/applications/zoom.nix
{ 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 {
home-manager.sharedModules = [
{
home.packages = with pkgs; [
zoom-us # Video conferencing application
];
}
];
};
}
```
### Complex Module(NixOS + Home Manager)
ディレクトリ構造で system と home を分離:
```
modules/applications/<app>/
├── default.nix # マスター enable + imports
├── system.nix # NixOS 設定
├── home.nix # Home Manager 設定
└── (other files) # 設定ファイル等
```
**default.nix** — `enable` のみ宣言。`system.enable`/`homeManager.enable` は sub-file に任せる:
```nix
{
lib,
config,
...
}:
let
cfg = config.my.applications.<name>;
in
{
imports = [
./home.nix
./system.nix
];
options.my.applications.<name> = {
enable = lib.mkEnableOption "<description>";
};
config = lib.mkIf cfg.enable {
my.applications.<name>.system.enable = lib.mkDefault true;
my.applications.<name>.homeManager.enable = lib.mkDefault true;
};
}
```
**system.nix:**
```nix
{
pkgs,
lib,
config,
...
}:
let
cfg = config.my.applications.<name>.system;
in
{
options.my.applications.<name>.system = {
enable = lib.mkEnableOption "<name> system configuration";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
<package> # Description
];
};
}
```
**home.nix** — `home-manager.sharedModules` を使用:
```nix
{
lib,
config,
...
}:
let
cfg = config.my.applications.<name>;
hmCfg = config.my.applications.<name>.homeManager;
in
{
options.my.applications.<name>.homeManager = {
enable = lib.mkEnableOption "<name> home-manager configuration";
};
config.home-manager.sharedModules = [
{
config = lib.mkIf hmCfg.enable {
# home-manager 設定をここに書く
};
}
];
}
```
**注意点:**
- `default.nix` では `enable` のみ宣言。`system.enable`/`homeManager.enable` は `system.nix`/`home.nix` で宣言する(重複宣言エラー回避)
- home.nix で親の `cfg` を参照する場合は `cfg` と `hmCfg` の両方を let で定義
- Complex Module の home-manager 設定は `home-manager.sharedModules` で記述(`home-manager.users.<user>` は使わない)
### Feature Module
**application/system を束ねる場合:**
```nix
# modules/features/services/container.nix
{ lib, config, ... }:
let
cfg = config.my.features.services.container;
in
{
options.my.features.services.container = {
enable = lib.mkEnableOption "Container runtime (Docker)";
};
config = lib.mkIf cfg.enable {
my.applications.docker.enable = true;
};
}
```
**パッケージを直接追加する場合(application/system に属さない):**
```nix
# modules/features/gui/capture.nix
{ pkgs, lib, config, ... }:
let
cfg = config.my.features.gui.capture;
in
{
options.my.features.gui.capture = {
enable = lib.mkEnableOption "Screen capture tools";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
slurp # Tool for selecting a region of the screen
grim # Screenshot tool for Wayland
];
};
}
```
**オプションを passthrough する場合:**
```nix
# modules/features/network/tailscale.nix
{
options.my.features.network.tailscale = {
enable = lib.mkEnableOption "Tailscale VPN";
acceptDns = lib.mkOption { type = lib.types.bool; default = false; };
};
config = lib.mkIf cfg.enable {
my.applications.tailscale = {
enable = true;
inherit (cfg) acceptDns;
};
};
}
```
**home.activation を使う場合(identity 等):**
```nix
# modules/features/identity/ssh-default-key.nix
config.home-manager.sharedModules = [
(
{ lib, ... }:
{
config = lib.mkIf cfg.enable {
home.activation.generateSshKey = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
# shell script here
'';
};
}
)
];
```
### Profile
features の有効化のみを記述:
```nix
# profiles/platforms/laptop.nix
{
my.features = {
boot.power.enable = true;
connect = {
wifi.enable = true;
bluetooth.enable = true;
};
gui.camera.enable = true;
identity.fingerprint.enable = true;
network.tailscale.enable = true;
};
}
```
## Adding New Features — Checklist
### 新しいアプリケーションを追加する場合
1. `modules/applications/` にモジュール作成(Simple or Complex)
2. `modules/applications/default.nix` の `imports` に追加
3. `modules/features/` の適切なカテゴリに feature を作成(既存の feature に追記でも可)
4. `modules/features/<category>/default.nix` の `imports` に追加
5. `profiles/` の適切な profile で feature を有効化
### 新しいシステム設定を追加する場合
1. `modules/system/` にモジュール作成(Simple Module)
2. `modules/system/default.nix` の `imports` に追加
3. `modules/features/` の適切なカテゴリに feature を作成
4. `modules/features/<category>/default.nix` の `imports` に追加
5. `profiles/` の適切な profile で feature を有効化
### 新しいホストを追加する場合
1. `hosts/<hostname>/default.nix` を作成(`hardware-configuration.nix` を import)
2. `hosts/default.nix` の `flake.nixosConfigurations` に `mkSystem` で追加
3. profiles のリストを指定
## Key Technical Notes
- **nixpkgs channel**: `nixos-26.05` (stable) + `nixpkgs-unstable`
- **unstable パッケージ**: `specialArgs.unstable` 経由で参照(`unstable.<pkg>`)
- **llm-agents**: `inputs.llm-agents.packages.${pkgs.stdenv.hostPlatform.system}.<name>` で参照
- **nixvim**: `nixpkgs.source = pkgs.path` と `nixpkgs.config.allowUnfree = true` を vim/home/default.nix で設定
- **home-manager**: `useGlobalPkgs = true`, `useUserPackages = true`
- **hostname**: `specialArgs.host` から `modules/system/network/default.nix` で `networking.hostName` に設定
- **stateVersion**: `config.my.stateVersions.nixos` / `config.my.stateVersions.homeManager` で管理(`modules/system/version.nix`)
-189
View File
@@ -1,189 +0,0 @@
# dotfiles
NixOS + Home Manager configuration for moons. This repository uses Nix flakes to
manage multiple NixOS hosts and project-specific development shells.
This is a personal configuration. It assumes the `moons` user, `ja_JP.UTF-8`
locale, and `Asia/Tokyo` timezone.
## Features
- NixOS 25.11 based flake configuration
- Home Manager integrated as a NixOS module
- Wayland GUI profile with Niri, Hyprland, greetd, and Noctalia
- Home Manager modules for zsh, git, btop, zellij, direnv, NixVim, fcitx5, and more
- Separate hosts for ThinkPad X1 Carbon Gen 9 / Gen 13, WSL, and server machines
- `nix develop` shells for Next.js, Jupyter, and Rust projects
- GitHub Actions + Cachix build cache for host builds
- Renovate maintenance for flake inputs and the lock file
## Hosts
The following hosts are defined in `flake.nix` under `nixosConfigurations`.
| Host | Profile | Notes |
| --- | --- | --- |
| `x1g9` | `laptop` | ThinkPad X1 9th gen, using `nixos-hardware` and the Intel driver module |
| `x1g13` | `laptop` | ThinkPad X1 13th gen, using the Intel driver module and Lanzaboote secure boot |
| `x1g13-wsl` | `cli` | NixOS-WSL with `moons` as the default user |
| `monitor` | `cli-server` | Server host |
| `dev-1` | `cli-server` | Server host |
| `service-1` | `cli-server` | Server host with Immich / Cloudreve NFS mounts |
## Profiles
Profiles live in `profiles/` and are selected per host from `flake.nix`.
| Profile | Role |
| --- | --- |
| `cli-minimal` | Minimal profile with no extra imports. Shared NixOS and Home Manager modules are still always applied |
| `cli` | CLI profile extending `cli-minimal` |
| `cli-server` | Server profile extending `cli` |
| `gui` | GUI profile extending `cli` with Niri, Hyprland, greetd, Noctalia, KDE/GUI support, and GUI Home Manager modules |
| `laptop` | Laptop profile extending `gui` with fingerprint, power, and camera modules |
## Directory Layout
```text
.
|-- flake.nix # inputs, host definitions, devShells
|-- flake.lock # locked flake inputs
|-- hosts/ # host-specific NixOS settings
| `-- <host>/
| |-- default.nix
| `-- hardware-configuration.nix
|-- profiles/ # reusable host profiles
|-- modules/
| |-- core/ # NixOS modules
| |-- drivers/ # hardware / driver modules
| `-- home/ # Home Manager modules
|-- overlays/ # package overlays
|-- shells/ # nix develop environments
|-- images/ # managed image assets
|-- renovate.json # Renovate config
`-- .github/workflows/ # CI builds and Cachix integration
```
## System Usage
Rebuild the current machine by selecting the matching `#<host>` output.
```sh
sudo nixos-rebuild switch --flake .#x1g13
```
Switch on the next boot instead:
```sh
sudo nixos-rebuild boot --flake .#x1g13
```
Build a system closure in the same form used by CI:
```sh
nix build -L .#nixosConfigurations.x1g13.config.system.build.toplevel
```
List available hosts and development shells:
```sh
nix flake show
```
## Development Shells
`devShells.x86_64-linux` provides the following shells.
| Shell | Command | Main tools |
| --- | --- | --- |
| `next-web` | `nix develop .#next-web` | Node.js 24, pnpm, Vercel CLI, Prisma, OpenSSL, jq, ngrok |
| `jupyter` | `nix develop .#jupyter` | Python 3.12, JupyterLab, NumPy, pandas, matplotlib, scipy, scikit-learn |
| `rust` | `nix develop .#rust` | rustup, clang, LLVM/binutils, pkg-config |
To use a shell through direnv, add an `.envrc` to the target project.
```sh
use flake ~/dotfiles#next-web
```
## Adding A Host
1. Create `hosts/<host>/hardware-configuration.nix`.
For an existing NixOS install, use the output from `sudo nixos-generate-config`.
2. Create `hosts/<host>/default.nix` and import hardware modules or host-specific settings.
3. Add a `mkSystem` entry to `nixosConfigurations` in `flake.nix` and choose a `profile`.
4. Check the build with `nix build -L .#nixosConfigurations.<host>.config.system.build.toplevel`.
5. Run `sudo nixos-rebuild switch --flake .#<host>` on the target host.
## Common Modules
### NixOS
`modules/core/default.nix` imports boot, Cachix, environment, fonts, GC, hardware,
i18n, network, packages, services, SSH, system, user, and xserver modules.
Main settings include:
- flakes / nix-command enabled
- `moons` user and Home Manager integration
- zsh, Docker, Tailscale, PipeWire, adb, Java 25, Python, Bun, Claude Code, Codex, and more
- NetworkManager, fixed nameservers, and JP Wi-Fi regulatory domain
- OpenSSH server with password login and root login disabled
- Cachix caches for `moons-dotfiles` and `vicinae`
### Home Manager
`modules/home/default.nix` imports btop, git, fcitx5, SSH, NixVim, zsh, direnv,
zellij, and Claude configuration.
The GUI profile additionally manages Niri, VS Code, Google Chrome, Vicinae,
Noctalia, Ghostty, wallpaper, lock screen, Discord, Nautilus, GTK, and Zoom.
NixVim is split into modules for LSP, formatters, completion, git integration,
UI plugins, editor plugins, options, keymaps, and autocmds.
## Manual Steps
The following setup is not fully declarative or needs host-specific manual work.
- Register an SSH public key with GitHub.
- Enroll fingerprints on laptop hosts.
```sh
fprintd-enroll
```
- `x1g13` uses Lanzaboote / sbctl for secure boot. The PKI bundle is read from
`/var/lib/sbctl`.
- Log in to services that require authentication, such as Tailscale and 1Password.
## Maintenance
Update all flake inputs:
```sh
nix flake update
```
Update a single input:
```sh
nix flake lock --update-input nixpkgs
```
GitHub Actions builds all hosts when `flake.nix`, `flake.lock`, `hosts/**`,
`modules/**`, `profiles/**`, or `overlays/**` changes. Pushes to `main` upload
to the `moons-dotfiles` Cachix cache.
Renovate enables Nix lock file maintenance and has a separate package rule for
`llm-agents`.
## Inspired
- [Zaney/zaneyos](https://gitlab.com/Zaney/zaneyos)
- [fa0311/.zshrc](https://gist.github.com/fa0311/d37d53ff39c73c54c883379e8e3732df)
- [AsianLovesLinux/Niri](https://github.com/AsianLovesLinux/Niri)
- [natsukium/dotfiles](https://github.com/natsukium/dotfiles)
- [dracula](https://github.com/dracula)
- [akazdayo/nix-configs](https://github.com/akazdayo/nix-configs)
- [yutakobayashidev/dotnix](https://github.com/yutakobayashidev/dotnix)
+68
View File
@@ -0,0 +1,68 @@
# Fingerprint Commands
This note covers the basic `fprintd` commands used by the fingerprint module.
## Enroll a new fingerprint
Register a fingerprint for the current user:
```sh
fprintd-enroll $USER
```
To enroll a specific finger, pass the finger name:
```sh
fprintd-enroll -f right-index-finger $USER
```
Common finger names include:
- `left-thumb`
- `left-index-finger`
- `right-thumb`
- `right-index-finger`
Follow the prompts and swipe or touch the sensor until enrollment completes.
## List enrolled fingerprints
Show fingerprints registered for the current user:
```sh
fprintd-list $USER
```
You can also list fingerprints for another user:
```sh
fprintd-list <username>
```
## Delete fingerprints
Delete one enrolled fingerprint for the current user:
```sh
fprintd-delete
```
Delete all enrolled fingerprints for the current user:
```sh
fprintd-delete $USER
```
Delete fingerprints for another user:
```sh
fprintd-delete <username>
```
## Verify authentication
Test fingerprint authentication for the current user:
```sh
fprintd-verify
```
+157
View File
@@ -0,0 +1,157 @@
# NixOSインストール手順
## 事前準備
1. [ISOビルド](iso-build.md)を参照してISOを作成
2. USBに書き込んで対象マシンでブート
## ネットワーク接続
### 有線LAN
DHCPで自動設定される。
### WiFi(有線が使えない場合)
```bash
nmcli device wifi connect <SSID> --ask
```
## SSH接続
コンソールに表示されたIPアドレスに接続:
```bash
ssh root@<ip-address>
```
## インストール手順
### 1. dotfilesのクローン
```bash
git clone [email protected]:moons-14/dotfiles.git ~/dotfiles
```
### 2. SSHホストキーの生成
新しいホスト用のSSHホストキーを生成:
```bash
ssh-keygen -t ed25519 -f /tmp/ssh_host_ed25519_key -N ""
```
### 3. age公開鍵の取得
SSHホストキーからage公開鍵を取得:
```bash
ssh-to-age -i /tmp/ssh_host_ed25519_key.pub
```
出力されたage公開鍵をコピー。
### 4. .sops.yamlの編集
```bash
cd ~/dotfiles
vim .sops.yaml
```
以下を追加:
```yaml
keys:
- &host_<hostname> <age公開鍵>
creation_rules:
- path_regex: ^secrets/hosts/<hostname>/[^/]+\.ya?ml$
key_groups:
- age:
- *admin_yubikey1
- *host_<hostname>
```
### 5. シークレットの再暗号化
```bash
sops updatekeys secrets/common/system.yaml
sops updatekeys secrets/hosts/<hostname>/*.yaml
```
### 6. disko設定の作成
新しいホスト用の`hosts/<hostname>/disko.nix`を作成。
#### シンプル構成(暗号化なし)
```nix
_:
{
disko.enableConfig = true;
disko.devices.disk.main = {
type = "disk";
device = "/dev/sda";
content = {
type = "gpt";
partitions = {
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
}
```
#### LUKS暗号化 + btrfs
`hosts/x1g13/disko.nix`を参照。
### 7. ディスクのパーティション
```bash
cd ~/dotfiles
nix run github:nix-community/disko -- --mode disko hosts/<hostname>/disko.nix
```
### 8. ホストキーのコピー
```bash
mkdir -p /mnt/etc/ssh
cp /tmp/ssh_host_ed25519_key* /mnt/etc/ssh/
chmod 600 /mnt/etc/ssh/ssh_host_ed25519_key
```
### 9. NixOSインストール
```bash
nixos-install --flake ~/dotfiles#<hostname>
```
### 10. 再起動
```bash
reboot
```
## インストール後の確認
- SSHでログインできるか
- sopsシークレットが復号できるか
- diskoでパーティションが正しく設定されているか
+26
View File
@@ -0,0 +1,26 @@
# カスタムISOビルド
## ビルド
```bash
nix build .#nixosConfigurations.installer.config.system.build.isoImage
```
## ISO書き込み
```bash
# USBデバイスの確認
lsblk
# 書き込み(/dev/sdXは実際のデバイスに置き換える)
sudo dd if=./result/nixos-minimal-*.iso of=/dev/sdX bs=4M status=progress
sync
```
## ISOの特徴
- SSH鍵認証でrootログイン可能
- 有線LANはDHCPで自動設定
- WiFiは`nmcli`で手動設定可能
- disko/sops/ageなどのツールを内蔵
- ブート時にIPアドレスとヘルプを表示
+17
View File
@@ -0,0 +1,17 @@
# Generate Sops key file
```bash
mkdir -p ~/.config/sops/age
chmod 700 ~/.config/sops/age
age-plugin-yubikey --identity --slot 1 \
> ~/.config/sops/age/yubikey-identity.txt
chmod 600 ~/.config/sops/age/yubikey-identity.txt
```
## Edit sops file
```bash
sops secrets/common/system.yaml
```
Generated
+460 -175
View File
File diff suppressed because it is too large Load Diff
+70 -106
View File
@@ -1,142 +1,106 @@
{ {
description = "moons nix configurations and development shells"; description = "moons NixOS configurations";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; # NixOS
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
nixos-wsl.url = "github:nix-community/NixOS-WSL";
home-manager = { home-manager = {
url = "github:nix-community/home-manager/release-25.11"; url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
# Hardware / Platform
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
nixos-wsl.url = "github:nix-community/NixOS-WSL";
# Desktop
niri-flake.url = "github:sodiboo/niri-flake";
stylix = {
url = "github:nix-community/stylix";
inputs.nixpkgs.follows = "nixpkgs";
};
# Terminal
ghostty.url = "github:ghostty-org/ghostty";
# Shell / Launcher
vicinae.url = "github:vicinaehq/vicinae"; vicinae.url = "github:vicinaehq/vicinae";
vicinae-extensions = { vicinae-extensions = {
url = "github:vicinaehq/extensions"; url = "github:vicinaehq/extensions";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
ghostty.url = "github:ghostty-org/ghostty";
niri-flake.url = "github:sodiboo/niri-flake";
quickshell = { quickshell = {
url = "github:outfoxxed/quickshell"; url = "github:outfoxxed/quickshell";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
noctalia = { noctalia = {
url = "github:noctalia-dev/noctalia-shell"; url = "github:noctalia-dev/noctalia-shell";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
inputs.quickshell.follows = "quickshell"; inputs.quickshell.follows = "quickshell";
}; };
stylix = {
url = "github:nix-community/stylix"; # Editor
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
# Secrets management
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# Disk management
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
# Boot
lanzaboote = { lanzaboote = {
url = "github:nix-community/lanzaboote"; url = "github:nix-community/lanzaboote";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nixvim = { # Flake framework
url = "github:nix-community/nixvim/nixos-25.11"; flake-parts.url = "github:hercules-ci/flake-parts";
inputs.nixpkgs.follows = "nixpkgs";
}; # Code formatting and git hooks
treefmt-nix.url = "github:numtide/treefmt-nix";
git-hooks-nix.url = "github:cachix/git-hooks.nix";
# 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";
}; };
outputs = inputs @ { outputs =
self, inputs@{
nixpkgs, flake-parts,
nixpkgs-unstable, systems,
nixos-hardware, ...
home-manager,
...
}: let
mkSystem = {
host,
system,
profile,
extraModules ? [],
}: }:
nixpkgs.lib.nixosSystem { flake-parts.lib.mkFlake { inherit inputs; } {
inherit system; systems = import systems;
specialArgs = {
inherit inputs;
inherit host;
inherit profile;
};
modules =
[
./overlays
./modules/core
./profiles/${profile}.nix
./hosts/${host}
]
++ extraModules;
};
in {
nixosConfigurations = {
x1g9 = mkSystem {
host = "x1g9";
system = "x86_64-linux";
profile = "laptop";
extraModules = [];
};
x1g13-wsl = mkSystem {
host = "x1g13-wsl";
system = "x86_64-linux";
profile = "cli";
extraModules = [];
};
x1g13 = mkSystem {
host = "x1g13";
system = "x86_64-linux";
profile = "laptop";
extraModules = [];
};
monitor = mkSystem {
host = "monitor";
system = "x86_64-linux";
profile = "cli-server";
extraModules = [];
};
dev-1 = mkSystem {
host = "dev-1";
system = "x86_64-linux";
profile = "cli-server";
extraModules = [];
};
service-1 = mkSystem {
host = "service-1";
system = "x86_64-linux";
profile = "cli-server";
extraModules = [];
};
ops = mkSystem {
host = "ops";
system = "x86_64-linux";
profile = "cli-server";
extraModules = [];
};
nix-test = mkSystem {
host = "nix-test";
system = "x86_64-linux";
profile = "cli-server";
extraModules = [];
};
};
devShells = { imports = [
x86_64-linux = let ./overlays
pkgs = import nixpkgs { ./hosts
system = "x86_64-linux"; ./shells
config.allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg) ["ngrok"]; ./flake/formatter.nix
}; ./flake/git-hooks.nix
in { ];
next-web = import ./shells/next-web.nix {inherit pkgs;};
jupyter = import ./shells/jupyter.nix {inherit pkgs;};
rust = import ./shells/rust/default.nix {inherit pkgs;};
};
}; };
};
} }
+35
View File
@@ -0,0 +1,35 @@
{ inputs, ... }:
{
imports = [
inputs.treefmt-nix.flakeModule
];
perSystem = _: {
treefmt = {
projectRootFile = "flake.nix";
programs = {
nixfmt.enable = true;
deadnix.enable = true;
statix.enable = true;
shfmt.enable = true;
shellcheck.enable = true;
prettier.enable = true;
yamlfmt.enable = true;
taplo.enable = true;
oxfmt.enable = true;
};
settings = {
excludes = [
".git/**"
"*.lock"
".direnv/**"
"*.age"
];
};
};
};
}
+43
View File
@@ -0,0 +1,43 @@
{ inputs, ... }:
{
imports = [
inputs.git-hooks-nix.flakeModule
];
perSystem =
{
pkgs,
config,
...
}:
{
pre-commit.settings = {
hooks = {
treefmt = {
enable = true;
package = config.treefmt.build.wrapper;
};
gitleaks = {
enable = true;
name = "gitleaks";
description = "Detect hardcoded secrets";
entry = "${pkgs.gitleaks}/bin/gitleaks dir --no-banner --redact --verbose .";
pass_filenames = false;
stages = [
"pre-commit"
"pre-push"
];
};
deadnix.enable = true;
statix.enable = true;
shellcheck.enable = true;
};
};
};
}
+84
View File
@@ -0,0 +1,84 @@
{
inputs,
pkgs,
config,
lib,
...
}:
let
inherit (inputs.nixpkgs.lib) nixosSystem;
username = "moons";
unstable = import inputs.nixpkgs-unstable {
inherit (pkgs) system;
config = {
allowUnfree = true;
};
};
mkSystem =
{
host,
system,
profiles ? [ ],
extraModules ? [ ],
}:
assert lib.assertMsg (lib.elem system config.systems)
"mkSystem: system '${system}' not in valid systems: ${lib.generators.toPretty { } config.systems}";
nixosSystem {
inherit system;
modules = [
{
nixpkgs.config.allowUnfree = true;
}
../modules
./${host}/default.nix
]
++ map (p: ../profiles/${p}.nix) profiles
++ extraModules;
specialArgs = {
inherit
inputs
username
unstable
host
;
};
};
in
{
flake.nixosConfigurations = {
nix-example = mkSystem {
host = "nix-example";
system = "x86_64-linux";
profiles = [
"interfaces/cli-interactive"
"platforms/vm"
"workloads/dev"
"workloads/remote"
];
};
x1g13 = mkSystem {
host = "x1g13";
system = "x86_64-linux";
profiles = [
"interfaces/gui"
"platforms/thinkpad"
"workloads/dev"
"workloads/personal"
"workloads/secure-storage"
];
};
installer = nixosSystem {
system = "x86_64-linux";
modules = [
./installer/default.nix
];
specialArgs = {
inherit inputs;
};
};
};
}
-12
View File
@@ -1,12 +0,0 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ ... }:
{
imports =
[
./hardware-configuration.nix
];
}
-37
View File
@@ -1,37 +0,0 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/53d2fe07-d84b-4cda-9428-45a3361d6b11";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/72E9-E469";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.ens18.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}
+191
View File
@@ -0,0 +1,191 @@
{
pkgs,
lib,
modulesPath,
...
}:
{
imports = [
"${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix"
];
networking = {
hostName = "nixos-installer";
networkmanager = {
enable = true;
wifi.powersave = false;
};
};
services.openssh = {
enable = true;
settings = {
PermitRootLogin = "prohibit-password";
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
PubkeyAuthentication = "yes";
};
};
users.users.root.openssh.authorizedKeys.keys = [
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIKhxDkucmeCor6CKoXAua7DgDSzuXrZOtpdkyzQxz5+aAAAABHNzaDo= moons@moons14.com"
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIN6hZJyng/5LgFKPjR6uZAd/00UkO0vN0uQOoIvfSELdAAAABHNzaDo= moons@moons14.com"
];
environment.systemPackages = with pkgs; [
git # Clone dotfiles repository
disko # Disk partitioning
sops # Secrets management
age # Age encryption
ssh-to-age # Convert SSH keys to age
age-plugin-yubikey # YubiKey support
yubikey-manager # YubiKey management
pcsc-tools # Smart card tools
mkpasswd # Password hash generation
rsync # File synchronization
vim # Text editor
wget # Download files
curl # HTTP client
jq # JSON processor
parted # Partition tools
cryptsetup # LUKS encryption
btrfs-progs # Btrfs filesystem tools
];
services.pcscd.enable = true;
environment.etc."installer-help.txt".text = ''
╔══════════════════════════════════════════════════════════════╗
║ NixOS Installer ISO ║
╠══════════════════════════════════════════════════════════════╣
║ ║
║ SSH Access: ║
║ ssh root@<ip-address> ║
║ ║
║ Network Setup: ║
║ Wired: Auto-configured via DHCP ║
║ WiFi: nmcli device wifi connect <SSID> --ask ║
║ ║
║ Installation Workflow: ║
║ ║
║ 1. Clone dotfiles: ║
║ git clone git@github.com:moons-14/dotfiles.git ~/dotfiles║
║ ║
║ 2. Generate SSH host key for new host: ║
║ ssh-keygen -t ed25519 -f /tmp/ssh_host_ed25519_key -N "" ║
║ ║
║ 3. Get age public key from SSH host key: ║
║ ssh-to-age -i /tmp/ssh_host_ed25519_key.pub ║
║ ║
║ 4. Add age key to .sops.yaml: ║
║ cd ~/dotfiles ║
║ # Edit .sops.yaml and add the age key ║
║ # Add new host entry to creation_rules ║
║ ║
║ 5. Re-encrypt secrets: ║
║ sops updatekeys secrets/common/system.yaml ║
║ sops updatekeys secrets/hosts/<host>/*.yaml ║
║ ║
║ 6. Create disko.nix for new host: ║
║ # Check disk devices ║
║ lsblk -f ║
║ ║
║ # Create hosts/<host>/disko.nix ║
║ # Example: LUKS + btrfs ║
║ # See hosts/x1g13/disko.nix for reference ║
║ ║
║ 7. Partition disk with disko: ║
║ nix run github:nix-community/disko -- \ ║
║ --mode disko hosts/<host>/disko.nix ║
║ ║
║ 8. Copy host key to installed system: ║
║ mkdir -p /mnt/etc/ssh ║
║ cp /tmp/ssh_host_ed25519_key* /mnt/etc/ssh/ ║
║ chmod 600 /mnt/etc/ssh/ssh_host_ed25519_key ║
║ ║
║ 9. Install NixOS: ║
║ nixos-install --flake ~/dotfiles#<host> ║
║ ║
║ Disko Configuration Examples: ║
║ ║
║ Simple (no encryption): ║
║ disko.devices.disk.main = { ║
║ type = "disk"; ║
║ device = "/dev/sda"; ║
║ content = { ║
║ type = "gpt"; ║
║ partitions = { ║
║ ESP = { size = "512M"; type = "EF00"; ║
║ content = { type = "filesystem"; ║
║ format = "vfat"; mountpoint = "/boot"; }; }; ║
║ root = { size = "100%"; ║
║ content = { type = "filesystem"; ║
║ format = "ext4"; mountpoint = "/"; }; }; ║
║ }; ║
║ }; ║
║ }; ║
║ ║
║ LUKS + btrfs (see hosts/x1g13/disko.nix): ║
║ - Use partuuid for device path ║
║ - Set askPassword = true for LUKS ║
║ - Configure btrfs subvolumes ║
║ ║
╚══════════════════════════════════════════════════════════════╝
'';
systemd.services.installer-banner = {
description = "Display installer help on console";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.coreutils}/bin/cat /etc/installer-help.txt";
StandardOutput = "tty";
TTYPath = "/dev/tty1";
};
};
systemd.services.display-ip = {
description = "Display IP address on console";
wantedBy = [ "multi-user.target" ];
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = pkgs.writeShellScript "display-ip" ''
sleep 2
echo ""
echo "=== Network Interfaces ==="
${pkgs.iproute2}/bin/ip -4 addr show | ${pkgs.gnugrep}/bin/grep inet
echo ""
echo "=== SSH Access ==="
for ip in $(${pkgs.iproute2}/bin/ip -4 addr show | ${pkgs.gnugrep}/bin/grep -oP 'inet \K[\d.]+' | ${pkgs.gnugrep}/bin/grep -v '127.0.0.1'); do
echo " ssh root@$ip"
done
echo ""
'';
StandardOutput = "tty";
TTYPath = "/dev/tty1";
};
};
nix = {
settings = {
experimental-features = [
"nix-command"
"flakes"
];
trusted-users = [ "root" ];
};
extraOptions = ''
experimental-features = nix-command flakes
'';
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
system.stateVersion = "26.05";
}
-12
View File
@@ -1,12 +0,0 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ ... }:
{
imports =
[
./hardware-configuration.nix
];
}
-37
View File
@@ -1,37 +0,0 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/770de3b2-eb30-4ccd-b7a6-13e7655b1d5c";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/1308-E5E7";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.ens18.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}
+6
View File
@@ -0,0 +1,6 @@
{ ... }:
{
imports = [
./hardware-configuration.nix
];
}
@@ -0,0 +1,43 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{
lib,
modulesPath,
...
}:
{
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [
"ata_piix"
"uhci_hcd"
"virtio_pci"
"virtio_scsi"
"sd_mod"
"sr_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-uuid/8f0eaec6-5dc9-4821-aa8d-fb6809b5a5bf";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/201C-961B";
fsType = "vfat";
options = [
"fmask=0077"
"dmask=0077"
];
};
swapDevices = [ ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}
-12
View File
@@ -1,12 +0,0 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ ... }:
{
imports =
[
./hardware-configuration.nix
];
}
-30
View File
@@ -1,30 +0,0 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/8f0eaec6-5dc9-4821-aa8d-fb6809b5a5bf";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/201C-961B";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices = [ ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}
-45
View File
@@ -1,45 +0,0 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{...}: {
imports = [
./hardware-configuration.nix
];
services.qemuGuest.enable = true;
networking = {
useDHCP = false;
interfaces = {
ens18 = {
useDHCP = false;
ipv4.addresses = [
{
address = "10.50.128.20";
prefixLength = 24;
}
];
};
ens19 = {
useDHCP = false;
ipv4.addresses = [
{
address = "10.50.7.101";
prefixLength = 24;
}
];
};
};
defaultGateway = {
address = "10.50.128.1";
interface = "ens18";
};
nameservers = [
"1.1.1.1"
];
};
}
-30
View File
@@ -1,30 +0,0 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/69fa2193-1e4f-438a-8898-5de8a3f36e5b";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/D09B-4277";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices = [ ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}
-43
View File
@@ -1,43 +0,0 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ ... }:
{
imports = [
./hardware-configuration.nix
];
fileSystems."/mnt/immich-nfs" = {
device = "unas.moons14.com:/var/nfs/shared/immich";
fsType = "nfs";
options = [
"nfsvers=3"
"hard"
"timeo=600"
"retrans=2"
"noatime"
"_netdev"
"nofail"
"x-systemd.requires=network-online.target"
"x-systemd.after=network-online.target"
];
};
fileSystems."/mnt/cloudreve-nfs" = {
device = "unas.moons14.com:/var/nfs/shared/cloudreve";
fsType = "nfs";
options = [
"nfsvers=3"
"hard"
"timeo=600"
"retrans=2"
"noatime"
"_netdev"
"nofail"
"x-systemd.requires=network-online.target"
"x-systemd.after=network-online.target"
];
};
}
@@ -1,37 +0,0 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/d9f05715-e68a-4d69-bf46-bd903b0782f0";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/1772-FC70";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.ens18.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}
-18
View File
@@ -1,18 +0,0 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ lib, inputs, ... }:
{
imports =
[
inputs.nixos-wsl.nixosModules.wsl
];
wsl.enable = true;
wsl.defaultUser = "moons";
boot.loader.systemd-boot.enable = lib.mkForce false;
boot.loader.grub.enable = lib.mkForce false;
}
+5 -13
View File
@@ -1,15 +1,7 @@
# Edit this configuration file to define what should be installed on { ... }:
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ inputs, ... }:
{ {
imports = imports = [
[ ./hardware-configuration.nix
inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x1-13th-gen ./disko.nix
./../../modules/drivers/intel-drivers.nix ];
./../../modules/core/secure-boot.nix
./hardware-configuration.nix
];
} }
+99
View File
@@ -0,0 +1,99 @@
_:
let
espPart = "/dev/disk/by-partuuid/a53e3b19-67de-40de-9ded-3eac3117689a";
nixosPart = "/dev/disk/by-partuuid/311d0f9c-f35f-42e6-b6fc-a4d67dd21b2e";
btrfsMountOptions = [
"compress=zstd"
"noatime"
"ssd"
"space_cache=v2"
];
in
{
disko.enableConfig = true;
disko.devices.disk = {
esp = {
type = "disk";
device = espPart;
destroy = false;
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"umask=0077"
];
};
};
nixos = {
type = "disk";
device = nixosPart;
destroy = false;
content = {
type = "luks";
name = "cryptroot";
askPassword = true;
settings = {
allowDiscards = true;
};
extraFormatArgs = [
"--type"
"luks2"
"--pbkdf"
"argon2id"
"--label"
"NixOS-LUKS"
];
content = {
type = "btrfs";
extraArgs = [
"-f"
"-L"
"NixOS"
];
subvolumes = {
"@root" = {
mountpoint = "/";
mountOptions = btrfsMountOptions;
};
"@home" = {
mountpoint = "/home";
mountOptions = btrfsMountOptions;
};
"@nix" = {
mountpoint = "/nix";
mountOptions = btrfsMountOptions;
};
"@log" = {
mountpoint = "/var/log";
mountOptions = btrfsMountOptions;
};
"@swap" = {
mountpoint = "/.swapvol";
mountOptions = [
"noatime"
];
swap.swapfile.size = "32G";
};
};
};
};
};
};
}
+16 -21
View File
@@ -1,37 +1,32 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’ # Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }: {
config,
lib,
modulesPath,
...
}:
{ {
imports = imports = [
[ (modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ]; boot.initrd.availableKernelModules = [
"xhci_pci"
"thunderbolt"
"nvme"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/29b4b68d-c25e-48b1-beb3-30f63ac2f491";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/EA69-77EE";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices = [ ]; swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true; networking.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
-14
View File
@@ -1,14 +0,0 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ inputs, ... }:
{
imports =
[
inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x1-9th-gen
./../../modules/drivers/intel-drivers.nix
./hardware-configuration.nix
];
}
-38
View File
@@ -1,38 +0,0 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/16b29578-6836-414b-a5e1-863bc21c5fc3";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/209A-C8C9";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
+21
View File
@@ -0,0 +1,21 @@
{
pkgs,
lib,
config,
...
}:
let
cfg = config.my.applications.arduino;
in
{
options.my.applications.arduino = {
enable = lib.mkEnableOption "Arduino development tools";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
arduino-cli # Arduino command-line interface
arduino-ide # Arduino IDE (GUI)
];
};
}
+23
View File
@@ -0,0 +1,23 @@
{
lib,
config,
...
}:
let
cfg = config.my.applications.btop;
in
{
imports = [
./home.nix
./system.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;
};
}
+25
View File
@@ -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;
};
};
}
];
}
+20
View File
@@ -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
];
};
}
+44
View File
@@ -0,0 +1,44 @@
{
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 {
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";
};
}
];
};
}
+23
View File
@@ -0,0 +1,23 @@
{
lib,
config,
...
}:
let
cfg = config.my.applications.claude;
in
{
imports = [
./home.nix
./system.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;
};
}
+27
View File
@@ -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;
};
};
};
}
];
}
+21
View File
@@ -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
];
};
}
+21
View File
@@ -0,0 +1,21 @@
{
pkgs,
inputs,
lib,
config,
...
}:
let
cfg = config.my.applications.codex;
in
{
options.my.applications.codex = {
enable = lib.mkEnableOption "Codex AI coding assistant";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [
inputs.llm-agents.packages.${pkgs.stdenv.hostPlatform.system}.codex # OpenAI Codex CLI
];
};
}
+37
View File
@@ -0,0 +1,37 @@
{
imports = [
./arduino.nix
./btop
./chrome.nix
./claude
./codex.nix
./direnv.nix
./discord.nix
./docker.nix
./fcitx5
./ghostty
./git
./gnupg.nix
./greetd.nix
./gtk
./java
./kde.nix
./nautilus.nix
./nh.nix
./niri
./noctalia
./opencode.nix
./openssh.nix
./slack.nix
./ssh
./swayidle.nix
./tailscale.nix
./vicinae.nix
./vim
./vscode
./wayland.nix
./zellij
./zoom.nix
./zsh
];
}
+16
View File
@@ -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;
};
};
}
+23
View File
@@ -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;
};
}
];
};
}
+34
View File
@@ -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
];
};
}
@@ -67,4 +67,3 @@ AllowInputMethodForPassword=False
ShowPreeditForPassword=False ShowPreeditForPassword=False
# ユーザーデータを保存する間隔(分) # ユーザーデータを保存する間隔(分)
AutoSavePeriod=30 AutoSavePeriod=30
+23
View File
@@ -0,0 +1,23 @@
{
lib,
config,
...
}:
let
cfg = config.my.applications.fcitx5;
in
{
imports = [
./home.nix
./system.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;
};
}
+24
View File
@@ -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;
};
};
}
];
}
+48
View File
@@ -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 = "";
};
};
};
};
};
}
@@ -9,7 +9,7 @@ window-decoration = true
# keybind # keybind
# Copy/Paste # Copy/Paste
keybind = ctrl+shift+c=copy_to_clipboard keybind = performable:ctrl+shift+c=copy_to_clipboard
keybind = ctrl+shift+v=paste_from_clipboard keybind = ctrl+shift+v=paste_from_clipboard
# create new tab # create new tab
@@ -28,3 +28,4 @@ keybind = ctrl+shift+minus=increase_font_size:1
shell-integration-features = ssh-terminfo,ssh-env shell-integration-features = ssh-terminfo,ssh-env
+23
View File
@@ -0,0 +1,23 @@
{
lib,
config,
...
}:
let
cfg = config.my.applications.ghostty;
in
{
imports = [
./home.nix
./system.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;
};
}
@@ -41,4 +41,5 @@ foreground = #f8f8f2
cursor-color = #f8f8f2 cursor-color = #f8f8f2
cursor-text = #282a36 cursor-text = #282a36
selection-foreground = #f8f8f2 selection-foreground = #f8f8f2
selection-background = #44475a selection-background = #44475a
+29
View File
@@ -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;
};
};
}
];
}
+20
View File
@@ -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; [
ghostty # A fast and minimal terminal emulator for Wayland
];
};
}
+33
View File
@@ -0,0 +1,33 @@
{
lib,
config,
...
}:
let
cfg = config.my.applications.git;
in
{
imports = [
./home.nix
./system.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;
};
}
+59
View File
@@ -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";
};
};
};
};
}
];
}
+20
View File
@@ -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
];
};
}
+16
View File
@@ -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;
};
};
}
+26
View File
@@ -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";
};
};
};
};
}
+23
View File
@@ -0,0 +1,23 @@
{
lib,
config,
...
}:
let
cfg = config.my.applications.gtk;
in
{
imports = [
./home.nix
./system.nix
];
options.my.applications.gtk = {
enable = lib.mkEnableOption "GTK theme configuration";
};
config = lib.mkIf cfg.enable {
my.applications.gtk.system.enable = lib.mkDefault true;
my.applications.gtk.homeManager.enable = lib.mkDefault true;
};
}
+36
View File
@@ -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";
};
};
};
}
];
}
+20
View File
@@ -0,0 +1,20 @@
{
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;
services.gnome.gnome-keyring.enable = true;
};
}
+23
View File
@@ -0,0 +1,23 @@
{
lib,
config,
...
}:
let
cfg = config.my.applications.java;
in
{
imports = [
./home.nix
./system.nix
];
options.my.applications.java = {
enable = lib.mkEnableOption "Java runtime";
};
config = lib.mkIf cfg.enable {
my.applications.java.system.enable = lib.mkDefault true;
my.applications.java.homeManager.enable = lib.mkDefault true;
};
}
+23
View File
@@ -0,0 +1,23 @@
{
lib,
config,
...
}:
let
cfg = config.my.applications.java.homeManager;
in
{
options.my.applications.java.homeManager = {
enable = lib.mkEnableOption "Java home-manager configuration";
};
config.home-manager.sharedModules = [
{
config = lib.mkIf cfg.enable {
programs.java = {
enable = true;
};
};
}
];
}
+27
View File
@@ -0,0 +1,27 @@
{
pkgs,
lib,
config,
...
}:
let
cfg = config.my.applications.java.system;
in
{
options.my.applications.java.system = {
enable = lib.mkEnableOption "Java system configuration";
};
config = lib.mkIf cfg.enable {
programs.java = {
enable = true;
package = pkgs.jdk25;
};
environment.systemPackages = with pkgs; [
jdk25 # Java Development Kit 25
maven # Java Build Tool
gradle # Java Build Tool
];
};
}
+19
View File
@@ -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;
};
};
}
+22
View File
@@ -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
];
};
}
+21
View File
@@ -0,0 +1,21 @@
{
username,
lib,
config,
...
}:
let
cfg = config.my.applications.nh;
in
{
options.my.applications.nh = {
enable = lib.mkEnableOption "nh Nix CLI helper";
};
config = lib.mkIf cfg.enable {
programs.nh = {
enable = true;
flake = "/home/${username}/dotfiles";
};
};
}
+23
View File
@@ -0,0 +1,23 @@
{
lib,
config,
...
}:
let
cfg = config.my.applications.niri;
in
{
imports = [
./home.nix
./system.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;
};
}
@@ -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 = { };
}
+164
View File
@@ -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"
];
};
};
};
};
}
];
}
+17
View File
@@ -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;
};
}
+23
View File
@@ -0,0 +1,23 @@
{
lib,
config,
...
}:
let
cfg = config.my.applications.noctalia;
in
{
imports = [
./home.nix
./system.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;
};
}
+178
View File
@@ -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";
}
];
};
};
};
};
}
];
}
+21
View File
@@ -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
];
};
}
+21
View File
@@ -0,0 +1,21 @@
{
pkgs,
inputs,
lib,
config,
...
}:
let
cfg = config.my.applications.opencode;
in
{
options.my.applications.opencode = {
enable = lib.mkEnableOption "OpenCode AI coding assistant";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [
inputs.llm-agents.packages.${pkgs.stdenv.hostPlatform.system}.opencode # OpenCode CLI
];
};
}
+23
View File
@@ -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";
};
};
};
}
+24
View File
@@ -0,0 +1,24 @@
{
pkgs,
lib,
config,
...
}:
let
cfg = config.my.applications.slack;
in
{
options.my.applications.slack = {
enable = lib.mkEnableOption "Slack messaging client";
};
config = lib.mkIf cfg.enable {
home-manager.sharedModules = [
{
home.packages = with pkgs; [
slack # Team messaging and collaboration platform
];
}
];
};
}
+41
View File
@@ -0,0 +1,41 @@
{
lib,
config,
...
}:
let
cfg = config.my.applications.ssh;
in
{
imports = [
./home.nix
./system.nix
];
options.my.applications.ssh = {
enable = lib.mkEnableOption "OpenSSH client";
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;
};
}
+37
View File
@@ -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;
settings = cfg.matchBlocks // {
"*" = {
IdentityFile = cfg.defaultIdentityFile;
AddKeysToAgent = cfg.addKeysToAgent;
};
};
};
};
}
];
}
+20
View File
@@ -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
];
};
}
+101
View File
@@ -0,0 +1,101 @@
{
pkgs,
lib,
config,
inputs,
...
}:
let
cfg = config.my.applications.swayidle;
noctaliaPkg = inputs.noctalia.packages.${pkgs.system}.default;
noctalia = lib.getExe noctaliaPkg;
bash = lib.getExe pkgs.bash;
brightnessctl = lib.getExe pkgs.brightnessctl;
niri = lib.getExe pkgs.niri;
rm = "${pkgs.coreutils}/bin/rm";
brightnessState = "$XDG_RUNTIME_DIR/swayidle-brightness";
noctaliaCall = target: action: "${bash} -lc '${noctalia} ipc call ${target} ${action}'";
lockCmd = noctaliaCall "lockScreen" "lock";
# AC 接続中は何もしない。つまり battery-only の処理にする。
skipIfOnAC = ''
for supply in /sys/class/power_supply/*; do
if [ -f "$supply/type" ] \
&& [ "$(< "$supply/type")" = "Mains" ] \
&& [ -f "$supply/online" ] \
&& [ "$(< "$supply/online")" = "1" ]; then
exit 0
fi
done
'';
dimScreen = pkgs.writeShellScript "swayidle-dim-screen" ''
${skipIfOnAC}
${brightnessctl} get > "${brightnessState}" 2>/dev/null || exit 0
${brightnessctl} set 10% >/dev/null 2>&1 || true
'';
restoreBrightness = pkgs.writeShellScript "swayidle-restore-brightness" ''
if [ -f "${brightnessState}" ]; then
saved=$(< "${brightnessState}")
${brightnessctl} set "$saved" >/dev/null 2>&1 || true
${rm} -f "${brightnessState}"
fi
'';
lockAndSuspend = pkgs.writeShellScript "swayidle-lock-and-suspend" ''
${skipIfOnAC}
${noctaliaCall "sessionMenu" "lockAndSuspend"}
'';
afterResume = pkgs.writeShellScript "swayidle-after-resume" ''
${niri} msg action power-on-monitors
${restoreBrightness}
'';
in
{
options.my.applications.swayidle = {
enable = lib.mkEnableOption "swayidle idle manager";
};
config = lib.mkIf cfg.enable {
home-manager.sharedModules = [
{
services.swayidle = {
enable = true;
systemdTargets = [ "graphical-session.target" ];
timeouts = [
{
timeout = 300;
command = "${dimScreen}";
resumeCommand = "${restoreBrightness}";
}
{
timeout = 360;
command = "${lockAndSuspend}";
}
];
events = {
lock = lockCmd;
before-sleep = lockCmd;
after-resume = "${afterResume}";
};
};
systemd.user.services.swayidle.Service.PassEnvironment = [
"WAYLAND_DISPLAY"
"XDG_RUNTIME_DIR"
"DBUS_SESSION_BUS_ADDRESS"
];
}
];
};
}
+38
View File
@@ -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;
};
};
}
+62
View File
@@ -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
];
};
}
];
};
}
+23
View File
@@ -0,0 +1,23 @@
{
lib,
config,
...
}:
let
cfg = config.my.applications.vim;
in
{
imports = [
./home
./system.nix
];
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;
};
}
@@ -1,4 +1,4 @@
{...}: { _: {
programs.nixvim.autoCmd = [ programs.nixvim.autoCmd = [
{ {
event = "TextYankPost"; event = "TextYankPost";
@@ -1,4 +1,4 @@
{...}: { _: {
programs.nixvim.colorschemes.catppuccin = { programs.nixvim.colorschemes.catppuccin = {
enable = true; enable = true;
settings.transparent_background = true; settings.transparent_background = true;
+62
View File
@@ -0,0 +1,62 @@
{
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;
nixpkgs = {
source = pkgs.path;
config.allowUnfree = 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
];
};
}
];
};
}
@@ -1,4 +1,5 @@
{...}: let _:
let
mk = key: action: desc: { mk = key: action: desc: {
mode = "n"; mode = "n";
inherit key action; inherit key action;
@@ -28,7 +29,31 @@
inherit desc; inherit desc;
}; };
}; };
in {
mkSmartWindowNav = key: direction: zellijDirection: desc: {
mode = "n";
inherit key;
action.__raw = ''
function()
local current_win = vim.api.nvim_get_current_win()
vim.cmd.wincmd("${direction}")
local at_edge = vim.api.nvim_get_current_win() == current_win
local in_zellij = vim.env.ZELLIJ ~= nil
local has_zellij_cli = vim.fn.executable("zellij") == 1
if at_edge and in_zellij and has_zellij_cli then
vim.system({ "zellij", "action", "move-focus-or-tab", "${zellijDirection}" })
end
end
'';
options = {
silent = true;
inherit desc;
};
};
in
{
programs.nixvim = { programs.nixvim = {
opts = { opts = {
# ジャンプ履歴をスタック寄りに扱う # ジャンプ履歴をスタック寄りに扱う
@@ -65,7 +90,10 @@ in {
# Convenience aliases # Convenience aliases
(mkRaw "<leader>rn" "vim.lsp.buf.rename" "シンボル名を一括変換") (mkRaw "<leader>rn" "vim.lsp.buf.rename" "シンボル名を一括変換")
(mkRaw "<leader>cf" "function() require('conform').format({ timeout_ms = 1000, lsp_format = 'fallback' }) end" "コードをフォーマット") (mkRaw "<leader>cf"
"function() require('conform').format({ timeout_ms = 1000, lsp_format = 'fallback' }) end"
"コードをフォーマット"
)
(mkRaw "<leader>ca" "vim.lsp.buf.code_action" "コードアクション") (mkRaw "<leader>ca" "vim.lsp.buf.code_action" "コードアクション")
# Diagnostics # Diagnostics
@@ -93,14 +121,14 @@ in {
(mk "[l" "<cmd>lprev<CR>" "前のLocation Listへ") (mk "[l" "<cmd>lprev<CR>" "前のLocation Listへ")
# Window navigation # Window navigation
(mk "<C-h>" "<C-w>h" "左のウィンドウへ") (mkSmartWindowNav "<C-h>" "h" "left" "左のウィンドウへ(端ならZellijペイン/タブへ)")
(mk "<C-j>" "<C-w>j" "下のウィンドウへ") (mkSmartWindowNav "<C-j>" "j" "down" "下のウィンドウへ(端ならZellijペインへ)")
(mk "<C-k>" "<C-w>k" "上のウィンドウへ") (mkSmartWindowNav "<C-k>" "k" "up" "上のウィンドウへ(端ならZellijペインへ)")
(mk "<C-l>" "<C-w>l" "右のウィンドウへ") (mkSmartWindowNav "<C-l>" "l" "right" "右のウィンドウへ(端ならZellijペイン/タブへ)")
(mk "<C-Left>" "<C-w>h" "左のウィンドウへ") (mkSmartWindowNav "<C-Left>" "h" "left" "左のウィンドウへ(端ならZellijペイン/タブへ)")
(mk "<C-Down>" "<C-w>j" "下のウィンドウへ") (mkSmartWindowNav "<C-Down>" "j" "down" "下のウィンドウへ(端ならZellijペインへ)")
(mk "<C-Up>" "<C-w>k" "上のウィンドウへ") (mkSmartWindowNav "<C-Up>" "k" "up" "上のウィンドウへ(端ならZellijペインへ)")
(mk "<C-Right>" "<C-w>l" "右のウィンドウへ") (mkSmartWindowNav "<C-Right>" "l" "right" "右のウィンドウへ(端ならZellijペイン/タブへ)")
# Alternate file / previous file # Alternate file / previous file
(mk "<leader><leader>" "<C-^>" "直前のファイルへ戻る") (mk "<leader><leader>" "<C-^>" "直前のファイルへ戻る")
@@ -1,4 +1,4 @@
{...}: { _: {
programs.nixvim = { programs.nixvim = {
env = { env = {
LANG = "ja_JP.UTF-8"; LANG = "ja_JP.UTF-8";
@@ -1,4 +1,4 @@
{...}: { _: {
programs.nixvim = { programs.nixvim = {
plugins.lsp = { plugins.lsp = {
enable = true; enable = true;
@@ -1,4 +1,4 @@
{...}: { _: {
programs.nixvim = { programs.nixvim = {
opts = { opts = {
# display # display
@@ -1,6 +1,7 @@
{...}: { { ... }:
{
imports = [ imports = [
./ui
./editor ./editor
./ui
]; ];
} }
@@ -1,3 +1,3 @@
{...}: { _: {
programs.nixvim.plugins.nvim-autopairs.enable = true; programs.nixvim.plugins.nvim-autopairs.enable = true;
} }
@@ -1,4 +1,4 @@
{...}: { _: {
programs.nixvim.plugins.blink-cmp = { programs.nixvim.plugins.blink-cmp = {
enable = true; enable = true;
setupLspCapabilities = true; setupLspCapabilities = true;
@@ -7,10 +7,10 @@
keymap = { keymap = {
preset = "enter"; preset = "enter";
"<C-Space>" = ["show"]; "<C-Space>" = [ "show" ];
"<C-d>" = ["scroll_documentation_up"]; "<C-d>" = [ "scroll_documentation_up" ];
"<C-e>" = ["hide"]; "<C-e>" = [ "hide" ];
"<C-f>" = ["scroll_documentation_down"]; "<C-f>" = [ "scroll_documentation_down" ];
"<Tab>" = [ "<Tab>" = [
"accept" "accept"
@@ -27,9 +27,18 @@
} }
"fallback" "fallback"
]; ];
"<S-Tab>" = ["select_prev" "fallback"]; "<S-Tab>" = [
"<C-n>" = ["select_next" "fallback"]; "select_prev"
"<C-p>" = ["select_prev" "fallback"]; "fallback"
];
"<C-n>" = [
"select_next"
"fallback"
];
"<C-p>" = [
"select_prev"
"fallback"
];
}; };
completion.list.selection = { completion.list.selection = {
@@ -1,3 +1,3 @@
{...}: { _: {
programs.nixvim.plugins.comment.enable = true; programs.nixvim.plugins.comment.enable = true;
} }
@@ -1,4 +1,4 @@
{...}: { _: {
programs.nixvim.plugins."conform-nvim" = { programs.nixvim.plugins."conform-nvim" = {
enable = true; enable = true;
settings = { settings = {
@@ -10,9 +10,9 @@
json.__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 }''; yaml.__raw = ''{ "prettierd", "prettier", stop_after_first = true }'';
markdown.__raw = ''{ "prettierd", "prettier", stop_after_first = true }''; markdown.__raw = ''{ "prettierd", "prettier", stop_after_first = true }'';
lua = ["stylua"]; lua = [ "stylua" ];
nix = ["alejandra"]; nix = [ "alejandra" ];
sh = ["shfmt"]; sh = [ "shfmt" ];
}; };
format_on_save.__raw = '' format_on_save.__raw = ''
function(_) function(_)

Some files were not shown because too many files have changed in this diff Show More