fix some hyprland stuff
This commit is contained in:
26
systems/aarch64-darwin/macbook-pro/default.nix
Executable file
26
systems/aarch64-darwin/macbook-pro/default.nix
Executable file
@@ -0,0 +1,26 @@
|
||||
{ config, inputs, pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
./nix.nix
|
||||
./homebrew.nix
|
||||
./programs.nix
|
||||
./system.nix
|
||||
];
|
||||
|
||||
# List packages installed in system profile. To search by name, run:
|
||||
# $ nix-env -qaP | grep wget
|
||||
environment = {
|
||||
systemPackages = with pkgs; [
|
||||
asitop
|
||||
mas
|
||||
nh
|
||||
];
|
||||
};
|
||||
|
||||
security.pam.services.sudo_local.touchIdAuth = true;
|
||||
|
||||
users.users.mattjallen = {
|
||||
name = "mattjallen";
|
||||
home = "/Users/mattjallen";
|
||||
};
|
||||
}
|
||||
66
systems/aarch64-darwin/macbook-pro/homebrew.nix
Normal file
66
systems/aarch64-darwin/macbook-pro/homebrew.nix
Normal file
@@ -0,0 +1,66 @@
|
||||
{ config, inputs, ... }:
|
||||
{
|
||||
nix-homebrew = {
|
||||
user = config.system.primaryUser;
|
||||
enable = true;
|
||||
autoMigrate = true;
|
||||
enableRosetta = true;
|
||||
mutableTaps = false;
|
||||
taps = {
|
||||
"homebrew/homebrew-core" = inputs.homebrew-core;
|
||||
"homebrew/homebrew-cask" = inputs.homebrew-cask;
|
||||
};
|
||||
};
|
||||
|
||||
# Homebrew
|
||||
homebrew = {
|
||||
enable = true;
|
||||
taps = builtins.attrNames config.nix-homebrew.taps;
|
||||
global = {
|
||||
autoUpdate = false;
|
||||
brewfile = true;
|
||||
};
|
||||
onActivation = {
|
||||
autoUpdate = false;
|
||||
cleanup = "zap";
|
||||
};
|
||||
casks = [
|
||||
"aldente"
|
||||
"bartender"
|
||||
"betterdisplay"
|
||||
"chromium"
|
||||
"discord"
|
||||
"epic-games"
|
||||
"gstreamer-runtime"
|
||||
"iterm2"
|
||||
"kitty"
|
||||
"minecraft"
|
||||
"omnissa-horizon-client"
|
||||
"onlyoffice"
|
||||
"orcaslicer"
|
||||
"proton-drive"
|
||||
"proton-pass"
|
||||
"protonvpn"
|
||||
"scroll-reverser"
|
||||
"steam"
|
||||
"tabby"
|
||||
"tg-pro"
|
||||
"utm"
|
||||
"vesktop"
|
||||
"vlc"
|
||||
"vscodium"
|
||||
"wine-stable"
|
||||
# "xpipe"
|
||||
"xquartz"
|
||||
];
|
||||
masApps = {
|
||||
Amphetamine = 937984704;
|
||||
Infuse = 1136220934;
|
||||
"Proton Pass for Safari" = 6502835663;
|
||||
Tailscale = 1475387142;
|
||||
Termius = 1176074088;
|
||||
};
|
||||
};
|
||||
|
||||
# homebrew.global.autoUpdate = true;
|
||||
}
|
||||
17
systems/aarch64-darwin/macbook-pro/nix.nix
Normal file
17
systems/aarch64-darwin/macbook-pro/nix.nix
Normal file
@@ -0,0 +1,17 @@
|
||||
{ ... }:
|
||||
{
|
||||
# Auto upgrade nix package and the daemon service.
|
||||
# services.nix-daemon.enable = true;
|
||||
# nix.package = pkgs.nix;
|
||||
|
||||
# Necessary for using flakes on this system.
|
||||
nix = {
|
||||
settings.experimental-features = "nix-command flakes";
|
||||
};
|
||||
|
||||
# The platform the configuration will be used on.
|
||||
nixpkgs = {
|
||||
config.allowUnfree = true;
|
||||
hostPlatform = "aarch64-darwin";
|
||||
};
|
||||
}
|
||||
24
systems/aarch64-darwin/macbook-pro/programs.nix
Normal file
24
systems/aarch64-darwin/macbook-pro/programs.nix
Normal file
@@ -0,0 +1,24 @@
|
||||
{ ... }:
|
||||
{
|
||||
programs = {
|
||||
direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
|
||||
nix-index = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
ssh.knownHosts = {
|
||||
desktop = {
|
||||
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPTBMydhOc6SnOdB5WrEd7X07DrboAtagCUgXiOJjLov matt@matt-nixos";
|
||||
};
|
||||
nas = {
|
||||
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIwoHWOLSTGVif9hAhaMLl0qDA4roIzCNuyR6kyIXDOj admin@jallen-nas";
|
||||
};
|
||||
};
|
||||
|
||||
zsh.enable = true; # default shell on catalina
|
||||
};
|
||||
}
|
||||
50
systems/aarch64-darwin/macbook-pro/system.nix
Normal file
50
systems/aarch64-darwin/macbook-pro/system.nix
Normal file
@@ -0,0 +1,50 @@
|
||||
{ config, ... }:
|
||||
{
|
||||
system = {
|
||||
primaryUser = config.users.users.mattjallen.name;
|
||||
defaults = {
|
||||
controlcenter = {
|
||||
AirDrop = true;
|
||||
BatteryShowPercentage = true;
|
||||
Bluetooth = true;
|
||||
Display = true;
|
||||
FocusModes = true;
|
||||
NowPlaying = true;
|
||||
};
|
||||
dock = {
|
||||
minimize-to-application = true;
|
||||
mouse-over-hilite-stack = true;
|
||||
show-recents = false;
|
||||
};
|
||||
finder = {
|
||||
AppleShowAllExtensions = true;
|
||||
AppleShowAllFiles = true;
|
||||
_FXSortFoldersFirst = true;
|
||||
_FXSortFoldersFirstOnDesktop = true;
|
||||
FXEnableExtensionChangeWarning = false;
|
||||
ShowPathbar = true; # breadcrumb nav at bottom
|
||||
ShowStatusBar = true; # file count & disk space
|
||||
};
|
||||
loginwindow = {
|
||||
GuestEnabled = false;
|
||||
};
|
||||
NSGlobalDomain = {
|
||||
"com.apple.keyboard.fnState" = false;
|
||||
AppleInterfaceStyle = "Dark";
|
||||
"com.apple.mouse.tapBehavior" = 1;
|
||||
AppleShowAllExtensions = true;
|
||||
AppleShowAllFiles = true;
|
||||
};
|
||||
trackpad = {
|
||||
Clicking = true;
|
||||
};
|
||||
WindowManager = {
|
||||
EnableTiledWindowMargins = false;
|
||||
};
|
||||
};
|
||||
startup.chime = false;
|
||||
# Used for backwards compatibility, please read the changelog before changing.
|
||||
# $ darwin-rebuild changelog
|
||||
stateVersion = 5;
|
||||
};
|
||||
}
|
||||
25
systems/aarch64-darwin/macbook-pro/trampoline-apps/default.nix
Executable file
25
systems/aarch64-darwin/macbook-pro/trampoline-apps/default.nix
Executable file
@@ -0,0 +1,25 @@
|
||||
# Hook home-manager to make a trampoline for each app we install
|
||||
# from: https://github.com/nix-community/home-manager/issues/1341#issuecomment-1870352014
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
config = mkIf pkgs.stdenv.hostPlatform.isDarwin {
|
||||
# Install MacOS applications to the user Applications folder. Also update Docked applications
|
||||
home.extraActivationPath = with pkgs; [
|
||||
rsync
|
||||
dockutil
|
||||
gawk
|
||||
];
|
||||
home.activation.trampolineApps = hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
${builtins.readFile ./lib-bash/trampoline-apps.sh}
|
||||
fromDir="$HOME/Applications/Home Manager Apps"
|
||||
toDir="$HOME/Applications/Home Manager Trampolines"
|
||||
sync_trampolines "$fromDir" "$toDir"
|
||||
'';
|
||||
};
|
||||
}
|
||||
131
systems/aarch64-darwin/macbook-pro/trampoline-apps/lib-bash/trampoline-apps.sh
Executable file
131
systems/aarch64-darwin/macbook-pro/trampoline-apps/lib-bash/trampoline-apps.sh
Executable file
@@ -0,0 +1,131 @@
|
||||
# Utilities not in nixpkgs.
|
||||
plutil="/usr/bin/plutil"
|
||||
killall="/usr/bin/killall"
|
||||
osacompile="/usr/bin/osacompile"
|
||||
|
||||
copyable_app_props=(
|
||||
"CFBundleDevelopmentRegion"
|
||||
"CFBundleDocumentTypes"
|
||||
"CFBundleGetInfoString"
|
||||
"CFBundleIconFile"
|
||||
"CFBundleIdentifier"
|
||||
"CFBundleInfoDictionaryVersion"
|
||||
"CFBundleName"
|
||||
"CFBundleShortVersionString"
|
||||
"CFBundleURLTypes"
|
||||
"NSAppleEventsUsageDescription"
|
||||
"NSAppleScriptEnabled"
|
||||
"NSDesktopFolderUsageDescription"
|
||||
"NSDocumentsFolderUsageDescription"
|
||||
"NSDownloadsFolderUsageDescription"
|
||||
"NSPrincipalClass"
|
||||
"NSRemovableVolumesUsageDescription"
|
||||
"NSServices"
|
||||
"UTExportedTypeDeclarations"
|
||||
)
|
||||
|
||||
function sync_icons() {
|
||||
local from="$1"
|
||||
local to="$2"
|
||||
from_resources="$from/Contents/Resources/"
|
||||
to_resources="$to/Contents/Resources/"
|
||||
|
||||
find "$to_resources" -name "*.icns" -delete
|
||||
rsync --include "*.icns" --exclude "*" --recursive "$from_resources" "$to_resources"
|
||||
}
|
||||
|
||||
function copy_paths() {
|
||||
local from="$1"
|
||||
local to="$2"
|
||||
local paths=("${@:3}")
|
||||
|
||||
keys=$(jq -n '$ARGS.positional' --args "${paths[@]}")
|
||||
jqfilter="to_entries |[.[]| select(.key as \$item| \$keys | index(\$item) >= 0) ] | from_entries"
|
||||
|
||||
temp_dir=$(mktemp -d)
|
||||
trap 'rm -rf "$temp_dir"' EXIT
|
||||
|
||||
pushd $temp_dir >/dev/null
|
||||
|
||||
cp "$from" "orig"
|
||||
chmod u+w "orig"
|
||||
|
||||
cp "$to" "bare-wrapper"
|
||||
chmod u+w "bare-wrapper"
|
||||
|
||||
$plutil -convert json -- "orig"
|
||||
$plutil -convert json -- "bare-wrapper"
|
||||
jq --argjson keys "$keys" "$jqfilter" <"orig" >"filtered"
|
||||
cat "bare-wrapper" "filtered" | jq -s add >"final"
|
||||
$plutil -convert xml1 -- "final"
|
||||
|
||||
cp "final" "$to"
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
function sync_dock() {
|
||||
# Make sure all environment variables are cleared that might affect dockutil
|
||||
unset SUDO_USER
|
||||
|
||||
# Array of applications to sync
|
||||
declare -a apps=("$@")
|
||||
|
||||
# Iterate through each provided app
|
||||
for app_path in "${apps[@]}"; do
|
||||
if [ -d "$app_path" ]; then
|
||||
# Extract the name of the app from the path
|
||||
app_name=$(basename "$app_path")
|
||||
app_name=${app_name%.*} # Remove the '.app' extension
|
||||
resolved_path=$(realpath "$app_path")
|
||||
|
||||
# Find the current Dock item for the app, if it exists
|
||||
current_dock_item=$(dockutil --list --no-restart | grep "$app_name.app" | awk -F "\t" '{print $1}' || echo "")
|
||||
|
||||
if [ -n "$current_dock_item" ]; then
|
||||
# The app is currently in the Dock, attempt to replace it
|
||||
echo "Updating $app_name in Dock..."
|
||||
dockutil --add "$resolved_path" --replacing "$current_dock_item" --no-restart
|
||||
else
|
||||
# The app is not in the Dock; you might choose to add it or do nothing
|
||||
echo "$app_name is not currently in the Dock."
|
||||
fi
|
||||
else
|
||||
echo "Warning: Provided path $app_path is not valid."
|
||||
fi
|
||||
done
|
||||
|
||||
# Restart the Dock to apply changes
|
||||
$killall Dock
|
||||
}
|
||||
|
||||
function mktrampoline() {
|
||||
local app="$1"
|
||||
local trampoline="$2"
|
||||
|
||||
if [[ ! -d $app ]]; then
|
||||
echo "app path is not directory."
|
||||
return 1
|
||||
fi
|
||||
|
||||
cmd="do shell script \"open '$app'\""
|
||||
$osacompile -o "$trampoline" -e "$cmd"
|
||||
sync_icons "$app" "$trampoline"
|
||||
copy_paths "$(realpath "$app/Contents/Info.plist")" "$(realpath "$trampoline/Contents/Info.plist")" "${copyable_app_props[@]}"
|
||||
}
|
||||
|
||||
function sync_trampolines() {
|
||||
[[ ! -d "$1" ]] && echo "Source directory does not exist" && return 1
|
||||
|
||||
if [[ -d "$2" ]]; then
|
||||
rm -rf "$2"
|
||||
fi
|
||||
mkdir -p "$2"
|
||||
|
||||
apps=("$1"/*.app)
|
||||
|
||||
for app in "${apps[@]}"; do
|
||||
trampoline="$2/$(basename "$app")"
|
||||
mktrampoline "$app" "$trampoline"
|
||||
done
|
||||
sync_dock "${apps[@]}"
|
||||
}
|
||||
Reference in New Issue
Block a user