diff --git a/config.nix b/config.nix index 6f69a13..ad171bd 100644 --- a/config.nix +++ b/config.nix @@ -9,6 +9,7 @@ with lib; { options = { username = mkOption {type = types.str;}; dotfilesPath = mkOption {type = types.str;}; + homePath = mkOption {type = types.str;}; gitSigningKey = mkOption {type = types.str;}; gpgSshControl = mkOption {type = types.str;}; sshPublicKey = mkOption {type = types.str;}; @@ -24,8 +25,21 @@ with lib; { "aarch64-darwin" = "/Users/${config.username}/.config/dotfiles"; } .${system}; - gitSigningKey = "4EB39A80B52672EC"; - gpgSshControl = "CC54AAD6EF69F323DEB5CDDF9521D2F679686C9E"; - sshPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJP8m7CjSO/Rme3xkIAnvQrVi0AUnLGwDm5DoM6JucWj"; + homePath = + lib.mkDefault + { + x86_64-linux = "/home/${config.username}"; + aarch64-linux = "/home/${config.username}"; + aarch64-darwin = "/Users/${config.username}"; + } + .${system}; + # gpg --list-secret-keys --keyid-format=long --with-keygrip + gitSigningKey = "3F6BC2C89D644E2A"; + gpgSshControl = '' + CC54AAD6EF69F323DEB5CDDF9521D2F679686C9E + 8B9C3AD17594CA999C879DEE644A8F8D9D61DB05 + ''; + # ssh-add -L + sshPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHP5frSskVtjewKR1Bg2U7DFyG/o9HmwaRKbX8vnnEW+"; }; } diff --git a/flake.lock b/flake.lock index bf00ec1..0f66b4a 100644 --- a/flake.lock +++ b/flake.lock @@ -76,22 +76,6 @@ "type": "github" } }, - "darwin-nixpkgs": { - "locked": { - "lastModified": 1718182942, - "narHash": "sha256-7IAIo8dA+XxC9ARKl/xTXUWy5Y0p+JTRxJG6S11sKZg=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "2e92235aa591abc613504fde2546d6f78b18c0cd", - "type": "github" - }, - "original": { - "owner": "nixos", - "repo": "nixpkgs", - "rev": "2e92235aa591abc613504fde2546d6f78b18c0cd", - "type": "github" - } - }, "disko": { "inputs": { "nixpkgs": [ @@ -99,11 +83,11 @@ ] }, "locked": { - "lastModified": 1729712798, - "narHash": "sha256-a+Aakkb+amHw4biOZ0iMo8xYl37uUL48YEXIC5PYJ/8=", + "lastModified": 1735468753, + "narHash": "sha256-2dt1nOe9zf9pDkf5Kn7FUFyPRo581s0n90jxYXJ94l0=", "owner": "nix-community", "repo": "disko", - "rev": "09a776702b004fdf9c41a024e1299d575ee18a7d", + "rev": "84a5b93637cc16cbfcc61b6e1684d626df61eb21", "type": "github" }, "original": { @@ -113,6 +97,22 @@ } }, "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { "flake": false, "locked": { "lastModified": 1673956053, @@ -128,7 +128,7 @@ "type": "github" } }, - "flake-compat_2": { + "flake-compat_3": { "flake": false, "locked": { "lastModified": 1696426674, @@ -169,6 +169,24 @@ "inputs": { "systems": "systems_2" }, + "locked": { + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_3" + }, "locked": { "lastModified": 1681202837, "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", @@ -183,6 +201,29 @@ "type": "github" } }, + "ghostty": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs-stable": "nixpkgs-stable", + "nixpkgs-unstable": [ + "nixpkgs" + ], + "zig": "zig" + }, + "locked": { + "lastModified": 1735535921, + "narHash": "sha256-cfsHww91bRA2Frni54+blIGZGU9/269vaWzeGcNRNN0=", + "owner": "ghostty-org", + "repo": "ghostty", + "rev": "87bd0bb744d6a1c45022aa39f21219d0b6ff3261", + "type": "github" + }, + "original": { + "owner": "ghostty-org", + "repo": "ghostty", + "type": "github" + } + }, "gitignore": { "inputs": { "nixpkgs": [ @@ -212,11 +253,11 @@ ] }, "locked": { - "lastModified": 1729716953, - "narHash": "sha256-FbRKGRRd0amsk/WS/UV9ukJ8jT1dZ2pJBISxkX+uq6A=", + "lastModified": 1735381016, + "narHash": "sha256-CyCZFhMUkuYbSD6bxB/r43EdmDE7hYeZZPTCv0GudO4=", "owner": "nix-community", "repo": "home-manager", - "rev": "a4353cc43d1b4dd6bdeacea90eb92a8b7b78a9d7", + "rev": "10e99c43cdf4a0713b4e81d90691d22c6a58bdf2", "type": "github" }, "original": { @@ -228,9 +269,9 @@ "lanzaboote": { "inputs": { "crane": "crane", - "flake-compat": "flake-compat", + "flake-compat": "flake-compat_2", "flake-parts": "flake-parts", - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_2", "nixpkgs": [ "nixpkgs" ], @@ -259,11 +300,11 @@ ] }, "locked": { - "lastModified": 1729757100, - "narHash": "sha256-x+8uGaX66V5+fUBHY23Q/OQyibQ38nISzxgj7A7Jqds=", + "lastModified": 1735478292, + "narHash": "sha256-Ys9pSP9ch0SthhpbjnkCSJ9ZLfaNKnt/dcy7swjmS1A=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "04193f188e4144d7047f83ad1de81d6034d175cd", + "rev": "71a3a075e3229a7518d76636bb762aef2bcb73ac", "type": "github" }, "original": { @@ -274,11 +315,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1729742320, - "narHash": "sha256-u3Of8xRkN//me8PU+RucKA59/6RNy4B2jcGAF36P4jI=", + "lastModified": 1735388221, + "narHash": "sha256-e5IOgjQf0SZcFCEV/gMGrsI0gCJyqOKShBQU0iiM3Kg=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "e8a2f6d5513fe7b7d15701b2d05404ffdc3b6dda", + "rev": "7c674c6734f61157e321db595dbfcd8523e04e19", "type": "github" }, "original": { @@ -289,11 +330,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1729665710, - "narHash": "sha256-AlcmCXJZPIlO5dmFzV3V2XF6x/OpNWUV8Y/FMPGd8Z4=", + "lastModified": 1735471104, + "narHash": "sha256-0q9NGQySwDQc7RhAV2ukfnu7Gxa5/ybJ2ANT8DQrQrs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2768c7d042a37de65bb1b5b3268fc987e534c49d", + "rev": "88195a94f390381c6afcdaa933c2f6ff93959cb4", "type": "github" }, "original": { @@ -303,22 +344,38 @@ "type": "github" } }, - "nixpkgs-24_05": { + "nixpkgs-24_11": { "locked": { - "lastModified": 1717144377, - "narHash": "sha256-F/TKWETwB5RaR8owkPPi+SPJh83AQsm6KrQAlJ8v/uA=", + "lastModified": 1734083684, + "narHash": "sha256-5fNndbndxSx5d+C/D0p/VF32xDiJCJzyOqorOYW4JEo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "805a384895c696f802a9bf5bf4720f37385df547", + "rev": "314e12ba369ccdb9b352a4db26ff419f7c49fa84", "type": "github" }, "original": { "id": "nixpkgs", - "ref": "nixos-24.05", + "ref": "nixos-24.11", "type": "indirect" } }, "nixpkgs-stable": { + "locked": { + "lastModified": 1733423277, + "narHash": "sha256-TxabjxEgkNbCGFRHgM/b9yZWlBj60gUOUnRT/wbVQR8=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "e36963a147267afc055f7cf65225958633e536bf", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "release-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable_2": { "locked": { "lastModified": 1678872516, "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", @@ -349,7 +406,7 @@ "lanzaboote", "nixpkgs" ], - "nixpkgs-stable": "nixpkgs-stable" + "nixpkgs-stable": "nixpkgs-stable_2" }, "locked": { "lastModified": 1681413034, @@ -368,33 +425,16 @@ "root": { "inputs": { "agenix": "agenix", - "darwin-nixpkgs": "darwin-nixpkgs", "disko": "disko", + "ghostty": "ghostty", "home-manager": "home-manager", "lanzaboote": "lanzaboote", "nix-darwin": "nix-darwin", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", - "rose-pine-kitty": "rose-pine-kitty", "simple-nixos-mailserver": "simple-nixos-mailserver" } }, - "rose-pine-kitty": { - "flake": false, - "locked": { - "lastModified": 1693615686, - "narHash": "sha256-AcMVkliLGuabZVGkfQPLhfspkaTZxPG5GyuJdzA4uSg=", - "owner": "rose-pine", - "repo": "kitty", - "rev": "788bf1bf1a688dff9bbacbd9e516d83ac7dbd216", - "type": "github" - }, - "original": { - "owner": "rose-pine", - "repo": "kitty", - "type": "github" - } - }, "rust-overlay": { "inputs": { "flake-utils": [ @@ -423,18 +463,18 @@ "simple-nixos-mailserver": { "inputs": { "blobs": "blobs", - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat_3", "nixpkgs": [ "nixpkgs" ], - "nixpkgs-24_05": "nixpkgs-24_05" + "nixpkgs-24_11": "nixpkgs-24_11" }, "locked": { - "lastModified": 1722877200, - "narHash": "sha256-qgKDNJXs+od+1UbRy62uk7dYal3h98I4WojfIqMoGcg=", + "lastModified": 1735230346, + "narHash": "sha256-zgR8NTiNDPVNrfaiOlB9yHSmCqFDo7Ks2IavaJ2dZo4=", "owner": "simple-nixos-mailserver", "repo": "nixos-mailserver", - "rev": "af7d3bf5daeba3fc28089b015c0dd43f06b176f2", + "rev": "dc0569066e79ae96184541da6fa28f35a33fbf7b", "type": "gitlab" }, "original": { @@ -473,6 +513,46 @@ "repo": "default", "type": "github" } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "zig": { + "inputs": { + "flake-compat": [ + "ghostty" + ], + "flake-utils": "flake-utils", + "nixpkgs": [ + "ghostty", + "nixpkgs-stable" + ] + }, + "locked": { + "lastModified": 1717848532, + "narHash": "sha256-d+xIUvSTreHl8pAmU1fnmkfDTGQYCn2Rb/zOwByxS2M=", + "owner": "mitchellh", + "repo": "zig-overlay", + "rev": "02fc5cc555fc14fda40c42d7c3250efa43812b43", + "type": "github" + }, + "original": { + "owner": "mitchellh", + "repo": "zig-overlay", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 974f51d..8bae7a7 100644 --- a/flake.nix +++ b/flake.nix @@ -23,14 +23,11 @@ simple-nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/master"; simple-nixos-mailserver.inputs.nixpkgs.follows = "nixpkgs"; - # nixpkgs with working and cached swift build - darwin-nixpkgs.url = "github:nixos/nixpkgs?rev=2e92235aa591abc613504fde2546d6f78b18c0cd"; - disko.url = "github:nix-community/disko"; disko.inputs.nixpkgs.follows = "nixpkgs"; - rose-pine-kitty.url = "github:rose-pine/kitty"; - rose-pine-kitty.flake = false; + ghostty.url = "github:ghostty-org/ghostty"; + ghostty.inputs.nixpkgs-unstable.follows = "nixpkgs"; }; outputs = inputs: diff --git a/homes/jakub-macos/default.nix b/homes/jakub-macos/default.nix index af53bca..a7c63fd 100644 --- a/homes/jakub-macos/default.nix +++ b/homes/jakub-macos/default.nix @@ -9,33 +9,65 @@ "common/env" "common/git" "common/home" - "common/kitty" "common/neovim" "common/password-store" + "common/xdg" "common/zsh" "darwin/dark-mode-notify" ]; home = { - packages = with pkgs; [ + packages = with pkgs; let + phpEnv = php84.buildEnv { + extensions = { + enabled, + all, + }: + enabled ++ (with all; [ctype curl dom fileinfo mbstring openssl pdo session tokenizer]); + }; + in [ hyperfine git-crypt pinentry_mac - bun + nerdfetch + oath-toolkit # fix pass support in Raycast + + # dev env managed by mise, but here are some exceptions + phpEnv + phpEnv.packages.composer + shellcheck ]; sessionVariables = { - # Work + # Ruby OBJC_DISABLE_INITIALIZE_FORK_SAFETY = "YES"; DISABLE_SPRING = "true"; + RUBY_YJIT_ENABLE = 1; + RUBY_CONFIGURE_OPTS = "--enable-yjit --with-jemalloc"; + + # Inlined from eval "$(/opt/homebrew/bin/brew shellenv)" + HOMEBREW_PREFIX = "/opt/homebrew"; + HOMEBREW_CELLAR = "/opt/homebrew/Cellar"; + HOMEBREW_REPOSITORY = "/opt/homebrew"; + INFOPATH = "/opt/homebrew/share/info:''${INFOPATH:-}"; + + # Include Homebrew and Orbstack in the PATH + PATH = "/opt/homebrew/bin:/opt/homebrew/sbin:$PATH:/Users/jakub/.orbstack/bin"; + + # Fix Homebrew libs + LDFLAGS = "-L/opt/homebrew/lib"; + CPPFLAGS = "-I/opt/homebrew/include"; + + # Work IAC_PATH = "$HOME/Documents/betterstack/infrastructure-as-code"; }; shellAliases = { # Work linear = "git checkout main && git pull && git checkout -b $(pbpaste)"; - swarm = "RBENV_VERSION=$(cat $IAC_PATH/.ruby-version) $IAC_PATH/exe/swarm"; + swarm = "mise x ruby@$(cat $IAC_PATH/.ruby-version) -- $IAC_PATH/exe/swarm"; prod-deploy = "git checkout main && git pull && swarm production deploy"; + staging-deploy = "git checkout main && git pull && swarm staging deploy"; }; file = { @@ -56,11 +88,28 @@ programs = { gpg.enable = true; + mise = { + enable = true; + globalConfig.tools = { + bun = "latest"; + deno = "latest"; + node = ["latest" "20.3.0"]; + python = "latest"; + ruby = ["latest" "3.3.4" "3.1.1"]; + rust = "latest"; + }; + }; zoxide = { enable = true; enableZshIntegration = true; }; - zsh.profileExtra = builtins.readFile ./profile; + zsh.initExtraBeforeCompInit = '' + # Inlined from ‹eval "$(/opt/homebrew/bin/brew shellenv)"› + fpath+="/opt/homebrew/share/zsh/site-functions" + + # Inlined from ‹~/.orbstack/shell/init.zsh› + fpath+="/Applications/OrbStack.app/Contents/MacOS/../Resources/completions/zsh" + ''; }; home.stateVersion = "24.05"; diff --git a/homes/jakub-macos/profile b/homes/jakub-macos/profile deleted file mode 100644 index fded6a1..0000000 --- a/homes/jakub-macos/profile +++ /dev/null @@ -1,14 +0,0 @@ -source "$HOME/.cargo/env" - -eval "$(/opt/homebrew/bin/brew shellenv)" - -# Added by OrbStack: command-line tools and integration -# Comment this line if you don't want it to be added again. -source ~/.orbstack/shell/init.zsh 2>/dev/null || : - -# Consider moving to home-manager rbenv -eval "$(rbenv init - --no-rehash zsh)" - -eval "$(nodenv init - zsh)" - -export PATH="$HOME/.yarn/bin:$PATH" diff --git a/hosts/nyckelharpa/default.nix b/hosts/nyckelharpa/default.nix index d370695..7cab9e9 100644 --- a/hosts/nyckelharpa/default.nix +++ b/hosts/nyckelharpa/default.nix @@ -38,6 +38,17 @@ ''; }; + launchd.daemons.tildeRemap = { + serviceConfig = { + Label = "tilde-remap"; + KeepAlive = false; + RunAtLoad = true; + }; + script = '' + /usr/bin/hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000035}]}' + ''; + }; + system = { defaults = { dock = { @@ -45,10 +56,9 @@ mineffect = "scale"; persistent-apps = [ "/Applications/Arc.app" + "/Applications/Ghostty.app" "/Applications/RubyMine.app" "/Applications/Cursor.app" - "/Applications/Zed.app" - "${config.users.users.${config.username}.home}/Applications/Home\ Manager\ Apps/kitty.app" "/Applications/Notion.app" "/Applications/Slack.app" "/Applications/Obsidian.app" @@ -72,16 +82,11 @@ }; }; - keyboard = { - enableKeyMapping = true; - nonUS.remapTilde = true; - }; - # Set Git commit hash for darwin-version. configurationRevision = self.rev or self.dirtyRev or null; # Used for backwards compatibility, please read the changelog before changing. - # $ darwin-rebuild changelog + # $ os changelog stateVersion = 4; }; diff --git a/hosts/nyckelharpa/homebrew.nix b/hosts/nyckelharpa/homebrew.nix index 6fa1cea..b0209c3 100644 --- a/hosts/nyckelharpa/homebrew.nix +++ b/hosts/nyckelharpa/homebrew.nix @@ -12,25 +12,28 @@ taps = [ "homebrew/services" - "puma/puma" # for brews -> puma-dev + "puma/puma" ]; brews = [ + "coreutils" "gpg" "gpg2" - "pass" - "pass-otp" - # work specific - "rbenv" - "ruby-build" - "nodenv" - "puma/puma/puma-dev" - "libyaml" + # ruby building + "autoconf" + "gmp" + "jemalloc" "libsodium" - "vips" + "libyaml" + "openssl@3" "python-setuptools" - "php" + "readline" + "vips" + + "puma/puma/puma-dev" + + # services { name = "postgresql@14"; restart_service = "changed"; @@ -42,16 +45,15 @@ ]; casks = [ - "bruno" "1password" "arc" "around" "beekeeper-studio" "cursor" "figma" - "firefox" + "firefox@developer-edition" + "ghostty" "intellij-idea-ce" - "iterm2" "linearmouse" "loom" "macmediakeyforwarder" @@ -67,6 +69,7 @@ "tailscale" "whatsapp" "zed" + "zoom" ]; }; } diff --git a/lib/default.nix b/lib/default.nix index 7095518..237d370 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -64,7 +64,13 @@ inputs @ { home-manager.lib.homeManagerConfiguration { inherit pkgs; extraSpecialArgs = {inherit inputs lib system homeName;}; - modules = [../config.nix agenix.homeManagerModules.default path] ++ lib._.autoloadedModules; + modules = + [ + ../config.nix + agenix.homeManagerModules.default + path + ] + ++ lib._.autoloadedModules; }); in { formatter.${system} = pkgs.alejandra; @@ -96,7 +102,7 @@ inputs @ { mappedSystems = foldl recursiveUpdate {} (mapAttrsToList mapSystem systems); - # Merge all options into one attribute set for use with nixd + # Merge all options into one attribute set for use with ‹nixd› options = let getOptions = configs: foldl recursiveUpdate {} (mapAttrsToList (_: value: value.options) configs); in { diff --git a/modules/autoload/theme.nix b/modules/autoload/theme.nix index e2753e0..d161929 100644 --- a/modules/autoload/theme.nix +++ b/modules/autoload/theme.nix @@ -1,8 +1,16 @@ +# To support dark/light mode switching {lib, ...}: with lib; { options = { - # To support dark/light mode switching - theme.dark.onSwitch = mkOption {type = types.lines;}; - theme.light.onSwitch = mkOption {type = types.lines;}; + theme.dark.onSwitch = mkOption { + type = types.lines; + default = ""; + description = "Commands to run when the OS theme switches to dark mode"; + }; + theme.light.onSwitch = mkOption { + type = types.lines; + default = ""; + description = "Commands to run when the OS theme switches to light mode"; + }; }; } diff --git a/modules/common/aliases.nix b/modules/common/aliases.nix index 456320d..6d63184 100644 --- a/modules/common/aliases.nix +++ b/modules/common/aliases.nix @@ -21,10 +21,12 @@ chx = "chmod +x"; # Git + gad = "git add ."; gc = "git commit"; gcm = "git commit -m"; gca = "git commit --amend"; gcan = "git commit --amend --no-edit"; + gcl = "git clone"; gp = "git push"; gpo = "git push -u origin HEAD"; gfp = "git push --force"; @@ -37,6 +39,11 @@ gb = "git checkout"; gnb = "git checkout -b"; gprev = "git checkout -"; + gr = "git reset HEAD~"; + grh = "git reset --hard HEAD~"; + gclean = "git restore --staged ."; + gs = "git stash"; + gsp = "git stash pop"; # Utils benchzsh = "hyperfine 'zsh -i -c exit' --warmup 1"; diff --git a/modules/common/home.nix b/modules/common/home.nix index 15d2fd1..7ded917 100644 --- a/modules/common/home.nix +++ b/modules/common/home.nix @@ -1,3 +1,4 @@ +# [home-manager] { config, pkgs, diff --git a/modules/common/kitty.nix b/modules/common/kitty.nix deleted file mode 100644 index a078c8b..0000000 --- a/modules/common/kitty.nix +++ /dev/null @@ -1,70 +0,0 @@ -# [home-manager] -{ - config, - inputs, - lib, - system, - ... -}: { - options.programs.kitty = { - darkTheme = lib.mkOption { - type = lib.types.path; - default = "${inputs.rose-pine-kitty}/dist/rose-pine.conf"; - }; - lightTheme = lib.mkOption { - type = lib.types.path; - default = "${inputs.rose-pine-kitty}/dist/rose-pine-dawn.conf"; - }; - }; - - config = { - programs.kitty = let - mod = - { - "x86_64-linux" = "ctrl"; - "aarch64-linux" = "ctrl"; - "aarch64-darwin" = "cmd"; - } - .${system}; - in { - enable = true; - extraConfig = '' - font_size 12.0 - modify_font cell_height +6px - - map ${mod}+t no_op - map ${mod}+c copy_to_clipboard - map ${mod}+v paste_from_clipboard - - mouse_map ${mod}+left press ungrabbed,grabbed mouse_click_url - - confirm_os_window_close 0 - window_padding_width 10 - initial_window_width 640 - initial_window_height 400 - inactive_text_alpha 0.7 - macos_show_window_title_in none - macos_titlebar_color background - macos_quit_when_last_window_closed yes - active_border_color none - enable_audio_bell no - - # If current theme is not set, use the light theme - include ${config.programs.kitty.lightTheme} - include $HOME/.config/kitty_current_theme - ''; - }; - - theme = { - dark.onSwitch = '' - ln -sf "${config.programs.kitty.lightTheme}" "$HOME"/.config/kitty_current_theme - pkill -USR1 kitty - ''; - - light.onSwitch = '' - ln -sf "${config.programs.kitty.darkTheme}" "$HOME"/.config/kitty_current_theme - pkill -USR1 kitty - ''; - }; - }; -} diff --git a/modules/common/nix.nix b/modules/common/nix.nix index 2f3c832..296049b 100644 --- a/modules/common/nix.nix +++ b/modules/common/nix.nix @@ -27,12 +27,11 @@ options = "--delete-older-than 1w"; }; - # Optimize storage + # Periodically optimize storage + # https://nixos.wiki/wiki/Storage_optimization#Automatic # You can also manually optimize the store via: # nix-store --optimise - # Refer to the following link for more details: - # https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-auto-optimise-store - settings.auto-optimise-store = true; + optimise.automatic = true; }; nixpkgs.config.allowUnfree = true; diff --git a/modules/common/xdg.nix b/modules/common/xdg.nix new file mode 100644 index 0000000..edccfbc --- /dev/null +++ b/modules/common/xdg.nix @@ -0,0 +1,25 @@ +# [home-manager] +{...}: { + xdg.enable = true; + + home.sessionVariables = { + CARGO_HOME = "$XDG_DATA_HOME/cargo"; + DOCKER_CONFIG = "$XDG_CONFIG_HOME/docker"; + BUNDLE_USER_CACHE = "$XDG_CACHE_HOME/bundle"; + BUNDLE_USER_CONFIG = "$XDG_CONFIG_HOME/bundle/config"; + BUNDLE_USER_PLUGIN = "$XDG_DATA_HOME/bundle"; + MAVEN_OPTS = ''-Dmaven.repo.local="$XDG_DATA_HOME"/maven/repository''; + NODE_REPL_HISTORY = "$XDG_DATA_HOME/node_repl_history"; + SOLARGRAPH_CACHE = "$XDG_CACHE_HOME/solargraph"; + REDISCLI_HISTFILE = "$XDG_DATA_HOME/redis/rediscli_history"; + RUSTUP_HOME = "$XDG_DATA_HOME/rustup"; + SQLITE_HISTORY = "$XDG_DATA_HOME/sqlite_history"; + TERMINFO = "$XDG_DATA_HOME/terminfo"; + TERMINFO_DIRS = "$XDG_DATA_HOME/terminfo:/usr/share/terminfo"; + }; + + home.shellAliases = { + wget = ''wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"''; + yarn = ''yarn --use-yarnrc "$XDG_CONFIG_HOME/yarn/config"''; + }; +} diff --git a/modules/darwin/dark-mode-notify.nix b/modules/darwin/dark-mode-notify.nix index 6582a27..987c635 100644 --- a/modules/darwin/dark-mode-notify.nix +++ b/modules/darwin/dark-mode-notify.nix @@ -1,25 +1,19 @@ { config, lib, - inputs, - system, + pkgs, ... -}: let - pkgs = import inputs.darwin-nixpkgs { - inherit system; - config.allowUnfree = true; - }; -in { +}: { launchd = let script = pkgs.writeShellApplication { name = "dark-mode-onswitch"; text = '' case "$DARKMODE" in 0) - ${config.theme.dark.onSwitch} + ${config.theme.light.onSwitch} ;; 1) - ${config.theme.light.onSwitch} + ${config.theme.dark.onSwitch} ;; esac '';