From 69053ec92d7893c252d73444c54198ece1f24ac1 Mon Sep 17 00:00:00 2001 From: Sense T Date: Sat, 25 Nov 2023 15:09:43 +0800 Subject: [PATCH] update --- darwin-configuration.nix | 48 +++++++++++++++++++++++++++++++++++++++- flake.lock | 18 +++++++-------- flake.nix | 30 +++++++++++++++++++------ home.nix | 26 ++++++++++++---------- 4 files changed, 93 insertions(+), 29 deletions(-) diff --git a/darwin-configuration.nix b/darwin-configuration.nix index 19ced6c..5970c18 100644 --- a/darwin-configuration.nix +++ b/darwin-configuration.nix @@ -1,4 +1,4 @@ -{ lib, config, pkgs, ... }: +{ lib, pkgs, ... }: { # List packages installed in system profile. To search by name, run: @@ -11,6 +11,14 @@ htop ]; + environment.variables = { + HOMEBREW_API_DOMAIN = "https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"; + HOMEBREW_BOTTLE_DOMAIN = "https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"; + HOMEBREW_BREW_GIT_REMOTE = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"; + HOMEBREW_CORE_GIT_REMOTE = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"; + HOMEBREW_PIP_INDEX_URL = "https://pypi.tuna.tsinghua.edu.cn/simple"; + }; + # Use a custom configuration.nix location. # $ darwin-rebuild switch -I darwin-config=$HOME/.config/nixpkgs/darwin/configuration.nix # environment.darwinConfig = "$HOME/.config/nixpkgs/darwin/configuration.nix"; @@ -46,4 +54,42 @@ name = "tonychyi"; home = "/Users/tonychyi"; }; + + homebrew = { + enable = true; + onActivation = { + autoUpdate = false; + # 'zap': uninstalls all formulae(and related files) not listed here. + cleanup = "zap"; + }; + + masApps = { + # TODO Feel free to add your favorite apps here. + + # Xcode = 497799835; + # Wechat = 836500024; + # NeteaseCloudMusic = 944848654; + # QQ = 451108668; + # WeCom = 1189898970; # Wechat for Work + # TecentMetting = 1484048379; + # QQMusic = 595615424; + }; + + # TODO package list + brews = [ + "curl" + "ffmpeg" + "qemu" + ]; + + # TODO package list + casks = [ + "clock-bar" + "macfuse" + "ntfstool" + "rar" + "tailscale" + "webpquicklook" + ]; + }; } diff --git a/flake.lock b/flake.lock index e25c19e..d426b6e 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1689825754, - "narHash": "sha256-u3W3WGO3BA63nb+CeNLBajbJ/sl8tDXBHKxxeTOCxfo=", + "lastModified": 1700795494, + "narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "531c3de7eccf95155828e0cd9f18c25e7f937777", + "rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d", "type": "github" }, "original": { @@ -28,11 +28,11 @@ ] }, "locked": { - "lastModified": 1687871164, - "narHash": "sha256-bBFlPthuYX322xOlpJvkjUBz0C+MOBjZdDOOJJ+G2jU=", + "lastModified": 1700392168, + "narHash": "sha256-v5LprEFx3u4+1vmds9K0/i7sHjT0IYGs7u9v54iz/OA=", "owner": "nix-community", "repo": "home-manager", - "rev": "07c347bb50994691d7b0095f45ebd8838cf6bc38", + "rev": "28535c3a34d79071f2ccb68671971ce0c0984d7e", "type": "github" }, "original": { @@ -44,11 +44,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1690022785, - "narHash": "sha256-WV3Rg6WcP3UErddn/+Kw3BTsc8kB9F4Y5sv7I/N5q4o=", + "lastModified": 1700854570, + "narHash": "sha256-GiwMS5sWSgF/CyZYbm+G5EcgG1VOEyvcsP5lE1L97Aw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "0ee595490f5b1d181cccc17928aa250faf4b91c1", + "rev": "cbd3f3722ac41a200c1655141e021cf12c3ba4e6", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 839bc1b..79605ae 100644 --- a/flake.nix +++ b/flake.nix @@ -1,13 +1,29 @@ { - inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-23.05-darwin"; - darwin.url = "github:lnl7/nix-darwin/master"; - darwin.inputs.nixpkgs.follows = "nixpkgs"; - home-manager.url = "github:nix-community/home-manager/release-23.05"; - home-manager.inputs.nixpkgs.follows = "nixpkgs"; + nixConfig = { + experimental-features = [ "nix-command" "flakes" ]; + + substituters = [ + # Replace official cache with a mirror located in China + # + # Feel free to remove this line if you are not in China + "https://mirrors.ustc.edu.cn/nix-channels/store" + "https://cache.nixos.org" + ]; }; - outputs = { self, darwin, nixpkgs, home-manager }: { + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-23.05-darwin"; + darwin = { + url = "github:lnl7/nix-darwin/master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + home-manager = { + url = "github:nix-community/home-manager/release-23.05"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, darwin, home-manager }: { darwinConfigurations."mbp" = darwin.lib.darwinSystem { system = "x86_64-darwin"; modules = [ diff --git a/home.nix b/home.nix index ef6df18..e0734c2 100644 --- a/home.nix +++ b/home.nix @@ -1,11 +1,10 @@ -{ pkgs, config, ... }: { +{ pkgs, ... }: { home = { stateVersion = "23.05"; homeDirectory = "/Users/tonychyi"; packages = with pkgs; [ bat - thefuck ranger coreutils icdiff @@ -19,8 +18,6 @@ kube-capacity kubernetes-helm arduino-cli - qemu - ffmpeg #obs-studio #podman-desktop ]; @@ -30,18 +27,10 @@ nixos-rebuild = "darwin-rebuild"; top = "htop"; pip = "pip3"; - ls = "ls --color=auto"; cat = "bat -p --paging=never -u"; diff = "icdiff"; }; - sessionVariables = { - HOMEBREW_API_DOMAIN = "https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"; - HOMEBREW_BOTTLE_DOMAIN = "https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"; - HOMEBREW_BREW_GIT_REMOTE = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"; - HOMEBREW_CORE_GIT_REMOTE = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"; - }; - sessionPath = [ "$HOME/.local/bin" "$HOME/.cargo/bin" @@ -52,6 +41,19 @@ programs = { home-manager.enable = true; timidity.enable = true; + thefuck.enable = true; + + eza = { + enable = true; + enableAliases = true; + git = true; + icons = true; + }; + + direnv = { + enable = true; + enableZshIntegration = true; + }; vim = { enable = true;