diff --git a/config/nix/Makefile b/config/nix/Makefile index 13aaf8e3..1d66804f 100644 --- a/config/nix/Makefile +++ b/config/nix/Makefile @@ -10,4 +10,4 @@ home: nix --extra-experimental-features "nix-command flakes" run home-manager/master -- switch --flake . nixos: - nixos-rebuild switch --flake . + sudo nixos-rebuild switch --flake . diff --git a/config/nix/common/firefox.nix b/config/nix/common/firefox.nix index 8476da43..3fec2250 100644 --- a/config/nix/common/firefox.nix +++ b/config/nix/common/firefox.nix @@ -1,5 +1 @@ -{...}: { - programs.firefox = { - enable = true; - }; -} +{ ... }: { programs.firefox = { enable = true; }; } diff --git a/config/nix/common/home.nix b/config/nix/common/home.nix index 07b83d75..649e2f7c 100644 --- a/config/nix/common/home.nix +++ b/config/nix/common/home.nix @@ -1,290 +1,235 @@ -{ - config, - pkgs, - lib, - device, - inputs, - ... -}: let +{ config, pkgs, lib, device, ... }: +let start-tmux = (import ../scripts/start-tmux.nix) pkgs; -in # https://mipmip.github.io/home-manager-option-search/ - { - imports = [ - # Include the results of the hardware scan. - ./tmux.nix - ./wezterm.nix - ../linux/hyprland.nix - ./firefox.nix - inputs.anyrun.nixosModules.home-manager - ]; +in { + imports = [ + # Include the results of the hardware scan. + ./tmux.nix + ./wezterm.nix + ./firefox.nix + ../linux/hyprland.nix + ../linux/anyrun.nix + ../linux/ironbar.nix + ]; - home.packages = with pkgs; [ - htop-vim - lsof - wl-clipboard - qmk - nodejs - nix-index - yubikey-personalization - macchina - ripgrep - fd - alejandra - dust - eza - cachix - rustup - cmake - fzf - clang - ncpamixer - neovim-nightly - yubikey-agent - (nerdfonts.override {fonts = ["Hasklig"];}) - mpv - - # # 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}!" - # '') - ]; - - xdg.enable = true; - - programs = { - git = { - enable = true; - userName = "uttarayan21"; - userEmail = "email@uttarayan.me"; - }; - nix-index.enableFishIntegration = true; - fish = { - enable = true; - shellAbbrs = { - vim = "nvim"; - vi = "nvim"; - nv = "nvim"; - g = "git"; - cd = "z"; - ls = "exa"; - t = "${start-tmux}"; - }; - shellInit = '' - set fish_greeting - ''; - interactiveShellInit = '' - ${pkgs.macchina.outPath}/bin/macchina - ''; - }; - - nushell = { - enable = true; - shellAliases = { - "cd" = "z"; - }; - package = pkgs.nushellFull; - configFile.text = '' - $env.config = { - show_banner: false, - } - ''; - }; - 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; - }; - fzf = { - enable = true; - package = pkgs.fzf; - enableFishIntegration = true; - tmux.enableShellIntegration = true; - }; - # keychain = { - # enable = pkgs.isLinux; - # keys = [ "id_ed25519" ]; - # enableFishIntegration = true; - # enableNushellIntegration = true; - # }; - yazi = { - enable = true; - enableFishIntegration = true; - enableNushellIntegration = true; - }; - foot = { - 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"; - }; - colors = { - foreground = "f8f8f2"; - background = 000000; - alpha = 0.8; - - "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"; - }; - }; - }; - - anyrun = { - enable = true; - config = { - plugins = with inputs.anyrun.packages.${pkgs.system}; [ - inputs.anyrun-hyprwin.packages.${pkgs.system}.hyprwin - rink - applications - websearch - shell - translate - symbols - ]; - x = {fraction = 0.5;}; - y = {fraction = 0.3;}; - height = {absolute = 0;}; - width = {absolute = 1000;}; - showResultsImmediately = true; - layer = "overlay"; - }; - - extraConfigFiles = { - "shell.ron".text = '' - Config( - prefix: "", - shell: None, - ) - ''; - "handlr.ron".text = '' - Config( - prefix: "", - log: None, - ) - ''; - "websearch.ron".text = '' - Config( - prefix: "?" - engines: [Google, DuckDuckGo] - ) - ''; - }; - - extraCss = '' - window { - color: #ffffff; - background-color: rgba(15, 15, 15, .2); - border-color: #000000; - } - - entry { - color: #ffffff; - background-color: rgba(40, 40, 40, .98); - padding: 14px; - font-size: 30px; - border-color: #000000; - border-radius: 10px; - } - - #plugin { - color: #efefef; - border-color: #000000; - border-color: #000000; - border-radius: 5px; - } - - #main { - color: #efefef; - border-color: #000000; - border-color: #000000; - border-radius: 5px; - } - ''; - }; - - # Let Home Manager install and manage itself. - home-manager = { - enable = true; + gtk = { + enable = true; + theme = { + name = "Catppuccin-Mocha-Normal-Dark"; + package = pkgs.catppuccin-gtk.override { + size = "standard"; + accents = [ "mauve" ]; + variant = "mocha"; + tweaks = [ "normal" ]; }; }; - fonts.fontconfig.enable = true; - home = { - # Home Manager needs a bit of information about you and the paths it should - # manage. - username = device.user; - homeDirectory = - if device.isMac - then lib.mkForce "/Users/${device.user}" - else lib.mkForce "/home/${device.user}"; - - stateVersion = "23.11"; - - file = { - ".config/tmux/sessions".source = ../../tmux/sessions; - ".config/nvim/lua".source = ../../nvim/lua; - ".config/nvim/init.lua".source = ../../nvim/init.lua; - ".config/macchina".source = ../../macchina; - - # # You can also set the file content immediately. - # ".gradle/gradle.properties".text = '' - # org.gradle.console=verbose - # org.gradle.daemon.idletimeout=3600000 - # ''; + iconTheme = { + name = "Papirus-Dark"; + package = pkgs.catppuccin-papirus-folders.override { + accent = "mauve"; + flavor = "mocha"; }; - - sessionVariables = { - EDITOR = "nvim"; - SHELL = "${pkgs.nushellFull}/bin/nu"; - CARGO_TARGET_DIR = "${config.xdg.cacheHome}/cargo/target"; - }; - sessionPath = [ - "${config.home.homeDirectory}/.local/bin" - "${config.home.homeDirectory}/.nix-profile/bin" - ]; }; - } + + gtk3.extraConfig = { gtk-application-prefer-dark-theme = 1; }; + + gtk4.extraConfig = { gtk-application-prefer-dark-theme = 1; }; + }; + + home.packages = with pkgs; [ + gnome.nautilus + webcord-vencord + spotify + htop-vim + lsof + wl-clipboard + qmk + nodejs + nix-index + yubikey-personalization + macchina + ripgrep + fd + nixfmt + dust + eza + cachix + rustup + cmake + fzf + clang + ncpamixer + neovim-nightly + yubikey-agent + (nerdfonts.override { fonts = [ "Hasklig" ]; }) + mpv + + # # 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}!" + # '') + ]; + + xdg.enable = true; + + programs = { + git = { + enable = true; + userName = "uttarayan21"; + userEmail = "email@uttarayan.me"; + }; + nix-index.enableFishIntegration = true; + fish = { + enable = true; + shellAbbrs = { + vim = "nvim"; + vi = "nvim"; + nv = "nvim"; + g = "git"; + cd = "z"; + ls = "exa"; + t = "${start-tmux}"; + }; + shellInit = '' + set fish_greeting + ''; + interactiveShellInit = '' + ${pkgs.macchina.outPath}/bin/macchina + ''; + }; + + nushell = { + enable = true; + shellAliases = { "cd" = "z"; }; + package = pkgs.nushellFull; + configFile.text = '' + $env.config = { + show_banner: false, + } + ''; + }; + 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; + }; + fzf = { + enable = true; + package = pkgs.fzf; + enableFishIntegration = true; + tmux.enableShellIntegration = true; + }; + # keychain = { + # enable = pkgs.isLinux; + # keys = [ "id_ed25519" ]; + # enableFishIntegration = true; + # enableNushellIntegration = true; + # }; + yazi = { + enable = true; + enableFishIntegration = true; + enableNushellIntegration = true; + }; + foot = { + 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"; + }; + colors = { + foreground = "f8f8f2"; + background = 0; + alpha = 0.8; + + "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"; + }; + }; + }; + + # Let Home Manager install and manage itself. + home-manager = { enable = true; }; + }; + + fonts.fontconfig.enable = true; + home = { + # Home Manager needs a bit of information about you and the paths it should + # manage. + username = device.user; + homeDirectory = if device.isMac then + lib.mkForce "/Users/${device.user}" + else + lib.mkForce "/home/${device.user}"; + + stateVersion = "23.11"; + + file = { + ".config/tmux/sessions".source = ../../tmux/sessions; + ".config/nvim/lua".source = ../../nvim/lua; + ".config/nvim/init.lua".source = ../../nvim/init.lua; + ".config/macchina".source = ../../macchina; + + # # 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.nushellFull}/bin/nu"; + CARGO_TARGET_DIR = "${config.xdg.cacheHome}/cargo/target"; + }; + sessionPath = [ + "${config.home.homeDirectory}/.local/bin" + "${config.home.homeDirectory}/.nix-profile/bin" + ]; + }; +} diff --git a/config/nix/common/tmux.nix b/config/nix/common/tmux.nix index 3ee8bc15..07d96fe9 100644 --- a/config/nix/common/tmux.nix +++ b/config/nix/common/tmux.nix @@ -1,28 +1,25 @@ { pkgs, ... }: let - tmux-super-fingers = - pkgs.tmuxPlugins.mkTmuxPlugin - { - pluginName = "tmux-super-fingers"; - version = "v1-2024-02-14"; - src = pkgs.fetchFromGitHub { - owner = "artemave"; - repo = "tmux_super_fingers"; - rev = "518044ef78efa1cf3c64f2e693fef569ae570ddd"; - sha256 = "sha256-iKfx9Ytk2vSuINvQTB6Kww8Vv7i51cFEnEBHLje+IJw="; - }; - }; + tmux-super-fingers = pkgs.tmuxPlugins.mkTmuxPlugin { + pluginName = "tmux-super-fingers"; + version = "v1-2024-02-14"; + src = pkgs.fetchFromGitHub { + owner = "artemave"; + repo = "tmux_super_fingers"; + rev = "518044ef78efa1cf3c64f2e693fef569ae570ddd"; + sha256 = "sha256-iKfx9Ytk2vSuINvQTB6Kww8Vv7i51cFEnEBHLje+IJw="; + }; + }; scratchpad = pkgs.writeShellScript "scratchpad" '' - width=''\${2:-95%} - height=''\${2:-95%} + width=''${2:-95%} + height=''${2:-95%} if [ "$(tmux display-message -p -F "#{session_name}")" = "scratch" ];then tmux detach-client else tmux popup -d '#{pane_current_path}' -xC -yC -w$width -h$height -E "tmux attach -t scratch || tmux new -s scratch" fi ''; -in -{ +in { programs.tmux = { enable = true; shell = "${pkgs.nushellFull}/bin/nu"; diff --git a/config/nix/common/wezterm.nix b/config/nix/common/wezterm.nix index e6a37fa4..fdeb06ad 100644 --- a/config/nix/common/wezterm.nix +++ b/config/nix/common/wezterm.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +{ pkgs, ... }: { programs.wezterm = { enable = true; extraConfig = '' diff --git a/config/nix/darwin/configuration.nix b/config/nix/darwin/configuration.nix index 6e7369fb..ba103d90 100644 --- a/config/nix/darwin/configuration.nix +++ b/config/nix/darwin/configuration.nix @@ -1,21 +1,12 @@ -{ - pkgs, - ... -}: { - imports = [ - ./yabai.nix - ./skhd.nix - ]; +{ pkgs, ... }: { + imports = [ ./yabai.nix ./skhd.nix ]; - environment.systemPackages = with pkgs; [ - nix - neovim - ]; + environment.systemPackages = with pkgs; [ nix neovim ]; nix = { settings = { experimental-features = "nix-command flakes repl-flake"; max-jobs = 8; - trusted-users = ["root" "fs0c131y"]; + trusted-users = [ "root" "fs0c131y" ]; }; extraOptions = '' build-users-group = nixbld diff --git a/config/nix/darwin/default.nix b/config/nix/darwin/default.nix index 099e2af8..fae8be1a 100644 --- a/config/nix/darwin/default.nix +++ b/config/nix/darwin/default.nix @@ -1,34 +1,24 @@ -{ - devices, - inputs, - overlays, - home-manager, - nix-darwin, - ... -}: -builtins.listToAttrs -(builtins.map - (device: { - name = device.name; - value = nix-darwin.lib.darwinSystem { - system = device.system; - modules = [ - {nixpkgs.overlays = overlays;} - ./configuration.nix - home-manager.darwinModules.home-manager - { - nixpkgs.config.allowUnfree = true; - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - extraSpecialArgs = { - inherit inputs; - inherit device; - }; - users.${device.user}.imports = [../common/home.nix]; +{ devices, inputs, overlays, home-manager, nix-darwin, ... }: +builtins.listToAttrs (builtins.map (device: { + name = device.name; + value = nix-darwin.lib.darwinSystem { + system = device.system; + modules = [ + { nixpkgs.overlays = overlays; } + ./configuration.nix + home-manager.darwinModules.home-manager + { + nixpkgs.config.allowUnfree = true; + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { + inherit inputs; + inherit device; }; - } - ]; - }; - }) - devices) + users.${device.user}.imports = [ ../common/home.nix ]; + }; + } + ]; + }; +}) devices) diff --git a/config/nix/darwin/skhd.nix b/config/nix/darwin/skhd.nix index 4024cf35..3f1773c0 100644 --- a/config/nix/darwin/skhd.nix +++ b/config/nix/darwin/skhd.nix @@ -1,4 +1,4 @@ -{...}: { +{ ... }: { services = { skhd = { enable = true; diff --git a/config/nix/darwin/yabai.nix b/config/nix/darwin/yabai.nix index 7e2e9bc9..357ac1cd 100644 --- a/config/nix/darwin/yabai.nix +++ b/config/nix/darwin/yabai.nix @@ -1,4 +1,4 @@ -{...}: { +{ ... }: { services = { yabai = { enable = true; diff --git a/config/nix/flake.lock b/config/nix/flake.lock index 67831d08..254facff 100644 --- a/config/nix/flake.lock +++ b/config/nix/flake.lock @@ -47,6 +47,27 @@ "type": "github" } }, + "crane": { + "inputs": { + "nixpkgs": [ + "ironbar", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1706473964, + "narHash": "sha256-Fq6xleee/TsX6NbtoRuI96bBuDHMU57PrcK9z1QEKbk=", + "owner": "ipetkov", + "repo": "crane", + "rev": "c798790eabec3e3da48190ae3698ac227aab770c", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -165,6 +186,24 @@ "inputs": { "systems": "systems_3" }, + "locked": { + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_4": { + "inputs": { + "systems": "systems_4" + }, "locked": { "lastModified": 1701680307, "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", @@ -221,9 +260,50 @@ "type": "github" } }, + "ironbar": { + "inputs": { + "crane": "crane", + "naersk": "naersk", + "nixpkgs": [ + "nixpkgs" + ], + "rust-overlay": "rust-overlay_2" + }, + "locked": { + "lastModified": 1708134405, + "narHash": "sha256-ktSi+D3lj7eStJVHCcmsizQlVvVW8GaCEYjKnPCGt7k=", + "owner": "JakeStanger", + "repo": "ironbar", + "rev": "31505c71400256af69b67039b44cb3ce9f0a953f", + "type": "github" + }, + "original": { + "owner": "JakeStanger", + "repo": "ironbar", + "type": "github" + } + }, + "naersk": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1698420672, + "narHash": "sha256-/TdeHMPRjjdJub7p7+w55vyABrsJlt5QkznPYy55vKA=", + "owner": "nix-community", + "repo": "naersk", + "rev": "aeb58d5e8faead8980a807c840232697982d47b9", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "naersk", + "type": "github" + } + }, "neovim-flake": { "inputs": { - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils_4", "nixpkgs": [ "neovim-nightly-overlay", "nixpkgs" @@ -251,7 +331,7 @@ "flake-parts": "flake-parts_2", "hercules-ci-effects": "hercules-ci-effects", "neovim-flake": "neovim-flake", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1708128234, @@ -304,6 +384,20 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1706683685, + "narHash": "sha256-FtPPshEpxH/ewBOsdKBNhlsL2MLEFv1hEnQ19f/bFsQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5ad9903c16126a7d949101687af0aa589b1d7d3d", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1708093448, "narHash": "sha256-gohEm3/NVyu7WINFhRf83yJH8UM2ie/KY9Iw3VN6fiE=", @@ -319,7 +413,7 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_4": { "locked": { "lastModified": 1708118438, "narHash": "sha256-kk9/0nuVgA220FcqH/D2xaN6uGyHp/zoxPNUmPCMmEE=", @@ -341,9 +435,10 @@ "anyrun-hyprwin": "anyrun-hyprwin", "flake-utils": "flake-utils_2", "home-manager": "home-manager", + "ironbar": "ironbar", "neovim-nightly-overlay": "neovim-nightly-overlay", "nix-darwin": "nix-darwin", - "nixpkgs": "nixpkgs_3" + "nixpkgs": "nixpkgs_4" } }, "rust-overlay": { @@ -365,6 +460,28 @@ "type": "github" } }, + "rust-overlay_2": { + "inputs": { + "flake-utils": "flake-utils_3", + "nixpkgs": [ + "ironbar", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1706667075, + "narHash": "sha256-KBI5jcOWh9nsOFWj2SRq7vj+fPDf8Do8ceL582kFA70=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "2c993daf3136c6955fd13bfe215d0d4faf6090f1", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, "systems": { "locked": { "lastModified": 1681028828, @@ -409,6 +526,21 @@ "repo": "default", "type": "github" } + }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/config/nix/flake.nix b/config/nix/flake.nix index 8350fa83..9258d639 100644 --- a/config/nix/flake.nix +++ b/config/nix/flake.nix @@ -22,87 +22,82 @@ url = "github:uttarayan21/anyrun-hyprwin"; inputs.nixpkgs.follows = "nixpkgs"; }; + ironbar = { + url = "github:JakeStanger/ironbar"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { - nixpkgs, + outputs = { nixpkgs, # nixos, - home-manager, - nix-darwin, - flake-utils, - anyrun, - neovim-nightly-overlay, - ... - } @ inputs: let - config_devices = [ - { - name = "mirai"; - system = "x86_64-linux"; - user = "fs0c131y"; - } - { - name = "ryu"; - system = "x86_64-linux"; - user = "servius"; - isNix = true; - } - { - name = "genzai"; - system = "x86_64-linux"; - user = "fs0c131y"; - } - { - name = "Uttarayans-MacBook-Pro"; - system = "aarch64-darwin"; - user = "fs0c131y"; - } - { - name = "SteamDeck"; - system = "x86_64-linux"; - user = "deck"; - } - ]; + home-manager, nix-darwin, flake-utils, anyrun, neovim-nightly-overlay, ... + }@inputs: + let + config_devices = [ + { + name = "mirai"; + system = "x86_64-linux"; + user = "fs0c131y"; + } + { + name = "ryu"; + system = "x86_64-linux"; + user = "servius"; + isNix = true; + } + { + name = "genzai"; + system = "x86_64-linux"; + user = "fs0c131y"; + } + { + name = "Uttarayans-MacBook-Pro"; + system = "aarch64-darwin"; + user = "fs0c131y"; + } + { + name = "SteamDeck"; + system = "x86_64-linux"; + user = "deck"; + } + ]; - mkDevice = {device}: { - isLinux = !isNull (builtins.match ".*-linux" device.system); - isNix = - if (builtins.hasAttr "isNix" device) - then device.isNix - else false; - isMac = !isNull (builtins.match ".*-darwin" device.system); - system = device.system; - name = device.name; - user = device.user; + mkDevice = { device }: { + isLinux = !isNull (builtins.match ".*-linux" device.system); + isNix = + if (builtins.hasAttr "isNix" device) then device.isNix else false; + isMac = !isNull (builtins.match ".*-darwin" device.system); + system = device.system; + name = device.name; + user = device.user; + }; + + devices = + builtins.map (device: mkDevice { inherit device; }) config_devices; + + nixos_devices = builtins.filter (x: x.isNix) devices; + linux_devices = builtins.filter (x: x.isLinux) devices; + darwin_devices = builtins.filter (x: x.isMac) devices; + + anyrun-overlay = final: prev: { + anyrun = inputs.anyrun.packages.${prev.system}.anyrun; + hyprwin = inputs.anyrun-hyprwin.packages.${prev.system}.hyprwin; + }; + overlays = [ inputs.neovim-nightly-overlay.overlay anyrun-overlay ]; + in { + nixosConfigurations = let devices = nixos_devices; + in import ./nixos { + inherit devices inputs nixpkgs home-manager overlays; + }; + + darwinConfigurations = let devices = darwin_devices; + in import ./darwin { + inherit devices inputs nixpkgs home-manager overlays nix-darwin; + }; + + homeConfigurations = let devices = linux_devices; + in import ./linux { + inherit devices inputs nixpkgs home-manager overlays; + }; }; - - devices = builtins.map (device: mkDevice {inherit device;}) config_devices; - - nixos_devices = builtins.filter (x: x.isNix) devices; - linux_devices = builtins.filter (x: x.isLinux) devices; - darwin_devices = builtins.filter (x: x.isMac) devices; - - anyrun-overlay = final: prev: { - anyrun = inputs.anyrun.packages.${prev.system}.anyrun; - hyprwin = inputs.anyrun-hyprwin.packages.${prev.system}.hyprwin; - }; - overlays = [ - inputs.neovim-nightly-overlay.overlay - anyrun-overlay - ]; - in { - nixosConfigurations = let - devices = nixos_devices; - in - import ./nixos {inherit devices inputs nixpkgs home-manager overlays;}; - - darwinConfigurations = let - devices = darwin_devices; - in - import ./darwin {inherit devices inputs nixpkgs home-manager overlays nix-darwin;}; - - homeConfigurations = let - devices = linux_devices; - in - import ./linux {inherit devices inputs nixpkgs home-manager overlays;}; - }; } diff --git a/config/nix/linux/anyrun.nix b/config/nix/linux/anyrun.nix new file mode 100644 index 00000000..01f21682 --- /dev/null +++ b/config/nix/linux/anyrun.nix @@ -0,0 +1,75 @@ +{ inputs, pkgs, ... }: { + imports = [ inputs.anyrun.nixosModules.home-manager ]; + programs.anyrun = { + enable = true; + config = { + plugins = with inputs.anyrun.packages.${pkgs.system}; [ + inputs.anyrun-hyprwin.packages.${pkgs.system}.hyprwin + rink + applications + websearch + shell + translate + symbols + ]; + x = { fraction = 0.5; }; + y = { fraction = 0.3; }; + height = { absolute = 0; }; + width = { absolute = 1000; }; + showResultsImmediately = true; + layer = "overlay"; + }; + + extraConfigFiles = { + "shell.ron".text = '' + Config( + prefix: "", + shell: None, + ) + ''; + "handlr.ron".text = '' + Config( + prefix: "", + log: None, + ) + ''; + "websearch.ron".text = '' + Config( + prefix: "?" + engines: [Google, DuckDuckGo] + ) + ''; + }; + + extraCss = '' + window { + color: #ffffff; + background-color: rgba(15, 15, 15, .2); + border-color: #000000; + } + + entry { + color: #ffffff; + background-color: rgba(40, 40, 40, .98); + padding: 14px; + font-size: 30px; + border-color: #000000; + border-radius: 10px; + } + + #plugin { + color: #efefef; + border-color: #000000; + border-color: #000000; + border-radius: 5px; + } + + #main { + color: #efefef; + border-color: #000000; + border-color: #000000; + border-radius: 5px; + } + ''; + }; +} diff --git a/config/nix/linux/default.nix b/config/nix/linux/default.nix index 45e9a1a9..e6f0bb58 100644 --- a/config/nix/linux/default.nix +++ b/config/nix/linux/default.nix @@ -1,28 +1,17 @@ -{ - devices, - inputs, - overlays, - home-manager, - ... -}: -builtins.listToAttrs (builtins.map - (device: { - name = device.user; - value = let - pkgs = import inputs.nixpkgs { - inherit overlays; - system = device.system; - }; - in - home-manager.lib.homeManagerConfiguration { - inherit pkgs; - extraSpecialArgs = { - inherit inputs; - inherit device; - }; - modules = [ - ../common/home.nix - ]; - }; - }) - devices) +{ devices, inputs, overlays, home-manager, ... }: +builtins.listToAttrs (builtins.map (device: { + name = device.user; + value = let + pkgs = import inputs.nixpkgs { + inherit overlays; + system = device.system; + }; + in home-manager.lib.homeManagerConfiguration { + inherit pkgs; + extraSpecialArgs = { + inherit inputs; + inherit device; + }; + modules = [ ../common/home.nix ]; + }; +}) devices) diff --git a/config/nix/linux/hyprland.nix b/config/nix/linux/hyprland.nix index d5baf288..079e0cbc 100644 --- a/config/nix/linux/hyprland.nix +++ b/config/nix/linux/hyprland.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +{ pkgs, ... }: { wayland.windowManager.hyprland = { enable = pkgs.stdenv.isLinux; settings = { @@ -68,7 +68,8 @@ dwindle = { # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more - pseudotile = true; # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + pseudotile = + true; # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below preserve_split = true; # you probably want this }; @@ -84,9 +85,7 @@ # Example per-device config # See https://wiki.hyprland.org/Configuring/Keywords/#executing for more - "device:epic-mouse-v1" = { - sensitivity = -0.5; - }; + "device:epic-mouse-v1" = { sensitivity = -0.5; }; # Example windowrule v1 # windowrule = float, ^(kitty)$ @@ -94,10 +93,7 @@ # windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more - windowrule = [ - "float, title:^(Steam)$" - "float, title:^(Archetype.*)$" - ]; + windowrule = [ "float, title:^(Steam)$" "float, title:^(Archetype.*)$" ]; "misc:vfr" = true; diff --git a/config/nix/linux/ironbar.nix b/config/nix/linux/ironbar.nix new file mode 100644 index 00000000..33616a72 --- /dev/null +++ b/config/nix/linux/ironbar.nix @@ -0,0 +1,283 @@ +{ inputs, ... }: { + imports = [ inputs.ironbar.homeManagerModules.default ]; + programs.ironbar = { + enable = true; + config.monitors = { + HDMI-A-2 = { + position = "bottom"; + start = [ + { + type = "launcher"; + favourites = [ "firefox" "discord" ]; + show_names = false; + show_icons = true; + } + { type = "focused"; } + ]; + end = [ + { + type = "clipboard"; + max_items = 3; + truncate.length = 50; + truncate.mode = "end"; + } + { + type = "music"; + player_type = "mpris"; + } + { type = "clock"; } + ]; + }; + DP-1 = { + position = "bottom"; + icon_theme = "Paper-Mono-Dark"; + end = [ + { + type = "sys_info"; + format = [ + " CPU {cpu_percent}% | {temp_c=coretemp-Package-id-0}°C" + " RAM {memory_percent}%" + # -  {disk_used=/home} GiB / {disk_total:/home} GiB ({disk_percent:/home}%) + # - 猪 {load_average=1} | {load_average:5} | {load_average:15} + # - 李 {net_down=eno1} / {net_up:eno1} Mbps + # -  {uptime} + ]; + interval = { + cpu = 1; + temps = 5; + memory = 30; + # disks= 300; + # networks= 3; + }; + } + { type = "tray"; } + ]; + start = [{ + type = "workspaces"; + name_map = { + "1" = "icon:code"; + "2" = ""; + "3" = "icon:chrome"; + "4" = "icon:discord"; + "5" = "icon:steam"; + "6" = "icon:misc"; + "7" = "icon:misc"; + "8" = "icon:docky"; + "9" = "icon:monodoc"; + "10" = "icon:spotify"; + }; + favorites = [ "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" ]; + all_monitors = true; + }]; + }; + }; + style = '' + @define-color color_bg #2d2d2d; + @define-color color_bg_dark #1c1c1c; + @define-color color_border #424242; + @define-color color_border_active #6699cc; + @define-color color_text #ffffff; + @define-color color_urgent #8f0a0a; + + /* -- base styles -- */ + + * { + font-family: Noto Sans Nerd Font, sans-serif; + font-size: 16px; + border: none; + border-radius: 0; + } + + box, menubar, button { + background-color: @color_bg; + background-image: none; + } + + button, label { + color: @color_text; + } + + button:hover { + background-color: @color_bg_dark; + } + + #bar { + border-top: 1px solid @color_border; + } + + .popup { + border: 1px solid @color_border; + padding: 1em; + } + + + /* -- clipboard -- */ + + .clipboard { + margin-left: 5px; + font-size: 1.1em; + } + + .popup-clipboard .item { + padding-bottom: 0.3em; + border-bottom: 1px solid @color_border; + } + + + /* -- clock -- */ + + .clock { + font-weight: bold; + margin-left: 5px; + } + + .popup-clock .calendar-clock { + color: @color_text; + font-size: 2.5em; + padding-bottom: 0.1em; + } + + .popup-clock .calendar { + background-color: @color_bg; + color: @color_text; + } + + .popup-clock .calendar .header { + padding-top: 1em; + border-top: 1px solid @color_border; + font-size: 1.5em; + } + + .popup-clock .calendar:selected { + background-color: @color_border_active; + } + + + /* -- launcher -- */ + + .launcher .item { + margin-right: 4px; + } + + .launcher .item:not(.focused):hover { + background-color: @color_bg_dark; + } + + .launcher .open { + border-bottom: 1px solid @color_text; + } + + .launcher .focused { + border-bottom: 2px solid @color_border_active; + } + + .launcher .urgent { + border-bottom-color: @color_urgent; + } + + .popup-launcher { + padding: 0; + } + + .popup-launcher .popup-item:not(:first-child) { + border-top: 1px solid @color_border; + } + + + /* -- music -- */ + + .music:hover * { + background-color: @color_bg_dark; + } + + .popup-music .album-art { + margin-right: 1em; + } + + .popup-music .icon-box { + margin-right: 0.4em; + } + + .popup-music .title .icon, .popup-music .title .label { + font-size: 1.7em; + } + + .popup-music .controls *:disabled { + color: @color_border; + } + + .slider slider { + color: @color_urgent; + background-color: @color_urgent; + } + + .popup-music .volume .slider slider { + border-radius: 100%; + } + + .popup-music .volume .icon { + margin-left: 4px; + } + + .popup-music .progress .slider slider { + border-radius: 100%; + } + + /* -- script -- */ + + .script { + padding-left: 10px; + } + + + /* -- sys_info -- */ + + .sysinfo { + margin-left: 10px; + } + + .sysinfo .item { + margin-left: 5px; + } + + + /* -- tray -- */ + + .tray { + margin-left: 10px; + } + + + /* -- workspaces -- */ + + .workspaces .item.focused { + box-shadow: inset 0 -3px; + background-color: @color_bg_dark; + } + + .workspaces .item:hover { + box-shadow: inset 0 -3px; + } + + + /* -- custom: power menu -- */ + + .popup-power-menu #header { + font-size: 1.4em; + padding-bottom: 0.4em; + margin-bottom: 0.6em; + border-bottom: 1px solid @color_border; + } + + .popup-power-menu .power-btn { + border: 1px solid @color_border; + padding: 0.6em 1em; + } + + .popup-power-menu #buttons > *:nth-child(1) .power-btn { + margin-right: 1em; + } + + ''; + }; +} diff --git a/config/nix/nixos/configuration.nix b/config/nix/nixos/configuration.nix index abec0f0e..d7fa63c7 100644 --- a/config/nix/nixos/configuration.nix +++ b/config/nix/nixos/configuration.nix @@ -1,7 +1,7 @@ # Edit this configuration file to define what should be installed on # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{pkgs, ...}: { +{ pkgs, ... }: { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix @@ -12,10 +12,11 @@ boot.loader.efi.canTouchEfiVariables = true; networking.hostName = "ryu"; # Define your hostname. - networking.nameservers = ["1.1.1.1" "8.8.8.8"]; + networking.nameservers = [ "1.1.1.1" "8.8.8.8" ]; # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - services.udev.packages = [pkgs.yubikey-personalization pkgs.yubikey-personalization-gui]; + services.udev.packages = + [ pkgs.yubikey-personalization pkgs.yubikey-personalization-gui ]; services.yubikey-agent.enable = true; # Configure network proxy if necessary @@ -28,9 +29,7 @@ # Set your time zone. time.timeZone = "Asia/Kolkata"; - i18n.supportedLocales = [ - "en_US.UTF-8/UTF-8" - ]; + i18n.supportedLocales = [ "en_US.UTF-8/UTF-8" ]; # Select internationalisation properties. i18n.defaultLocale = "en_US.UTF-8"; @@ -57,7 +56,7 @@ users.users.servius = { isNormalUser = true; description = "Uttarayan"; - extraGroups = ["networkmanager" "wheel"]; + extraGroups = [ "networkmanager" "wheel" ]; }; # Allow unfree packages @@ -76,10 +75,11 @@ git fish nushellFull - (pkgs.wrapFirefox (pkgs.firefox-unwrapped.override {pipewireSupport = true;}) {}) + (pkgs.wrapFirefox + (pkgs.firefox-unwrapped.override { pipewireSupport = true; }) { }) gnumake python3 - (nerdfonts.override {fonts = ["FiraCode" "Hasklig"];}) + (nerdfonts.override { fonts = [ "FiraCode" "Hasklig" ]; }) ]; programs = { @@ -123,4 +123,5 @@ # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "23.11"; # Did you read the comment? nix.settings.extra-experimental-features = "nix-command flakes"; + nix.settings.trusted-users = [ "root" "servius" ]; } diff --git a/config/nix/nixos/default.nix b/config/nix/nixos/default.nix index d947ed3b..53358d75 100644 --- a/config/nix/nixos/default.nix +++ b/config/nix/nixos/default.nix @@ -1,35 +1,25 @@ -{ - nixpkgs, - devices, - inputs, - overlays, - home-manager, - ... -}: -builtins.listToAttrs -(builtins.map - (device: { - name = device.name; - value = nixpkgs.lib.nixosSystem { - system = device.system; - specialArgs = {inherit device;}; - modules = [ - {nixpkgs.overlays = overlays;} - ./configuration.nix - home-manager.nixosModules.home-manager - { - nixpkgs.config.allowUnfree = true; - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - extraSpecialArgs = { - inherit inputs; - inherit device; - }; - users.${device.user}.imports = [../common/home.nix]; +{ nixpkgs, devices, inputs, overlays, home-manager, ... }: +builtins.listToAttrs (builtins.map (device: { + name = device.name; + value = nixpkgs.lib.nixosSystem { + system = device.system; + specialArgs = { inherit device; }; + modules = [ + { nixpkgs.overlays = overlays; } + ./configuration.nix + home-manager.nixosModules.home-manager + { + nixpkgs.config.allowUnfree = true; + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { + inherit inputs; + inherit device; }; - } - ]; - }; - }) - devices) + users.${device.user}.imports = [ ../common/home.nix ]; + }; + } + ]; + }; +}) devices) diff --git a/config/nix/nixos/hardware-configuration.nix b/config/nix/nixos/hardware-configuration.nix index 36c5f1f8..dceb946f 100644 --- a/config/nix/nixos/hardware-configuration.nix +++ b/config/nix/nixos/hardware-configuration.nix @@ -4,24 +4,23 @@ { config, lib, pkgs, modulesPath, ... }: { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "vmd" "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = + [ "vmd" "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/disk/by-uuid/bcaa8c53-6c04-43e0-bf2a-97d8c0f572d9"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/bcaa8c53-6c04-43e0-bf2a-97d8c0f572d9"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/4E27-DAC0"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/4E27-DAC0"; + fsType = "vfat"; + }; swapDevices = [ ]; @@ -34,5 +33,6 @@ # networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.cpu.intel.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/config/nix/scripts/start-tmux.nix b/config/nix/scripts/start-tmux.nix index 89a0465d..ec1f789a 100644 --- a/config/nix/scripts/start-tmux.nix +++ b/config/nix/scripts/start-tmux.nix @@ -1,6 +1,4 @@ -{ pkgs -, ... -}: +{ pkgs, ... }: pkgs.writeShellScript "start-tmux" '' live_sessions=$(${pkgs.tmux}/bin/tmux list-sessions 2>/dev/null) all_sessions=$(${pkgs.findutils}/bin/find -L ~/.config/tmux/sessions -type f -executable -printf '%f\n'| sort) @@ -16,18 +14,18 @@ pkgs.writeShellScript "start-tmux" '' for live_session in $live_sessions; do live_session_name=$(echo $live_session | ${pkgs.coreutils}/bin/cut -d: -f1) - if [ -z "''\${all_sessions##*$live_session_name*}" ];then # see https://stackoverflow.com/questions/229551/how-to-check-if-a-string-contains-a-substring-in-bash + if [ -z "''${all_sessions##*$live_session_name*}" ];then # see https://stackoverflow.com/questions/229551/how-to-check-if-a-string-contains-a-substring-in-bash all_sessions="$(echo "$all_sessions" | sed "s/$live_session_name/$live_session/g")" else all_sessions="$(echo -e "$all_sessions\n$live_session")" fi done - session=$(echo "''\$all_sessions" | ${pkgs.fzf}/bin/fzf) + session=$(echo "$all_sessions" | ${pkgs.fzf}/bin/fzf) session_name=$(echo $session | cut -d: -f1) if [ -z "$session" ];then exit 0 fi - if ! [ -z "''\${session##*created*}" ];then + if ! [ -z "''${session##*created*}" ];then if [ -x "$TMUX_SESSIONS/$session_name" ];then source $TMUX_SESSIONS/$session_name else @@ -35,7 +33,7 @@ pkgs.writeShellScript "start-tmux" '' exit 1 fi fi - if [ -z "''\${session##*attached*}" ];then + if [ -z "''${session##*attached*}" ];then read -r -p "The session is already attached somewhere else. Attach it here too ? (y/N): " choice if [ "$choice" == "y" ] || [ "$choice" == "Y" ];then ${pkgs.tmux}/bin/tmux attach-session -t$session_name @@ -44,6 +42,3 @@ pkgs.writeShellScript "start-tmux" '' ${pkgs.tmux}/bin/tmux attach-session -t$session_name fi '' - - - diff --git a/config/nvim/lua/lsp.lua b/config/nvim/lua/lsp.lua index 72aed363..994b5008 100644 --- a/config/nvim/lua/lsp.lua +++ b/config/nvim/lua/lsp.lua @@ -41,7 +41,7 @@ require("mason-lspconfig").setup_handlers { settings = { ['nil'] = { formatting = { - command = { "alejandra" }, + command = { "nixfmt" }, } } }