From 40995b640f2578a0afe92be2c263e0bec579f086 Mon Sep 17 00:00:00 2001 From: Alliana <56180684+Allianaab2m@users.noreply.github.com> Date: Tue, 3 Dec 2024 01:52:05 +0900 Subject: [PATCH 1/9] chore: add darwin settings --- Taskfile.yaml | 8 +++++++- flake.nix | 19 +++++++++++++++++++ home-manager/README.md | 6 ++++++ nix-darwin/default.nix | 25 +++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 home-manager/README.md create mode 100644 nix-darwin/default.nix diff --git a/Taskfile.yaml b/Taskfile.yaml index 0b3130f..a66c1d6 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -1,9 +1,15 @@ version: '3' tasks: - switch: + up: + cmds: + - nix flake update + hmsw: # home-manager switch cmds: - nix run nixpkgs#home-manager -- switch --flake .#{{env "NAME"}} + dwsw: # nix-darwin switch + cmds: + - nix run nix-darwin -- switch --flake .#marisa gc: cmds: - nix-collect-garbage --delete-old diff --git a/flake.nix b/flake.nix index 2394dc5..860fec3 100644 --- a/flake.nix +++ b/flake.nix @@ -5,14 +5,21 @@ nixpkgs = { url = "github:nixos/nixpkgs?ref=nixos-unstable"; }; + # Nix modules for darwin + # nix-darwin = { + # url = "github:LnL7/nix-darwin"; + # inputs.nixpkgs.follows = "nixpkgs"; + # }; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + # Neovim nightly build neovim-nightly-overlay = { url = "github:nix-community/neovim-nightly-overlay"; inputs.nixpkgs.follows = "nixpkgs"; }; + # Nix wrapper for Rust fenix = { url = "github:nix-community/fenix/monthly"; inputs.nixpkgs.follows = "nixpkgs"; @@ -23,6 +30,7 @@ { self, nixpkgs, + # nix-darwin, home-manager, fenix, ... @@ -44,9 +52,18 @@ inputs.neovim-nightly-overlay.overlays.default ]; + # nix-darwin + # darwinConfigurations = { + # marisa = nix-darwin.lib.darwinSystem { + # modules = [ ./nix-darwin ]; + # }; + # }; + + # home-manager homeManagerModules = import ./modules/home-manager; homeConfigurations = { + # youmu: Ubuntu 24.04.1 + WSL2 (Host: Windows 11 23H2) youmu-wsl = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.x86_64-linux; extraSpecialArgs = { @@ -58,6 +75,7 @@ ]; }; + # reimu: Ubuntu 24.04.1 + WSL2 (Host: Windows 11 23H2) reimu-wsl = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.x86_64-linux; extraSpecialArgs = { @@ -69,6 +87,7 @@ ]; }; + # marisa: macOS 15(Darwin) # marisa = home-manager.lib.homeManagerConfiguration { # pkgs = nixpkgs.legacyPackages.aarch64-darwin; # extraSpecialArgs = { inherit inputs outputs; }; diff --git a/home-manager/README.md b/home-manager/README.md new file mode 100644 index 0000000..d700d1f --- /dev/null +++ b/home-manager/README.md @@ -0,0 +1,6 @@ +# home-manager + +```txt +hosts/ => host specific settings +programs/ => install & configure packages +``` diff --git a/nix-darwin/default.nix b/nix-darwin/default.nix new file mode 100644 index 0000000..fb120d6 --- /dev/null +++ b/nix-darwin/default.nix @@ -0,0 +1,25 @@ +{ pkgs, ... }: { + nix = { + optimise.automatic = true; + settings = { + experimental-features = "nix-command flakes"; + max-jobs = 8; + }; + services.nix-daemon.enable = true; + + system = { + defaults = { + NSGlobalDomain.AppleShowAllExtensions = true; + finder = { + AppleShowAllFiles = true; + AppleShowAllExtensions = true; + }; + dock = { + autohide = true; + show-recents = false; + orientation = "left"; + }; + }; + }; + }; +} From fddf83d1f5e5b2d3bcdd47dccee46882aeebfc43 Mon Sep 17 00:00:00 2001 From: Alliana <56180684+Allianaab2m@users.noreply.github.com> Date: Tue, 3 Dec 2024 01:56:02 +0900 Subject: [PATCH 2/9] chore: update lock --- flake.lock | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/flake.lock b/flake.lock index 243397a..3f4a85f 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1730442928, - "narHash": "sha256-U1DWb5c3EfkA7pqx5V1H4AWRA+EaE6UJ0lIRvK1RxgM=", + "lastModified": 1732689334, + "narHash": "sha256-yKI1KiZ0+bvDvfPTQ1ZT3oP/nIu3jPYm4dnbRd6hYg4=", "owner": "nix-community", "repo": "fenix", - "rev": "87b4d20f896c99018dde4702a9c6157b516f2a76", + "rev": "a8a983027ca02b363dfc82fbe3f7d9548a8d3dce", "type": "github" }, "original": { @@ -25,11 +25,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "lastModified": 1732722421, + "narHash": "sha256-HRJ/18p+WoXpWJkcdsk9St5ZiukCqSDgbOGFa8Okehg=", "owner": "edolstra", "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "rev": "9ed2ac151eada2306ca8c418ebd97807bb08f6ac", "type": "github" }, "original": { @@ -174,11 +174,11 @@ ] }, "locked": { - "lastModified": 1732482255, - "narHash": "sha256-GUffLwzawz5WRVfWaWCg78n/HrBJrOG7QadFY6rtV8A=", + "lastModified": 1733133928, + "narHash": "sha256-gU40r9AfpIr4eq+0noM8yH1Hxf+EA3dqfIpFtQl8Y1E=", "owner": "nix-community", "repo": "home-manager", - "rev": "a9953635d7f34e7358d5189751110f87e3ac17da", + "rev": "873e39d5f4437d2f3ab06881fea8e63e45e1d011", "type": "github" }, "original": { @@ -199,11 +199,11 @@ ] }, "locked": { - "lastModified": 1732689435, - "narHash": "sha256-9Klse4XZraC6Ls+eelgLa35CAjTyTtfOWw/5HAHolTs=", + "lastModified": 1733098025, + "narHash": "sha256-HOzahkMv67wtSYcudRpGqNXjFwFoc2lwq0+Ev6h8T3k=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "eebc41c930eff8e4e47e9398fc6bfdf843cacd00", + "rev": "73ec92a4c2773ead4af1c657ea81142d4a27fe78", "type": "github" }, "original": { @@ -215,11 +215,11 @@ "neovim-src": { "flake": false, "locked": { - "lastModified": 1732652521, - "narHash": "sha256-50bhYFPBB+Z8yKpEPtRoIU0aQS9oRBXaq7qtVAdcJlg=", + "lastModified": 1733090308, + "narHash": "sha256-oIbVYa5y0lgXDRaZUn0MdAKC2Vf9OakbtIFmbhL8K1k=", "owner": "neovim", "repo": "neovim", - "rev": "d460928263d0ff53283f301dfcb85f5b6e17d2ac", + "rev": "feb62d5429680278c1353c565db6bb3ecb3b7c24", "type": "github" }, "original": { @@ -230,11 +230,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1732521221, - "narHash": "sha256-2ThgXBUXAE1oFsVATK1ZX9IjPcS4nKFOAjhPNKuiMn0=", + "lastModified": 1733015953, + "narHash": "sha256-t4BBVpwG9B4hLgc6GUBuj3cjU7lP/PJfpTHuSqE+crk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "4633a7c72337ea8fd23a4f2ba3972865e3ec685d", + "rev": "ac35b104800bff9028425fec3b6e8a41de2bbfff", "type": "github" }, "original": { From 09d9cb1f2c3ceb1d9ae7d4fc425b42f3ab844595 Mon Sep 17 00:00:00 2001 From: Alliana <56180684+Allianaab2m@users.noreply.github.com> Date: Tue, 3 Dec 2024 13:26:35 +0900 Subject: [PATCH 3/9] chore: update --- Taskfile.yaml | 3 ++ config/nvim/lazy-lock.json | 2 +- flake.lock | 21 ++++++++++++++ flake.nix | 37 ++++++++++++------------ home-manager/default.nix | 2 -- home-manager/hosts/marisa/default.nix | 28 ++++++++++++++++++ home-manager/hosts/marisa/git.nix | 9 ++++++ nix-darwin/default.nix | 41 ++++++++++++++++++--------- 8 files changed, 109 insertions(+), 34 deletions(-) create mode 100644 home-manager/hosts/marisa/default.nix create mode 100644 home-manager/hosts/marisa/git.nix diff --git a/Taskfile.yaml b/Taskfile.yaml index a66c1d6..c8e4d62 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -10,6 +10,9 @@ tasks: dwsw: # nix-darwin switch cmds: - nix run nix-darwin -- switch --flake .#marisa + dwhmsw: + cmds: + - nix run nixpkgs#home-manager -- switch --flake .#marisa gc: cmds: - nix-collect-garbage --delete-old diff --git a/config/nvim/lazy-lock.json b/config/nvim/lazy-lock.json index 7ac6403..e7e0c8e 100644 --- a/config/nvim/lazy-lock.json +++ b/config/nvim/lazy-lock.json @@ -15,7 +15,7 @@ "guihua.lua": { "branch": "master", "commit": "d783191eaa75215beae0c80319fcce5e6b3beeda" }, "inc-rename.nvim": { "branch": "main", "commit": "1871ca49ae6ee3e9ebee37955ba10c7b1425974f" }, "indent-blankline.nvim": { "branch": "master", "commit": "7871a88056f7144defca9c931e311a3134c5d509" }, - "lazy.nvim": { "branch": "main", "commit": "56ead98e05bb37a4ec28930a54d836d033cf00f2" }, + "lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" }, "lazydev.nvim": { "branch": "main", "commit": "f59bd14a852ca43db38e3662395354cb2a9b13e0" }, "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, "luvit-meta": { "branch": "main", "commit": "57d464c4acb5c2e66bd4145060f5dc9e96a7bbb7" }, diff --git a/flake.lock b/flake.lock index 3f4a85f..d13d1fb 100644 --- a/flake.lock +++ b/flake.lock @@ -228,6 +228,26 @@ "type": "github" } }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733105089, + "narHash": "sha256-Qs3YmoLYUJ8g4RkFj2rMrzrP91e4ShAioC9s+vG6ENM=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "c6b65d946097baf3915dd51373251de98199280d", + "type": "github" + }, + "original": { + "owner": "LnL7", + "repo": "nix-darwin", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1733015953, @@ -249,6 +269,7 @@ "fenix": "fenix", "home-manager": "home-manager", "neovim-nightly-overlay": "neovim-nightly-overlay", + "nix-darwin": "nix-darwin", "nixpkgs": "nixpkgs" } }, diff --git a/flake.nix b/flake.nix index 860fec3..c0850bc 100644 --- a/flake.nix +++ b/flake.nix @@ -6,10 +6,10 @@ url = "github:nixos/nixpkgs?ref=nixos-unstable"; }; # Nix modules for darwin - # nix-darwin = { - # url = "github:LnL7/nix-darwin"; - # inputs.nixpkgs.follows = "nixpkgs"; - # }; + nix-darwin = { + url = "github:LnL7/nix-darwin"; + inputs.nixpkgs.follows = "nixpkgs"; + }; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; @@ -30,7 +30,7 @@ { self, nixpkgs, - # nix-darwin, + nix-darwin, home-manager, fenix, ... @@ -53,11 +53,12 @@ ]; # nix-darwin - # darwinConfigurations = { - # marisa = nix-darwin.lib.darwinSystem { - # modules = [ ./nix-darwin ]; - # }; - # }; + darwinConfigurations = { + marisa = nix-darwin.lib.darwinSystem { + system = "aarch64-darwin"; + modules = [ ./nix-darwin ]; + }; + }; # home-manager homeManagerModules = import ./modules/home-manager; @@ -88,14 +89,14 @@ }; # marisa: macOS 15(Darwin) - # marisa = home-manager.lib.homeManagerConfiguration { - # pkgs = nixpkgs.legacyPackages.aarch64-darwin; - # extraSpecialArgs = { inherit inputs outputs; }; - # modules = [ - # ./home-manager/home.nix - # ./home-manager/hosts/marisa - # ]; - # }; + marisa = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.aarch64-darwin; + extraSpecialArgs = { inherit inputs outputs; }; + modules = [ + ./home-manager + ./home-manager/hosts/marisa + ]; + }; }; }; } diff --git a/home-manager/default.nix b/home-manager/default.nix index 6178353..6ab61db 100644 --- a/home-manager/default.nix +++ b/home-manager/default.nix @@ -19,6 +19,4 @@ }; programs.home-manager.enable = true; - - home.stateVersion = "24.05"; } diff --git a/home-manager/hosts/marisa/default.nix b/home-manager/hosts/marisa/default.nix new file mode 100644 index 0000000..c26f480 --- /dev/null +++ b/home-manager/hosts/marisa/default.nix @@ -0,0 +1,28 @@ +{ lib, config, pkgs, homeManager, ... }: +let + symlink = config.lib.file.mkOutOfStoreSymlink; +in +rec { + imports = [ + ./git.nix + ]; + + home.packages = with pkgs; [ + gcc + alacritty + # _1password-gui + ]; + + home.activation = { + updateLinks = '' + export ROOT="${home.homeDirectory}/dotfiles" + ln -snf "$ROOT/config/atcoder-cli-nodejs" "${home.homeDirectory}/.config/" + ''; + }; + + home = { + username = "alliana"; + homeDirectory = "/Users/${home.username}"; + stateVersion = "24.11"; + }; +} diff --git a/home-manager/hosts/marisa/git.nix b/home-manager/hosts/marisa/git.nix new file mode 100644 index 0000000..d22a539 --- /dev/null +++ b/home-manager/hosts/marisa/git.nix @@ -0,0 +1,9 @@ +{ + programs.git = { + extraConfig = { + gpg = { + "ssh".program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign"; + }; + }; + }; +} diff --git a/nix-darwin/default.nix b/nix-darwin/default.nix index fb120d6..f63fc5d 100644 --- a/nix-darwin/default.nix +++ b/nix-darwin/default.nix @@ -5,21 +5,36 @@ experimental-features = "nix-command flakes"; max-jobs = 8; }; - services.nix-daemon.enable = true; + }; + + services.nix-daemon.enable = true; - system = { - defaults = { - NSGlobalDomain.AppleShowAllExtensions = true; - finder = { - AppleShowAllFiles = true; - AppleShowAllExtensions = true; - }; - dock = { - autohide = true; - show-recents = false; - orientation = "left"; - }; + system = { + stateVersion = 5; + defaults = { + NSGlobalDomain.AppleShowAllExtensions = true; + finder = { + AppleShowAllFiles = true; + AppleShowAllExtensions = true; + ShowPathbar = true; + ShowStatusBar = true; + }; + dock = { + autohide = true; + show-recents = false; + orientation = "left"; + mineffect = "scale"; }; }; }; + + homebrew = { + enable = true; + onActivation = { + autoUpdate = true; + }; + casks = [ + "1password" + ]; + }; } From dc4444c275b0ccfa6d0e3ee1b94e651859cb72d5 Mon Sep 17 00:00:00 2001 From: Alliana <56180684+Allianaab2m@users.noreply.github.com> Date: Wed, 4 Dec 2024 10:34:05 +0900 Subject: [PATCH 4/9] chore: update --- Taskfile.yaml | 4 +-- flake.lock | 18 +++++------ home-manager/hosts/marisa/alacritty.nix | 35 ++++++++++++++++++++ home-manager/hosts/marisa/default.nix | 9 ++++++ home-manager/programs/git.nix | 9 ++++++ home-manager/programs/package.nix | 2 +- nix-darwin/default.nix | 43 ++++++++++++++++++++++++- 7 files changed, 107 insertions(+), 13 deletions(-) create mode 100644 home-manager/hosts/marisa/alacritty.nix diff --git a/Taskfile.yaml b/Taskfile.yaml index c8e4d62..72ed776 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -7,10 +7,10 @@ tasks: hmsw: # home-manager switch cmds: - nix run nixpkgs#home-manager -- switch --flake .#{{env "NAME"}} - dwsw: # nix-darwin switch + darwin-sw: # nix-darwin switch cmds: - nix run nix-darwin -- switch --flake .#marisa - dwhmsw: + darwin-home-sw: cmds: - nix run nixpkgs#home-manager -- switch --flake .#marisa gc: diff --git a/flake.lock b/flake.lock index d13d1fb..e104452 100644 --- a/flake.lock +++ b/flake.lock @@ -174,11 +174,11 @@ ] }, "locked": { - "lastModified": 1733133928, - "narHash": "sha256-gU40r9AfpIr4eq+0noM8yH1Hxf+EA3dqfIpFtQl8Y1E=", + "lastModified": 1733175814, + "narHash": "sha256-zFOtOaqjzZfPMsm1mwu98syv3y+jziAq5DfWygaMtLg=", "owner": "nix-community", "repo": "home-manager", - "rev": "873e39d5f4437d2f3ab06881fea8e63e45e1d011", + "rev": "bf23fe41082aa0289c209169302afd3397092f22", "type": "github" }, "original": { @@ -199,11 +199,11 @@ ] }, "locked": { - "lastModified": 1733098025, - "narHash": "sha256-HOzahkMv67wtSYcudRpGqNXjFwFoc2lwq0+Ev6h8T3k=", + "lastModified": 1733211153, + "narHash": "sha256-Ml7GGmUsaDldssIVE189Sf+PMPRgkkGpj66EvZvy8MI=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "73ec92a4c2773ead4af1c657ea81142d4a27fe78", + "rev": "90426479f3220aadcc01832db56ee8cfa3886671", "type": "github" }, "original": { @@ -215,11 +215,11 @@ "neovim-src": { "flake": false, "locked": { - "lastModified": 1733090308, - "narHash": "sha256-oIbVYa5y0lgXDRaZUn0MdAKC2Vf9OakbtIFmbhL8K1k=", + "lastModified": 1733163189, + "narHash": "sha256-0NlEbJgUYghWNgp2Iiak8N989Cvjoq87xkeRCagfCeU=", "owner": "neovim", "repo": "neovim", - "rev": "feb62d5429680278c1353c565db6bb3ecb3b7c24", + "rev": "49d6cd1da86cab49c7a5a8c79e59d48d016975fa", "type": "github" }, "original": { diff --git a/home-manager/hosts/marisa/alacritty.nix b/home-manager/hosts/marisa/alacritty.nix new file mode 100644 index 0000000..9e02cf1 --- /dev/null +++ b/home-manager/hosts/marisa/alacritty.nix @@ -0,0 +1,35 @@ +{ pkgs, lib, ... }: + let + src = pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "alacritty"; + sha256 = "1r2z223hza63v5lmzlg3022mlar67j3a2gh41rsaiqwja2wyiihz"; + rev = "f6cb5a5c2b404cdaceaff193b9c52317f62c62f7"; + }; + in +{ + programs.alacritty = { + enable = true; + settings = { + window = { + blur = true; + opacity = 0.7; + dimensions = { + columns = 180; + lines = 55; + }; + position = { + x = 300; + y = 250; + }; + }; + font = { + size = 15; + normal = { + family = "PlemolJP35 Console NF"; + style = "Regular"; + }; + }; + } // lib.importTOML "${src}/catppuccin-mocha.toml"; + }; +} diff --git a/home-manager/hosts/marisa/default.nix b/home-manager/hosts/marisa/default.nix index c26f480..4500d56 100644 --- a/home-manager/hosts/marisa/default.nix +++ b/home-manager/hosts/marisa/default.nix @@ -4,6 +4,7 @@ let in rec { imports = [ + ./alacritty.nix ./git.nix ]; @@ -25,4 +26,12 @@ rec { homeDirectory = "/Users/${home.username}"; stateVersion = "24.11"; }; + + targets.darwin.defaults = { + # DS_Store + "com.apple.desktopservices" = { + DSDontWriteUSBStores = true; + DSDontWriteNetworkStores = true; + }; + }; } diff --git a/home-manager/programs/git.nix b/home-manager/programs/git.nix index 0212d12..a6d6b17 100644 --- a/home-manager/programs/git.nix +++ b/home-manager/programs/git.nix @@ -15,6 +15,9 @@ cm = "commit -m"; al = "config --get-regexp ^alias\\."; }; + ignores = [ + ".DS_Store" + ]; extraConfig = { init = { defaultBranch = "main"; @@ -31,6 +34,12 @@ push = { autoSetupRemote = true; }; + ghq = { + user = "Allianaab2m"; + }; + core = { + pager = "delta"; + }; }; }; } diff --git a/home-manager/programs/package.nix b/home-manager/programs/package.nix index 5268144..f6ef80b 100644 --- a/home-manager/programs/package.nix +++ b/home-manager/programs/package.nix @@ -6,7 +6,7 @@ let ]; # Language runtimes dev = with pkgs; [ - gcc nodejs_22 nodePackages.pnpm go python3 deno + gcc nodejs_22 nodePackages.pnpm go python3 deno typst ]; rust = with pkgs; [ diff --git a/nix-darwin/default.nix b/nix-darwin/default.nix index f63fc5d..2dbbe61 100644 --- a/nix-darwin/default.nix +++ b/nix-darwin/default.nix @@ -7,12 +7,22 @@ }; }; + security.pam.enableSudoTouchIdAuth = true; + services.nix-daemon.enable = true; system = { stateVersion = 5; defaults = { - NSGlobalDomain.AppleShowAllExtensions = true; + NSGlobalDomain = { + AppleShowAllExtensions = true; + # 長押しして出てくるアクセントメニューを消す + ApplePressAndHoldEnabled = false; + # キーリピート + InitialKeyRepeat = 11; + KeyRepeat = 2; + "com.apple.mouse.tapBehavior" = 1; + }; finder = { AppleShowAllFiles = true; AppleShowAllExtensions = true; @@ -24,6 +34,20 @@ show-recents = false; orientation = "left"; mineffect = "scale"; + minimize-to-application = true; + wvous-br-corner = 1; + }; + screencapture = { + disable-shadow = true; + }; + controlcenter = { + BatteryShowPercentage = true; + }; + WindowManager = { + EnableTiledWindowMargins = false; + }; + trackpad = { + Clicking = true; }; }; }; @@ -35,6 +59,23 @@ }; casks = [ "1password" + "raycast" + "karabiner-elements" + "arc" + "notion" + "discord" + "microsoft-word" + "microsoft-powerpoint" + "microsoft-excel" + "google-drive" + "orbstack" + "visual-studio-code@insiders" + ]; + }; + + fonts = { + packages = with pkgs; [ + plemoljp-nf ]; }; } From a97f6b9e284ca35a5c7bf98483f4b790f620f24b Mon Sep 17 00:00:00 2001 From: Alliana <56180684+Allianaab2m@users.noreply.github.com> Date: Wed, 4 Dec 2024 12:26:18 +0900 Subject: [PATCH 5/9] chore: separate files --- nix-darwin/brew.nix | 24 +++++++++++++++ nix-darwin/default.nix | 67 ++++-------------------------------------- nix-darwin/system.nix | 43 +++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 62 deletions(-) create mode 100644 nix-darwin/brew.nix create mode 100644 nix-darwin/system.nix diff --git a/nix-darwin/brew.nix b/nix-darwin/brew.nix new file mode 100644 index 0000000..02ff791 --- /dev/null +++ b/nix-darwin/brew.nix @@ -0,0 +1,24 @@ +{...}: { + homebrew = { + enable = true; + onActivation = { + autoUpdate = true; + }; + casks = [ + "1password" + "raycast" + "karabiner-elements" + "arc" + "notion" + "discord" + "microsoft-word" + "microsoft-powerpoint" + "microsoft-excel" + "google-drive" + "orbstack" + "visual-studio-code@insiders" + "tailscale" + ]; + }; + +} diff --git a/nix-darwin/default.nix b/nix-darwin/default.nix index 2dbbe61..f61180a 100644 --- a/nix-darwin/default.nix +++ b/nix-darwin/default.nix @@ -1,4 +1,9 @@ { pkgs, ... }: { + imports = [ + ./system.nix + ./brew.nix + ]; + nix = { optimise.automatic = true; settings = { @@ -11,68 +16,6 @@ services.nix-daemon.enable = true; - system = { - stateVersion = 5; - defaults = { - NSGlobalDomain = { - AppleShowAllExtensions = true; - # 長押しして出てくるアクセントメニューを消す - ApplePressAndHoldEnabled = false; - # キーリピート - InitialKeyRepeat = 11; - KeyRepeat = 2; - "com.apple.mouse.tapBehavior" = 1; - }; - finder = { - AppleShowAllFiles = true; - AppleShowAllExtensions = true; - ShowPathbar = true; - ShowStatusBar = true; - }; - dock = { - autohide = true; - show-recents = false; - orientation = "left"; - mineffect = "scale"; - minimize-to-application = true; - wvous-br-corner = 1; - }; - screencapture = { - disable-shadow = true; - }; - controlcenter = { - BatteryShowPercentage = true; - }; - WindowManager = { - EnableTiledWindowMargins = false; - }; - trackpad = { - Clicking = true; - }; - }; - }; - - homebrew = { - enable = true; - onActivation = { - autoUpdate = true; - }; - casks = [ - "1password" - "raycast" - "karabiner-elements" - "arc" - "notion" - "discord" - "microsoft-word" - "microsoft-powerpoint" - "microsoft-excel" - "google-drive" - "orbstack" - "visual-studio-code@insiders" - ]; - }; - fonts = { packages = with pkgs; [ plemoljp-nf diff --git a/nix-darwin/system.nix b/nix-darwin/system.nix new file mode 100644 index 0000000..667416d --- /dev/null +++ b/nix-darwin/system.nix @@ -0,0 +1,43 @@ +{...}: { + system = { + stateVersion = 5; + defaults = { + NSGlobalDomain = { + AppleShowAllExtensions = true; + # 長押しして出てくるアクセントメニューを消す + ApplePressAndHoldEnabled = false; + # キーリピート + InitialKeyRepeat = 11; + KeyRepeat = 2; + "com.apple.mouse.tapBehavior" = 1; + }; + finder = { + AppleShowAllFiles = true; + AppleShowAllExtensions = true; + ShowPathbar = true; + ShowStatusBar = true; + }; + dock = { + autohide = true; + show-recents = false; + orientation = "left"; + mineffect = "scale"; + minimize-to-application = true; + wvous-br-corner = 1; + }; + screencapture = { + disable-shadow = true; + }; + controlcenter = { + BatteryShowPercentage = true; + }; + WindowManager = { + EnableTiledWindowMargins = false; + }; + trackpad = { + Clicking = true; + }; + }; + }; + +} From e51dae111e888c3a866298eb8a1603b9b8e595a6 Mon Sep 17 00:00:00 2001 From: Alliana <56180684+Allianaab2m@users.noreply.github.com> Date: Fri, 6 Dec 2024 18:19:47 +0900 Subject: [PATCH 6/9] chore: update --- config/nvim/lazy-lock.json | 14 +++++------ home-manager/programs/default.nix | 1 + home-manager/programs/fastfetch.nix | 36 +++++++++++++++++++++++++++++ home-manager/programs/zsh.nix | 14 ++++++++++- nix-darwin/brew.nix | 1 + 5 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 home-manager/programs/fastfetch.nix diff --git a/config/nvim/lazy-lock.json b/config/nvim/lazy-lock.json index e7e0c8e..9cb5f27 100644 --- a/config/nvim/lazy-lock.json +++ b/config/nvim/lazy-lock.json @@ -5,17 +5,17 @@ "cmp-git": { "branch": "main", "commit": "ec049036e354ed8ed0215f2427112882e1ea7051" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "conform.nvim": { "branch": "master", "commit": "a203480a350b03092e473bf3001733d547160a73" }, + "conform.nvim": { "branch": "master", "commit": "02fd64fb3d4b18ec029c0e0683c3dc3ec6d2c5b8" }, "dressing.nvim": { "branch": "master", "commit": "fc78a3ca96f4db9f8893bb7e2fd9823e0780451b" }, "fidget.nvim": { "branch": "main", "commit": "e2a175c2abe2d4f65357da1c98c59a5cfb2b543f" }, "flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" }, - "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" }, + "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, "gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" }, - "go.nvim": { "branch": "master", "commit": "6368756601a358b1491ac2ff10d0e2939a76df5e" }, + "go.nvim": { "branch": "master", "commit": "c6d5ca26377d01c4de1f7bff1cd62c8b43baa6bc" }, "guihua.lua": { "branch": "master", "commit": "d783191eaa75215beae0c80319fcce5e6b3beeda" }, "inc-rename.nvim": { "branch": "main", "commit": "1871ca49ae6ee3e9ebee37955ba10c7b1425974f" }, "indent-blankline.nvim": { "branch": "master", "commit": "7871a88056f7144defca9c931e311a3134c5d509" }, - "lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" }, + "lazy.nvim": { "branch": "main", "commit": "56ead98e05bb37a4ec28930a54d836d033cf00f2" }, "lazydev.nvim": { "branch": "main", "commit": "f59bd14a852ca43db38e3662395354cb2a9b13e0" }, "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, "luvit-meta": { "branch": "main", "commit": "57d464c4acb5c2e66bd4145060f5dc9e96a7bbb7" }, @@ -38,14 +38,14 @@ "nvim-dap": { "branch": "master", "commit": "0a0daa796a5919a51e5e5019ffa91219c94c4fef" }, "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "76d80c3d171224315b61c006502a1e30c213a9ab" }, - "nvim-lspconfig": { "branch": "master", "commit": "7b0a2f6b14485bb5a237fc1328a487ff3e4a08c5" }, + "nvim-lspconfig": { "branch": "master", "commit": "1aa9f36b6d542dafc0b4a38c48969d036003b00a" }, "nvim-metals": { "branch": "main", "commit": "f861db9fda55939797ac1b05238c49b0dcdc3bdb" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, "nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" }, "nvim-snippets": { "branch": "main", "commit": "56b4052f71220144689caaa2e5b66222ba5661eb" }, - "nvim-treesitter": { "branch": "master", "commit": "454354e5998edb448111574e58d5f5f2d6a940bd" }, + "nvim-treesitter": { "branch": "master", "commit": "b31188671d8a060022dbbeb6905019e69e310108" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" }, - "nvim-ts-autotag": { "branch": "main", "commit": "f2d24aca1bcbbd2c0306fd93d52e3697027b77ff" }, + "nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" }, "obscure.nvim": { "branch": "main", "commit": "17cda9c64e3534510668881f6e7637b8d88390cf" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, diff --git a/home-manager/programs/default.nix b/home-manager/programs/default.nix index a922233..9854e58 100644 --- a/home-manager/programs/default.nix +++ b/home-manager/programs/default.nix @@ -4,6 +4,7 @@ ./bat.nix ./delta.nix ./direnv.nix + ./fastfetch.nix ./git.nix ./gh.nix ./lazygit.nix diff --git a/home-manager/programs/fastfetch.nix b/home-manager/programs/fastfetch.nix new file mode 100644 index 0000000..91328f0 --- /dev/null +++ b/home-manager/programs/fastfetch.nix @@ -0,0 +1,36 @@ +{...}: { + programs.fastfetch = { + enable = true; + settings = { + display = { + size = { + binaryPrefix = "si"; + }; + percent = { + type = 3; + }; + }; + modules = [ + "title" + "separator" + "os" + "host" + "kernel" + "cpu" + "gpu" + "memory" + "disk" + "battery" + "separator" + "packages" + "display" + "de" + "wm" + "terminal" + "terminalfont" + "player" + "media" + ]; + }; + }; +} diff --git a/home-manager/programs/zsh.nix b/home-manager/programs/zsh.nix index c35d2f2..46cd7d1 100644 --- a/home-manager/programs/zsh.nix +++ b/home-manager/programs/zsh.nix @@ -16,7 +16,19 @@ dot = "cd ~/dotfiles"; }; initExtra = '' - eval "$(direnv hook zsh)" + function _fzf_cd_ghq() { + FZF_DEFAULT_OPTS="''${FZF_DEFAULT_OPTS} --reverse --height=50%" + local root="$(ghq root)" + local repo="$(ghq list | fzf --preview="ls -AF --color=always ''${root}/{1}")" + local dir="''${root}/''${repo}" + [ -n "''${dir}" ] && cd "''${dir}" + zle accept-line + zle reset-prompt + } + + zle -N _fzf_cd_ghq + bindkey "^g" _fzf_cd_ghq + eval "$(direnv hook zsh)" ''; }; } diff --git a/nix-darwin/brew.nix b/nix-darwin/brew.nix index 02ff791..ff22daa 100644 --- a/nix-darwin/brew.nix +++ b/nix-darwin/brew.nix @@ -3,6 +3,7 @@ enable = true; onActivation = { autoUpdate = true; + cleanup = "uninstall"; }; casks = [ "1password" From 99e93032812f4c88f795a4cca412dbda647d5f64 Mon Sep 17 00:00:00 2001 From: Alliana <56180684+Allianaab2m@users.noreply.github.com> Date: Sat, 7 Dec 2024 01:23:27 +0900 Subject: [PATCH 7/9] feat: add anytype (via brew) --- nix-darwin/brew.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix-darwin/brew.nix b/nix-darwin/brew.nix index ff22daa..ccf3497 100644 --- a/nix-darwin/brew.nix +++ b/nix-darwin/brew.nix @@ -19,6 +19,7 @@ "orbstack" "visual-studio-code@insiders" "tailscale" + "anytype" ]; }; From 454af799176ca0b8d7f0502c1a89a8a29346bfcb Mon Sep 17 00:00:00 2001 From: Alliana <56180684+Allianaab2m@users.noreply.github.com> Date: Sat, 7 Dec 2024 12:18:56 +0900 Subject: [PATCH 8/9] chore: update --- home-manager/hosts/marisa/aerospace.nix | 127 ++++++++++++++++++++++++ home-manager/hosts/marisa/default.nix | 6 +- nix-darwin/brew.nix | 30 +++--- nix-darwin/default.nix | 2 +- nix-darwin/system.nix | 5 + 5 files changed, 152 insertions(+), 18 deletions(-) create mode 100644 home-manager/hosts/marisa/aerospace.nix diff --git a/home-manager/hosts/marisa/aerospace.nix b/home-manager/hosts/marisa/aerospace.nix new file mode 100644 index 0000000..d99b833 --- /dev/null +++ b/home-manager/hosts/marisa/aerospace.nix @@ -0,0 +1,127 @@ +{...}: { + home.file.".aerospace.toml".text = '' + # Start aerospace at login + start-at-login = true + + enable-normalization-flatten-containers = true + enable-normalization-opposite-orientation-for-nested-containers = true + + accordion-padding = 30 + + default-root-container-layout = 'tiles' + + on-focused-monitor-changed = ['move-mouse monitor-lazy-center'] + + [key-mapping] + preset = 'qwerty' + + [gaps] + inner.vertical = 8 + inner.horizontal = 8 + outer.top = 8 + outer.left = 8 + outer.right = 8 + outer.bottom = 8 + + [mode.main.binding] + + # Change split layout + alt-slash = 'layout tiles horizontal vertical' + alt-comma = 'layout accordion horizontal vertical' + + # Terminal + alt-enter = 'exec-and-forget open -n /Users/alliana/Applications/Home Manager Apps/Alacritty.app' + alt-t = 'exec-and-forget open -n /Users/alliana/Applications/Home Manager Apps/Alacritty.app' + + # Window Focus + alt-h = 'focus left' + alt-j = 'focus down' + alt-k = 'focus up' + alt-l = 'focus right' + + # Window Move + alt-shift-h = 'move left' + alt-shift-j = 'move down' + alt-shift-k = 'move up' + alt-shift-l = 'move right' + + # Window Resize + alt-shift-minus = 'resize smart -50' + alt-shift-equal = 'resize smart +50' + + # Switch workspaces + alt-1 = 'workspace 1' + alt-2 = 'workspace 2' + alt-3 = 'workspace 3' + alt-4 = 'workspace 4' + alt-5 = 'workspace 5' + alt-6 = 'workspace 6' + alt-7 = 'workspace 7' + alt-8 = 'workspace 8' + alt-9 = 'workspace 9' + alt-0 = 'workspace 0' + + # Window move to workspaces + alt-shift-1 = 'move-node-to-workspace 1' + alt-shift-2 = 'move-node-to-workspace 2' + alt-shift-3 = 'move-node-to-workspace 3' + alt-shift-4 = 'move-node-to-workspace 4' + alt-shift-5 = 'move-node-to-workspace 5' + alt-shift-6 = 'move-node-to-workspace 6' + alt-shift-7 = 'move-node-to-workspace 7' + alt-shift-8 = 'move-node-to-workspace 8' + alt-shift-9 = 'move-node-to-workspace 9' + alt-shift-0 = 'move-node-to-workspace 0' + + # Switch workspaces with F-row + f1 = 'workspace 1' + f2 = 'workspace 2' + f3 = 'workspace 3' + f4 = 'workspace 4' + f5 = 'workspace 5' + f6 = 'workspace 6' + f7 = 'workspace 7' + f8 = 'workspace 8' + f9 = 'workspace 9' + f10 = 'workspace 0' + + # Window move to workspaces with F-row + shift-f1 = 'move-node-to-workspace 1' + shift-f2 = 'move-node-to-workspace 2' + shift-f3 = 'move-node-to-workspace 3' + shift-f4 = 'move-node-to-workspace 4' + shift-f5 = 'move-node-to-workspace 5' + shift-f6 = 'move-node-to-workspace 6' + shift-f7 = 'move-node-to-workspace 7' + shift-f8 = 'move-node-to-workspace 8' + shift-f9 = 'move-node-to-workspace 9' + shift-f10 = 'move-node-to-workspace 0' + + # Mode service + alt-shift-semicolon = 'mode service' + + # workspace assignment + [workspace-to-monitor-force-assignment] + 1 = 'main' + 2 = 'main' + 3 = 'main' + 4 = 'main' + 5 = 'main' + 6 = ['secondary', 'main'] + 7 = ['secondary', 'main'] + 8 = ['secondary', 'main'] + 9 = ['secondary', 'main'] + 0 = ['secondary', 'main'] + + [mode.service.binding] + esc = ['reload-config', 'mode main'] + + [[on-window-detected]] + if.app-id = 'company.thebrowser.Browser' + run = 'move-node-to-workspace 1' + + [[on-window-detected]] + if.app-id = 'org.alacritty' + run = 'move-node-to-workspace 2' + ''; +} diff --git a/home-manager/hosts/marisa/default.nix b/home-manager/hosts/marisa/default.nix index 4500d56..d944dd8 100644 --- a/home-manager/hosts/marisa/default.nix +++ b/home-manager/hosts/marisa/default.nix @@ -5,13 +5,13 @@ in rec { imports = [ ./alacritty.nix + ./aerospace.nix ./git.nix ]; home.packages = with pkgs; [ gcc alacritty - # _1password-gui ]; home.activation = { @@ -27,6 +27,10 @@ rec { stateVersion = "24.11"; }; + home.file.".hushlogin" = { + text = ""; + }; + targets.darwin.defaults = { # DS_Store "com.apple.desktopservices" = { diff --git a/nix-darwin/brew.nix b/nix-darwin/brew.nix index ccf3497..290ab7c 100644 --- a/nix-darwin/brew.nix +++ b/nix-darwin/brew.nix @@ -1,25 +1,23 @@ -{...}: { +{...}: + let + browser = ["arc"]; + tools = ["1password" "google-drive" "tailscale"]; + keybind = ["raycast" "karabiner-elements" "aerospace"]; + msoffice = ["microsoft-word" "microsoft-excel" "microsoft-powerpoint"]; + chat = ["discord"]; + dev = ["orbstack" "visual-studio-code@insiders"]; + note = ["notion" "anytype"]; + in +{ homebrew = { enable = true; onActivation = { autoUpdate = true; cleanup = "uninstall"; }; - casks = [ - "1password" - "raycast" - "karabiner-elements" - "arc" - "notion" - "discord" - "microsoft-word" - "microsoft-powerpoint" - "microsoft-excel" - "google-drive" - "orbstack" - "visual-studio-code@insiders" - "tailscale" - "anytype" + casks = browser ++ tools ++ keybind ++ msoffice ++ chat ++ dev ++ note; + taps = [ + "nikitabobko/tap" ]; }; diff --git a/nix-darwin/default.nix b/nix-darwin/default.nix index f61180a..fe8f7b7 100644 --- a/nix-darwin/default.nix +++ b/nix-darwin/default.nix @@ -1,7 +1,7 @@ { pkgs, ... }: { imports = [ - ./system.nix ./brew.nix + ./system.nix ]; nix = { diff --git a/nix-darwin/system.nix b/nix-darwin/system.nix index 667416d..a1ba835 100644 --- a/nix-darwin/system.nix +++ b/nix-darwin/system.nix @@ -10,6 +10,8 @@ InitialKeyRepeat = 11; KeyRepeat = 2; "com.apple.mouse.tapBehavior" = 1; + # Fnキーを押さなくてもF1~F12が使えるように + "com.apple.keyboard.fnState" = true; }; finder = { AppleShowAllFiles = true; @@ -24,8 +26,11 @@ mineffect = "scale"; minimize-to-application = true; wvous-br-corner = 1; + # for Aerospace + Mission Control + expose-group-by-app = true; }; screencapture = { + location = "/Users/alliana/Pictures/screenshot"; disable-shadow = true; }; controlcenter = { From ebbac283c05cd15c91f12b35c57a35f734e01ec9 Mon Sep 17 00:00:00 2001 From: Alliana <56180684+Allianaab2m@users.noreply.github.com> Date: Sat, 7 Dec 2024 12:27:53 +0900 Subject: [PATCH 9/9] docs: add comment --- home-manager/hosts/marisa/default.nix | 7 +++---- nix-darwin/README.md | 8 ++++++++ nix-darwin/system.nix | 5 +++++ 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 nix-darwin/README.md diff --git a/home-manager/hosts/marisa/default.nix b/home-manager/hosts/marisa/default.nix index d944dd8..390047f 100644 --- a/home-manager/hosts/marisa/default.nix +++ b/home-manager/hosts/marisa/default.nix @@ -1,3 +1,4 @@ +# Marisa - Apple M3 MacBook Air 13" { lib, config, pkgs, homeManager, ... }: let symlink = config.lib.file.mkOutOfStoreSymlink; @@ -9,10 +10,7 @@ rec { ./git.nix ]; - home.packages = with pkgs; [ - gcc - alacritty - ]; + home.packages = with pkgs; []; home.activation = { updateLinks = '' @@ -27,6 +25,7 @@ rec { stateVersion = "24.11"; }; + # Remove `Last login:` prompt home.file.".hushlogin" = { text = ""; }; diff --git a/nix-darwin/README.md b/nix-darwin/README.md new file mode 100644 index 0000000..2c8507b --- /dev/null +++ b/nix-darwin/README.md @@ -0,0 +1,8 @@ +# nix-darwin + +```txt +brew.nix => Installing with homebrew(cask) +system.nix => Setting system preferences +``` + +Some `.config` settings will find `home-manager/hosts/*/.nix`. (i.e. Aerospace, Alacritty) diff --git a/nix-darwin/system.nix b/nix-darwin/system.nix index a1ba835..7d9c52c 100644 --- a/nix-darwin/system.nix +++ b/nix-darwin/system.nix @@ -25,10 +25,15 @@ orientation = "left"; mineffect = "scale"; minimize-to-application = true; + # 右下にカーソル動かしたら出るメモを無効化 wvous-br-corner = 1; # for Aerospace + Mission Control expose-group-by-app = true; }; + # Fnキーで入力ソースを切り替えない + hitoolbox = { + AppleFnUsageType = "Do Nothing"; + }; screencapture = { location = "/Users/alliana/Pictures/screenshot"; disable-shadow = true;