[feat] Add some config options for home-manager nix

This commit is contained in:
Uttarayan
2024-02-14 19:01:37 +05:30
parent a60c1f5b67
commit 21eda15d4b
9 changed files with 346 additions and 105 deletions

View File

@@ -1 +1,2 @@
jorgebucaran/fisher
edc/bass

View File

@@ -3,8 +3,9 @@
SETUVAR AFTERSHOOT_LOG:desktop_rust_backend\x3dtrace
SETUVAR BW_SESSION:lW6\x2bALLBSowAJgVMgqI6sSMqku9z/192K\x2bDNX0jF2WlzRGhBtKGlUAqXJgbWKTw/cDKU2MRO5Z/6aQPi6fkA6Q\x3d\x3d
SETUVAR __fish_initialized:3400
SETUVAR _fisher_edc_2F_bass_files:/home/fs0c131y/\x2econfig/fish/functions/__bass\x2epy\x1e/home/fs0c131y/\x2econfig/fish/functions/bass\x2efish
SETUVAR _fisher_jorgebucaran_2F_fisher_files:/Users/fs0c131y/\x2econfig/fish/functions/fisher\x2efish\x1e/Users/fs0c131y/\x2econfig/fish/completions/fisher\x2efish
SETUVAR _fisher_plugins:jorgebucaran/fisher
SETUVAR _fisher_plugins:jorgebucaran/fisher\x1eedc/bass
SETUVAR fish_color_autosuggestion:555\x1ebrblack
SETUVAR fish_color_cancel:\x2dr
SETUVAR fish_color_command:005fd7

View File

@@ -1,5 +1,5 @@
monitors:
DP-3:
HDMI-A-2:
position: bottom
start:
- type: launcher
@@ -29,7 +29,7 @@ monitors:
player_type: mpris
- type: clock
DP-2:
DP-1:
position: bottom
icon_theme: Paper-Mono-Dark
end:

6
config/nix/Makefile Normal file
View File

@@ -0,0 +1,6 @@
.PHONY: run build
switch:
nix run home-manager/master -- init --switch ~/.local/share/dotfiles/config/nix
build:
nix run home-manager/master -- init ~/.local/share/dotfiles/config/nix

98
config/nix/darwin.nix Normal file
View File

@@ -0,0 +1,98 @@
{
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;
};
}

30
config/nix/flake.lock generated
View File

@@ -1,44 +1,44 @@
{
"nodes": {
"nix-darwin": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1706833576,
"narHash": "sha256-w7BL0EWRts+nD1lbLECIuz6fRzmmV+z8oWwoY7womR0=",
"owner": "LnL7",
"repo": "nix-darwin",
"rev": "bdbae6ecff8fcc322bf6b9053c0b984912378af7",
"lastModified": 1707683400,
"narHash": "sha256-Zc+J3UO1Xpx+NL8UB6woPHyttEy9cXXtm+0uWwzuYDc=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "21b078306a2ab68748abf72650db313d646cf2ca",
"type": "github"
},
"original": {
"owner": "LnL7",
"repo": "nix-darwin",
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1707588924,
"narHash": "sha256-0e1ce6X5ghapv6cAF9rxLZKeNyFHHXsLbGxN2cQQE8U=",
"owner": "NixOS",
"lastModified": 1707689078,
"narHash": "sha256-UUGmRa84ZJHpGZ1WZEBEUOzaPOWG8LZ0yPg1pdDF/yM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "10b813040df67c4039086db0f6eaf65c536886c6",
"rev": "f9d39fb9aff0efee4a3d5f4a6d7c17701d38a1d8",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nix-darwin": "nix-darwin",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
}

View File

@@ -1,98 +1,29 @@
{
description = "Example Darwin system flake";
description = "Home Manager configuration of fs0c131y";
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";
# Specify the source of Home Manager and Nixpkgs.
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ self, nix-darwin, nixpkgs }:
outputs = { nixpkgs, home-manager, ... }:
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
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in {
homeConfigurations."fs0c131y" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
fish
nushellFull
# Specify your home configuration modules here, for example,
# the path to your home.nix.
modules = [ ./home.nix ];
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;
# Optionally use extraSpecialArgs
# to pass through arguments to home.nix
};
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;
};
}

171
config/nix/home.nix Normal file
View File

@@ -0,0 +1,171 @@
{ config, pkgs, ... }:
{
# 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
];
programs = {
fish = {
enable = true;
shellAbbrs = {
vim = "nvim";
vi = "nvim";
nv = "nvim";
g = "git";
cd = "z";
ls = "exa";
};
interactiveShellInit = ''
# Add the following line to your ~/.config/fish/config.fish to enable
# Home Manager's Fish integration.
# source ${config.home.homeDirectory}/.nix-profile/share/hm-session-vars/hm-session-vars.fish
set fish_greeting
# macchina
'';
};
zoxide = {
enable = true;
enableFishIntegration = true;
enableNushellIntegration = true;
};
starship = {
enable = true;
enableFishIntegration = true;
enableNushellIntegration = true;
};
eza = {
enable = true;
enableAliases = true;
git = true;
icons = true;
};
carapace = {
enable = true;
enableFishIntegration = true;
enableNushellIntegration = true;
};
nushell = {
enable = true;
package = pkgs.nushellFull;
};
keychain = {
enable = true;
enableFishIntegration = true;
enableNushellIntegration = true;
};
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,
}
'';
};
};
home.packages = [
pkgs.macchina
# # 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
# # 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
# # configuration. For example, this adds a command 'my-hello' to your
# # environment:
# (pkgs.writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!"
# '')
];
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;
# # You can also set the file content immediately.
# ".gradle/gradle.properties".text = ''
# org.gradle.console=verbose
# org.gradle.daemon.idletimeout=3600000
# '';
};
home.sessionVariables = {
EDITOR = "nvim";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
}

33
config/nix/tmux.nix Normal file
View File

@@ -0,0 +1,33 @@
{ pkgs, ... }:
let
tmux-super-fingers = pkgs.tmuxPlugins.mkTmuxPlugin
{
pluginName = "tmux-super-fingers";
version = "unstable-2023-01-06";
src = pkgs.fetchFromGitHub {
owner = "artemave";
repo = "tmux_super_fingers";
rev = "2c12044984124e74e21a5a87d00f844083e4bdf7";
sha256 = "sha256-cPZCV8xk9QpU49/7H8iGhQYK6JwWjviL29eWabuqruc=";
};
};
in
{
programs.tmux = {
enable = true;
shell = "${pkgs.fish}/bin/fish";
terminal = "tmux-256color";
historyLimit = 100000;
plugins = with pkgs;
[
{
plugin = tmux-super-fingers;
extraConfig = "set -g @super-fingers-key f";
}
tmuxPlugins.better-mouse-mode
];
extraConfig = ''
'';
};
}