stuff
This commit is contained in:
42
flake.lock
generated
42
flake.lock
generated
@@ -24,11 +24,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1755751773,
|
||||
"narHash": "sha256-d1H34kko9J5fWrxCVgfa1TkIwdkGt/eDSVopAWenw24=",
|
||||
"lastModified": 1755825449,
|
||||
"narHash": "sha256-XkiN4NM9Xdy59h69Pc+Vg4PxkSm9EWl6u7k6D5FZ5cM=",
|
||||
"owner": "LnL7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "3a0a38a1e7ac2c4b4150ea37a491fdffdc9c92e1",
|
||||
"rev": "8df64f819698c1fee0c2969696f54a843b2231e8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -100,11 +100,11 @@
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1755755322,
|
||||
"narHash": "sha256-spCxkNihCk3uT3LUrUwzdEAjLA/E0EtEgF3KVI05nlM=",
|
||||
"lastModified": 1755914636,
|
||||
"narHash": "sha256-VJ+Gm6YsHlPfUCpmRQxvdiZW7H3YPSrdVOewQHAhZN8=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "282b4c98de97da6667cb03de4f427371734bc39c",
|
||||
"rev": "8b55a6ac58b678199e5bba701aaff69e2b3281c0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -132,11 +132,11 @@
|
||||
"homebrew-cask": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1755752921,
|
||||
"narHash": "sha256-HfCLZurzFgk5eX0hGmE6LwDrvX/1DF0JGJabywPc3nk=",
|
||||
"lastModified": 1755945318,
|
||||
"narHash": "sha256-tJlgNf3YuOVc6RfbA2icX9SArjzbPvBq4A4QCbdlOn4=",
|
||||
"owner": "homebrew",
|
||||
"repo": "homebrew-cask",
|
||||
"rev": "f9cfcb07de78a378e0f81fd2876c94cf7242f9f7",
|
||||
"rev": "da5913d519f5253c9b03f1805ea01cf5aa7a1183",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -148,11 +148,11 @@
|
||||
"homebrew-core": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1755757723,
|
||||
"narHash": "sha256-JOTKjMRNYIhc+D9CTQH4R76/d+IL3/rG1MaSeiXOJ88=",
|
||||
"lastModified": 1755949354,
|
||||
"narHash": "sha256-2jS+Z+iAR6KiGBpte5rSZUKnfsTgDsn1OxgmVra/3J4=",
|
||||
"owner": "homebrew",
|
||||
"repo": "homebrew-core",
|
||||
"rev": "9c091755985b2da34afa6616c69bb1410d60dc6a",
|
||||
"rev": "f03ca49ac4659c5ef2c0f89d04dde6616cdd7f50",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -240,11 +240,11 @@
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1755756304,
|
||||
"narHash": "sha256-9nv3PhRr+fVFRdG/caDW7HYcF/i+R29XRIBjGdXoNxg=",
|
||||
"lastModified": 1755949573,
|
||||
"narHash": "sha256-m24Vj1lECTWMg++kWdTJw2j/pgeNgA0Kw8nm4NNRNAY=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "aa54caffb447fded192133f654411427f71ab069",
|
||||
"rev": "cefcc33ed82f9e218423c6f970caebcad360b7df",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -256,11 +256,11 @@
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1755577059,
|
||||
"narHash": "sha256-5hYhxIpco8xR+IpP3uU56+4+Bw7mf7EMyxS/HqUYHQY=",
|
||||
"lastModified": 1755736253,
|
||||
"narHash": "sha256-jlIQRypNhB1PcB1BE+expE4xZeJxzoAGr1iUbHQta8s=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "97eb7ee0da337d385ab015a23e15022c865be75c",
|
||||
"rev": "596312aae91421d6923f18cecce934a7d3bfd6b8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -278,11 +278,11 @@
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1755741137,
|
||||
"narHash": "sha256-YnpE/fOL3H8cJZ9by/YmeNhIqOQdKuZRYA1L3+w6WsI=",
|
||||
"lastModified": 1755924483,
|
||||
"narHash": "sha256-wNqpEXZuAwPjW8hYKIYzmN+fgEZT/Qx+sUIWXg3EIWU=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixvim",
|
||||
"rev": "91a38e66240c338e683421a4ee3f525d329fc4ad",
|
||||
"rev": "91f51aede7c9c769c19f74ba9042b8fdb4ed2989",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
user,
|
||||
...
|
||||
@@ -10,6 +12,36 @@
|
||||
networking.hostName = "chidi";
|
||||
networking.computerName = "Chidi";
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(import ../../../overlays/postgresql-darwin.nix)
|
||||
];
|
||||
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
package = pkgs.postgresql_17;
|
||||
enableTCPIP = true;
|
||||
port = 5432;
|
||||
ensureDatabases = ["postgres"];
|
||||
ensureUsers = [
|
||||
{
|
||||
name = "postgres";
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
{
|
||||
name = "cschmatzler";
|
||||
ensureClauses = {
|
||||
superuser = true;
|
||||
createdb = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
authentication = pkgs.lib.mkForce ''
|
||||
local all all trust
|
||||
host all all 127.0.0.1/32 trust
|
||||
host all all ::1/128 trust
|
||||
'';
|
||||
};
|
||||
|
||||
services.syncthing.settings.folders = {
|
||||
"Projects/Work" = {
|
||||
path = "/Users/${user}/Projects/Work";
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
window-padding-x = 8;
|
||||
window-padding-y = 2;
|
||||
window-padding-balance = true;
|
||||
font-family = "Iosevka";
|
||||
font-family = "Fira Code";
|
||||
font-size = 15.5;
|
||||
font-feature = [
|
||||
"-calt"
|
||||
|
||||
@@ -19,4 +19,180 @@ in {
|
||||
rebase.autoStash = true;
|
||||
};
|
||||
};
|
||||
|
||||
home.shellAliases = {
|
||||
g = "git";
|
||||
ga = "git add";
|
||||
gaa = "git add --all";
|
||||
gapa = "git add --patch";
|
||||
gau = "git add --update";
|
||||
gav = "git add --verbose";
|
||||
gap = "git apply";
|
||||
gapt = "git apply --3way";
|
||||
gb = "git branch";
|
||||
gba = "git branch --all";
|
||||
gbd = "git branch --delete";
|
||||
gbD = "git branch --delete --force";
|
||||
gbl = "git blame -w";
|
||||
gbnm = "git branch --no-merged";
|
||||
gbr = "git branch --remote";
|
||||
gbs = "git bisect";
|
||||
gbsb = "git bisect bad";
|
||||
gbsg = "git bisect good";
|
||||
gbsn = "git bisect new";
|
||||
gbso = "git bisect old";
|
||||
gbsr = "git bisect reset";
|
||||
gbss = "git bisect start";
|
||||
gc = "git commit --verbose";
|
||||
gca = "git commit --verbose --all";
|
||||
gcam = "git commit --all --message";
|
||||
gcas = "git commit --all --signoff";
|
||||
gcasm = "git commit --all --signoff --message";
|
||||
gcb = "git checkout -b";
|
||||
gcB = "git checkout -B";
|
||||
gcf = "git config --list";
|
||||
gclean = "git clean --interactive -d";
|
||||
gcl = "git clone --recurse-submodules";
|
||||
gclf = "git clone --recursive --shallow-submodules --filter=blob:none --also-filter-submodules";
|
||||
gcm = "git checkout main";
|
||||
gcmsg = "git commit --message";
|
||||
gcn = "git commit --verbose --no-edit";
|
||||
gco = "git checkout";
|
||||
gcor = "git checkout --recurse-submodules";
|
||||
gcount = "git shortlog --summary --numbered";
|
||||
gcp = "git cherry-pick";
|
||||
gcpa = "git cherry-pick --abort";
|
||||
gcpc = "git cherry-pick --continue";
|
||||
gcs = "git commit --gpg-sign";
|
||||
gcss = "git commit --gpg-sign --signoff";
|
||||
gcssm = "git commit --gpg-sign --signoff --message";
|
||||
gcsm = "git commit --signoff --message";
|
||||
gd = "git diff";
|
||||
gdca = "git diff --cached";
|
||||
gdcw = "git diff --cached --word-diff";
|
||||
gds = "git diff --staged";
|
||||
gdw = "git diff --word-diff";
|
||||
gdt = "git diff-tree --no-commit-id --name-only -r";
|
||||
gdup = "git diff @{upstream}";
|
||||
gf = "git fetch";
|
||||
gfa = "git fetch --all --tags --prune";
|
||||
gfo = "git fetch origin";
|
||||
gfg = "git ls-files | grep";
|
||||
gg = "git gui citool";
|
||||
gga = "git gui citool --amend";
|
||||
ggpull = "git pull origin \"$(git branch --show-current)\"";
|
||||
ggpush = "git push origin \"$(git branch --show-current)\"";
|
||||
ggsup = "git branch --set-upstream-to=origin/$(git branch --show-current)";
|
||||
ghh = "git help";
|
||||
gignore = "git update-index --assume-unchanged";
|
||||
gignored = "git ls-files -v | grep \"^[[:lower:]]\"";
|
||||
gl = "git pull";
|
||||
glg = "git log --stat";
|
||||
glgp = "git log --stat --patch";
|
||||
glgg = "git log --graph";
|
||||
glgga = "git log --graph --decorate --all";
|
||||
glgm = "git log --graph --max-count=10";
|
||||
glo = "git log --oneline --decorate";
|
||||
glog = "git log --oneline --decorate --graph";
|
||||
gloga = "git log --oneline --decorate --graph --all";
|
||||
glol = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\"";
|
||||
glola = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\" --all";
|
||||
glols = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\" --stat";
|
||||
glod = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset\"";
|
||||
glods = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset\" --date=short";
|
||||
gluc = "git pull upstream $(git branch --show-current)";
|
||||
glum = "git pull upstream main";
|
||||
gm = "git merge";
|
||||
gma = "git merge --abort";
|
||||
gmc = "git merge --continue";
|
||||
gms = "git merge --squash";
|
||||
gmff = "git merge --ff-only";
|
||||
gmtl = "git mergetool --no-prompt";
|
||||
gmtlvim = "git mergetool --no-prompt --tool=vimdiff";
|
||||
gmum = "git merge upstream/main";
|
||||
gmom = "git merge origin/main";
|
||||
gp = "git push";
|
||||
gpd = "git push --dry-run";
|
||||
gpf = "git push --force-with-lease";
|
||||
gpod = "git push origin --delete";
|
||||
gpoat = "git push origin --all && git push origin --tags";
|
||||
gpr = "git pull --rebase";
|
||||
gpra = "git pull --rebase --autostash";
|
||||
gprav = "git pull --rebase --autostash -v";
|
||||
gprom = "git pull --rebase origin main";
|
||||
gpromi = "git pull --rebase=interactive origin main";
|
||||
gprv = "git pull --rebase -v";
|
||||
gprum = "git pull --rebase upstream main";
|
||||
gprumi = "git pull --rebase=interactive upstream main";
|
||||
gpsup = "git push --set-upstream origin $(git branch --show-current)";
|
||||
gpsupf = "git push --set-upstream origin $(git branch --show-current) --force-with-lease";
|
||||
gpv = "git push --verbose";
|
||||
gpu = "git push upstream";
|
||||
gr = "git remote";
|
||||
gra = "git remote add";
|
||||
grb = "git rebase";
|
||||
grba = "git rebase --abort";
|
||||
grbc = "git rebase --continue";
|
||||
grbd = "git rebase develop";
|
||||
grbi = "git rebase --interactive";
|
||||
grbm = "git rebase main";
|
||||
grbo = "git rebase --onto";
|
||||
grbom = "git rebase origin/main";
|
||||
grbs = "git rebase --skip";
|
||||
grbum = "git rebase upstream/main";
|
||||
grev = "git revert";
|
||||
greva = "git revert --abort";
|
||||
grevc = "git revert --continue";
|
||||
grf = "git reflog";
|
||||
grh = "git reset";
|
||||
grhh = "git reset --hard";
|
||||
grhk = "git reset --keep";
|
||||
grhs = "git reset --soft";
|
||||
grm = "git rm";
|
||||
grmc = "git rm --cached";
|
||||
grmv = "git remote rename";
|
||||
groh = "git reset origin/$(git branch --show-current) --hard";
|
||||
grrm = "git remote remove";
|
||||
grs = "git restore";
|
||||
grset = "git remote set-url";
|
||||
grss = "git restore --source";
|
||||
grst = "git restore --staged";
|
||||
grt = "cd \"$(git rev-parse --show-toplevel || echo .)\"";
|
||||
gru = "git reset --";
|
||||
grup = "git remote update";
|
||||
grv = "git remote --verbose";
|
||||
gsb = "git status --short --branch";
|
||||
gsh = "git show";
|
||||
gsi = "git submodule init";
|
||||
gsps = "git show --pretty=short --show-signature";
|
||||
gss = "git status --short";
|
||||
gst = "git status";
|
||||
gsta = "git stash push";
|
||||
gstaa = "git stash apply";
|
||||
gstall = "git stash --all";
|
||||
gstc = "git stash clear";
|
||||
gstd = "git stash drop";
|
||||
gstl = "git stash list";
|
||||
gstp = "git stash pop";
|
||||
gsts = "git stash show --patch";
|
||||
gstu = "git stash push --include-untracked";
|
||||
gsu = "git submodule update";
|
||||
gsw = "git switch";
|
||||
gswc = "git switch --create";
|
||||
gswd = "git switch develop";
|
||||
gswm = "git switch main";
|
||||
gta = "git tag --annotate";
|
||||
gts = "git tag --sign";
|
||||
gtv = "git tag | sort -V";
|
||||
gunignore = "git update-index --no-assume-unchanged";
|
||||
gunwip = "git rev-list --max-count=1 --format=\"%s\" HEAD | grep -q \"\\--wip--\" && git reset HEAD~1";
|
||||
gwch = "git whatchanged -p --abbrev-commit --pretty=medium";
|
||||
gwipe = "git reset --hard && git clean --force -df";
|
||||
gwt = "git worktree";
|
||||
gwta = "git worktree add";
|
||||
gwtls = "git worktree list";
|
||||
gwtmv = "git worktree move";
|
||||
gwtrm = "git worktree remove";
|
||||
gwip = "git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message \"--wip-- [skip ci]\"";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ with pkgs; [
|
||||
gnupg
|
||||
htop
|
||||
hyperfine
|
||||
iosevka
|
||||
fira-code
|
||||
jq
|
||||
killall
|
||||
nurl
|
||||
|
||||
74
overlays/postgresql-darwin.nix
Normal file
74
overlays/postgresql-darwin.nix
Normal file
@@ -0,0 +1,74 @@
|
||||
final: prev: {
|
||||
postgresql = { config, lib, ... }: let
|
||||
cfg = config.services.postgresql;
|
||||
|
||||
postStartScript = prev.writeScript "postgresql-post-start" ''
|
||||
#!${prev.bash}/bin/bash
|
||||
set -e
|
||||
|
||||
# Wait for PostgreSQL to be ready
|
||||
until ${cfg.package}/bin/pg_isready -h localhost -p ${toString cfg.port} -U ${cfg.superUser}; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Create databases if they don't exist
|
||||
${prev.lib.concatMapStringsSep "\n" (db: ''
|
||||
if ! ${cfg.package}/bin/psql -h localhost -p ${toString cfg.port} -U ${cfg.superUser} -lqt | cut -d'|' -f1 | grep -qw ${prev.lib.escapeShellArg db}; then
|
||||
echo "Creating database: ${prev.lib.escapeShellArg db}"
|
||||
${cfg.package}/bin/createdb -h localhost -p ${toString cfg.port} -U ${cfg.superUser} ${prev.lib.escapeShellArg db}
|
||||
fi
|
||||
'') cfg.ensureDatabases}
|
||||
|
||||
# Create users and set permissions
|
||||
${prev.lib.concatMapStringsSep "\n" (user: ''
|
||||
# Create user if it doesn't exist
|
||||
if ! ${cfg.package}/bin/psql -h localhost -p ${toString cfg.port} -U ${cfg.superUser} -tAc "SELECT 1 FROM pg_roles WHERE rolname='${prev.lib.escapeShellArg user.name}'" | grep -q 1; then
|
||||
echo "Creating user: ${prev.lib.escapeShellArg user.name}"
|
||||
${cfg.package}/bin/psql -h localhost -p ${toString cfg.port} -U ${cfg.superUser} -c "CREATE USER \"${prev.lib.escapeShellArg user.name}\""
|
||||
fi
|
||||
|
||||
# Set user privileges
|
||||
${prev.lib.optionalString (user ? ensureDBOwnership && user.ensureDBOwnership) ''
|
||||
echo "Setting database ownership for ${prev.lib.escapeShellArg user.name}"
|
||||
${cfg.package}/bin/psql -h localhost -p ${toString cfg.port} -U ${cfg.superUser} -c "ALTER USER \"${prev.lib.escapeShellArg user.name}\" CREATEDB CREATEROLE"
|
||||
''}
|
||||
|
||||
${prev.lib.optionalString (user ? ensureClauses) ''
|
||||
${prev.lib.optionalString (user.ensureClauses ? superuser && user.ensureClauses.superuser) ''
|
||||
echo "Granting superuser to ${prev.lib.escapeShellArg user.name}"
|
||||
${cfg.package}/bin/psql -h localhost -p ${toString cfg.port} -U ${cfg.superUser} -c "ALTER USER \"${prev.lib.escapeShellArg user.name}\" SUPERUSER"
|
||||
''}
|
||||
${prev.lib.optionalString (user.ensureClauses ? createdb && user.ensureClauses.createdb) ''
|
||||
echo "Granting createdb to ${prev.lib.escapeShellArg user.name}"
|
||||
${cfg.package}/bin/psql -h localhost -p ${toString cfg.port} -U ${cfg.superUser} -c "ALTER USER \"${prev.lib.escapeShellArg user.name}\" CREATEDB"
|
||||
''}
|
||||
''}
|
||||
|
||||
# Grant permissions (legacy support)
|
||||
${prev.lib.concatMapStringsSep "\n" (perm: ''
|
||||
echo "Granting ${prev.lib.escapeShellArg perm} to ${prev.lib.escapeShellArg user.name}"
|
||||
${cfg.package}/bin/psql -h localhost -p ${toString cfg.port} -U ${cfg.superUser} -c "GRANT ${prev.lib.escapeShellArg perm} TO \"${prev.lib.escapeShellArg user.name}\""
|
||||
'') (prev.lib.optionals (user ? ensurePermissions) (prev.lib.mapAttrsToList (target: perm: "${perm} ON ${target}") user.ensurePermissions))}
|
||||
'') cfg.ensureUsers}
|
||||
|
||||
# Run initial script if provided
|
||||
${prev.lib.optionalString (cfg.initialScript != null) ''
|
||||
echo "Running initial script"
|
||||
${cfg.package}/bin/psql -h localhost -p ${toString cfg.port} -U ${cfg.superUser} -f ${cfg.initialScript}
|
||||
''}
|
||||
'';
|
||||
|
||||
in {
|
||||
config = prev.lib.mkIf cfg.enable {
|
||||
launchd.user.agents.postgresql = prev.lib.mkIf (cfg.ensureDatabases != [] || cfg.ensureUsers != [] || cfg.initialScript != null) {
|
||||
script = prev.lib.mkAfter ''
|
||||
# Run post-start script in background after PostgreSQL starts
|
||||
(
|
||||
sleep 5 # Give PostgreSQL a moment to fully start
|
||||
${prev.bash}/bin/bash ${postStartScript}
|
||||
) &
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user