Skip to content

Commit 14f332a

Browse files
committed
only write graphite config if not present
1 parent 249c6d2 commit 14f332a

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

‎modules/home/scm.nix‎

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,23 @@ in {
9898
(mkIf graphiteCfg.enable {
9999
home.packages = [pkgs.graphite-cli];
100100

101-
home.file.".config/graphite/user_config".text = builtins.toJSON {
102-
branchPrefix = "corey/";
103-
branchDate = false;
104-
branchReplacement = "-";
105-
skipApplyingPrefixToNonGeneratedBranchNames = true;
106-
updateAutomatically = false;
107-
};
101+
home.activation.graphiteConfig = lib.hm.dag.entryAfter ["writeBoundary"] ''
102+
config_dir="$HOME/.config/graphite"
103+
config_file="$config_dir/user_config"
104+
run mkdir -p "$config_dir"
105+
if [ ! -f "$config_file" ]; then
106+
run cp ${
107+
pkgs.writeText "graphite-user-config" (builtins.toJSON {
108+
branchPrefix = "corey/";
109+
branchDate = false;
110+
branchReplacement = "-";
111+
skipApplyingPrefixToNonGeneratedBranchNames = true;
112+
updateAutomatically = false;
113+
})
114+
} "$config_file"
115+
run chmod u+w "$config_file"
116+
fi
117+
'';
108118
})
109119

110120
(mkIf jjCfg.enable {

0 commit comments

Comments
 (0)