[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 @@
{
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;
{pkgs, ...}: {
nix = {
settings = {
experimental-features = "nix-command flakes repl-flake";
max-jobs = 8;
};
};
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": {
"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": false,
"locked": {
@@ -198,6 +218,7 @@
},
"root": {
"inputs": {
"darwin": "darwin",
"home-manager": "home-manager",
"neovim-nightly-overlay": "neovim-nightly-overlay",
"nixpkgs": "nixpkgs_2"

View File

@@ -8,30 +8,57 @@
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
};
outputs = { nixpkgs, home-manager, ... }@inputs:
let
outputs = {
nixpkgs,
home-manager,
darwin,
...
} @ inputs: {
homeConfigurations = let
system = "x86_64-linux";
overlays = [ inputs.neovim-nightly-overlay.overlay ];
overlays = [inputs.neovim-nightly-overlay.overlay];
pkgs = nixpkgs.legacyPackages.${system};
in
{
homeConfigurations."fs0c131y" = home-manager.lib.homeManagerConfiguration {
in {
"fs0c131y" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
# Specify your home configuration modules here, for example,
# the path to your home.nix.
modules = [
./home.nix
({
{
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/
{
# 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 = [
# Include the results of the hardware scan.
./tmux.nix
@@ -31,6 +28,7 @@
${pkgs.macchina.outPath}/bin/macchina
'';
};
nushell = {
enable = true;
shellAliases = {
@@ -65,10 +63,10 @@
enableNushellIntegration = true;
};
fzf = {
enable = true;
package = pkgs.fzf;
enableFishIntegration = true;
tmux.enableShellIntegration = true;
enable = true;
package = pkgs.fzf;
enableFishIntegration = true;
tmux.enableShellIntegration = true;
};
keychain = {
enable = true;
@@ -77,97 +75,104 @@
enableNushellIntegration = true;
};
yazi = {
enable = true;
enableFishIntegration = true;
enableNushellIntegration = true;
enable = true;
enableFishIntegration = true;
enableNushellIntegration = true;
};
foot = {
enable = true;
enable = pkgs.stdenv.isLinux;
server.enable = true;
settings = {
main = {
shell = "${pkgs.fish.outPath}/bin/fish";
font = "Hasklug Nerd Font Mono:size=13";
initial-window-size-pixels="1440x800";
shell = "${pkgs.fish.outPath}/bin/fish";
font = "Hasklug Nerd Font Mono:size=13";
initial-window-size-pixels = "1440x800";
};
colors = {
foreground = "f8f8f2";
background=000000;
alpha=0.8;
foreground = "f8f8f2";
background = 000000;
alpha = 0.8;
"136" = "af8700";
"136" = "af8700";
regular0 ="21222c";
regular1 ="ff5555";
regular2 ="50fa7b";
regular3 ="f1fa8c";
regular4 ="bd93f9";
regular5 ="ff79c6";
regular6 ="8be9fd";
regular7 ="f8f8f2";
bright0 ="6272a4";
bright1 ="ff6e6e";
bright2 ="69ff94";
bright3 ="ffffa5";
bright4 ="d6acff";
bright5 ="ff92df";
bright6 ="a4ffff";
bright7 ="ffffff";
regular0 = "21222c";
regular1 = "ff5555";
regular2 = "50fa7b";
regular3 = "f1fa8c";
regular4 = "bd93f9";
regular5 = "ff79c6";
regular6 = "8be9fd";
regular7 = "f8f8f2";
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 = [
pkgs.macchina
pkgs.nixpkgs-fmt
pkgs.neovim-nightly
pkgs.cachix
# # Adds the 'hello' command to your environment. It prints a friendly
# # "Hello, world!" when run.
# pkgs.hello
home = {
# Home Manager needs a bit of information about you and the paths it should
# manage.
username = "fs0c131y";
homeDirectory = "/home/fs0c131y";
# # It is sometimes useful to fine-tune packages, for example, by applying
# # 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" ]; })
stateVersion = "23.11";
# # You can also create simple shell scripts directly inside your
# # configuration. For example, this adds a command 'my-hello' to your
# # environment:
# (pkgs.writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!"
# '')
];
packages = [
pkgs.macchina
pkgs.alejandra
pkgs.neovim-nightly
pkgs.cachix
# # Adds the 'hello' command to your environment. It prints a friendly
# # "Hello, world!" when run.
# pkgs.hello
home.file = {
# # Building this configuration will create a copy of 'dotfiles/screenrc' in
# # the Nix store. Activating the configuration will then make '~/.screenrc' a
# # symlink to the Nix store copy.
# ".screenrc".source = dotfiles/screenrc;
# # It is sometimes useful to fine-tune packages, for example, by applying
# # 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 set the file content immediately.
# ".gradle/gradle.properties".text = ''
# org.gradle.console=verbose
# org.gradle.daemon.idletimeout=3600000
# '';
};
# # You can also create simple shell scripts directly inside your
# # configuration. For example, this adds a command 'my-hello' to your
# # environment:
# (pkgs.writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!"
# '')
];
home.sessionVariables = {
EDITOR = "nvim";
SHELL = "${pkgs.fish.outPath}/bin/fish";
};
home.sessionPath = [
"${config.home.homeDirectory}/.local/bin"
"${config.home.homeDirectory}/.nix-profile/bin"
];
file = {
# # Building this configuration will create a copy of 'dotfiles/screenrc' in
# # the Nix store. Activating the configuration will then make '~/.screenrc' a
# # symlink to the Nix store copy.
# ".screenrc".source = dotfiles/screenrc;
# Let Home Manager install and manage itself.
programs.home-manager = {
enable = true;
# # You can also set the file content immediately.
# ".gradle/gradle.properties".text = ''
# 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 = {
enable = true;
enable = pkgs.stdenv.isLinux;
settings = {
monitor = [
",preferred,auto,auto"
@@ -37,8 +37,6 @@
# See https://wiki.hyprland.org/Configuring/Variables/ for more
rounding = 10;
drop_shadow = true;
shadow_range = 4;
shadow_render_power = 3;
@@ -150,7 +148,6 @@
# "$mainModShift,Print, exec, grim -g "$(slurp)""
"$mainModShift,s, exec, watershot"
# Move focus with mainMod + arrow keys
"$mainMod, left, movefocus, l"
"$mainMod, right, movefocus, r"
@@ -191,13 +188,10 @@
"$mainMod SHIFT, 9, movetoworkspace, 9"
"$mainMod SHIFT, 0, movetoworkspace, 10"
# Scroll through existing workspaces with mainMod + scroll
"$mainMod, mouse_down, workspace, e+1"
"$mainMod, mouse_up, workspace, e-1"
"$mainMod, Tab, cyclenext, bind = ALT, Tab, bringactivetotop,"
];
@@ -220,8 +214,6 @@
"9, monitor:HDMI-A-2"
"10, monitor:HDMI-A-2"
];
};
};
}

View File

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