diff --git a/flake.nix b/flake.nix index 2f6faaa..95188d1 100644 --- a/flake.nix +++ b/flake.nix @@ -13,26 +13,38 @@ claude-code.url = "github:ryoppippi/claude-code-overlay"; }; - outputs = { nixpkgs, home-manager, nixos-hardware, neovim-nightly, zen-browser, claude-code, ... }: + outputs = + { + nixpkgs, + home-manager, + nixos-hardware, + neovim-nightly, + zen-browser, + claude-code, + ... + }: let system = "x86_64-linux"; pkgs = import nixpkgs { inherit system; - config.allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg) [ - "slack" - "claude-code" - "claude" - "nvidia-x11" - "nvidia-settings" - "apple_cursor" - ]; + config.allowUnfreePredicate = + pkg: + builtins.elem (nixpkgs.lib.getName pkg) [ + "slack" + "claude-code" + "claude" + "nvidia-x11" + "nvidia-settings" + "apple_cursor" + ]; overlays = [ neovim-nightly.overlays.default claude-code.overlays.default ]; }; - in { - formatter.${system} = pkgs.nixfmt; + in + { + formatter.${system} = pkgs.nixfmt-tree; nixosConfigurations.xps15 = nixpkgs.lib.nixosSystem { inherit system; @@ -44,14 +56,16 @@ neovim-nightly.overlays.default claude-code.overlays.default ]; - nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg) [ - "slack" - "claude-code" - "claude" - "nvidia-x11" - "nvidia-settings" - "apple_cursor" - ]; + nixpkgs.config.allowUnfreePredicate = + pkg: + builtins.elem (nixpkgs.lib.getName pkg) [ + "slack" + "claude-code" + "claude" + "nvidia-x11" + "nvidia-settings" + "apple_cursor" + ]; } home-manager.nixosModules.home-manager { diff --git a/home/home.nix b/home/home.nix index 65de890..4dd5674 100644 --- a/home/home.nix +++ b/home/home.nix @@ -1,8 +1,14 @@ -{ lib, config, pkgs, ... }: +{ + lib, + config, + pkgs, + ... +}: let isNixOS = builtins.pathExists /etc/NIXOS; -in { +in +{ imports = [ ./modules/bootstrap.nix ./modules/theme.nix diff --git a/home/modules/bootstrap.nix b/home/modules/bootstrap.nix index 05f7393..b923f39 100644 --- a/home/modules/bootstrap.nix +++ b/home/modules/bootstrap.nix @@ -1,11 +1,23 @@ -{ lib, config, pkgs, ... }: +{ + lib, + config, + pkgs, + ... +}: let homeDir = config.home.homeDirectory; repoDir = "${homeDir}/nix-config"; - directories = [ "dev" "dl" "img" "img/screen" "wp" ]; -in { + directories = [ + "dev" + "dl" + "img" + "img/screen" + "wp" + ]; +in +{ home.activation.createDirectories = lib.hm.dag.entryAfter [ "writeBoundary" ] '' for dir in ${lib.concatStringsSep " " directories}; do $DRY_RUN_CMD mkdir -p "$HOME/$dir" diff --git a/home/modules/editor.nix b/home/modules/editor.nix index baf442f..5bf9770 100644 --- a/home/modules/editor.nix +++ b/home/modules/editor.nix @@ -13,5 +13,6 @@ vimAlias = true; }; - xdg.configFile."nvim".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nix-config/config/nvim"; + xdg.configFile."nvim".source = + config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nix-config/config/nvim"; } diff --git a/home/modules/git.nix b/home/modules/git.nix index bada0c0..be6bb5c 100644 --- a/home/modules/git.nix +++ b/home/modules/git.nix @@ -1,4 +1,9 @@ -{ lib, config, pkgs, ... }: +{ + lib, + config, + pkgs, + ... +}: { programs.git = { diff --git a/home/modules/packages.nix b/home/modules/packages.nix index f740944..71a3cb4 100644 --- a/home/modules/packages.nix +++ b/home/modules/packages.nix @@ -1,4 +1,11 @@ -{ pkgs, lib, config, zen-browser, hostPlatform, ... }: +{ + pkgs, + lib, + config, + zen-browser, + hostPlatform, + ... +}: let enableClaude = true; @@ -6,22 +13,25 @@ let enableSioyek = true; enableVesktop = true; enableNeovim = config.programs.neovim.enable; -in { +in +{ home.sessionVariables = lib.optionalAttrs enableZen { BROWSER = "zen-browser"; }; programs.mpv.enable = true; - home.packages = with pkgs; [ - signal-desktop - slack - bitwarden-desktop - ] - ++ lib.optionals enableClaude [ claude-code ] - ++ lib.optionals enableZen [ zen-browser.packages.${hostPlatform}.default ] - ++ lib.optionals enableSioyek [ sioyek ] - ++ lib.optionals enableVesktop [ vesktop ]; + home.packages = + with pkgs; + [ + signal-desktop + slack + bitwarden-desktop + ] + ++ lib.optionals enableClaude [ claude-code ] + ++ lib.optionals enableZen [ zen-browser.packages.${hostPlatform}.default ] + ++ lib.optionals enableSioyek [ sioyek ] + ++ lib.optionals enableVesktop [ vesktop ]; xdg.configFile."claude/settings.json" = lib.mkIf enableClaude { text = builtins.toJSON { @@ -86,21 +96,22 @@ in { xdg.mimeApps = { enable = true; - defaultApplications = {} - // lib.optionalAttrs enableZen { - "x-scheme-handler/http" = "zen.desktop"; - "x-scheme-handler/https" = "zen.desktop"; - "text/html" = "zen.desktop"; - } - // lib.optionalAttrs enableNeovim { - "text/plain" = "nvim.desktop"; - } - // lib.optionalAttrs enableSioyek { - "application/pdf" = "sioyek.desktop"; - "application/epub" = "sioyek.desktop"; - } - // lib.optionalAttrs enableVesktop { - "x-scheme-handler/discord" = "vesktop.desktop"; - }; + defaultApplications = + { } + // lib.optionalAttrs enableZen { + "x-scheme-handler/http" = "zen.desktop"; + "x-scheme-handler/https" = "zen.desktop"; + "text/html" = "zen.desktop"; + } + // lib.optionalAttrs enableNeovim { + "text/plain" = "nvim.desktop"; + } + // lib.optionalAttrs enableSioyek { + "application/pdf" = "sioyek.desktop"; + "application/epub" = "sioyek.desktop"; + } + // lib.optionalAttrs enableVesktop { + "x-scheme-handler/discord" = "vesktop.desktop"; + }; }; } diff --git a/home/modules/shell.nix b/home/modules/shell.nix index c6d561d..eb4a67b 100644 --- a/home/modules/shell.nix +++ b/home/modules/shell.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let c = config.colors; @@ -15,7 +20,8 @@ let aws = true; psql = true; sqlite = true; -in { +in +{ home.packages = with pkgs; [ pure-prompt xclip @@ -225,7 +231,8 @@ in { zle -N fzf-config-widget bindkey '^E' fzf-config-widget - '' + lib.optionalString ocaml '' + '' + + lib.optionalString ocaml '' [[ ! -r "$OPAMROOT/opam-init/init.zsh" ]] || source "$OPAMROOT/opam-init/init.zsh" > /dev/null 2> /dev/null ''; }; @@ -452,42 +459,48 @@ in { }; commands = { - open = ''$${{ - setsid -f xdg-open "$f" 2>/dev/null 2>&1 & - }}''; - sopen = ''$${{ - for f in $fx; do - setsid -f xdg-open "$f" >/dev/null 2>&1 & - done - }}''; - rmd = ''$${{ - set -f - while IFS= read -r dir; do - rmdir -v -- "$dir" - done <<< "$fx" - }}''; - rmf = ''$${{ - set -f - while IFS= read -r file; do - rm -v -- "$file" - done <<< "$fx" - }}''; - resize = ''%{{ - w=$(tmux display-message -p '#{pane_width}' || tput cols) - if [ $w -le 62 ]; then - lf -remote "send $id set ratios 1:4" - lf -remote "send $id set nopreview" - elif [ $w -le 80 ]; then - lf -remote "send $id set ratios 1:2:2" - elif [ $w -le 100 ]; then - lf -remote "send $id set ratios 1:2:3" - else - lf -remote "send $id set ratios 2:4:5" - fi - }}''; - on-init = ''%{{ - lf -remote "send $id resize" - }}''; + open = '' + $${{ + setsid -f xdg-open "$f" 2>/dev/null 2>&1 & + }}''; + sopen = '' + $${{ + for f in $fx; do + setsid -f xdg-open "$f" >/dev/null 2>&1 & + done + }}''; + rmd = '' + $${{ + set -f + while IFS= read -r dir; do + rmdir -v -- "$dir" + done <<< "$fx" + }}''; + rmf = '' + $${{ + set -f + while IFS= read -r file; do + rm -v -- "$file" + done <<< "$fx" + }}''; + resize = '' + %{{ + w=$(tmux display-message -p '#{pane_width}' || tput cols) + if [ $w -le 62 ]; then + lf -remote "send $id set ratios 1:4" + lf -remote "send $id set nopreview" + elif [ $w -le 80 ]; then + lf -remote "send $id set ratios 1:2:2" + elif [ $w -le 100 ]; then + lf -remote "send $id set ratios 1:2:3" + else + lf -remote "send $id set ratios 2:4:5" + fi + }}''; + on-init = '' + %{{ + lf -remote "send $id resize" + }}''; }; keybindings = { @@ -517,6 +530,8 @@ in { source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nix-config/config/lf/cleaner"; }; - xdg.configFile."lf/lf.lua".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nix-config/config/lf/lf.lua"; - xdg.configFile."lf/sort.py".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nix-config/config/lf/sort.py"; + xdg.configFile."lf/lf.lua".source = + config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nix-config/config/lf/lf.lua"; + xdg.configFile."lf/sort.py".source = + config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nix-config/config/lf/sort.py"; } diff --git a/home/modules/terminal.nix b/home/modules/terminal.nix index 45dae67..f17f969 100644 --- a/home/modules/terminal.nix +++ b/home/modules/terminal.nix @@ -2,7 +2,8 @@ let c = config.colors; -in { +in +{ home.sessionVariables = { TERMINAL = "ghostty"; TERM = "xterm-ghostty"; diff --git a/home/modules/theme.nix b/home/modules/theme.nix index 6b949da..1997f67 100644 --- a/home/modules/theme.nix +++ b/home/modules/theme.nix @@ -1,4 +1,9 @@ -{ lib, config, pkgs, ... }: +{ + lib, + config, + pkgs, + ... +}: let palettes = { @@ -35,9 +40,13 @@ let activityFg = "#3b5bdb"; }; }; -in { +in +{ options.theme = lib.mkOption { - type = lib.types.enum [ "midnight" "daylight" ]; + type = lib.types.enum [ + "midnight" + "daylight" + ]; default = "midnight"; }; diff --git a/home/modules/ui.nix b/home/modules/ui.nix index 2ff43e5..ab5b282 100644 --- a/home/modules/ui.nix +++ b/home/modules/ui.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: let isNixOS = builtins.pathExists /etc/NIXOS; @@ -6,7 +11,8 @@ let nvidia = true; backlightDevice = "intel_backlight"; -in { +in +{ home.packages = with pkgs; [ wl-clipboard cliphist @@ -42,7 +48,8 @@ in { env = QT_QPA_PLATFORM,wayland env = GDK_BACKEND,wayland,x11 env = SDL_VIDEODRIVER,wayland - '' + lib.optionalString nvidia '' + '' + + lib.optionalString nvidia '' env = LIBVA_DRIVER_NAME,nvidia env = __GLX_VENDOR_LIBRARY_NAME,nvidia env = NVD_BACKEND,direct @@ -50,15 +57,18 @@ in { env = GSK_RENDERER,ngl env = __NV_PRIME_RENDER_OFFLOAD,1 env = __VK_LAYER_NV_optimus,NVIDIA_only - '' + '' + '' + + '' env = XCURSOR_SIZE,24 env = HYPRCURSOR_SIZE,24 - '' + lib.optionalString nvidia '' + '' + + lib.optionalString nvidia '' cursor { no_hardware_cursors = true } - '' + '' + '' + + '' general { gaps_in = 0 @@ -249,10 +259,12 @@ in { hide_cursor = true; grace = 0; }; - background = [{ - monitor = ""; - path = "~/img/screen/lock.jpg"; - }]; + background = [ + { + monitor = ""; + path = "~/img/screen/lock.jpg"; + } + ]; animations.enabled = false; }; }; @@ -275,9 +287,18 @@ in { exclusive = true; height = 34; - modules-left = [ "hyprland/workspaces" "hyprland/window" ]; - modules-center = []; - modules-right = [ "backlight" "pulseaudio" "network" "battery" "clock" ]; + modules-left = [ + "hyprland/workspaces" + "hyprland/window" + ]; + modules-center = [ ]; + modules-right = [ + "backlight" + "pulseaudio" + "network" + "battery" + "clock" + ]; "hyprland/workspaces" = { disable-scroll = true; @@ -300,7 +321,7 @@ in { format = " {} [{}]"; separate-outputs = true; max-length = 80; - rewrite = {}; + rewrite = { }; }; pulseaudio = { @@ -405,73 +426,80 @@ in { extraConfig = { show-icons = false; }; - theme = let - inherit (config.lib.formats.rasi) mkLiteral; - in { - "*" = { - selected-normal-foreground = mkLiteral "${c.fg}"; - foreground = mkLiteral "${c.fg}"; - normal-foreground = mkLiteral "@foreground"; - alternate-normal-background = mkLiteral "${c.bg}"; - background = mkLiteral "${c.bgAlt}"; - alternate-normal-foreground = mkLiteral "@foreground"; - normal-background = mkLiteral "@background"; - selected-normal-background = mkLiteral "${c.accent}"; - border-color = mkLiteral "${c.fgAlt}"; - spacing = 2; - separatorcolor = mkLiteral "@foreground"; - background-color = mkLiteral "rgba ( 0, 0, 0, 0 % )"; + theme = + let + inherit (config.lib.formats.rasi) mkLiteral; + in + { + "*" = { + selected-normal-foreground = mkLiteral "${c.fg}"; + foreground = mkLiteral "${c.fg}"; + normal-foreground = mkLiteral "@foreground"; + alternate-normal-background = mkLiteral "${c.bg}"; + background = mkLiteral "${c.bgAlt}"; + alternate-normal-foreground = mkLiteral "@foreground"; + normal-background = mkLiteral "@background"; + selected-normal-background = mkLiteral "${c.accent}"; + border-color = mkLiteral "${c.fgAlt}"; + spacing = 2; + separatorcolor = mkLiteral "@foreground"; + background-color = mkLiteral "rgba ( 0, 0, 0, 0 % )"; + }; + window = { + background-color = mkLiteral "@background"; + border = 1; + padding = 5; + }; + mainbox = { + border = 0; + padding = 0; + }; + listview = { + fixed-height = 0; + border = mkLiteral "2px 0px 0px"; + border-color = mkLiteral "@separatorcolor"; + spacing = mkLiteral "2px"; + scrollbar = false; + padding = mkLiteral "2px 0px 0px"; + }; + element = { + border = 0; + padding = mkLiteral "1px"; + }; + element-text = { + background-color = mkLiteral "inherit"; + text-color = mkLiteral "inherit"; + }; + "element.normal.normal" = { + background-color = mkLiteral "@normal-background"; + text-color = mkLiteral "@normal-foreground"; + }; + "element.selected.normal" = { + background-color = mkLiteral "@selected-normal-background"; + text-color = mkLiteral "@selected-normal-foreground"; + }; + "element.alternate.normal" = { + background-color = mkLiteral "@alternate-normal-background"; + text-color = mkLiteral "@alternate-normal-foreground"; + }; + inputbar = { + spacing = 0; + text-color = mkLiteral "@normal-foreground"; + padding = mkLiteral "1px"; + children = map mkLiteral [ + "prompt" + "textbox-prompt-colon" + "entry" + "case-indicator" + ]; + }; + textbox-prompt-colon = { + expand = false; + str = ":"; + margin = mkLiteral "0px 0.3em 0em 0em"; + text-color = mkLiteral "@normal-foreground"; + }; }; - window = { - background-color = mkLiteral "@background"; - border = 1; - padding = 5; - }; - mainbox = { - border = 0; - padding = 0; - }; - listview = { - fixed-height = 0; - border = mkLiteral "2px 0px 0px"; - border-color = mkLiteral "@separatorcolor"; - spacing = mkLiteral "2px"; - scrollbar = false; - padding = mkLiteral "2px 0px 0px"; - }; - element = { - border = 0; - padding = mkLiteral "1px"; - }; - element-text = { - background-color = mkLiteral "inherit"; - text-color = mkLiteral "inherit"; - }; - "element.normal.normal" = { - background-color = mkLiteral "@normal-background"; - text-color = mkLiteral "@normal-foreground"; - }; - "element.selected.normal" = { - background-color = mkLiteral "@selected-normal-background"; - text-color = mkLiteral "@selected-normal-foreground"; - }; - "element.alternate.normal" = { - background-color = mkLiteral "@alternate-normal-background"; - text-color = mkLiteral "@alternate-normal-foreground"; - }; - inputbar = { - spacing = 0; - text-color = mkLiteral "@normal-foreground"; - padding = mkLiteral "1px"; - children = map mkLiteral [ "prompt" "textbox-prompt-colon" "entry" "case-indicator" ]; - }; - textbox-prompt-colon = { - expand = false; - str = ":"; - margin = mkLiteral "0px 0.3em 0em 0em"; - text-color = mkLiteral "@normal-foreground"; - }; - }; }; services.dunst = { @@ -502,5 +530,6 @@ in { }; }; }; - xdg.configFile."X11".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nix-config/config/X11"; + xdg.configFile."X11".source = + config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nix-config/config/X11"; } diff --git a/hosts/xps15/configuration.nix b/hosts/xps15/configuration.nix index 6936cbe..d0983de 100644 --- a/hosts/xps15/configuration.nix +++ b/hosts/xps15/configuration.nix @@ -15,7 +15,12 @@ }; boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.efiSysMountPoint = "/boot/efi"; - boot.kernelParams = [ "nvidia-drm.modeset=1" "ibt=off" "loglevel=3" "quiet" ]; + boot.kernelParams = [ + "nvidia-drm.modeset=1" + "ibt=off" + "loglevel=3" + "quiet" + ]; networking.hostName = "xps15"; networking.wireless.iwd = { @@ -31,22 +36,30 @@ services.pcscd.enable = true; i18n.defaultLocale = "en_US.UTF-8"; - security.pam.services.hyprlock = {}; + security.pam.services.hyprlock = { }; security.doas = { enable = true; - extraRules = [{ - groups = [ "wheel" ]; - persist = true; - keepEnv = true; - }]; + extraRules = [ + { + groups = [ "wheel" ]; + persist = true; + keepEnv = true; + } + ]; }; environment.binsh = "${pkgs.dash}/bin/dash"; users.users.barrett = { isNormalUser = true; - extraGroups = [ "wheel" "docker" "libvirt" "storage" "power" ]; + extraGroups = [ + "wheel" + "docker" + "libvirt" + "storage" + "power" + ]; shell = pkgs.zsh; }; @@ -119,7 +132,10 @@ dmidecode ]; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; system.stateVersion = "24.11"; }