Skip to content

Commit 937cdbf

Browse files
Merge pull request #2 from samuelcotterall/chore/gitignore-scan-reports
Adds docker
2 parents 06e2670 + dfa958d commit 937cdbf

File tree

3 files changed

+57
-16
lines changed

3 files changed

+57
-16
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Security scans
2+
3+
on:
4+
push:
5+
branches: ["main", "master"]
6+
pull_request:
7+
8+
jobs:
9+
semgrep:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Run Semgrep
14+
uses: returntocorp/semgrep-action@v1
15+
with:
16+
config: p/ci
17+
18+
gitleaks:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Run gitleaks
23+
uses: zricethezav/gitleaks-action@v2
24+
with:
25+
args: detect --source . --exit-code 1

darwin/darwin.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
homebrew = {
4848
enable = true;
49-
brews = [ "supabase/tap/supabase" "postgresql" "pnpm" ];
49+
brews = [ "supabase/tap/supabase" "postgresql" "pnpm" "semgrep" ];
5050
casks = [];
5151
# Add homebrew to PATH
5252
onActivation.cleanup = "zap";

home-manager/default.nix

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
fzf
2424
zoxide
2525
direnv
26+
gitleaks
27+
pre-commit
2628
nodejs_22
2729
mkcert
2830
cmake
@@ -39,15 +41,21 @@
3941
# atomically when a real `docker completion zsh` is available.
4042
home.file = {
4143
".local/share/zsh/site-functions/_docker".text = ''
42-
# Home Manager managed stub for docker completion
43-
# If the real Docker CLI is available the runtime updater will replace this
44-
# file with the full completion script; this stub gives a minimal useful
45-
# fallback to avoid missing completion errors.
46-
_docker() {
47-
compadd build run compose ps images pull push exec logs start stop rm rmi
48-
}
49-
compdef _docker docker
50-
'';
44+
# Home Manager managed stub for docker completion
45+
# If the real Docker CLI is available the runtime updater will replace this
46+
# file with the full completion script; this stub gives a minimal useful
47+
# fallback to avoid missing completion errors.
48+
_docker() {
49+
compadd build run compose ps images pull push exec logs start stop rm rmi
50+
}
51+
compdef _docker docker
52+
'';
53+
".zshenv".text = ''
54+
# Prepend the user site-functions directory to fpath early so compinit can
55+
# autoload completions managed by Home Manager (e.g. _docker). This runs for
56+
# all zsh shells before other init files.
57+
fpath=("$HOME/.local/share/zsh/site-functions" $fpath)
58+
'';
5159
};
5260

5361

@@ -117,12 +125,20 @@ compdef _docker docker
117125
# only when different. This avoids slowing every shell startup and
118126
# keeps the activation-time managed stub as the authoritative source.
119127
if command -v docker >/dev/null 2>&1; then
120-
TMPFILE="$ZSH_SITE_FUNCS/_docker.tmp"
121-
if docker completion zsh > "$TMPFILE" 2>/dev/null; then
122-
if [ ! -f "$ZSH_SITE_FUNCS/_docker" ] || ! cmp -s "$TMPFILE" "$ZSH_SITE_FUNCS/_docker"; then
123-
mv "$TMPFILE" "$ZSH_SITE_FUNCS/_docker"
124-
else
125-
rm -f "$TMPFILE"
128+
# If the completion file is a symlink (managed by home-manager/Nix),
129+
# don't try to overwrite it from shell startup — that can trigger an
130+
# interactive "override" prompt. Only update when the target is a
131+
# regular file owned/writable by the user.
132+
if [ -L "$ZSH_SITE_FUNCS/_docker" ]; then
133+
: # skip updater for home-managed symlink
134+
else
135+
TMPFILE="$ZSH_SITE_FUNCS/_docker.tmp"
136+
if docker completion zsh > "$TMPFILE" 2>/dev/null; then
137+
if [ ! -f "$ZSH_SITE_FUNCS/_docker" ] || ! cmp -s "$TMPFILE" "$ZSH_SITE_FUNCS/_docker"; then
138+
mv -f "$TMPFILE" "$ZSH_SITE_FUNCS/_docker"
139+
else
140+
rm -f "$TMPFILE"
141+
fi
126142
fi
127143
fi
128144
fi

0 commit comments

Comments
 (0)