Compare commits

..

9 Commits

Author SHA1 Message Date
arnie 9503c33f24 Mac things 2026-01-13 13:26:57 +01:00
arnie fa9c2115e9 Add claude code to mac 2026-01-02 23:28:02 +01:00
arnie b9b62ea3c3 Formatting and hammerspoon 2025-12-29 12:23:03 +01:00
arnie c34274413a Add session manager plugin 2025-12-29 12:21:57 +01:00
arnie 0a7d543ff4 Update darwin stuff 2025-12-29 10:16:31 +01:00
Arnie 4c7d1aabea Add tree 2025-12-14 21:57:38 +01:00
Arnie 43fe34151a Update becky 2025-12-14 20:10:10 +01:00
Arnie ebcc853148 Fix pinentry for linux 2025-12-08 16:05:39 +01:00
Arnie 524ccea715 Update flake 2025-12-08 16:05:28 +01:00
12 changed files with 307 additions and 173 deletions
+1
View File
@@ -52,6 +52,7 @@ in
git git
coreutils coreutils
vim vim
flameshot
wireguard-tools wireguard-tools
]; ];
+1 -1
View File
@@ -6,11 +6,11 @@
# these need to be updated manually # these need to be updated manually
homebrew.casks = [ homebrew.casks = [
"drawio" "drawio"
"flameshot"
"ghostty" "ghostty"
"keepassxc" "keepassxc"
"spotify" "spotify"
"wireshark-chmodbpf" "wireshark-chmodbpf"
"visual-studio-code"
]; ];
system.primaryUser = "lcech"; system.primaryUser = "lcech";
Generated
+135 -31
View File
@@ -1,12 +1,18 @@
{ {
"nodes": { "nodes": {
"cl-nix-lite": { "cl-nix-lite": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs",
"systems": "systems",
"treefmt-nix": "treefmt-nix"
},
"locked": { "locked": {
"lastModified": 1728174978, "lastModified": 1766810506,
"narHash": "sha256-Grqqg+xuicANB85j0gNEXxi9SBKY7bzGeTuyi95eGcY=", "narHash": "sha256-I4BxozsEu205tA7jazufztI8ZQ5p7hcCnjqrSKPz9nI=",
"owner": "hraban", "owner": "hraban",
"repo": "cl-nix-lite", "repo": "cl-nix-lite",
"rev": "31cfe6275c341eb3120a99f4b1c8516c49a29d87", "rev": "038e341cede255a83a8f04af114dc95717461d32",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -32,6 +38,24 @@
"type": "github" "type": "github"
} }
}, },
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1765835352,
"narHash": "sha256-XswHlK/Qtjasvhd1nOa1e8MgZ8GS//jBoTqWtrS1Giw=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "a34fae9c08a15ad73f295041fec82323541400a9",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": [ "systems": [
@@ -54,7 +78,7 @@
}, },
"flake-utils_2": { "flake-utils_2": {
"inputs": { "inputs": {
"systems": "systems_2" "systems": "systems_3"
}, },
"locked": { "locked": {
"lastModified": 1731533236, "lastModified": 1731533236,
@@ -77,11 +101,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1762704774, "lastModified": 1766980997,
"narHash": "sha256-iodz4xQbULkHqetbPu5BCSWsVEzZiiNSv0/dzfH4XiE=", "narHash": "sha256-oegDNAvyQwaG3GqSi4U5jpKM7SYHGESGVIuKMRV/lbw=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "be4a9233dd3f6104c9b0fdd3d56f953eb519a4c7", "rev": "7a7b43c7231a439d248179ba8d561dd6cd81799b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -98,15 +122,15 @@
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"systems": "systems", "systems": "systems_2",
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix_2"
}, },
"locked": { "locked": {
"lastModified": 1756057867, "lastModified": 1766810876,
"narHash": "sha256-ziR5eQGqRWhW8tf8r0TIplaqNt+HXu1G1X41LUr4IYo=", "narHash": "sha256-VPElWFQIiP31lXQXEom+L4sl85alZpZn33O4hewsP9k=",
"owner": "hraban", "owner": "hraban",
"repo": "mac-app-util", "repo": "mac-app-util",
"rev": "8414fa1e2cb775b17793104a9095aabeeada63ef", "rev": "4747968574ea58512c5385466400b2364c85d2d0",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -122,11 +146,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1762627886, "lastModified": 1766784396,
"narHash": "sha256-/QLk1bzmbcqJt9sU43+y/3tHtXhAy0l8Ck0MoO2+evQ=", "narHash": "sha256-rIlgatT0JtwxsEpzq+UrrIJCRfVAXgbYPzose1DmAcM=",
"owner": "LnL7", "owner": "LnL7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "5125a3cd414dc98bbe2c528227aa6b62ee61f733", "rev": "f0c8e1f6feb562b5db09cee9fb566a2f989e6b55",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -158,11 +182,42 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1754340878, "lastModified": 1766736597,
"narHash": "sha256-lgmUyVQL9tSnvvIvBp7x1euhkkCho7n3TMzgjdvgPoU=", "narHash": "sha256-BASnpCLodmgiVn0M1MU2Pqyoz0aHwar/0qLkp7CjvSQ=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "cab778239e705082fe97bb4990e0d24c50924c04", "rev": "f560ccec6b1116b22e6ed15f4c510997d99d5852",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-25.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1765674936,
"narHash": "sha256-k00uTP4JNfmejrCLJOwdObYC9jHRrr/5M/a/8L2EIdo=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "2075416fcb47225d9b68ac469a5c4801a9c4dd85",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1761236834,
"narHash": "sha256-+pthv6hrL5VLW2UqPdISGuLiUZ6SnAXdd2DdUE+fV2Q=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d5faa84122bc0a1fd5d378492efce4e289f8eac1",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -172,13 +227,29 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1762482733, "lastModified": 1761236834,
"narHash": "sha256-g/da4FzvckvbiZT075Sb1/YDNDr+tGQgh4N8i5ceYMg=", "narHash": "sha256-+pthv6hrL5VLW2UqPdISGuLiUZ6SnAXdd2DdUE+fV2Q=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d5faa84122bc0a1fd5d378492efce4e289f8eac1",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1766870016,
"narHash": "sha256-fHmxAesa6XNqnIkcS6+nIHuEmgd/iZSP/VXxweiEuQw=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e1ebeec86b771e9d387dd02d82ffdc77ac753abc", "rev": "5c2bc52fb9f8c264ed6c93bd20afa2ff5e763dce",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -198,11 +269,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1762274591, "lastModified": 1763909441,
"narHash": "sha256-Vbhluvk15qwiyNDyPd9tjJh9gxIfUjbKVT79c05Pd3I=", "narHash": "sha256-56LwV51TX/FhgX+5LCG6akQ5KrOWuKgcJa+eUsRMxsc=",
"owner": "nix-community", "owner": "nix-community",
"repo": "plasma-manager", "repo": "plasma-manager",
"rev": "6296d7100cc84b2ff732b7c103a50c2856974cf6", "rev": "b24ed4b272256dfc1cc2291f89a9821d5f9e14b4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -217,11 +288,26 @@
"mac-app-util": "mac-app-util", "mac-app-util": "mac-app-util",
"nix-darwin": "nix-darwin", "nix-darwin": "nix-darwin",
"nixgl": "nixgl", "nixgl": "nixgl",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_4",
"plasma-manager": "plasma-manager" "plasma-manager": "plasma-manager"
} }
}, },
"systems": { "systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": { "locked": {
"lastModified": 1689347925, "lastModified": 1689347925,
"narHash": "sha256-ozenz5bFe1UUqOn7f60HRmgc01BgTGIKZ4Xl+HbocGQ=", "narHash": "sha256-ozenz5bFe1UUqOn7f60HRmgc01BgTGIKZ4Xl+HbocGQ=",
@@ -236,7 +322,7 @@
"type": "github" "type": "github"
} }
}, },
"systems_2": { "systems_3": {
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
@@ -253,14 +339,32 @@
}, },
"treefmt-nix": { "treefmt-nix": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs_2"
}, },
"locked": { "locked": {
"lastModified": 1755934250, "lastModified": 1766000401,
"narHash": "sha256-CsDojnMgYsfshQw3t4zjRUkmMmUdZGthl16bXVWgRYU=", "narHash": "sha256-+cqN4PJz9y0JQXfAK5J1drd0U05D5fcAGhzhfVrDlsI=",
"owner": "numtide", "owner": "numtide",
"repo": "treefmt-nix", "repo": "treefmt-nix",
"rev": "74e1a52d5bd9430312f8d1b8b0354c92c17453e5", "rev": "42d96e75aa56a3f70cab7e7dc4a32868db28e8fd",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"treefmt-nix_2": {
"inputs": {
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1766000401,
"narHash": "sha256-+cqN4PJz9y0JQXfAK5J1drd0U05D5fcAGhzhfVrDlsI=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "42d96e75aa56a3f70cab7e7dc4a32868db28e8fd",
"type": "github" "type": "github"
}, },
"original": { "original": {
+17 -2
View File
@@ -52,7 +52,8 @@
function ( function (
import nixpkgs { import nixpkgs {
inherit system; inherit system;
config.allowUnfreePredicate = (pkg: builtins.elem (nixpkgs.lib.getName pkg) [ "nvidia" ]); config.allowUnfreePredicate = (pkg: builtins.elem (nixpkgs.lib.getName pkg) [ "nvidia" "claude-code" ]);
config.allowUnfree = true;
} }
) )
); );
@@ -106,7 +107,21 @@
( (
{ ... }: { ... }:
{ {
nixpkgs.overlays = [ overlay ]; nixpkgs.overlays = [
overlay
(
self: super:
let
nixpkgsWithFree = import nixpkgs {
system = "aarch64-darwin";
config.allowUnfree = true;
};
in
{
claude-code = nixpkgsWithFree.claude-code;
}
)
];
} }
) )
mac-app-util.darwinModules.default mac-app-util.darwinModules.default
+6
View File
@@ -46,6 +46,7 @@ in
"application/xhtml+xml" = "userapp-Firefox-5T0SK2.desktop"; "application/xhtml+xml" = "userapp-Firefox-5T0SK2.desktop";
"application/x-extension-xhtml" = "userapp-Firefox-5T0SK2.desktop"; "application/x-extension-xhtml" = "userapp-Firefox-5T0SK2.desktop";
"application/x-extension-xht" = "userapp-Firefox-5T0SK2.desktop"; "application/x-extension-xht" = "userapp-Firefox-5T0SK2.desktop";
"x-scheme-handler/lmstudio" = "LM Studio.desktop";
}; };
enable = true; enable = true;
}; };
@@ -65,6 +66,8 @@ in
home.packages = with pkgs; [ home.packages = with pkgs; [
android-tools android-tools
direnv
nix-direnv
kdePackages.kdeconnect-kde kdePackages.kdeconnect-kde
# TODO: Move from system to nix # TODO: Move from system to nix
# awscli2 # awscli2
@@ -78,6 +81,7 @@ in
text = '' text = ''
default-cache-ttl 34560000 default-cache-ttl 34560000
max-cache-ttl 34560000 max-cache-ttl 34560000
allow-loopback-pinentry
pinentry-program ${pkgs.pinentry-curses}/bin/pinentry pinentry-program ${pkgs.pinentry-curses}/bin/pinentry
''; '';
}; };
@@ -152,6 +156,7 @@ in
enable = true; enable = true;
settings = { settings = {
use-agent = true; use-agent = true;
pinentry-mode = "loopback";
}; };
mutableKeys = false; mutableKeys = false;
publicKeys = [ ]; publicKeys = [ ];
@@ -302,6 +307,7 @@ in
vysokyujezd = "${homedir}/storage/.life/stavby/vysoky-ujezd"; vysokyujezd = "${homedir}/storage/.life/stavby/vysoky-ujezd";
work = "/mnt/yosuke/share/arnie/work"; work = "/mnt/yosuke/share/arnie/work";
smarthome = "/mnt/yosuke/share/arnie/smarthome"; smarthome = "/mnt/yosuke/share/arnie/smarthome";
lab = "/mnt/storage/.lab";
# Hardware # Hardware
v2-red = "${homedir}/storage/.hardware/3d-print/v2-red-V2-2201270017"; v2-red = "${homedir}/storage/.hardware/3d-print/v2-red-V2-2201270017";
+2 -1
View File
@@ -15,8 +15,9 @@
awscli2 awscli2
kubectl kubectl
nixd nixd
yq tree
viu viu
yq
]; ];
# Let Home Manager install and manage itself. # Let Home Manager install and manage itself.
+3 -1
View File
@@ -29,7 +29,9 @@
echo "Commands:" echo "Commands:"
echo -n '${ echo -n '${
builtins.toJSON ( builtins.toJSON (
builtins.mapAttrs (s: value: value.description) self.devShells.${pkgs.stdenv.hostPlatform.system}.default.config.scripts builtins.mapAttrs (
s: value: value.description
) self.devShells.${pkgs.stdenv.hostPlatform.system}.default.config.scripts
) )
}' | \ }' | \
${pkgs.jq}/bin/jq -r 'to_entries | map(" \(.key)\n" + " - \(if .value == "" then "no description provided" else .value end)") | "" + .[]' ${pkgs.jq}/bin/jq -r 'to_entries | map(" \(.key)\n" + " - \(if .value == "" then "no description provided" else .value end)") | "" + .[]'
@@ -12,31 +12,27 @@ return (function()
license = "MIT"; license = "MIT";
} }
-- DELL S2722DGM: 0F6BDB5B-840D-40BE-AAC9-B467A78E057A -- DELL S2722DGM: 394ACDEE-CA25-43C4-A533-D4EDF4A897AF
-- DELL S2721DGF: D3142823-261D-46EF-B9C2-5181C7FE2CA5 -- DELL S2721DGF: D3142823-261D-46EF-B9C2-5181C7FE2CA5
-- AV Receiver: B5A65BB6-E73E-4C3D-977C-33C86798AA5A -- AV Receiver: B5845603-D54C-44B8-9B55-96F7E5F50646
local appScreenMap = { local appScreenMap = {
Slack = { Slack = {
desktop = 1, desktop = 1,
screen = "0F6BDB5B-840D-40BE-AAC9-B467A78E057A", screen = "394ACDEE-CA25-43C4-A533-D4EDF4A897AF",
fullscreen = true, fullscreen = true,
}, },
Cursor = { Code = {
desktop = 1, desktop = 1,
screen = "B5A65BB6-E73E-4C3D-977C-33C86798AA5A", screen = "D3142823-261D-46EF-B9C2-5181C7FE2CA5",
fullscreen = true, fullscreen = true,
}, },
Notes = {
desktop = 2,
screen = "B5A65BB6-E73E-4C3D-977C-33C86798AA5A"
},
Spotify = { Spotify = {
desktop = 3, desktop = 2,
screen = "B5A65BB6-E73E-4C3D-977C-33C86798AA5A", screen = "D3142823-261D-46EF-B9C2-5181C7FE2CA5",
fullscreen = true, fullscreen = true,
}, },
["zoom.us"] = { ["zoom.us"] = {
screen = "B5A65BB6-E73E-4C3D-977C-33C86798AA5A", screen = "D3142823-261D-46EF-B9C2-5181C7FE2CA5",
fullscreen = true, fullscreen = true,
}, },
["Microsoft Outlook"] = { ["Microsoft Outlook"] = {
+4 -4
View File
@@ -35,7 +35,7 @@ windowMove = function()
hs.hotkey.bind({ "ctrl", "alt", "cmd" }, "pad1", function() hs.hotkey.bind({ "ctrl", "alt", "cmd" }, "pad1", function()
-- DELL S2722DGM -- DELL S2722DGM
local scr = getScreenById("0F6BDB5B-840D-40BE-AAC9-B467A78E057A") local scr = getScreenById("394ACDEE-CA25-43C4-A533-D4EDF4A897AF")
if scr == nil then if scr == nil then
return return
end end
@@ -63,7 +63,7 @@ windowMove = function()
hs.hotkey.bind({ "ctrl", "alt", "cmd" }, "pad3", function() hs.hotkey.bind({ "ctrl", "alt", "cmd" }, "pad3", function()
-- AV Receiver -- AV Receiver
local scr = getScreenById("B5A65BB6-E73E-4C3D-977C-33C86798AA5A") local scr = getScreenById("B5845603-D54C-44B8-9B55-96F7E5F50646")
if scr == nil then if scr == nil then
return return
end end
@@ -79,7 +79,7 @@ windowMove = function()
hs.hotkey.bind({ "ctrl", "alt", "cmd", "shift" }, "pad1", function() hs.hotkey.bind({ "ctrl", "alt", "cmd", "shift" }, "pad1", function()
-- DELL S2722DGM -- DELL S2722DGM
local scr = getScreenById("0F6BDB5B-840D-40BE-AAC9-B467A78E057A") local scr = getScreenById("394ACDEE-CA25-43C4-A533-D4EDF4A897AF")
if scr == nil then if scr == nil then
return return
end end
@@ -109,7 +109,7 @@ windowMove = function()
hs.hotkey.bind({ "ctrl", "alt", "cmd", "shift" }, "pad3", function() hs.hotkey.bind({ "ctrl", "alt", "cmd", "shift" }, "pad3", function()
-- AV Receiver -- AV Receiver
local scr = getScreenById("B5A65BB6-E73E-4C3D-977C-33C86798AA5A") local scr = getScreenById("B5845603-D54C-44B8-9B55-96F7E5F50646")
if scr == nil then if scr == nil then
return return
end end
+17 -7
View File
@@ -32,11 +32,13 @@ in
home.stateVersion = "24.11"; home.stateVersion = "24.11";
home.packages = with pkgs; [ home.packages = with pkgs; [
hammerspoon claude-code
pstree
watch
colima colima
docker docker
hammerspoon
pstree
ssm-session-manager-plugin
watch
wireshark-qt wireshark-qt
]; ];
@@ -69,6 +71,9 @@ in
User becky User becky
Hostname 10.196.196.5 Hostname 10.196.196.5
IdentityFile ~/.ssh/id_ed25519_access IdentityFile ~/.ssh/id_ed25519_access
host gitlab.veracode-staging.us
IdentityFile ~/.ssh/id_rsa_fedramp
''; '';
}; };
@@ -96,8 +101,6 @@ in
programs.git = { programs.git = {
enable = true; enable = true;
userName = gitUsername;
userEmail = gitEmail;
ignores = [ ignores = [
".vscode" ".vscode"
@@ -111,7 +114,10 @@ in
key = "5ABD6C5E"; key = "5ABD6C5E";
}; };
extraConfig = { settings = {
user.name = gitUsername;
user.email = gitEmail;
core = { core = {
autocrlf = "input"; autocrlf = "input";
editor = "vim"; editor = "vim";
@@ -178,6 +184,7 @@ in
shellAliases = { shellAliases = {
hammerspoon-config = "open -a ${pkgs.hammerspoon}/Applications/Hammerspoon.app/Contents/MacOS/Hammerspoon"; hammerspoon-config = "open -a ${pkgs.hammerspoon}/Applications/Hammerspoon.app/Contents/MacOS/Hammerspoon";
get-key = "${pkgs.writeShellScript "get-key" '' get-key = "${pkgs.writeShellScript "get-key" ''
set -e
scp dingleberry:/self/hintihint/keys/sum.key ${homedir}/hw.key scp dingleberry:/self/hintihint/keys/sum.key ${homedir}/hw.key
read -p "waiting for confirmation to delete the key" read -p "waiting for confirmation to delete the key"
rm ${homedir}/hw.key rm ${homedir}/hw.key
@@ -192,12 +199,15 @@ in
fi fi
fi fi
if [[ $(dig +short myip.opendns.com @resolver1.opendns.com) == "185.142.210.84" ]]; then if [[ "$(ipconfig getifaddr en0)" =~ "10.125.24" ]]; then
sudo wg-quick up /etc/wireguard/home.conf sudo wg-quick up /etc/wireguard/home.conf
else else
sudo wg-quick up /etc/wireguard/home-remote.conf sudo wg-quick up /etc/wireguard/home-remote.conf
fi fi
''}"; ''}";
ssm = "${pkgs.writeShellScript "ssm" ''
aws --profile $1 --region ''${3:-us-east-1} ssm start-session --target $2
''}";
}; };
initContent = '' initContent = ''
+112 -113
View File
@@ -21,145 +21,144 @@ in
size = 10000; size = 10000;
}; };
shellAliases = shellAliases = {
{ # use eval $(aws-export-credentials) to expose them to environment
# use eval $(aws-export-credentials) to expose them to environment aws-export-credentials = lib.mkDefault "${pkgs.awscli2}/bin/aws configure export-credentials --format env --profile";
aws-export-credentials = lib.mkDefault "${pkgs.awscli2}/bin/aws configure export-credentials --format env --profile";
aws-export-assume-role = lib.mkDefault "${pkgs.writeShellScript "aws-export-assume-role" '' aws-export-assume-role = lib.mkDefault "${pkgs.writeShellScript "aws-export-assume-role" ''
[[ -z "$1" || -z "$2" ]] && echo "Usage: aws-export-assume-role <profile> <role-arn>" && exit 1 [[ -z "$1" || -z "$2" ]] && echo "Usage: aws-export-assume-role <profile> <role-arn>" && exit 1
${pkgs.coreutils}/bin/printf 'export AWS_ACCESS_KEY_ID=%s\nexport AWS_SECRET_ACCESS_KEY=%s\nexport AWS_SESSION_TOKEN=%s' $(${pkgs.awscli2}/bin/aws --profile "$1" sts assume-role --role-arn "$2" --role-session-name lcech --query "Credentials.[AccessKeyId,SecretAccessKey,SessionToken]" --output text) ${pkgs.coreutils}/bin/printf 'export AWS_ACCESS_KEY_ID=%s\nexport AWS_SECRET_ACCESS_KEY=%s\nexport AWS_SESSION_TOKEN=%s' $(${pkgs.awscli2}/bin/aws --profile "$1" sts assume-role --role-arn "$2" --role-session-name lcech --query "Credentials.[AccessKeyId,SecretAccessKey,SessionToken]" --output text)
''}"; ''}";
# https://docs.aws.amazon.com/singlesignon/latest/userguide/createshortcutlink.html # https://docs.aws.amazon.com/singlesignon/latest/userguide/createshortcutlink.html
aws-sharable-url = lib.mkDefault "${pkgs.writeShellScript "aws-sharable-url" '' aws-sharable-url = lib.mkDefault "${pkgs.writeShellScript "aws-sharable-url" ''
set -e set -e
URL=$1 URL=$1
[[ -z "$URL" ]] && read -p "Enter URL: " URL [[ -z "$URL" ]] && read -p "Enter URL: " URL
# Strip schema # Strip schema
URL="''${URL#https://}" URL="''${URL#https://}"
# Parse Account ID from multi-session URL # Parse Account ID from multi-session URL
ACCOUNT_ID="''${URL%%-*}" ACCOUNT_ID="''${URL%%-*}"
# Strip account ID and hash up to the region part # Strip account ID and hash up to the region part
URL="''${URL#*\.}" URL="''${URL#*\.}"
PROFILE=$(${pkgs.gnugrep}/bin/grep "sso_account_id = $ACCOUNT_ID" ~/.aws/config -B 5 | ${pkgs.gnugrep}/bin/grep "\[profile" | ${pkgs.coreutils}/bin/tail -n 1 | ${pkgs.coreutils}/bin/tr -d '[]') PROFILE=$(${pkgs.gnugrep}/bin/grep "sso_account_id = $ACCOUNT_ID" ~/.aws/config -B 5 | ${pkgs.gnugrep}/bin/grep "\[profile" | ${pkgs.coreutils}/bin/tail -n 1 | ${pkgs.coreutils}/bin/tr -d '[]')
PROFILE="''${PROFILE#profile }" PROFILE="''${PROFILE#profile }"
ROLE_NAME=$(${pkgs.awscli2}/bin/aws configure get profile.$PROFILE.sso_role_name) ROLE_NAME=$(${pkgs.awscli2}/bin/aws configure get profile.$PROFILE.sso_role_name)
SSO_SESSION=$(${pkgs.awscli2}/bin/aws configure get profile.$PROFILE.sso_session) SSO_SESSION=$(${pkgs.awscli2}/bin/aws configure get profile.$PROFILE.sso_session)
SSO_URL=$(${pkgs.gnugrep}/bin/grep "\[sso-session $SSO_SESSION" ~/.aws/config -A5 | ${pkgs.gnugrep}/bin/grep sso_start_url | ${pkgs.coreutils}/bin/head -n 1) SSO_URL=$(${pkgs.gnugrep}/bin/grep "\[sso-session $SSO_SESSION" ~/.aws/config -A5 | ${pkgs.gnugrep}/bin/grep sso_start_url | ${pkgs.coreutils}/bin/head -n 1)
SSO_URL="''${SSO_URL#sso_start_url = }" SSO_URL="''${SSO_URL#sso_start_url = }"
# Strip trailing slash from SSO_URL if present # Strip trailing slash from SSO_URL if present
SSO_URL="''${SSO_URL%/}" SSO_URL="''${SSO_URL%/}"
SHARABLE_URL="$SSO_URL/#/console?account_id=$ACCOUNT_ID&role_name=$ROLE_NAME&destination=$(${pkgs.urlencode}/bin/urlencode "https://$URL")" SHARABLE_URL="$SSO_URL/#/console?account_id=$ACCOUNT_ID&role_name=$ROLE_NAME&destination=$(${pkgs.urlencode}/bin/urlencode "https://$URL")"
${ ${
if isDarwin then if isDarwin then
'' ''
echo -n "$SHARABLE_URL" | pbcopy echo -n "$SHARABLE_URL" | pbcopy
'' ''
else else
'' ''
echo -n "$SHARABLE_URL" | ${pkgs.xclip}/bin/xclip -selection clipboard echo -n "$SHARABLE_URL" | ${pkgs.xclip}/bin/xclip -selection clipboard
'' ''
} }
echo "URL copied to clipboard" echo "URL copied to clipboard"
''}"; ''}";
aws-s3-cp-public = lib.mkDefault '' aws-s3-cp-public = lib.mkDefault ''
${pkgs.awscli2}/bin/aws s3 cp --acl "public-read" --expires "$(${pkgs.coreutils}/bin/date '+%a, %d %b %Y 00:00:00 GMT' -d "$(${pkgs.coreutils}/bin/date +%Y-%m-%d) + 365 day")" --cache-control "max-age=31536000" --metadata-directive REPLACE ${pkgs.awscli2}/bin/aws s3 cp --acl "public-read" --expires "$(${pkgs.coreutils}/bin/date '+%a, %d %b %Y 00:00:00 GMT' -d "$(${pkgs.coreutils}/bin/date +%Y-%m-%d) + 365 day")" --cache-control "max-age=31536000" --metadata-directive REPLACE
''; '';
bcrypt = lib.mkDefault "${pkgs.writeShellScript "bcrypt" '' bcrypt = lib.mkDefault "${pkgs.writeShellScript "bcrypt" ''
if [[ -z "$1" ]]; then if [[ -z "$1" ]]; then
echo "Usage: bcrypt <password> [cost]" echo "Usage: bcrypt <password> [cost]"
exit 1 exit 1
fi fi
echo -n "$1" | ${pkgs.apacheHttpd}/bin/htpasswd -i -nB -C ''${2:-12} "" | tr -d ':' echo -n "$1" | ${pkgs.apacheHttpd}/bin/htpasswd -i -nB -C ''${2:-12} "" | tr -d ':'
''}"; ''}";
cat = lib.mkDefault "${pkgs.bat}/bin/bat --paging=never"; cat = lib.mkDefault "${pkgs.bat}/bin/bat --paging=never";
# use curl-aws --aws-sigv4 "aws:amz:region:service" # use curl-aws --aws-sigv4 "aws:amz:region:service"
curl-aws = lib.mkDefault "${pkgs.curl}/bin/curl -H \"X-Amz-Security-Token: $AWS_SESSION_TOKEN\" --user \"$AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY\""; curl-aws = lib.mkDefault "${pkgs.curl}/bin/curl -H \"X-Amz-Security-Token: $AWS_SESSION_TOKEN\" --user \"$AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY\"";
curl-timing = lib.mkDefault "${pkgs.curl}/bin/curl -w \" time_namelookup: %{time_namelookup}s\n time_connect: %{time_connect}s\n time_appconnect: %{time_appconnect}s\n time_pretransfer: %{time_pretransfer}s\n time_redirect: %{time_redirect}s\n time_starttransfer: %{time_starttransfer}s\n ----------\n time_total: %{time_total}s\n\" -o /dev/null"; curl-timing = lib.mkDefault "${pkgs.curl}/bin/curl -w \" time_namelookup: %{time_namelookup}s\n time_connect: %{time_connect}s\n time_appconnect: %{time_appconnect}s\n time_pretransfer: %{time_pretransfer}s\n time_redirect: %{time_redirect}s\n time_starttransfer: %{time_starttransfer}s\n ----------\n time_total: %{time_total}s\n\" -o /dev/null";
dbase64 = lib.mkDefault "${pkgs.writeShellScript "dbase64" "echo -n \"$1\" | base64 -d"}"; dbase64 = lib.mkDefault "${pkgs.writeShellScript "dbase64" "echo -n \"$1\" | base64 -d"}";
git-sync-remote = lib.mkDefault "git remote update origin --prune"; git-sync-remote = lib.mkDefault "git remote update origin --prune";
cleanup-kube-config = "${ cleanup-kube-config = "${
pkgs.writeShellApplication { pkgs.writeShellApplication {
name = "app"; name = "app";
text = ./zsh/aliases/cleanup-kube-config.sh; text = ./zsh/aliases/cleanup-kube-config.sh;
runtimeInputs = [ runtimeInputs = [
pkgs.gnugrep pkgs.gnugrep
pkgs.coreutils pkgs.coreutils
]; ];
} }
}/bin/app"; }/bin/app";
klogs = lib.mkDefault "${pkgs.writeShellScript "klogs" '' klogs = lib.mkDefault "${pkgs.writeShellScript "klogs" ''
ctx="$1" ctx="$1"
shift shift
namespace="$1" namespace="$1"
shift shift
label="$1" label="$1"
shift shift
if [[ "$ctx" == "" || "$namespace" == "" || "$label" == "" ]]; then if [[ "$ctx" == "" || "$namespace" == "" || "$label" == "" ]]; then
echo "Usage: klogs context namespace label" echo "Usage: klogs context namespace label"
echo "${"\n"}Contexts:" echo "${"\n"}Contexts:"
kubectl config get-contexts -o name | sed 's/^/\t/g' kubectl config get-contexts -o name | sed 's/^/\t/g'
echo "Label examples:" echo "Label examples:"
echo "${"\t"}app.kubernetes.io/name=..." echo "${"\t"}app.kubernetes.io/name=..."
echo "${"\t"}eks.amazonaws.com/component=..." echo "${"\t"}eks.amazonaws.com/component=..."
exit 1 exit 1
fi fi
kubectl --context "$ctx" logs -f -n "$namespace" -l "$label" $@ kubectl --context "$ctx" logs -f -n "$namespace" -l "$label" $@
''}"; ''}";
nixfix = lib.mkDefault "nix fmt ./**/*.nix"; nixfix = lib.mkDefault "nix fmt ./**/*.nix";
# Git # Git
a = "git add"; a = "git add";
c = "git commit -m"; c = "git commit -m";
d = "git diff"; d = "git diff";
d-s = "git diff --staged"; d-s = "git diff --staged";
gtag = "${pkgs.writeShellScript "gtag" "git tag -a $1 -m '$2'"}"; gtag = "${pkgs.writeShellScript "gtag" "git tag -a $1 -m '$2'"}";
gtag-replace = "${pkgs.writeShellScript "gtag" '' gtag-replace = "${pkgs.writeShellScript "gtag" ''
msg=$(git tag -l -n9 $1 | sed "s/$1\s\+//g") msg=$(git tag -l -n9 $1 | sed "s/$1\s\+//g")
git tag -d $1 && \ git tag -d $1 && \
git push origin :refs/tags/$1 && \ git push origin :refs/tags/$1 && \
git tag -a $1 -m "$msg" && \ git tag -a $1 -m "$msg" && \
git push origin $1 git push origin $1
''}"; ''}";
gtagl = "git fetch --tags && git tag -l -n9 --sort=-v:refname"; gtagl = "git fetch --tags && git tag -l -n9 --sort=-v:refname";
s = "git status"; s = "git status";
} }
// ( // (
if isDarwin then if isDarwin then
{ {
hm-switch = lib.mkDefault "sudo darwin-rebuild switch --flake ~/.config/nix"; hm-switch = lib.mkDefault "sudo darwin-rebuild switch --flake ~/.config/nix";
} }
else if isLinux then else if isLinux then
{ {
hm-switch = lib.mkDefault "home-manager switch --impure --flake ~/.config/nix"; hm-switch = lib.mkDefault "home-manager switch --impure --flake ~/.config/nix";
} }
else else
{ } { }
); );
initContent = lib.mkBefore '' initContent = lib.mkBefore ''
for file in ${./zsh}/*.zsh; do for file in ${./zsh}/*.zsh; do
+1 -1
View File
@@ -1,4 +1,4 @@
theme = "catppuccin-mocha" theme = "Catppuccin Mocha"
window-width = 9999 window-width = 9999
window-height = 9999 window-height = 9999