Skip to content

Commit

Permalink
🧑💻 Improve darwin settings
Browse files Browse the repository at this point in the history
  • Loading branch information
turtton committed Jan 16, 2025
1 parent 58cefd2 commit 1848932
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 20 deletions.
12 changes: 12 additions & 0 deletions darwin/fonts.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{ pkgs, ... }: {
fonts.packages = with pkgs; [
noto-fonts
noto-fonts-cjk-serif
noto-fonts-cjk-sans
noto-fonts-emoji
nerd-fonts.jetbrains-mono
nerd-fonts.hack
twemoji-color-font
rictydiminished-with-firacode
];
}
24 changes: 24 additions & 0 deletions darwin/system.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,31 @@
};
keyboard = {
enableKeyMapping = true;
swapLeftCtrlAndFn = true;
userKeyMapping =
let
leftFn = 1095216660483;
leftControl = 30064771296;
# alt key
leftOption = 30064771298;
leftCommand = 30064771299;
in
[
{
HIDKeyboardModifierMappingSrc = leftFn;
HIDKeyboardModifierMappingDst = leftControl;
}
{
HIDKeyboardModifierMappingSrc = leftControl;
HIDKeyboardModifierMappingDst = leftCommand;
}
{
HIDKeyboardModifierMappingSrc = leftCommand;
HIDKeyboardModifierMappingDst = leftFn;
}
];
#remapCapsLockToControl = true;
};
};
security.pam.enableSudoTouchIdAuth = true;
}
29 changes: 18 additions & 11 deletions home-manager/gui/shared/default.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
{
imports = [
./fcitx
./libskk
./browser.nix
./chat.nix
./document.nix
./image.nix
./kdeconnect.nix
./keybase.nix
./media.nix
{ pkgs, hostPlatform, ... }: {
imports =
if hostPlatform.isLinux then [
./fcitx
./libskk
./chat.nix
./document.nix
./image.nix
./kdeconnect.nix
./keybase.nix
] else [ ] ++ [
./browser.nix
./media.nix
];

home.packages = with pkgs; lib.optionals hostPlatform.isDarwin [
raycast
macskk
];
}
21 changes: 14 additions & 7 deletions hosts/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ let
};
pkgs-staging-next = import inputs.nixpkgs-staging-next { inherit system; };
lib = originPkgs.lib;
hostPlatform = originPkgs.hostPlatform;
nixosSystem = import (nixpkgs + "/nixos/lib/eval-config.nix");
usernames = map (h: h.username) homes;
# Targets for home-manager configurations
Expand Down Expand Up @@ -64,7 +65,7 @@ let
useUserPackages = true;
sharedModules = homeModules;
extraSpecialArgs = {
inherit inputs system;
inherit inputs system hostPlatform;
};
backupFileExtension = "backup";
};
Expand All @@ -88,12 +89,13 @@ let
)
homes;
specialArgs = {
inherit inputs hostname usernames system pkgs-staging-next;
inherit inputs hostname usernames system pkgs-staging-next hostPlatform;
};
};
createDarwinConfig = { system, hostname, username, modules, homeModule }:
let
# originPkgs = inputs.nixpkgs.legacyPackages.${system};
originPkgs = inputs.nixpkgs.legacyPackages.${system};
hostPlatform = originPkgs.hostPlatform;
# nixpkgs = originPkgs.applyPatches {
# name = "nixpkgs-patched";
# src = inputs.nixpkgs;
Expand All @@ -103,7 +105,7 @@ let
in
inputs.nix-darwin.lib.darwinSystem {
specialArgs = {
inherit inputs hostname username system;
inherit inputs hostname username system hostPlatform;
};
modules = modules ++ [
./../overlay/d-darwin.nix
Expand All @@ -123,7 +125,7 @@ let
};
};
extraSpecialArgs = {
inherit inputs system username;
inherit inputs system username hostPlatform;
};
};
}
Expand All @@ -135,15 +137,20 @@ let
, username
, overlays ? [ ]
, modules
}: inputs.home-manager.lib.homeManagerConfiguration {
}:
let
pkgs = import inputs.nixpkgs {
inherit system overlays;
config = {
allowUnfree = true;
};
};
hostPlatform = pkgs.hostPlatform;
in
inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = {
inherit inputs username system;
inherit inputs username system hostPlatform;
};
modules = modules ++ [
{
Expand Down
1 change: 1 addition & 0 deletions hosts/dreamac/darwin.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
imports = [
./../../darwin/fonts.nix
./../../darwin/nix.nix
./../../darwin/system.nix
];
Expand Down
3 changes: 1 addition & 2 deletions hosts/dreamac/home-manager.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
(import ./../../home-manager/cli/git.nix { userName = "turtton"; userEmail = "[email protected]"; signingKey = "8152FC5D0B5A76E1"; })
./../../home-manager/cli/shell/zsh
./../../home-manager/gui/dev
./../../home-manager/gui/shared/browser.nix
./../../home-manager/gui/shared/media.nix
./../../home-manager/gui/shared
./../../home-manager/gui/term/alacritty.nix
];
}

0 comments on commit 1848932

Please sign in to comment.