diff --git a/flake.lock b/flake.lock index a80c91eb..74e54fd2 100644 --- a/flake.lock +++ b/flake.lock @@ -187,22 +187,6 @@ "type": "github" } }, - "catppuccin-wezterm": { - "flake": false, - "locked": { - "lastModified": 1681259790, - "narHash": "sha256-McSWoZaJeK+oqdK/0vjiRxZGuLBpEB10Zg4+7p5dIGY=", - "owner": "catppuccin", - "repo": "wezterm", - "rev": "b1a81bae74d66eaae16457f2d8f151b5bd4fe5da", - "type": "github" - }, - "original": { - "owner": "catppuccin", - "repo": "wezterm", - "type": "github" - } - }, "cattppuccin-k9s": { "flake": false, "locked": { @@ -345,11 +329,11 @@ ] }, "locked": { - "lastModified": 1699783872, - "narHash": "sha256-4zTwLT2LL45Nmo6iwKB3ls3hWodVP9DiSWxki/oewWE=", + "lastModified": 1701040754, + "narHash": "sha256-rHld3E3CeVI/GUxH3xE+mqAo+IX2hTbXVfXKahCrG5I=", "owner": "nix-community", "repo": "home-manager", - "rev": "280721186ab75a76537713ec310306f0eba3e407", + "rev": "7c97c46dc4f45f2a78df536a6ebe15252831b800", "type": "github" }, "original": { @@ -615,11 +599,11 @@ }, "nixpkgs-darwin": { "locked": { - "lastModified": 1699725108, - "narHash": "sha256-NTiPW4jRC+9puakU4Vi8WpFEirhp92kTOSThuZke+FA=", + "lastModified": 1700977043, + "narHash": "sha256-tX4d36Bq75NBjnYGaCO9b403VDpdFa99NtdUPQ4EALk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "911ad1e67f458b6bcf0278fa85e33bb9924fed7e", + "rev": "abbe047fb8a5a7074b6de24cced0dbdb27ea0ea8", "type": "github" }, "original": { @@ -731,11 +715,11 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1699781429, - "narHash": "sha256-UYefjidASiLORAjIvVsUHG6WBtRhM67kTjEY4XfZOFs=", + "lastModified": 1700794826, + "narHash": "sha256-RyJTnTNKhO0yqRpDISk03I/4A67/dp96YRxc86YOPgU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e44462d6021bfe23dfb24b775cc7c390844f773d", + "rev": "5a09cb4b393d58f9ed0d9ca1555016a8543c2ac8", "type": "github" }, "original": { @@ -841,7 +825,6 @@ "catppuccin-helix": "catppuccin-helix", "catppuccin-hyprland": "catppuccin-hyprland", "catppuccin-starship": "catppuccin-starship", - "catppuccin-wezterm": "catppuccin-wezterm", "cattppuccin-k9s": "cattppuccin-k9s", "home-manager": "home-manager_2", "hyprland": "hyprland", diff --git a/flake.nix b/flake.nix index bf760641..c9e4d8dd 100644 --- a/flake.nix +++ b/flake.nix @@ -277,13 +277,13 @@ # which represents the GitHub repository URL + branch/commit-id/tag. # Official NixOS package source, using nixos's stable branch by default - # nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; + # nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; # for macos - # nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-23.05-darwin"; nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + # nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-23.11-darwin"; nix-darwin = { url = "github:lnl7/nix-darwin"; inputs.nixpkgs.follows = "nixpkgs-darwin"; @@ -291,7 +291,7 @@ # home-manager, used for managing user configuration home-manager = { - # url = "github:nix-community/home-manager/release-23.05"; + # url = "github:nix-community/home-manager/release-23.11"; url = "github:nix-community/home-manager/master"; # The `follows` keyword in inputs is used for inheritance. # Here, `inputs.nixpkgs` of home-manager is kept consistent with the `inputs.nixpkgs` of the current flake, @@ -378,10 +378,6 @@ url = "github:catppuccin/alacritty"; flake = false; }; - catppuccin-wezterm = { - url = "github:catppuccin/wezterm"; - flake = false; - }; catppuccin-helix = { url = "github:catppuccin/helix"; flake = false; @@ -406,16 +402,19 @@ # the nixConfig here only affects the flake itself, not the system configuration! nixConfig = { - experimental-features = ["nix-command" "flakes"]; - substituters = [ + # cache mirror located in China + # status: https://mirror.sjtu.edu.cn/ + "https://mirror.sjtu.edu.cn/nix-channels/store" + # status: https://mirrors.ustc.edu.cn/status/ + # "https://mirrors.ustc.edu.cn/nix-channels/store" + # my own cache server "https://ryan4yin.cachix.org" - # replace official cache with a mirror located in China - "https://mirrors.ustc.edu.cn/nix-channels/store" - "https://cache.nixos.org" "https://anyrun.cachix.org" "https://hyprland.cachix.org" + + "https://cache.nixos.org" ]; # nix community's cache server diff --git a/home/base/desktop/cloud/default.nix b/home/base/desktop/cloud/default.nix index 8eb27623..3067d342 100644 --- a/home/base/desktop/cloud/default.nix +++ b/home/base/desktop/cloud/default.nix @@ -1,12 +1,9 @@ { pkgs, - pkgs-unstable, ... }: { home.packages = with pkgs; [ # general tools - terraform - pkgs-unstable.terraformer # generate terraform configs from existing cloud resources pulumi pulumictl # istioctl diff --git a/home/base/desktop/development.nix b/home/base/desktop/development.nix index 5acdb6d4..9390899e 100644 --- a/home/base/desktop/development.nix +++ b/home/base/desktop/development.nix @@ -46,7 +46,6 @@ # other tools bfg-repo-cleaner # remove large files from git history k6 # load testing tool - mitmproxy # http/https proxy tool protobuf # protocol buffer compiler ]; diff --git a/home/base/desktop/neovim/default.nix b/home/base/desktop/neovim/default.nix index 8f3207b6..36c861fa 100644 --- a/home/base/desktop/neovim/default.nix +++ b/home/base/desktop/neovim/default.nix @@ -103,7 +103,7 @@ #-- CloudNative nodePackages.dockerfile-language-server-nodejs - terraform + # terraform # install via brew on macOS terraform-ls jsonnet jsonnet-language-server diff --git a/home/base/desktop/terminal/wezterm.nix b/home/base/desktop/terminal/wezterm.nix index 7f49552f..88ad67fb 100644 --- a/home/base/desktop/terminal/wezterm.nix +++ b/home/base/desktop/terminal/wezterm.nix @@ -1,8 +1,5 @@ { - lib, pkgs, - pkgs-unstable, - catppuccin-wezterm, ... }: ########################################################### @@ -15,11 +12,14 @@ { # wezterm has catppuccin theme built-in, # it's not necessary to install it separately. - # xdg.configFile."wezterm/colors".source = "${catppuccin-wezterm}/dist"; programs.wezterm = { enable = true; - package = pkgs-unstable.wezterm; + package = if pkgs.stdenv.isDarwin + then + pkgs.hello # install wezterm via homebrew on macOS to avoid compilation, dummy package here. + else + pkgs.wezterm; extraConfig = let diff --git a/home/base/server/git.nix b/home/base/server/git.nix index d5e8ac68..482e730c 100644 --- a/home/base/server/git.nix +++ b/home/base/server/git.nix @@ -16,9 +16,6 @@ ''; home.packages = with pkgs; [ - # Automatically trims your branches whose tracking remote refs are merged or gone - # It's really useful when you work on a project for a long time. - git-trim ]; programs.git = { diff --git a/home/linux/base/system-tools.nix b/home/linux/base/system-tools.nix index 9d844e5a..8000be06 100644 --- a/home/linux/base/system-tools.nix +++ b/home/linux/base/system-tools.nix @@ -1,6 +1,14 @@ {pkgs, ...}: { # Linux Only Packages, not available on Darwin home.packages = with pkgs; [ + # Automatically trims your branches whose tracking remote refs are merged or gone + # It's really useful when you work on a project for a long time. + git-trim + + # cloud tools that nix do not have cache for. + terraform + terraformer # generate terraform configs from existing cloud resources + nmon iotop iftop diff --git a/home/linux/desktop/default.nix b/home/linux/desktop/default.nix index 3bb8b9ba..4edb3c1e 100644 --- a/home/linux/desktop/default.nix +++ b/home/linux/desktop/default.nix @@ -29,6 +29,7 @@ # misc flameshot + mitmproxy # http/https proxy tool ]; # GitHub CLI tool diff --git a/lib/macosSystem.nix b/lib/macosSystem.nix index 927349ff..6aa77c50 100644 --- a/lib/macosSystem.nix +++ b/lib/macosSystem.nix @@ -27,7 +27,7 @@ in { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - + home-manager.extraSpecialArgs = specialArgs; home-manager.users."${username}" = home-module; } diff --git a/modules/darwin/apps.nix b/modules/darwin/apps.nix index 48bcefb2..870bc426 100644 --- a/modules/darwin/apps.nix +++ b/modules/darwin/apps.nix @@ -44,7 +44,7 @@ # homebrew need to be installed manually, see https://brew.sh homebrew = { - enable = false; + enable = true; onActivation = { autoUpdate = false; @@ -83,6 +83,7 @@ "aria2" # download tool "httpie" # http client "wireguard-tools" # wireguard + "mitmproxy" # Usage: # https://github.com/tailscale/tailscale/wiki/Tailscaled-on-macOS#run-the-tailscaled-daemon @@ -97,10 +98,17 @@ # commands like `gsed` `gtar` are required by some tools "gnu-sed" "gnu-tar" + + # misc that nix do not have cache for. + "git-trim" + "terraform" + "terraformer" ]; # `brew install --cask` casks = [ + "wezterm" + "squirrel" # input method for Chinese, rime-squirrel "firefox" diff --git a/modules/darwin/nix-core.nix b/modules/darwin/nix-core.nix index 5972628c..12796ac5 100644 --- a/modules/darwin/nix-core.nix +++ b/modules/darwin/nix-core.nix @@ -35,7 +35,10 @@ options = lib.mkDefault "--delete-older-than 7d"; }; - # Manual optimise storage: nix-store --optimise - # https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-auto-optimise-store - nix.settings.auto-optimise-store = true; + # Disable auto-optimise-store because of this issue: + # https://github.com/NixOS/nix/issues/7273 + # "error: cannot link '/nix/store/.tmp-link-xxxxx-xxxxx' to '/nix/store/.links/xxxx': File exists" + nix.settings = { + auto-optimise-store = false; + }; } diff --git a/modules/darwin/system.nix b/modules/darwin/system.nix index aff06eb9..3508d048 100644 --- a/modules/darwin/system.nix +++ b/modules/darwin/system.nix @@ -151,10 +151,14 @@ # Fonts fonts = { - # use fonts specified by user rather than default ones + # will be removed after this PR is merged: + # https://github.com/LnL7/nix-darwin/pull/754 fontDir.enable = true; - packages = with pkgs; [ + # will change to `fonts.packages` after this PR is merged: + # https://github.com/LnL7/nix-darwin/pull/754 + fonts = with pkgs; [ + # packages = with pkgs; [ # icon fonts material-design-icons font-awesome