treewide: drop darwin
This commit is contained in:
parent
365c35cb8d
commit
d087e37f7c
23 changed files with 18 additions and 706 deletions
|
@ -1,4 +1,4 @@
|
|||
# nix{os,-darwin} config
|
||||
# nixos config
|
||||
|
||||
It just works™
|
||||
|
||||
|
@ -6,12 +6,9 @@ It just works™
|
|||
|
||||
```
|
||||
.
|
||||
│ # Darwin configuration is not actively maintained and sometimes it might
|
||||
│ # break.
|
||||
├── home # <-- See here for dotfiles!
|
||||
├── darwin
|
||||
├── nixos
|
||||
│ ├── modules
|
||||
│ ├── modules # nixos options
|
||||
│ └── profiles
|
||||
│
|
||||
│ # Internal packages, please see github:Guanran928/nur-packages instead
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
{...}: {
|
||||
imports = [
|
||||
./networking/proxy.nix
|
||||
./services/mihomo.nix
|
||||
];
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
# Copy & pasted https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/config/networking.nix
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.networking;
|
||||
opt = options.networking;
|
||||
in {
|
||||
options = {
|
||||
networking.proxy = {
|
||||
default = lib.mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = lib.mdDoc ''
|
||||
This option specifies the default value for httpProxy, httpsProxy, ftpProxy and rsyncProxy.
|
||||
'';
|
||||
example = "http://127.0.0.1:3128";
|
||||
};
|
||||
|
||||
httpProxy = lib.mkOption {
|
||||
type = types.nullOr types.str;
|
||||
inherit (cfg.proxy) default;
|
||||
defaultText = literalExpression "config.${opt.proxy.default}";
|
||||
description = lib.mdDoc ''
|
||||
This option specifies the http_proxy environment variable.
|
||||
'';
|
||||
example = "http://127.0.0.1:3128";
|
||||
};
|
||||
|
||||
httpsProxy = lib.mkOption {
|
||||
type = types.nullOr types.str;
|
||||
inherit (cfg.proxy) default;
|
||||
defaultText = literalExpression "config.${opt.proxy.default}";
|
||||
description = lib.mdDoc ''
|
||||
This option specifies the https_proxy environment variable.
|
||||
'';
|
||||
example = "http://127.0.0.1:3128";
|
||||
};
|
||||
|
||||
ftpProxy = lib.mkOption {
|
||||
type = types.nullOr types.str;
|
||||
inherit (cfg.proxy) default;
|
||||
defaultText = literalExpression "config.${opt.proxy.default}";
|
||||
description = lib.mdDoc ''
|
||||
This option specifies the ftp_proxy environment variable.
|
||||
'';
|
||||
example = "http://127.0.0.1:3128";
|
||||
};
|
||||
|
||||
rsyncProxy = lib.mkOption {
|
||||
type = types.nullOr types.str;
|
||||
inherit (cfg.proxy) default;
|
||||
defaultText = literalExpression "config.${opt.proxy.default}";
|
||||
description = lib.mdDoc ''
|
||||
This option specifies the rsync_proxy environment variable.
|
||||
'';
|
||||
example = "http://127.0.0.1:3128";
|
||||
};
|
||||
|
||||
allProxy = lib.mkOption {
|
||||
type = types.nullOr types.str;
|
||||
inherit (cfg.proxy) default;
|
||||
defaultText = literalExpression "config.${opt.proxy.default}";
|
||||
description = lib.mdDoc ''
|
||||
This option specifies the all_proxy environment variable.
|
||||
'';
|
||||
example = "http://127.0.0.1:3128";
|
||||
};
|
||||
|
||||
noProxy = lib.mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = lib.mdDoc ''
|
||||
This option specifies the no_proxy environment variable.
|
||||
If a default proxy is used and noProxy is null,
|
||||
then noProxy will be set to 127.0.0.1,localhost.
|
||||
'';
|
||||
example = "127.0.0.1,localhost,.localdomain";
|
||||
};
|
||||
|
||||
envVars = lib.mkOption {
|
||||
type = types.attrs;
|
||||
internal = true;
|
||||
default = {};
|
||||
description = lib.mdDoc ''
|
||||
Environment variables used for the network proxy.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
networking.proxy.envVars =
|
||||
optionalAttrs (cfg.proxy.default != null) {
|
||||
# other options already fallback to proxy.default
|
||||
no_proxy = "127.0.0.1,localhost";
|
||||
}
|
||||
// optionalAttrs (cfg.proxy.httpProxy != null) {
|
||||
http_proxy = cfg.proxy.httpProxy;
|
||||
}
|
||||
// optionalAttrs (cfg.proxy.httpsProxy != null) {
|
||||
https_proxy = cfg.proxy.httpsProxy;
|
||||
}
|
||||
// optionalAttrs (cfg.proxy.rsyncProxy != null) {
|
||||
rsync_proxy = cfg.proxy.rsyncProxy;
|
||||
}
|
||||
// optionalAttrs (cfg.proxy.ftpProxy != null) {
|
||||
ftp_proxy = cfg.proxy.ftpProxy;
|
||||
}
|
||||
// optionalAttrs (cfg.proxy.allProxy != null) {
|
||||
all_proxy = cfg.proxy.allProxy;
|
||||
}
|
||||
// optionalAttrs (cfg.proxy.noProxy != null) {
|
||||
no_proxy = cfg.proxy.noProxy;
|
||||
};
|
||||
|
||||
# Install the proxy environment variables
|
||||
environment.variables = cfg.proxy.envVars;
|
||||
launchd.daemons."nix-daemon".environment = cfg.proxy.envVars;
|
||||
|
||||
# Set macOS's system level proxy setting
|
||||
system.activationScripts."extraActivation".text = let
|
||||
inherit (cfg) knownNetworkServices;
|
||||
networksetup = /usr/sbin/networksetup;
|
||||
|
||||
# naive but works(tm)
|
||||
# "http://127.0.0.1:1234/" -> "127.0.0.1 1234"
|
||||
proxy = lib.replaceStrings ["http://" ":" "/"] ["" " " ""] cfg.proxy.httpProxy;
|
||||
in
|
||||
lib.concatMapStrings (x: ''
|
||||
${networksetup} -setwebproxystate "${x}" on
|
||||
${networksetup} -setwebproxy "${x}" ${proxy}
|
||||
'')
|
||||
knownNetworkServices;
|
||||
};
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.services.mihomo;
|
||||
in {
|
||||
options.services.mihomo = {
|
||||
enable = lib.mkEnableOption "Whether to enable Mihomo, A rule-based proxy in Go.";
|
||||
package = lib.mkPackageOption pkgs "mihomo" {};
|
||||
webui = lib.mkOption {
|
||||
default = null;
|
||||
type = lib.types.nullOr lib.types.path;
|
||||
description = ''
|
||||
Local web interface to use.
|
||||
|
||||
- metacubexd:
|
||||
- http://d.metacubex.one
|
||||
- https://metacubex.github.io/metacubexd
|
||||
- https://metacubexd.pages.dev
|
||||
- yacd:
|
||||
- https://yacd.haishan.me
|
||||
- clash-dashboard:
|
||||
- https://clash.razord.top
|
||||
'';
|
||||
};
|
||||
extraOpts = lib.mkOption {
|
||||
default = null;
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "Extra command line options to use.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
### launchd service
|
||||
# TODO: not run as root user
|
||||
launchd.daemons."mihomo" = {
|
||||
command = lib.concatStringsSep " " [
|
||||
(lib.getExe cfg.package)
|
||||
"-d /etc/mihomo"
|
||||
(lib.optionalString (cfg.webui != null) "-ext-ui ${cfg.webui}")
|
||||
(lib.optionalString (cfg.extraOpts != null) cfg.extraOpts)
|
||||
];
|
||||
serviceConfig = {
|
||||
RunAtLoad = true;
|
||||
KeepAlive.NetworkState = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{lib, ...}: {
|
||||
# Allow unfree applications
|
||||
nixpkgs.config.allowUnfreePredicate = pkg:
|
||||
lib.elem (lib.getName pkg) [
|
||||
"keka"
|
||||
];
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
{
|
||||
inputs,
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
### Options
|
||||
home-manager.users.guanranwang = import ./home;
|
||||
|
||||
imports = [
|
||||
./nix
|
||||
./anti-features.nix
|
||||
|
||||
inputs.self.darwinModules.default
|
||||
inputs.home-manager.darwinModules.home-manager
|
||||
];
|
||||
|
||||
users = {
|
||||
knownUsers = ["guanranwang"];
|
||||
users."guanranwang" = {
|
||||
createHome = true;
|
||||
description = "Guanran Wang";
|
||||
home = "/Users/guanranwang";
|
||||
shell = pkgs.fish;
|
||||
uid = 501;
|
||||
};
|
||||
};
|
||||
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
extraSpecialArgs = {inherit inputs;}; # ??? isnt specialArgs imported by default ???
|
||||
};
|
||||
|
||||
# Create /etc/zshrc that loads the nix-darwin environment.
|
||||
programs.zsh.enable = true; # default shell on catalina
|
||||
programs.fish.enable = true;
|
||||
|
||||
# WORKAROUND: Fix $PATH orders when using Fish shell
|
||||
# https://github.com/LnL7/nix-darwin/issues/122#issuecomment-1659465635
|
||||
programs.fish.loginShellInit = let
|
||||
# Double quotes instead of single quotes are necessary
|
||||
# ["$HOME/.local" "/usr/local"] -> "\"$HOME/.local/bin' '/usr/local/bin\""
|
||||
makePath = path: lib.concatMapStringsSep " " (path: "\"${path}/bin\"") path;
|
||||
in ''
|
||||
fish_add_path --move --prepend --path ${makePath config.environment.profiles}
|
||||
set fish_user_paths $fish_user_paths
|
||||
'';
|
||||
|
||||
# Install more recent versions of some macOS tools.
|
||||
# https://github.com/mathiasbynens/dotfiles/blob/master/brew.sh
|
||||
environment.systemPackages = with pkgs; [
|
||||
bashInteractive
|
||||
coreutils
|
||||
findutils
|
||||
git
|
||||
gnugrep
|
||||
gnused
|
||||
openssh
|
||||
screen
|
||||
tree
|
||||
vim
|
||||
];
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
{...}: {
|
||||
imports = [
|
||||
../../../../../home
|
||||
];
|
||||
|
||||
# https://github.com/mathiasbynens/dotfiles/blob/main/.macos
|
||||
targets.darwin.defaults = {
|
||||
### Inputs
|
||||
".GlobalPreferences"."com.apple.mouse.scaling" = "-1"; # Disable mouse acceleration
|
||||
|
||||
### .DS_Store
|
||||
"com.apple.desktopservices" = {
|
||||
DSDontWriteNetworkStores = true;
|
||||
DSDontWriteUSBStores = true;
|
||||
};
|
||||
|
||||
### Dock
|
||||
"com.apple.dock".autohide = true;
|
||||
|
||||
### Finder
|
||||
"com.apple.finder" = {
|
||||
_FXShowPosixPathInTitle = false;
|
||||
AppleShowAllExtensions = true;
|
||||
AppleShowAllFiles = true;
|
||||
CreateDesktop = false;
|
||||
FXDefaultSearchScope = "SCcf"; # Current folder
|
||||
FXEnableExtensionChangeWarning = false;
|
||||
FXPreferredViewStyle = "Nlsv"; # List view
|
||||
QuitMenuItem = true;
|
||||
ShowPathbar = true;
|
||||
ShowStatusBar = false;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{...}: {
|
||||
imports = [
|
||||
./flake.nix
|
||||
./nix.nix
|
||||
#./gc.nix # wtf is single user mode
|
||||
];
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
{
|
||||
inputs,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
# Enable Flakes
|
||||
nix.settings.experimental-features = ["nix-command" "flakes"];
|
||||
|
||||
# Disable flake-registry
|
||||
# https://nixos-and-flakes.thiscute.world/best-practices/nix-path-and-flake-registry
|
||||
nix.settings.flake-registry = "";
|
||||
nix.registry.nixpkgs.flake = inputs.nixpkgs;
|
||||
nix.registry.nixpkgs-stable.flake = inputs.nixpkgs-stable;
|
||||
|
||||
# Install Git
|
||||
environment.systemPackages = [pkgs.git];
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
nix = {
|
||||
### Auto hard linking
|
||||
settings.auto-optimise-store = true;
|
||||
|
||||
### Automatically delete older NixOS builds
|
||||
gc = {
|
||||
automatic = true;
|
||||
options = "--delete-older-than 7d";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
nix.settings = {
|
||||
trusted-users = ["@admin"];
|
||||
substituters =
|
||||
(lib.optionals (config.time.timeZone == "Asia/Shanghai") [
|
||||
"https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store" # TUNA - 清华大学 Mirror
|
||||
])
|
||||
++ [
|
||||
"https://nix-community.cachix.org"
|
||||
"https://guanran928.cachix.org"
|
||||
];
|
||||
trusted-public-keys = [
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
"guanran928.cachix.org-1:BE/iBCj2/pqJXG908wHRrcaV0B2fC+KbFjHsXY6b91c="
|
||||
];
|
||||
use-xdg-base-directories = true;
|
||||
};
|
||||
|
||||
# Auto upgrade nix package and the daemon service.
|
||||
services.nix-daemon.enable = true;
|
||||
nix.package = pkgs.nix;
|
||||
|
||||
# Set Git commit hash for darwin-version.
|
||||
#system.configurationRevision = self.rev or self.dirtyRev or null;
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
services.mihomo = {
|
||||
enable = true;
|
||||
webui = pkgs.metacubexd;
|
||||
};
|
||||
|
||||
### System proxy settings
|
||||
networking.proxy.default = "http://127.0.0.1:7890/";
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
{...}: {
|
||||
home-manager.users.guanranwang = import ./home;
|
||||
|
||||
imports = [
|
||||
../common/core
|
||||
./packages
|
||||
];
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
imports = map (n: ../../../../home/applications/${n}) [
|
||||
"go"
|
||||
# "mpv"
|
||||
"nix"
|
||||
];
|
||||
|
||||
# Install MacOS applications to the user Applications folder. Also update Docked applications
|
||||
# Modified version of: https://github.com/nix-community/home-manager/issues/1341#issuecomment-1870352014
|
||||
home.file."Applications/Home Manager Apps".enable = false;
|
||||
home.activation.trampolineApps = let
|
||||
apps = pkgs.buildEnv {
|
||||
name = "home-manager-applications";
|
||||
paths = config.home.packages;
|
||||
pathsToLink = "/Applications";
|
||||
};
|
||||
in
|
||||
lib.hm.dag.entryAfter ["writeBoundary"] ''
|
||||
${builtins.readFile ./trampoline-apps.sh}
|
||||
fromDir="${apps}/Applications"
|
||||
toDir="$HOME/Applications/Home Manager Trampolines"
|
||||
sync_trampolines "$fromDir" "$toDir"
|
||||
'';
|
||||
home.extraActivationPath = with pkgs; [
|
||||
rsync
|
||||
dockutil
|
||||
gawk
|
||||
];
|
||||
}
|
|
@ -1,131 +0,0 @@
|
|||
# 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 || exit
|
||||
|
||||
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 || exit
|
||||
}
|
||||
|
||||
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[@]}"
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{...}: {
|
||||
imports = [
|
||||
./fonts.nix
|
||||
./window-manager.nix
|
||||
];
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
fonts.packages = with pkgs; [
|
||||
(nerdfonts.override {fonts = ["JetBrainsMono"];})
|
||||
];
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
services = {
|
||||
yabai = {
|
||||
enable = true;
|
||||
enableScriptingAddition = true;
|
||||
config = {
|
||||
layout = "bsp";
|
||||
mouse_modifier = "fn";
|
||||
|
||||
# very broken on slow cpu
|
||||
#focus_follows_mouse = "autoraise";
|
||||
#mouse_follows_focus = "on";
|
||||
|
||||
top_padding = 10;
|
||||
bottom_padding = 10;
|
||||
left_padding = 10;
|
||||
right_padding = 10;
|
||||
window_gap = 4;
|
||||
};
|
||||
};
|
||||
skhd = {
|
||||
enable = true;
|
||||
skhdConfig = ''
|
||||
# FIXME
|
||||
cmd - return : open -n ${pkgs.alacritty}/Applications/Alacritty.app
|
||||
|
||||
cmd - 1 : yabai -m space --focus 1 # Focus space
|
||||
cmd - 2 : yabai -m space --focus 2
|
||||
cmd - 3 : yabai -m space --focus 3
|
||||
cmd - 4 : yabai -m space --focus 4
|
||||
cmd - 5 : yabai -m space --focus 5
|
||||
|
||||
shift + cmd - 1 : yabai -m window --space 1 # Send to space
|
||||
shift + cmd - 2 : yabai -m window --space 2
|
||||
shift + cmd - 3 : yabai -m window --space 3
|
||||
shift + cmd - 4 : yabai -m window --space 4
|
||||
shift + cmd - 5 : yabai -m window --space 5
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
21
flake.lock
21
flake.lock
|
@ -214,26 +214,6 @@
|
|||
"url": "https://git.ny4.dev/nyancat/nvim"
|
||||
}
|
||||
},
|
||||
"nix-darwin": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1724299755,
|
||||
"narHash": "sha256-P5zMA17kD9tqiqMuNXwupkM7buM3gMNtoZ1VuJTRDE4=",
|
||||
"owner": "LnL7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "a8968d88e5a537b0491f68ce910749cd870bdbef",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "LnL7",
|
||||
"repo": "nix-darwin",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixos-hardware": {
|
||||
"locked": {
|
||||
"lastModified": 1724067415,
|
||||
|
@ -306,7 +286,6 @@
|
|||
"impermanence": "impermanence",
|
||||
"lanzaboote": "lanzaboote",
|
||||
"neovim": "neovim",
|
||||
"nix-darwin": "nix-darwin",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"pre-commit-hooks-nix": "pre-commit-hooks-nix",
|
||||
|
|
39
flake.nix
39
flake.nix
|
@ -40,10 +40,6 @@
|
|||
inputs.treefmt-nix.follows = "treefmt-nix";
|
||||
inputs.systems.follows = "systems";
|
||||
};
|
||||
nix-darwin = {
|
||||
url = "github:LnL7/nix-darwin";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
nixos-hardware = {
|
||||
url = "github:NixOS/nixos-hardware";
|
||||
};
|
||||
|
@ -96,7 +92,7 @@
|
|||
formatter = treefmtEval.config.build.wrapper;
|
||||
|
||||
### nix flake check
|
||||
checks = {formatting = treefmtEval.config.build.check inputs.self;};
|
||||
checks.formatting = treefmtEval.config.build.check inputs.self;
|
||||
|
||||
### nix {run,shell,build}
|
||||
legacyPackages = import ./pkgs pkgs;
|
||||
|
@ -109,37 +105,22 @@
|
|||
];
|
||||
};
|
||||
})
|
||||
// (let
|
||||
mkNixOS = system: modules:
|
||||
inputs.nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [./nixos/profiles/core] ++ modules;
|
||||
specialArgs = {inherit inputs;};
|
||||
};
|
||||
|
||||
mkDarwin = system: modules:
|
||||
inputs.nix-darwin.lib.darwinSystem {
|
||||
inherit system modules;
|
||||
specialArgs = {inherit inputs;};
|
||||
};
|
||||
in {
|
||||
// {
|
||||
### imports = [];
|
||||
nixosModules.default = ./nixos/modules;
|
||||
darwinModules.default = ./darwin/modules;
|
||||
homeManagerModules.default = ./home/modules;
|
||||
|
||||
### nixpkgs.overlays = [];
|
||||
overlays = import ./overlays;
|
||||
|
||||
### NixOS
|
||||
nixosConfigurations = {
|
||||
"dust" = mkNixOS "x86_64-linux" [./hosts/dust];
|
||||
};
|
||||
|
||||
### Darwin
|
||||
darwinConfigurations = {
|
||||
"plato" = mkDarwin "x86_64-darwin" [./hosts/plato];
|
||||
"whitesteel" = mkDarwin "x86_64-darwin" [./hosts/whitesteel];
|
||||
nixosConfigurations."dust" = inputs.nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./nixos/profiles/core
|
||||
./hosts/dust
|
||||
];
|
||||
specialArgs = {inherit inputs;};
|
||||
};
|
||||
|
||||
colmena = {
|
||||
|
@ -165,5 +146,5 @@
|
|||
deployment.targetHost = "blacksteel"; # thru tailscale
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,31 +1,14 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
home = {
|
||||
username = "guanranwang";
|
||||
homeDirectory =
|
||||
if pkgs.stdenv.hostPlatform.isDarwin
|
||||
then "/Users/${config.home.username}"
|
||||
else "/home/${config.home.username}";
|
||||
|
||||
# This value determines the Home Manager release that your
|
||||
# configuration is compatible with. This helps avoid breakage
|
||||
# when a new Home Manager release introduces backwards
|
||||
# incompatible changes.
|
||||
#
|
||||
# You can update Home Manager without changing this value. See
|
||||
# the Home Manager release notes for a list of state version
|
||||
# changes in each release.
|
||||
homeDirectory = "/home/guanranwang";
|
||||
stateVersion = "23.05";
|
||||
};
|
||||
|
||||
# Let Home Manager install and manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
# Default applications
|
||||
imports = [
|
||||
./applications/atuin
|
||||
./applications/bash
|
||||
|
@ -45,14 +28,10 @@
|
|||
programs.ripgrep.enable = true;
|
||||
programs.skim.enable = true;
|
||||
programs.zoxide.enable = true;
|
||||
home.packages =
|
||||
(with pkgs; [
|
||||
fd
|
||||
fastfetch
|
||||
])
|
||||
++ lib.optionals pkgs.stdenv.hostPlatform.isLinux (with pkgs; [
|
||||
trashy
|
||||
]);
|
||||
home.packages = with pkgs; [
|
||||
fastfetch
|
||||
fd
|
||||
];
|
||||
|
||||
programs.fish.functions = let
|
||||
jq = lib.getExe pkgs.jq;
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
# iMac 18,3 (2017)
|
||||
{...}: {
|
||||
imports = [
|
||||
../../darwin/profiles/desktop
|
||||
../../darwin/profiles/common/opt-in/mihomo.nix
|
||||
];
|
||||
|
||||
networking.hostName = "plato";
|
||||
time.timeZone = "Asia/Shanghai";
|
||||
system.stateVersion = 4;
|
||||
nixpkgs.hostPlatform = "x86_64-darwin";
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
{...}: {
|
||||
imports = [
|
||||
../../darwin/profiles/desktop
|
||||
../../darwin/profiles/common/opt-in/mihomo.nix
|
||||
];
|
||||
|
||||
networking.hostName = "whitesteel";
|
||||
time.timeZone = "Asia/Shanghai";
|
||||
system.stateVersion = 4;
|
||||
nixpkgs.hostPlatform = "x86_64-darwin";
|
||||
}
|
Loading…
Reference in a new issue