[feat] Add darwin configs as well

This commit is contained in:
Uttarayan
2024-02-14 23:46:42 +05:30
parent 465a237519
commit dcd0b6b936
7 changed files with 316 additions and 262 deletions

View File

@@ -1,98 +1,107 @@
{ {pkgs, ...}: {
description = "Example Darwin system flake"; nix = {
settings = {
inputs = { experimental-features = "nix-command flakes repl-flake";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; max-jobs = 8;
# home-manager.url = "github:nix-community/home-manager/master";
# home-manager.inputs.nixpkgs.follows = "nixpkgs";
nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, nix-darwin, nixpkgs }:
let
configuration = { pkgs, ... }: {
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
environment.systemPackages =
with pkgs; [
neovim
bat
ripgrep
fd
fish
nushellFull
tmux
wezterm
# yabai
nerdfonts
];
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
# nix.package = pkgs.nix;
# Necessary for using flakes on this system.
nix = {
settings = {
experimental-features = "nix-command flakes repl-flake";
max-jobs = 8;
};
extraOptions = ''
build-users-group = nixbld
extra-nix-path = nixpkgs=flake:nixpkgs
'';
# keep-outputs = true
# keep-derivations = true
};
# Create /etc/zshrc that loads the nix-darwin environment.
# programs.zsh.enable = true; # default shell on catalina
# programs.fish.enable = true;
# Set Git commit hash for darwin-version.
system.configurationRevision = self.rev or self.dirtyRev or null;
system.keyboard.enableKeyMapping = true;
system.keyboard.remapCapsLockToControl = true;
system.keyboard.swapLeftCommandAndLeftAlt = true;
system.keyboard.userKeyMapping = {
# Right Command to Option
HIDKeyboardModifierMappingSrc = 30064771303;
HIDKeyboardModifierMappingDst = 30064771302;
# Right Option to command
HIDKeyboardModifierMappingSrc = 30064771302;
HIDKeyboardModifierMappingDst = 30064771303;
};
fonts.fonts = [ (pkgs.nerdfonts.override { fonts = [ "Hasklig" "Hack" ]; }) ];
system.defaults.finder.AppleShowAllExtensions = true;
system.defaults.dock.autohide = true;
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 4;
# The platform the configuration will be used on.
nixpkgs.hostPlatform = "aarch64-darwin";
nix.package = pkgs.nix;
};
in
{
# Build darwin flake using:
# $ darwin-rebuild build --flake .#simple
darwinConfigurations.Uttarayans-MacBook-Pro = nix-darwin.lib.darwinSystem {
# system = "aarch64-darwin";
pkgs = import nixpkgs { system = "aarch64-darwin"; };
modules = [ configuration ];
};
# Expose the package set, including overlays, for convenience.
darwinPackages = self.darwinConfigurations.Uttarayans-MacBook-Pro.pkgs;
}; };
};
system.keyboard.enableKeyMapping = true;
system.keyboard.remapCapsLockToControl = true;
system.keyboard.swapLeftCommandAndLeftAlt = true;
system.keyboard.userKeyMapping = [
{
# Right Command to Option
HIDKeyboardModifierMappingSrc = 30064771303;
HIDKeyboardModifierMappingDst = 30064771302;
}
{
# Right Option to command
HIDKeyboardModifierMappingSrc = 30064771302;
HIDKeyboardModifierMappingDst = 30064771303;
}
];
} }
# {
# description = "Example Darwin system flake";
# inputs = {
# nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
# # home-manager.url = "github:nix-community/home-manager/master";
# # home-manager.inputs.nixpkgs.follows = "nixpkgs";
# nix-darwin.url = "github:LnL7/nix-darwin";
# nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
# };
# outputs = inputs @ {
# self,
# nix-darwin,
# nixpkgs,
# }: let
# configuration = {pkgs, ...}: {
# # List packages installed in system profile. To search by name, run:
# # $ nix-env -qaP | grep wget
# environment.systemPackages = with pkgs; [
# neovim
# bat
# ripgrep
# fd
# fish
# nushellFull
# tmux
# wezterm
# # yabai
# nerdfonts
# ];
# # Auto upgrade nix package and the daemon service.
# services.nix-daemon.enable = true;
# # nix.package = pkgs.nix;
# # Necessary for using flakes on this system.
# nix = {
# settings = {
# experimental-features = "nix-command flakes repl-flake";
# max-jobs = 8;
# };
# extraOptions = ''
# build-users-group = nixbld
# extra-nix-path = nixpkgs=flake:nixpkgs
# '';
# # keep-outputs = true
# # keep-derivations = true
# };
# # Create /etc/zshrc that loads the nix-darwin environment.
# # programs.zsh.enable = true; # default shell on catalina
# # programs.fish.enable = true;
# # Set Git commit hash for darwin-version.
# system.configurationRevision = self.rev or self.dirtyRev or null;
# system.keyboard.enableKeyMapping = true;
# system.keyboard.remapCapsLockToControl = true;
# system.keyboard.swapLeftCommandAndLeftAlt = true;
# system.keyboard.userKeyMapping = {
# # Right Command to Option
# HIDKeyboardModifierMappingSrc = 30064771303;
# HIDKeyboardModifierMappingDst = 30064771302;
# # Right Option to command
# HIDKeyboardModifierMappingSrc = 30064771302;
# HIDKeyboardModifierMappingDst = 30064771303;
# };
# fonts.fonts = [(pkgs.nerdfonts.override {fonts = ["Hasklig" "Hack"];})];
# system.defaults.finder.AppleShowAllExtensions = true;
# system.defaults.dock.autohide = true;
# # Used for backwards compatibility, please read the changelog before changing.
# # $ darwin-rebuild changelog
# system.stateVersion = 4;
# # The platform the configuration will be used on.
# nixpkgs.hostPlatform = "aarch64-darwin";
# nix.package = pkgs.nix;
# };
# in {
# # Build darwin flake using:
# # $ darwin-rebuild build --flake .#simple
# darwinConfigurations.Uttarayans-MacBook-Pro = nix-darwin.lib.darwinSystem {
# # system = "aarch64-darwin";
# pkgs = import nixpkgs {system = "aarch64-darwin";};
# modules = [configuration];
# };
# # Expose the package set, including overlays, for convenience.
# # darwinPackages = self.darwinConfigurations.Uttarayans-MacBook-Pro.pkgs;
# };
# }

21
config/nix/flake.lock generated
View File

@@ -1,5 +1,25 @@
{ {
"nodes": { "nodes": {
"darwin": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1707707289,
"narHash": "sha256-YuDt/eSTXMEHv8jS8BEZJgqCcG8Tr3cyqaZjJFXZHsw=",
"owner": "LnL7",
"repo": "nix-darwin",
"rev": "44f50a5ecaab72a61d5fd8e5c5717bc4bf9c25dd",
"type": "github"
},
"original": {
"owner": "LnL7",
"repo": "nix-darwin",
"type": "github"
}
},
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
@@ -198,6 +218,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"darwin": "darwin",
"home-manager": "home-manager", "home-manager": "home-manager",
"neovim-nightly-overlay": "neovim-nightly-overlay", "neovim-nightly-overlay": "neovim-nightly-overlay",
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs_2"

View File

@@ -8,30 +8,57 @@
url = "github:nix-community/home-manager"; url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
}; };
outputs = { nixpkgs, home-manager, ... }@inputs: outputs = {
let nixpkgs,
home-manager,
darwin,
...
} @ inputs: {
homeConfigurations = let
system = "x86_64-linux"; system = "x86_64-linux";
overlays = [ inputs.neovim-nightly-overlay.overlay ]; overlays = [inputs.neovim-nightly-overlay.overlay];
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
in in {
{ "fs0c131y" = home-manager.lib.homeManagerConfiguration {
homeConfigurations."fs0c131y" = home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
# Specify your home configuration modules here, for example,
# the path to your home.nix.
modules = [ modules = [
./home.nix ./home.nix
({ {
nixpkgs.overlays = overlays; nixpkgs.overlays = overlays;
}) }
]; ];
# Optionally use extraSpecialArgs
# to pass through arguments to home.nix
}; };
}; };
darwinConfigurations = let
system = "aarch64-darwin";
pkgs = nixpkgs.legacyPackages.${system};
in {
"Uttarayans-MacBook-Pro" = darwin.lib.darwinSystem {
modules = [
home-manager.darwinModules.home-manager
./darwin.nix
({config, ...}: {
home-manager = {
users = {
fs0c131y = {
home = "/Users/fs0c131y";
stateVersion = "21.05";
configuration = home-manager.configurations.fs0c131y;
};
};
};
})
];
};
};
};
} }

View File

@@ -1,13 +1,10 @@
{ config, pkgs, ... }: {
config,
pkgs,
...
}:
# https://mipmip.github.io/home-manager-option-search/ # https://mipmip.github.io/home-manager-option-search/
{ {
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.username = "fs0c131y";
home.homeDirectory = "/home/fs0c131y";
home.stateVersion = "23.11"; # Please read the comment before changing.
imports = [ imports = [
# Include the results of the hardware scan. # Include the results of the hardware scan.
./tmux.nix ./tmux.nix
@@ -31,6 +28,7 @@
${pkgs.macchina.outPath}/bin/macchina ${pkgs.macchina.outPath}/bin/macchina
''; '';
}; };
nushell = { nushell = {
enable = true; enable = true;
shellAliases = { shellAliases = {
@@ -65,10 +63,10 @@
enableNushellIntegration = true; enableNushellIntegration = true;
}; };
fzf = { fzf = {
enable = true; enable = true;
package = pkgs.fzf; package = pkgs.fzf;
enableFishIntegration = true; enableFishIntegration = true;
tmux.enableShellIntegration = true; tmux.enableShellIntegration = true;
}; };
keychain = { keychain = {
enable = true; enable = true;
@@ -77,97 +75,104 @@
enableNushellIntegration = true; enableNushellIntegration = true;
}; };
yazi = { yazi = {
enable = true; enable = true;
enableFishIntegration = true; enableFishIntegration = true;
enableNushellIntegration = true; enableNushellIntegration = true;
}; };
foot = { foot = {
enable = true; enable = pkgs.stdenv.isLinux;
server.enable = true; server.enable = true;
settings = { settings = {
main = { main = {
shell = "${pkgs.fish.outPath}/bin/fish"; shell = "${pkgs.fish.outPath}/bin/fish";
font = "Hasklug Nerd Font Mono:size=13"; font = "Hasklug Nerd Font Mono:size=13";
initial-window-size-pixels="1440x800"; initial-window-size-pixels = "1440x800";
}; };
colors = { colors = {
foreground = "f8f8f2"; foreground = "f8f8f2";
background=000000; background = 000000;
alpha=0.8; alpha = 0.8;
"136" = "af8700"; "136" = "af8700";
regular0 ="21222c"; regular0 = "21222c";
regular1 ="ff5555"; regular1 = "ff5555";
regular2 ="50fa7b"; regular2 = "50fa7b";
regular3 ="f1fa8c"; regular3 = "f1fa8c";
regular4 ="bd93f9"; regular4 = "bd93f9";
regular5 ="ff79c6"; regular5 = "ff79c6";
regular6 ="8be9fd"; regular6 = "8be9fd";
regular7 ="f8f8f2"; regular7 = "f8f8f2";
bright0 ="6272a4";
bright1 ="ff6e6e";
bright2 ="69ff94";
bright3 ="ffffa5";
bright4 ="d6acff";
bright5 ="ff92df";
bright6 ="a4ffff";
bright7 ="ffffff";
bright0 = "6272a4";
bright1 = "ff6e6e";
bright2 = "69ff94";
bright3 = "ffffa5";
bright4 = "d6acff";
bright5 = "ff92df";
bright6 = "a4ffff";
bright7 = "ffffff";
}; };
}; };
}; };
# Let Home Manager install and manage itself.
home-manager = {
enable = true;
};
}; };
home.packages = [ home = {
pkgs.macchina # Home Manager needs a bit of information about you and the paths it should
pkgs.nixpkgs-fmt # manage.
pkgs.neovim-nightly username = "fs0c131y";
pkgs.cachix homeDirectory = "/home/fs0c131y";
# # Adds the 'hello' command to your environment. It prints a friendly
# # "Hello, world!" when run.
# pkgs.hello
# # It is sometimes useful to fine-tune packages, for example, by applying stateVersion = "23.11";
# # overrides. You can do that directly here, just don't forget the
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of
# # fonts?
# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
# # You can also create simple shell scripts directly inside your packages = [
# # configuration. For example, this adds a command 'my-hello' to your pkgs.macchina
# # environment: pkgs.alejandra
# (pkgs.writeShellScriptBin "my-hello" '' pkgs.neovim-nightly
# echo "Hello, ${config.home.username}!" pkgs.cachix
# '') # # Adds the 'hello' command to your environment. It prints a friendly
]; # # "Hello, world!" when run.
# pkgs.hello
home.file = { # # It is sometimes useful to fine-tune packages, for example, by applying
# # Building this configuration will create a copy of 'dotfiles/screenrc' in # # overrides. You can do that directly here, just don't forget the
# # the Nix store. Activating the configuration will then make '~/.screenrc' a # # parentheses. Maybe you want to install Nerd Fonts with a limited number of
# # symlink to the Nix store copy. # # fonts?
# ".screenrc".source = dotfiles/screenrc; # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
# # You can also set the file content immediately. # # You can also create simple shell scripts directly inside your
# ".gradle/gradle.properties".text = '' # # configuration. For example, this adds a command 'my-hello' to your
# org.gradle.console=verbose # # environment:
# org.gradle.daemon.idletimeout=3600000 # (pkgs.writeShellScriptBin "my-hello" ''
# ''; # echo "Hello, ${config.home.username}!"
}; # '')
];
home.sessionVariables = { file = {
EDITOR = "nvim"; # # Building this configuration will create a copy of 'dotfiles/screenrc' in
SHELL = "${pkgs.fish.outPath}/bin/fish"; # # the Nix store. Activating the configuration will then make '~/.screenrc' a
}; # # symlink to the Nix store copy.
home.sessionPath = [ # ".screenrc".source = dotfiles/screenrc;
"${config.home.homeDirectory}/.local/bin"
"${config.home.homeDirectory}/.nix-profile/bin"
];
# Let Home Manager install and manage itself. # # You can also set the file content immediately.
programs.home-manager = { # ".gradle/gradle.properties".text = ''
enable = true; # org.gradle.console=verbose
# org.gradle.daemon.idletimeout=3600000
# '';
};
sessionVariables = {
EDITOR = "nvim";
SHELL = "${pkgs.fish.outPath}/bin/fish";
};
sessionPath = [
"${config.home.homeDirectory}/.local/bin"
"${config.home.homeDirectory}/.nix-profile/bin"
];
}; };
} }

View File

@@ -1,6 +1,6 @@
{ pkgs, ... }: { {pkgs, ...}: {
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = pkgs.stdenv.isLinux;
settings = { settings = {
monitor = [ monitor = [
",preferred,auto,auto" ",preferred,auto,auto"
@@ -37,8 +37,6 @@
# See https://wiki.hyprland.org/Configuring/Variables/ for more # See https://wiki.hyprland.org/Configuring/Variables/ for more
rounding = 10; rounding = 10;
drop_shadow = true; drop_shadow = true;
shadow_range = 4; shadow_range = 4;
shadow_render_power = 3; shadow_render_power = 3;
@@ -150,7 +148,6 @@
# "$mainModShift,Print, exec, grim -g "$(slurp)"" # "$mainModShift,Print, exec, grim -g "$(slurp)""
"$mainModShift,s, exec, watershot" "$mainModShift,s, exec, watershot"
# Move focus with mainMod + arrow keys # Move focus with mainMod + arrow keys
"$mainMod, left, movefocus, l" "$mainMod, left, movefocus, l"
"$mainMod, right, movefocus, r" "$mainMod, right, movefocus, r"
@@ -191,13 +188,10 @@
"$mainMod SHIFT, 9, movetoworkspace, 9" "$mainMod SHIFT, 9, movetoworkspace, 9"
"$mainMod SHIFT, 0, movetoworkspace, 10" "$mainMod SHIFT, 0, movetoworkspace, 10"
# Scroll through existing workspaces with mainMod + scroll # Scroll through existing workspaces with mainMod + scroll
"$mainMod, mouse_down, workspace, e+1" "$mainMod, mouse_down, workspace, e+1"
"$mainMod, mouse_up, workspace, e-1" "$mainMod, mouse_up, workspace, e-1"
"$mainMod, Tab, cyclenext, bind = ALT, Tab, bringactivetotop," "$mainMod, Tab, cyclenext, bind = ALT, Tab, bringactivetotop,"
]; ];
@@ -220,8 +214,6 @@
"9, monitor:HDMI-A-2" "9, monitor:HDMI-A-2"
"10, monitor:HDMI-A-2" "10, monitor:HDMI-A-2"
]; ];
}; };
}; };
} }

View File

@@ -1,63 +1,63 @@
{pkgs, ...}: { {pkgs, ...}: {
programs.wezterm = { programs.wezterm = {
enable = true; enable = true;
extraConfig = '' extraConfig = ''
local wezterm = require 'wezterm'; local wezterm = require 'wezterm';
return { return {
-- -- font = wezterm.font("Hasklug Nerd Font Mono", { weight = "Regular", stretch = "Normal", style = "Normal" }), -- -- font = wezterm.font("Hasklug Nerd Font Mono", { weight = "Regular", stretch = "Normal", style = "Normal" }),
-- font = wezterm.font_with_fallback({ -- font = wezterm.font_with_fallback({
-- "Hasklig", -- "Hasklig",
-- "Symbols Nerd Font Mono" -- "Symbols Nerd Font Mono"
-- }), -- }),
font_size = 16, font_size = 16,
colors = { colors = {
-- The default text color -- The default text color
foreground = "#f8f8f2", foreground = "#f8f8f2",
-- The default background color -- The default background color
-- background = "#282a36", -- background = "#282a36",
-- Overrides the cell background color when the current cell is occupied by the -- Overrides the cell background color when the current cell is occupied by the
-- cursor and the cursor style is set to Block -- cursor and the cursor style is set to Block
cursor_bg = "#f8f8f2", cursor_bg = "#f8f8f2",
-- Overrides the text color when the current cell is occupied by the cursor -- Overrides the text color when the current cell is occupied by the cursor
cursor_fg = "#000", cursor_fg = "#000",
-- Specifies the border color of the cursor when the cursor style is set to Block, -- Specifies the border color of the cursor when the cursor style is set to Block,
-- or the color of the vertical or horizontal bar when the cursor style is set to -- or the color of the vertical or horizontal bar when the cursor style is set to
-- Bar or Underline. -- Bar or Underline.
cursor_border = "#52ad70", cursor_border = "#52ad70",
-- the foreground color of selected text -- the foreground color of selected text
selection_fg = "#ffffff", selection_fg = "#ffffff",
-- the background color of selected text -- the background color of selected text
selection_bg = "#ffffff", selection_bg = "#ffffff",
-- The color of the scrollbar "thumb"; the portion that represents the current viewport -- The color of the scrollbar "thumb"; the portion that represents the current viewport
scrollbar_thumb = "#222222", scrollbar_thumb = "#222222",
-- The color of the split lines between panes -- The color of the split lines between panes
split = "#444444", split = "#444444",
ansi = { "#21222c", "#ff5555", "#50fa7b", "#f1fa8c", "#bd93f9", "#ff79c6", "#8be9fd", "#f8f8f2" }, ansi = { "#21222c", "#ff5555", "#50fa7b", "#f1fa8c", "#bd93f9", "#ff79c6", "#8be9fd", "#f8f8f2" },
brights = { "#6272a4", "#ff6e6e", "#69ff94", "#ffffa5", "#d6acff", "#ff92df", "#a4ffff", "#ffffff" }, brights = { "#6272a4", "#ff6e6e", "#69ff94", "#ffffa5", "#d6acff", "#ff92df", "#a4ffff", "#ffffff" },
-- Arbitrary colors of the palette in the range from 16 to 255 -- Arbitrary colors of the palette in the range from 16 to 255
indexed = { [136] = "#af8700" }, indexed = { [136] = "#af8700" },
-- Since: nightly builds only -- Since: nightly builds only
-- When the IME, a dead key or a leader key are being processed and are effectively -- When the IME, a dead key or a leader key are being processed and are effectively
-- holding input pending the result of input composition, change the cursor -- holding input pending the result of input composition, change the cursor
-- to this color to give a visual cue about the compose state. -- to this color to give a visual cue about the compose state.
compose_cursor = "orange", compose_cursor = "orange",
}, },
initial_cols = 120, initial_cols = 120,
hide_tab_bar_if_only_one_tab = true, hide_tab_bar_if_only_one_tab = true,
window_background_opacity = 0.8, window_background_opacity = 0.8,
cursor_blink_rate = 8, cursor_blink_rate = 8,
default_cursor_style = "BlinkingBlock", default_cursor_style = "BlinkingBlock",
default_prog = { "${pkgs.fish.outPath}/bin/fish", "-l" }, default_prog = { "${pkgs.fish.outPath}/bin/fish", "-l" },
window_padding = { window_padding = {
left = 2, left = 2,
right = 0, right = 0,
top = 2, top = 2,
bottom = 0, bottom = 0,
}, },
window_decorations = "RESIZE", window_decorations = "RESIZE",
use_ime = false, use_ime = false,
} }
''; '';
}; };
} }

View File

@@ -41,7 +41,7 @@ require("mason-lspconfig").setup_handlers {
settings = { settings = {
['nil'] = { ['nil'] = {
formatting = { formatting = {
command = { "nixpkgs-fmt" }, command = { "alejandra" },
} }
} }
} }