From 21eda15d4ba0c93cb522018f4fdb54c7f9e5f504 Mon Sep 17 00:00:00 2001 From: Uttarayan Date: Wed, 14 Feb 2024 19:01:37 +0530 Subject: [PATCH] [feat] Add some config options for home-manager nix --- config/fish/fish_plugins | 1 + config/fish/fish_variables | 3 +- config/ironbar/config.yaml | 4 +- config/nix/Makefile | 6 ++ config/nix/darwin.nix | 98 +++++++++++++++++++++ config/nix/flake.lock | 30 +++---- config/nix/flake.nix | 105 ++++------------------- config/nix/home.nix | 171 +++++++++++++++++++++++++++++++++++++ config/nix/tmux.nix | 33 +++++++ 9 files changed, 346 insertions(+), 105 deletions(-) create mode 100644 config/nix/Makefile create mode 100644 config/nix/darwin.nix create mode 100644 config/nix/home.nix create mode 100644 config/nix/tmux.nix diff --git a/config/fish/fish_plugins b/config/fish/fish_plugins index 594dfc03..8e3516fb 100644 --- a/config/fish/fish_plugins +++ b/config/fish/fish_plugins @@ -1 +1,2 @@ jorgebucaran/fisher +edc/bass diff --git a/config/fish/fish_variables b/config/fish/fish_variables index adf7fc85..8693436b 100644 --- a/config/fish/fish_variables +++ b/config/fish/fish_variables @@ -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 diff --git a/config/ironbar/config.yaml b/config/ironbar/config.yaml index c5bb88b7..1b29c599 100644 --- a/config/ironbar/config.yaml +++ b/config/ironbar/config.yaml @@ -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: diff --git a/config/nix/Makefile b/config/nix/Makefile new file mode 100644 index 00000000..f2ae2981 --- /dev/null +++ b/config/nix/Makefile @@ -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 diff --git a/config/nix/darwin.nix b/config/nix/darwin.nix new file mode 100644 index 00000000..e32c6105 --- /dev/null +++ b/config/nix/darwin.nix @@ -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; + }; +} diff --git a/config/nix/flake.lock b/config/nix/flake.lock index efb2587f..a92162e6 100644 --- a/config/nix/flake.lock +++ b/config/nix/flake.lock @@ -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" } } diff --git a/config/nix/flake.nix b/config/nix/flake.nix index e32c6105..171e70e1 100644 --- a/config/nix/flake.nix +++ b/config/nix/flake.nix @@ -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 - - 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; + # Specify your home configuration modules here, for example, + # the path to your home.nix. + modules = [ ./home.nix ]; + # Optionally use extraSpecialArgs + # to pass through arguments to home.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; }; } diff --git a/config/nix/home.nix b/config/nix/home.nix new file mode 100644 index 00000000..f2e691f5 --- /dev/null +++ b/config/nix/home.nix @@ -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; +} diff --git a/config/nix/tmux.nix b/config/nix/tmux.nix new file mode 100644 index 00000000..781559fc --- /dev/null +++ b/config/nix/tmux.nix @@ -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 = '' + ''; + }; +} +