Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions config/claude/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,36 @@
{
home.file.".claude/settings.json" = {
source = ./settings.json;
force = true;
};

home.file.".claude/pushover.sh" = {
source = ./pushover.sh;
executable = true;
force = true;
};

home.file.".claude/notify.sh" = {
source = ./notify.sh;
executable = true;
force = true;
};

home.file.".claude/security.sh" = {
source = ./security.sh;
executable = true;
force = true;
};

home.file.".claude/statusline-git.sh" = {
source = ./statusline-git.sh;
executable = true;
force = true;
};

home.file.".claude/install-skills.sh" = {
source = ./install-skills.sh;
executable = true;
force = true;
};
}
2 changes: 2 additions & 0 deletions config/cliproxyapi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
# Template config - the service wrapper injects secrets and writes to config.yaml
home.file.".cli-proxy-api/config.template.yaml" = {
source = config.lib.file.mkOutOfStoreSymlink ./config.yaml;
force = true;
};
# Example config - required by cliproxyapi's object-backed config bootstrap
home.file.".cli-proxy-api/config.example.yaml" = {
source = config.lib.file.mkOutOfStoreSymlink ./config.yaml;
force = true;
};
}
1 change: 1 addition & 0 deletions config/crush/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
{
home.file.".config/crush/crush.json" = {
source = config.lib.file.mkOutOfStoreSymlink ./crush.json;
force = true;
};
}
1 change: 1 addition & 0 deletions config/direnv/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
{
home.file.".config/direnv/direnvrc" = {
source = config.lib.file.mkOutOfStoreSymlink ./direnvrc;
force = true;
};
}
1 change: 1 addition & 0 deletions config/factory/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
{
home.file.".factory/config.json" = {
source = config.lib.file.mkOutOfStoreSymlink ./config.json;
force = true;
};
}
1 change: 1 addition & 0 deletions config/hammerspoon/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
{
home.file.".hammerspoon/init.lua" = {
source = config.lib.file.mkOutOfStoreSymlink ./init.lua;
force = true;
};
}
1 change: 1 addition & 0 deletions config/k3s/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# k3s config file stored in home directory
home.file.".config/k3s/config.yaml" = lib.mkIf pkgs.stdenv.isLinux {
source = config.lib.file.mkOutOfStoreSymlink ./config.yaml;
force = true;
};

# Activation script to sync config to /etc/rancher/k3s/
Expand Down
1 change: 1 addition & 0 deletions config/karabiner/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
{
home.file.".config/karabiner/karabiner.json" = {
source = ./karabiner.json;
force = true;
};
}
1 change: 1 addition & 0 deletions config/opencode/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
{
home.file.".config/opencode/opencode.jsonc" = {
source = config.lib.file.mkOutOfStoreSymlink ./opencode.jsonc;
force = true;
};
}
1 change: 1 addition & 0 deletions config/serena/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
{
home.file.".serena/serena_config.yml" = {
source = config.lib.file.mkOutOfStoreSymlink ./serena_config.yml;
force = true;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using force = true is a good way to ensure the declarative configuration is applied, but it carries the risk of data loss. If a user has a pre-existing ~/.serena/serena_config.yml that is a regular file (not a symlink), it will be overwritten. Since the serena_config.yml file contains a projects list that is managed by the Serena application, overwriting it could cause the user to lose their list of registered projects.

To mitigate this and to inform future developers, I suggest adding a comment explaining why force = true is used and what its implications are.

    # WARNING: This overwrites any existing file, which can lead to data loss
    # of local modifications (e.g., the application-managed 'projects' list).
    force = true;

};
}
1 change: 1 addition & 0 deletions config/starship/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
{
home.file.".config/starship.toml" = {
source = config.lib.file.mkOutOfStoreSymlink ./starship.toml;
force = true;
};
}
6 changes: 4 additions & 2 deletions home-manager/modules/tailscale/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@ in
home.packages = [ cfg.tailscaled.package ];

# Declare directories and files for home-manager
home.file.".local/share/tailscale/tailscaled.state".source =
config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.local/state/tailscale/tailscaled.state";
home.file.".local/share/tailscale/tailscaled.state" = {
source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.local/state/tailscale/tailscaled.state";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: tailscaled.stateDir option is unused; state file paths remain hardcoded, so user configuration is ignored and state may be forced to the wrong location.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At home-manager/modules/tailscale/default.nix, line 143:

<comment>`tailscaled.stateDir` option is unused; state file paths remain hardcoded, so user configuration is ignored and state may be forced to the wrong location.</comment>

<file context>
@@ -139,8 +139,10 @@ in
-    home.file.".local/share/tailscale/tailscaled.state".source =
-      config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.local/state/tailscale/tailscaled.state";
+    home.file.".local/share/tailscale/tailscaled.state" = {
+      source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.local/state/tailscale/tailscaled.state";
+      force = true;
+    };
</file context>

force = true;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Forced symlink will delete existing tailscaled.state, risking loss of Tailscale node state

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At home-manager/modules/tailscale/default.nix, line 144:

<comment>Forced symlink will delete existing tailscaled.state, risking loss of Tailscale node state</comment>

<file context>
@@ -139,8 +139,10 @@ in
-      config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.local/state/tailscale/tailscaled.state";
+    home.file.".local/share/tailscale/tailscaled.state" = {
+      source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.local/state/tailscale/tailscaled.state";
+      force = true;
+    };
 
</file context>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Symlink forced to ~/.local/state but target directory is never created, leaving a broken state-file path

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At home-manager/modules/tailscale/default.nix, line 144:

<comment>Symlink forced to ~/.local/state but target directory is never created, leaving a broken state-file path</comment>

<file context>
@@ -139,8 +139,10 @@ in
-      config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.local/state/tailscale/tailscaled.state";
+    home.file.".local/share/tailscale/tailscaled.state" = {
+      source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.local/state/tailscale/tailscaled.state";
+      force = true;
+    };
 
</file context>

};
Comment on lines +142 to +145

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n home-manager/modules/tailscale/default.nix | head -150 | tail -40

Repository: shunkakinoki/dotfiles

Length of output: 1601


🏁 Script executed:

wc -l home-manager/modules/tailscale/default.nix

Repository: shunkakinoki/dotfiles

Length of output: 111


🏁 Script executed:

cat -n home-manager/modules/tailscale/default.nix

Repository: shunkakinoki/dotfiles

Length of output: 11383


Add migration logic before forcing tailscaled.state symlink to preserve existing state.

With force = true, the symlink will overwrite any existing .local/share/tailscale/tailscaled.state file without preserving it, causing loss of node identity and requiring re-authentication. Add an activation script that migrates existing state to .local/state/tailscale/ before the symlink is created, or implement a guard to check whether migration is needed.

🤖 Prompt for AI Agents
In `@home-manager/modules/tailscale/default.nix` around lines 142 - 145, The
current home.file entry for home.file.".local/share/tailscale/tailscaled.state"
uses force = true which will overwrite any existing file and lose tailscale node
identity; add migration logic before creating the symlink by adding an
activationScript (or preStart/activationScript hook) that checks for an existing
"${config.home.homeDirectory}/.local/share/tailscale/tailscaled.state" file and
moves it to
"${config.home.homeDirectory}/.local/state/tailscale/tailscaled.state" (creating
the target dir if needed) only when migration is required, and only after that
allow the home.file using config.lib.file.mkOutOfStoreSymlink to create the
symlink (or change force to false once migration is complete); reference the
existing home.file key ".local/share/tailscale/tailscaled.state", the source
assignment using mkOutOfStoreSymlink, and the force attribute when implementing
this activation/migration guard.


# Tailscaled service
systemd.user.services.tailscaled = mkIf configEnabled {
Expand Down
1 change: 1 addition & 0 deletions home-manager/programs/ssh/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
home.file.".ssh/rc" = {
source = config.lib.file.mkOutOfStoreSymlink ./rc;
force = true;
};
programs.ssh = {
enable = true;
Expand Down
Loading