diff --git a/flake.nix b/flake.nix index 682826e..02f4a4c 100644 --- a/flake.nix +++ b/flake.nix @@ -1,8 +1,7 @@ -{ - description = "Modular NixOS Config"; +{ description = "Modular NixOS Config"; - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + inputs = + { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; home-manager = { url = "github:nix-community/home-manager/master"; inputs.nixpkgs.follows = "nixpkgs"; @@ -17,30 +16,32 @@ }; }; - outputs = { self, nixpkgs, home-manager, disko }: - let - system = "x86_64-linux"; - - pkgs = import nixpkgs { - inherit system; - config = { - allowUnfree = true; - }; - }; - - in - { - nixosConfigurations.socratesV2 = nixpkgs.lib.nixosSystem { - inherit pkgs; - modules = [ - ./machines - disko.nixosModules.disko - home-manager.nixosModules.home-manager{ - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.bryan = import ./homeConfig/home.nix; - } - ]; - }; + outputs = { self, nixpkgs, home-manager, nur, disko }: + let + system = "x86_64-linux"; + pkgs = import nixpkgs { + inherit system; + config = { + allowUnfree = true; }; + }; + + me = "bryan"; + desktop = "socratesV2"; + + in + { nixosConfigurations.${desktop} = nixpkgs.lib.nixosSystem { + inherit pkgs; + modules = [ + (import ./sysConfig { inherit me desktop; }) + nur.nixosModules.nur + disko.nixosModules.disko + home-manager.nixosModules.home-manager{ + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.${me} = import ./homeConfig/home.nix { inherit me; }; + } + ]; + }; + }; } diff --git a/homeConfig/home.nix b/homeConfig/home.nix new file mode 100644 index 0000000..9c88138 --- /dev/null +++ b/homeConfig/home.nix @@ -0,0 +1,12 @@ +{ user, ... }: + +{ + home.stateVersion = "22.11"; + programs.home-manager.enable = true; + + home = { + username = user; + homeDirectory = "/home/${user}"; + }; + +} diff --git a/homeConfig/modules/alacritty.nix b/homeConfig/modules/alacritty.nix new file mode 100644 index 0000000..0c4e34a --- /dev/null +++ b/homeConfig/modules/alacritty.nix @@ -0,0 +1,92 @@ +{ pkgs, lib, config, ... }: + +with lib; +let + cfg = config.modules.alacritty; + +in +{ options.modules.alacritty = { enable = mkEnableOption "alacritty"; }; + config = mkIf cfg.enable { + programs.alacritty = { + enable = true; + settings = { + scrolling = { + history = 10000; + multiplier = 3; + }; + + window = { + opacity = 0.95; + }; + + colors = { + primary = { + background = 0x0d1117; + foreground = 0xb3b1ad; + }; + + normal = { + black = 0x484f58; + red = 0xff7b72; + green = 0x3fb950; + yellow = 0xd29922; + blue = 0x58a6ff; + magenta = 0xbc8cff; + cyan = 0x39c5cf; + white = 0xb1bac4; + }; + + bright = { + black = 0x6e7681; + red = 0xffa198; + green = 0x56d364; + yellow = 0xe3b341; + blue = 0x79c0ff; + magenta = 0xd2a8ff; + cyan = 0x56d4dd; + white = 0xf0f6fc; + }; + }; + + font = { + normal = { + family = terminus-nerdfont; + style = Medium; + }; + + bold = { + family = terminus-nerdfont; + style = Bold; + }; + + italic = { + family = terminus-nerdfont; + style = Medium Italic; + }; + + bold_italic = { + family = terminus-nerdfont; + style = Bold Italic; + }; + }; + + size = 14; + + cursor = { + color = 0xffffff; + style = { + shape = Block; + blinking = Always; + blink-interval = 750; + }; + }; + }; + }; + + home.packages = with pkgs; [ + terminus-nerdfont + ranger + highlight + ]; + }; +} diff --git a/homeConfig/modules/bash.nix b/homeConfig/modules/bash.nix new file mode 100644 index 0000000..4220774 --- /dev/null +++ b/homeConfig/modules/bash.nix @@ -0,0 +1,202 @@ +{ pkgs, lib, config, ... }: + +with lib; +let + cfg = config.modules.bash; + +in +{ options.modules.bash = { enable = mkEnableOption "bash"; }; + config = mkIf cfg.enable { + programs.bash = { + enable = true; + enableCompletion = true; + initExtra = '' + eval "$(direnv hook bash)" + + is_ssh_session() { + if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then + return 0 + else + return 1 + fi + } + + function set_ps1_prompt() { + local git_branch="" + local flake_icon="" + local cur_dir="" + + if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then + git_branch="$(git symbolic-ref --short HEAD 2>/dev/null)" + + if [ $? -ne 0 ]; then + git_branch="$(git rev-parse --short HEAD 2>/dev/null)" + fi + + git_branch=" \[\033[01;31m\]$git_branch󰘬:\[\033[00m\]" + + if [ -f "$(git rev-parse --show-toplevel)/flake.nix" ]; then + # If it exists, set the flake icon and color it blue + flake_icon="\[\033[01;34m\] \[\033[00m\]" + fi + + git_root="$(basename "$(git rev-parse --show-toplevel)")" + + cur_dir=$(realpath --relative-to=$(git rev-parse --show-toplevel) .) + if [ "$cur_dir" == "." ]; then + cur_dir="\[\033[01;34m\] $git_root\[\033[00m\]" + else + cur_dir="\[\033[01;34m\] $git_root/$cur_dir\[\033[00m\]" + fi + else + cur_dir="\[\033[01;34m\]\w\[\033[00m\]" + fi + + if [ -n "''${IN_NIX_SHELL:+x}" ]; then + PS1="$cur_dir\n$flake_icon\[\033[01;32m\]nixShell>$git_branch\[\033[00m\]" + else + if ! is_ssh_session; then + PS1="\n$cur_dir\n$flake_icon\[\033[01;32m\]>$git_branch\[\033[00m\]" + else + PS1="\n\[\033[01;34m\]\w\[\033[00m\]\n\[\033[01;32m\]\u@\h:\[\033[00m\] " + fi + fi + unset flake_icon + } + PROMPT_COMMAND="set_ps1_prompt; $PROMPT_COMMAND" + ''; + + profileExtra = '' + if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then + exec sway + fi + ''; + + bashrcExtra = '' + function cdg() { + if [[ $1 == "--help" ]]; then + echo "A simple utility for navigating to the root of a git repo" + return 0 + fi + + # Check for invalid command + if [[ -n "$1" ]]; then + echo "Invalid command: $1. Try 'cdg --help'." + return 1 + fi + + local root_dir + root_dir=$(git rev-parse --show-toplevel 2>/dev/null) + local git_status=$? + + if [ $git_status -ne 0 ]; then + echo "Error: Not a git repo." + return 1 + fi + + cd "$root_dir" + } + + function ldv() { + if [[ $1 == "help" ]] || [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then + cat << EOF + ldv + A simple utility for setting up development environments effortlessly. + Commands: + ldv Start a preconfigured nix shell. + init Create a new dev template in the current working directory. + help Show available commands and options. + + Contributions welcome: https://github.com/itme-brain/ldv + EOF + + elif [[ $1 == "init" ]] || [[ $1 == "-i" ]] || [[ $1 == "--init" ]]; then + if [[ -e ./shell.nix ]] || [[ -e ./.envrc ]]; then + cat << EOF + Existing environment found. + Initialization cancelled. + EOF + return + fi + + cat << EOF + Initializing a new environment... + Select an environment: + 1. Web + 2. Elixir + 3. Haskell + EOF + + read -p "Enter the number of your choice: " choice + + case $choice in + 1) + wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/shells/web.nix -O shell.nix + wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/flake -O flake.nix + wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/envrc -O .envrc + direnv allow + ;; + 2) + wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/shells/elixir.nix -O shell.nix + wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/flake -O flake.nix + wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/envrc -O .envrc + direnv allow + ;; + 3) + wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/shells/haskell.nix -O shell.nix + wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/flake -O flake.nix + wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/envrc -O .envrc + direnv allow + ;; + *) + echo "Invalid choice." + ;; + esac + elif [[ -z $1 ]]; then + cat << EOF + Select an environment: + 1. Web + 2. Elixir + 3. Haskell + EOF + + read -p "Enter the number of your choice: " choice + + case $choice in + 1) + (nix develop github:itme-brain/ldv#web) + ;; + 2) + (nix develop github:itme-brain/ldv#elixir) + ;; + 3) + (nix develop github:itme-brain/ldv#haskell) + ;; + # Add more cases here... + *) + echo "Invalid choice." + ;; + esac + else + echo "Error: Invalid command. Try 'ldv --help'" + fi + } + ''; + + shellAliases = { + hmup = "home-manager switch --flake '$HOME/Documents/projects/nixos#bryan'"; + nixup = "sudo nixos-rebuild switch --flake '$HOME/Documents/projects/nixos#socrates'"; + }; + }; + + services.gpg-agent.enableBashIntegration = true; + programs = { + direnv.nix-direnv.enable = true; + ripgrep.enable = true; + lsd = { + enable = true; + enableAliases = true; + }; + }; + }; +} diff --git a/homeConfig/modules/browsers.nix b/homeConfig/modules/browsers.nix new file mode 100644 index 0000000..71c90d6 --- /dev/null +++ b/homeConfig/modules/browsers.nix @@ -0,0 +1,52 @@ +{ pkgs, lib, config, user, ... }: + +with lib; +let + cfg = config.modules.firefox; + +in +{ options.modules.firefox = { enable = mkEnableOption "firefox"; }; + config = mkIf cfg.enable { + programs.firefox = { + enabled = true; + profiles.${user} = { + isDefault = true; + search.default = "Startpage"; + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + ublock-origin + darkreader + keepassxc-browser + multi-account-containers + ]; + + settings = { + "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; + + "dom.security.https_only_mode" = true; + "media.peerconnection.enabled" = false; + "browser.formfill.enable" = false; + + "privacy.sanitize.sanitizeOnShutdown" = true; + "toolkit.telemetry.enabled" = false; + "toolkit.telemetry.archive.enabled" = false; + "datareporting.healthreport.uploadEnabled" = false; + "browser.ping-centre.telemetry" = false; + + "privacy.resistFingerprinting" = true; + "privacy.trackingprotection.fingerprinting.enabled" = true; + "privacy.trackingprotection.cryptomining.enabled" = true; + + "geo.enabled" = false; + "privacy.trackingprotection.enabled" = true; + }; + }; + }; + + home.packages = [ + google-chrome + (tor-browser-bundle-bin.override { + useHardenedMalloc = false; # NixOS bug requires this + }) + ]; + }; +} diff --git a/homeConfig/modules/corn.nix b/homeConfig/modules/corn.nix new file mode 100644 index 0000000..a4428a1 --- /dev/null +++ b/homeConfig/modules/corn.nix @@ -0,0 +1,15 @@ +{ pkgs, lib, config, ... }: + +with lib; +let + cfg = config.modules.corn; + +in +{ options.modules.corn = { enable = mkEnableOption "corn"; }; + config = mkIf cfg.enable { + home.packages = with pkgs; [ + trezor-suite trezorctl + electrum bisq-desktop + ]; + }; +} diff --git a/homeConfig/modules/default.nix b/homeConfig/modules/default.nix new file mode 100644 index 0000000..a1c15cc --- /dev/null +++ b/homeConfig/modules/default.nix @@ -0,0 +1,12 @@ +{ pkgs, lib, config, ... }: + +with lib; +let + cfg = config.modules.PROGRAM; + +in +{ options.modules.PROGRAM = { enable = mkEnableOption "PROGRAM"; }; + config = mkIf cfg.enable { + + }; +} diff --git a/homeConfig/modules/fun.nix b/homeConfig/modules/fun.nix new file mode 100644 index 0000000..0f69db0 --- /dev/null +++ b/homeConfig/modules/fun.nix @@ -0,0 +1,16 @@ +{ pkgs, lib, config, ... }: + +with lib; +let + cfg = config.modules.PROGRAM; + +in +{ options.modules.PROGRAM = { enable = mkEnableOption "PROGRAM"; }; + config = mkIf cfg.enable { + home.packages = with pkgs; [ + spotify + discord + steam + ]; + }; +} diff --git a/homeConfig/modules/git.nix b/homeConfig/modules/git.nix new file mode 100644 index 0000000..286053c --- /dev/null +++ b/homeConfig/modules/git.nix @@ -0,0 +1,33 @@ +{ pkgs, lib, config, ... }: + +with lib; +let cfg = config.modules.git; + +in +{ + options.modules.git = { enable = mkEnableOption "git"; }; + config = mkIf cfg.enable { + programs = { + git = { + enable = true; + userName = "Bryan Ramos"; + userEmail = "bryan@ramos.codes"; + signingKey = "F1F3466458452B2DF351F1E864D12BA95ACE1F2D"; + + extraConfig = { + init = { defaultBranch = "main"; }; + }; + + ignores = [ + "node_modules" + ]; + }; + + gh = { + enable = true; + settings.git_protocol = "ssh"; + }; + + }; + }; +} diff --git a/homeConfig/modules/gpg.nix b/homeConfig/modules/gpg.nix new file mode 100644 index 0000000..f018afc --- /dev/null +++ b/homeConfig/modules/gpg.nix @@ -0,0 +1,133 @@ +{ pkgs, lib, config, ... }: + +with lib; +let cfg = config.modules.gpg; + +in +{ options.modules.gpg = { enable = mkEnableOption "gpg"; }; + config = mkIf cfg.enable { + programs.gpg = { + enable = true; + publicKeys."bryan@ramos.codes" = { + trust = 5; + text = '' + -----BEGIN PGP PUBLIC KEY BLOCK----- + + mQINBGP0BgMBEAC2v+n9plI0p+TqIrmvz7JHoYbtUK3NDkyNeIsgS+sE5nfLB1Ef + vQCR0HdysgpmAUywqEx+YK7Nkr4szoK8nDLpgpSfaDZNss+ePu6eYVTVktelBn2Q + 5f5MKDILY9mkmDPgzvpDDhkFXGK3cpeUX+X5vY1W76yuRgm6zBDIux+yf027nw3U + phesn/WlWXRsmAXG2helt1nB6Foj6LjgwRG/aKMI8cQq0JS13cfUZO1nq2ifM0pm + 4HqWgbZOKYWHsoOw4qNiuxWwVoL5E7UQW2MEyxZmLZaNohEpReYpI0N9FGB/AZYt + iKn9SO9SmG+afE+gxrExJYZSGVHHKlPc79dcIBVvYEA8dV/OJBjHc83EhUQVU4vQ + x1y386HYctlHVWZ64tc1XROlQe++NxfgQZz4jnvGzHMakr8/IZAV3LP3PGVAa7kx + iVrTE+WodK/kELm1PMLWlWmXT3GiumOngm4y1dWtUirqxni/Nl7BA4eHM3Q3OZiR + eEb80FkbXCoaP5REU1EdVlAW/ZGP+mTwiqekT5ThocaD/BgYSy9UlGf5YyOEnqOt + G+0JfS3mG0PysFjF0B5dMyBquikD4zVBo3+a7ppbrAage3EFhHiX0Les0q566I8p + 0hlXS7nz0I4xAxxRLfydwJptndjZgeiq9o1XMRA0JUZQhzuk2VYQ6MSVhwARAQAB + tB9CcnlhbiBSYW1vcyA8YnJ5YW5AcmFtb3MuY29kZXM+iQJOBBMBCgA4FiEE8fNG + ZFhFKy3zUfHoZNErqVrOHy0FAmP0BgMCGwEFCwkIBwIGFQoJCAsCBBYCAwECHgEC + F4AACgkQZNErqVrOHy25SBAArl6JHrDm3fLXPhwtHf9WzxQvW6BmMgLQQ+bGGGba + A3e+eKb0ibSmXH9M22GOSxKqk2BePtoLFdyDKDFNwYDwzj0ioQ80Q9YR6aoSuwOf + HwXeiYsgK76IbsRciXSv6JgAsXO9UOGTlHlTgFsE3AMjnCgPr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A76SJXkkqGs7GmJ3EHVA8N/2Lwhf0saaG3cBrKx + lXrJoSY7TxeoJ7rdt/KRJfKsU0bdXgVXDFrlf4ZvctCLZmQ0nno2cgYemTnELRYv + FzrS2itqqWP1ev2iPpCbKp099i/w6D13C3jBVAVYPBapD6aaD7YHWLhHIA5zH7bF + n8IgacgKBoJ8u3jo3eeT5CXfsrnwOYdrqposfMCUOriJHx41nGUqjNZDG2ByHxgS + mnUd3lrjRDWTUzXj8pRN2K7Uqbbs2Mz4Q64MgbCkkTichMlVux8kH+O/I/veAYto + OEpwdDwa67AtzYKG0ssOJI+po9TlbKYS4O4H8XnPhYSOEw8eObNPYCX7jyAjXloo + 1hbflYLyMYo1BxGR6bPS9gJA2w== + =5uun + -----END PGP PUBLIC KEY BLOCK----- + ''; + }; + }; + + programs.ssh.enable = true; + services.gpg-agent = { + enable = true; + enableSshSupport = true; + }; + }; +} diff --git a/homeConfig/modules/gui.nix b/homeConfig/modules/gui.nix new file mode 100644 index 0000000..3d146cd --- /dev/null +++ b/homeConfig/modules/gui.nix @@ -0,0 +1,273 @@ +{ pkgs, lib, config, ... }: + +with lib; +let cfg = config.modules.gui; + modifier = config.wayland.windowManager.sway.config.modifier; + +in { + options.modules.gui = { enable = mkEnableOption "gui"; }; + config = mkIf cfg.enable { + wayland.windowManager.sway = { + enable = true; + xwayland = true; + wrapperFeatures.gtk = true; + config = { + modifier = "Mod1"; + menu = "\${pkgs.rofi-wayland}/bin/rofi -show drun -show-icons -drun-icon-theme Qogir -font 'Noto Sans 14'"; + terminal = "\${pkgs.alacritty}/bin/alacritty"; + startup = [{ command = "exec { exec alacritty -e sh -c 'neofetch; exec $SHELL'"; always = true; }]; + + input = { + keyboard = { + xkb_numlock = "enabled"; + xkb_layout = "us"; + }; + pointer = { + accel_profile = "flat"; + pointer_accel = "0.65"; + }; + }; + + bars.sway-bar = { + position = "top"; + statusCommand = ''while :; do echo "$(free -h | awk '/^Mem/ {print $3}') '|' $(date +'%I:%M:%S %p') '|' $(date +'%m-%d-%Y')"; sleep 1; done''; + fonts = { + names = [ "Noto Sans" "Noto Emoji" "Noto Color Emoji" ]; + size = 10.0; + }; + colors.background = "#0A0E14"; + colors.statusline = "#FFFFFF"; + }; + + gaps = { + smartGaps = false; + inner = 10; + }; + + floating.border = 0; + window.border= 0; + + keybindings = lib.mkOptionDefault { + "${modifier}+q" = "kill"; + "Print" = "exec grim ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png"; + "Shift+Print" = "exec grim -g '$(slurp)'' ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png"; + "${modifier}+Print" = ''exec sh -c 'grim -g "$(swaymsg -t get_tree | jq -j '"'"'.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"'"'"')" ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png' ''; + "${modifier}+Shift+f" = "exec alacritty -e ranger"; + "${modifier}+Shift+d" = "exec emote"; + }; + + extraOptions = [ + "--unsupported-gpu" + "--my-next-gpu-wont-be-nvidia" + ]; + + extraSessionCommands = '' + export _JAVA_AWT_WM_NONREPARENTING=1 + ''; + }; + }; + + gtk = { + enable = true; + theme.package = pkgs.juno-theme; + theme.name = "Juno-ocean"; + iconTheme.package = pkgs.qogir-icon-theme; + iconTheme.name = "Qogir"; + }; + + programs.btop.enable = true; + fonts.fontconfig.enable = true; + + programs.rofi = { + enable = true; + package = pkgs.rofi-wayland; + location = "center"; + terminal = "\${pkgs.alacritty}/bin/alacritty"; + + theme = { + "*" = { + nord0 = mkLiteral "#2e3440"; + nord1 = mkLiteral "#3b4252"; + nord2 = mkLiteral "#434c5e"; + nord3 = mkLiteral "#4c566a"; + nord4 = mkLiteral "#d8dee9"; + nord5 = mkLiteral "#e5e9f0"; + nord6 = mkLiteral "#eceff4"; + nord7 = mkLiteral "#8fbcbb"; + nord8 = mkLiteral "#88c0d0"; + nord9 = mkLiteral "#81a1c1"; + nord10 = mkLiteral "#5e81ac"; + nord11 = mkLiteral "#bf616a"; + nord12 = mkLiteral "#d08770"; + nord13 = mkLiteral "#ebcb8b"; + nord14 = mkLiteral "#a3be8c"; + nord15 = mkLiteral "#b48ead"; + spacing = 2; + background-color = mkLiteral "var(nord1)"; + background = mkLiteral "var(nord1)"; + foreground = mkLiteral "var(nord4)"; + normal-background = mkLiteral "var(background)"; + normal-foreground = mkLiteral "var(foreground)"; + alternate-normal-background = mkLiteral "var(background)"; + alternate-normal-foreground = mkLiteral "var(foreground)"; + selected-normal-background = mkLiteral "var(nord8)"; + selected-normal-foreground = mkLiteral "var(background)"; + active-background = mkLiteral "var(background)"; + active-foreground = mkLiteral "var(nord10)"; + alternate-active-background = mkLiteral "var(background)"; + alternate-active-foreground = mkLiteral "var(nord10)"; + selected-active-background = mkLiteral "var(nord10)"; + selected-active-foreground = mkLiteral "var(background)"; + urgent-background = mkLiteral "var(background)"; + urgent-foreground = mkLiteral "var(nord11)"; + alternate-urgent-background = mkLiteral "var(background)"; + alternate-urgent-foreground = mkLiteral "var(nord11)"; + selected-urgent-background = mkLiteral "var(nord11)"; + selected-urgent-foreground = mkLiteral "var(background)"; + }; + + element = { + padding = mkLiteral "0px 0px 0px 7px"; + spacing = mkLiteral "5px"; + border = 0; + cursor = mkLiteral "pointer"; + }; + + "element normal.normal" = { + background-color = mkLiteral "var(normal-background)"; + text-color = mkLiteral "var(normal-foreground)"; + }; + + "element normal.urgent" = { + background-color = mkLiteral "var(urgent-background)"; + text-color = mkLiteral "var(urgent-foreground)"; + }; + + "element normal.active" = { + background-color = mkLiteral "var(active-background)"; + text-color = mkLiteral "var(active-foreground)"; + }; + + "element selected.normal" = { + background-color = mkLiteral "var(selected-normal-background)"; + text-color = mkLiteral "var(selected-normal-foreground)"; + }; + + "element selected.urgent" = { + background-color = mkLiteral "var(selected-urgent-background)"; + text-color = mkLiteral "var(selected-urgent-foreground)"; + }; + + "element selected.active" = { + background-color = mkLiteral "var(selected-active-background)"; + text-color = mkLiteral "var(selected-active-foreground)"; + }; + + "element alternate.normal" = { + background-color = mkLiteral "var(alternate-normal-background)"; + text-color = mkLiteral "var(alternate-normal-foreground)"; + }; + + "element alternate.urgent" = { + background-color = mkLiteral "var(alternate-urgent-background)"; + text-color = mkLiteral "var(alternate-urgent-foreground)"; + }; + + "element alternate.active" = { + background-color = mkLiteral "var(alternate-active-background)"; + text-color = mkLiteral "var(alternate-active-foreground)"; + }; + + "element-text" = { + background-color = mkLiteral "rgba(0, 0, 0, 0%)"; + text-color = mkLiteral "inherit"; + highlight = mkLiteral "inherit"; + cursor = mkLiteral "inherit"; + }; + + "element-icon" = { + background-color = mkLiteral "rgba(0, 0, 0, 0%)"; + size = mkLiteral "1.0000em"; + text-color = mkLiteral "inherit"; + cursor = mkLiteral "inherit"; + }; + + window = { + padding = 0; + border = 0; + background-color = mkLiteral "var(background)"; + }; + + mainbox = { + padding = 0; + border = 0; + }; + + message = { + margin = mkLiteral "0px 7px"; + }; + + textbox = { + text-color = mkLiteral "var(foreground)"; + }; + + listview = { + margin = mkLiteral "0px 0px 5px"; + scrollbar = true; + spacing = mkLiteral "2px"; + fixed-height = 0; + }; + + scrollbar = { + padding = 0; + handle-width = mkLiteral "14px"; + border = 0; + handle-color = mkLiteral "var(nord3)"; + }; + + button = { + spacing = 0; + text-color = mkLiteral "var(normal-foreground)"; + cursor = mkLiteral "pointer"; + }; + + "button selected" = { + background-color = mkLiteral "var(selected-normal-background)"; + text-color = mkLiteral "var(selected-normal-foreground)"; + }; + + inputbar = { + padding = mkLiteral "7px"; + margin = mkLiteral "7px"; + spacing = 0; + text-color = mkLiteral "var(normal-foreground)"; + background-color = mkLiteral "var(nord3)"; + children = [ "entry" ]; + }; + + entry = { + spacing = 0; + cursor = mkLiteral "text"; + text-color = mkLiteral "var(normal-foreground)"; + background-color = mkLiteral "var(nord3)"; + }; + }; + }; + + home.packages = [ + xdg-utils + grim + slurp + + imv + gimp + evince + + noto-fonts + noto-fonts-cjk + + emote + emojione + ]; + }; +} diff --git a/homeConfig/modules/nvim.nix b/homeConfig/modules/nvim.nix new file mode 100644 index 0000000..7b9af19 --- /dev/null +++ b/homeConfig/modules/nvim.nix @@ -0,0 +1,220 @@ +{ pkgs, lib, config, ... }: + +with lib; +let + cfg = config.modules.neovim; + + github-theme = pkgs.vimUtils.buildVimPlugin { + name = "github-theme"; + src = pkgs.fetchFromGithub { + owner = "projekt0n"; + repo = "github-nvim-theme"; + rev = "ea713c37691b2519f56cd801a2330bdf66393d0f"; + sha256 = "0cwr3b5r2ac7aizxmwb3mlhdc2sh0pw670vcwps79x9jp52yrj2y"; + }; + }; + + LSPs = with pkgs; [ + nil nixfmt marksman + sumneko-lua-language-server stylua + haskell-language-server hlint + ]; + + LSPs' = with pkgs.nodePackages; [ + vscode-langservers-extracted typescript-language-server eslint + bash-language-server diagnostic-languageserver + pyright purescript-language-server + ]; + +in +{ options.modules.neovim = { enable = mkEnableOption "neovim"; }; + config = mkIf cfg.enable { + programs.neovim = { + enable = true; + viAlias = true; + vimAlias = true; + + plugins = with pkgs.vimPlugins; [ + { + plugin = github-theme; + config = '' + lua << EOF + vim.cmd('colorscheme github_dark_high_contrast') + EOF + ''; + } + + { plugin = lazygit.nvim; } + + { + plugin = LazyVim; + config = '' + lua << EOF + return { + {'williamboman/mason.nvim', enabled = false }, + {'williamboman/mason-lspconfig.nvim', enabled = false }, + {'nvim-treesitter/nvim-treesitter', enabled = false }, + } + EOF + ''; + } + + { + plugin = lsp-zero-nvim; + config = '' + lua << EOF + branch = 'v2.x' + requires = { + {'neovim/nvim-lspconfig'}, + {'hrsh7th/nvim-cmp'}, + {'hrsh7th/cmp-nvim-lsp'}, + {'L3MON4D3/LuaSnip'}, + } + ''; + } + + { + plugin = nvim-treesitter.withAllGrammars; + config = '' + lua << EOF + require'nvim-treesitter.configs'.setup { + highlight = { + enable = true, + }, + } + EOF + ''; + } + ]; + + extraLuaConfig = '' + lua << EOF + vim.opt.tabstop = 2 + vim.opt.shiftwidth = 2 + vim.opt.expandtab = true + + vim.o.clipboard = "unnamedplus" + EOF + ''; + + generatedConfigs = { + lua = '' + require("config.lazy") + + local lsp = require("lsp-zero").preset({}) + + lsp.on_attach(function(client, bufnr) + lsp.default_keymaps({ buffer = bufnr }) + end) + + lsp.setup_servers({ + "tsserver", + "eslint", + "hls", + "pyright", + "nil_ls", + "cssls", + "html", + "jsonls", + "diagnosticls", + "lua_ls", + "marksman", + "purescriptls", + "tailwindcss", + "bashls", + }) + + require("lspconfig").lua_ls.setup(lsp.nvim_lua_ls()) + + lsp.setup() + + local cmp = require("cmp") + cmp.setup({ + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + sources = { + { name = "nvim_lsp" }, + { name = "luasnip" }, + }, + }) + + vim.cmd([[ + au BufRead,BufNewFile *.purs set filetype=purescript + ]]) + + local has_words_before = function() + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + end + + local luasnip = require("luasnip") + + cmp.setup({ + enabled = function() + -- disable completion in comments + local context = require("cmp.config.context") + -- keep command mode completion enabled when cursor is in a comment + if vim.api.nvim_get_mode().mode == "c" then + return true + else + return not context.in_treesitter_capture("comment") and not context.in_syntax_group("Comment") + end + end, + mapping = { + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() + -- they way you will only jump inside the snippet region + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + + [""] = cmp.mapping({ + i = function(fallback) + if cmp.visible() and cmp.get_active_entry() then + cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false }) + else + fallback() + end + end, + s = cmp.mapping.confirm({ select = true }), + c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), + }), + }, + }) + + vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { + -- Disable virtual_text + virtual_text = false, + }) + + require("notify").setup({ + background_colour = "#000000", + }) + ''; + }; + + extraPackages = LSPs ++ LSPs'; + }; + }; +} diff --git a/homeConfig/modules/security.nix b/homeConfig/modules/security.nix new file mode 100644 index 0000000..907ce35 --- /dev/null +++ b/homeConfig/modules/security.nix @@ -0,0 +1,14 @@ +{ pkgs, lib, config, ... }: + +with lib; +let + cfg = config.modules.security; + +in +{ options.modules.security = { enable = mkEnableOption "security"; }; + config = mkIf cfg.enable { + home.packages = [ + keepassxc wireguard-tools ipscan + ]; + }; +} diff --git a/homeConfig/modules/utils.nix b/homeConfig/modules/utils.nix new file mode 100644 index 0000000..e6b904b --- /dev/null +++ b/homeConfig/modules/utils.nix @@ -0,0 +1,22 @@ +{ pkgs, lib, config, ... }: + +with lib; +let + cfg = config.modules.utils; + +in +{ options.modules.utils = { enable = mkEnableOption "utils"; }; + config = mkIf cfg.enable { + + services.syncthing.enable = true; + + home.packages = with pkgs; [ + wget curl tree neofetch + unzip fping calc qrendcode + fd pkg-config pciutils + neofetch mdbook rsync + android-studio docker + gcc gnumake + ]; + }; +} diff --git a/modules/alacritty/default.nix b/modules/alacritty/default.nix deleted file mode 100644 index 4ad3473..0000000 --- a/modules/alacritty/default.nix +++ /dev/null @@ -1,83 +0,0 @@ -{ pkgs, lib, config, ... } = - -with lib; -let cfg = config.modules.alacritty; - -in { - options.modules.alacritty = { enable = mkEnableOption "alacritty"; }; - config = mkIf cfg.enable { - programs.alacritty = { - enable = true; - settings = { - - scrolling = { - history = 10000; - multiplier = 3; - }; - - window = { - opacity = 0.95; - }; - - colors = { - primary = { - background = 0x0d1117; - foreground = 0xb3b1ad; - }; - - normal = { - black = 0x484f58; - red = 0xff7b72; - green = 0x3fb950; - yellow = 0xd29922; - blue = 0x58a6ff; - magenta = 0xbc8cff; - cyan = 0x39c5cf; - white = 0xb1bac4; - }; - - bright = { - black = 0x6e7681; - red = 0xffa198; - green = 0x56d364; - yellow = 0xe3b341; - blue = 0x79c0ff; - magenta = 0xd2a8ff; - cyan = 0x56d4dd; - white = 0xf0f6fc; - }; - - font = { - normal = { - family = TerminusWithNerdFont; - style = Medium; - }; - - bold = { - family = TerminusWithNerdFont; - style = Bold; - }; - - italic = { - family = TerminusWithNerdFont; - style = Medium Italic; - }; - - bold_italic = { - family = TerminusWithNerdFont; - style = Bold Italic; - }; - - size = 14; - - cursor = { - color = 0xffffff; - style = { - shape = Block; - blinking = Always; - blink-interval = 750; - }; - }; - }; - }; -} diff --git a/modules/bash/default.nix b/modules/bash/default.nix deleted file mode 100644 index f023ddb..0000000 --- a/modules/bash/default.nix +++ /dev/null @@ -1,187 +0,0 @@ -{ pkgs, lib, config, ... }: - -with lib; -let cfg = config.modules.bash; - -in { - options.modules.bash = { enable = mkEnableOption "bash"; }; - config = mkIf cfg.enable { - programs.bash = { - enable = true; - enableCompletion = true; - - initExtra = '' - eval "$(direnv hook bash)" - - is_ssh_session() { - if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then - return 0 - else - return 1 - fi - } - - function set_ps1_prompt() { - local git_branch="" - local flake_icon="" - local cur_dir="" - - if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then - git_branch="$(git symbolic-ref --short HEAD 2>/dev/null)" - - if [ $? -ne 0 ]; then - git_branch="$(git rev-parse --short HEAD 2>/dev/null)" - fi - - git_branch=" \[\033[01;31m\]$git_branch󰘬:\[\033[00m\]" - - if [ -f "$(git rev-parse --show-toplevel)/flake.nix" ]; then - # If it exists, set the flake icon and color it blue - flake_icon="\[\033[01;34m\] \[\033[00m\]" - fi - - git_root="$(basename "$(git rev-parse --show-toplevel)")" - - cur_dir=$(realpath --relative-to=$(git rev-parse --show-toplevel) .) - if [ "$cur_dir" == "." ]; then - cur_dir="\[\033[01;34m\] $git_root\[\033[00m\]" - else - cur_dir="\[\033[01;34m\] $git_root/$cur_dir\[\033[00m\]" - fi - else - cur_dir="\[\033[01;34m\]\w\[\033[00m\]" - fi - - if [ -n "${IN_NIX_SHELL:+x}" ]; then - PS1="$cur_dir\n$flake_icon\[\033[01;32m\]nixShell>$git_branch\[\033[00m\]" - else - if ! is_ssh_session; then - PS1="\n$cur_dir\n$flake_icon\[\033[01;32m\]>$git_branch\[\033[00m\]" - else - PS1="\n\[\033[01;34m\]\w\[\033[00m\]\n\[\033[01;32m\]\u@\h:\[\033[00m\] " - fi - fi - unset flake_icon - } - PROMPT_COMMAND="set_ps1_prompt; $PROMPT_COMMAND" - ''; - - bashrcExtra = '' - function cdg() { - if [[ $1 == "--help" ]]; then - echo "A simple utility for navigating to the root of a git repo" - return 0 - fi - - # Check for invalid command - if [[ -n "$1" ]]; then - echo "Invalid command: $1. Try 'cdg --help'." - return 1 - fi - - local root_dir - root_dir=$(git rev-parse --show-toplevel 2>/dev/null) - local git_status=$? - - if [ $git_status -ne 0 ]; then - echo "Error: Not a git repo." - return 1 - fi - - cd "$root_dir" - } - - function ldv() { - if [[ $1 == "help" ]] || [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then - cat << EOF - ldv - A simple utility for setting up development environments effortlessly. - Commands: - ldv Start a preconfigured nix shell. - init Create a new dev template in the current working directory. - help Show available commands and options. - - Contributions welcome: https://github.com/itme-brain/ldv - EOF - - elif [[ $1 == "init" ]] || [[ $1 == "-i" ]] || [[ $1 == "--init" ]]; then - if [[ -e ./shell.nix ]] || [[ -e ./.envrc ]]; then - cat << EOF - Existing environment found. - Initialization cancelled. - EOF - return - fi - - cat << EOF - Initializing a new environment... - Select an environment: - 1. Web - 2. Elixir - 3. Haskell - EOF - - read -p "Enter the number of your choice: " choice - - case $choice in - 1) - wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/shells/web.nix -O shell.nix - wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/flake -O flake.nix - wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/envrc -O .envrc - direnv allow - ;; - 2) - wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/shells/elixir.nix -O shell.nix - wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/flake -O flake.nix - wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/envrc -O .envrc - direnv allow - ;; - 3) - wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/shells/haskell.nix -O shell.nix - wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/flake -O flake.nix - wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/envrc -O .envrc - direnv allow - ;; - *) - echo "Invalid choice." - ;; - esac - elif [[ -z $1 ]]; then - cat << EOF - Select an environment: - 1. Web - 2. Elixir - 3. Haskell - EOF - - read -p "Enter the number of your choice: " choice - - case $choice in - 1) - (nix develop github:itme-brain/ldv#web) - ;; - 2) - (nix develop github:itme-brain/ldv#elixir) - ;; - 3) - (nix develop github:itme-brain/ldv#haskell) - ;; - # Add more cases here... - *) - echo "Invalid choice." - ;; - esac - else - echo "Error: Invalid command. Try 'ldv --help'" - fi - } - ''; - - shellAliases = { - ls = "lsd"; - hmup = "home-manager switch --flake '$HOME/Documents/projects/nixos#bryan'"; - nixup = "sudo nixos-rebuild switch --flake '$HOME/Documents/projects/nixos#socrates'"; - }; - }; - }; -} diff --git a/modules/default.nix b/modules/default.nix deleted file mode 100644 index ce7f29b..0000000 --- a/modules/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ pkgs, lib, config, ... }: - -with lib; -let cfg = config.modules.PROGRAM; - -in { - options.modules.PROGRAM = { enable = mkEnableOption "PROGRAM"; }; - config = mkIf cfg.enable { - }; -} diff --git a/modules/git/default.nix b/modules/git/default.nix deleted file mode 100644 index 90ffccd..0000000 --- a/modules/git/default.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ pkgs, lib, config, ... }: - -with lib; -let cfg = config.modules.git; - -in -{ - options.modules.git = { enable = mkEnableOption "git"; }; - config = mkIf cfg.enable { - programs.git = { - enable = true; - extraConfig = { - init = { defaultBranch = "main"; }; - }; - }; - - home.file = { - ".gitconfig".source = ./gitconfig; - }; - }; -} diff --git a/modules/git/gitconfig b/modules/git/gitconfig deleted file mode 100644 index c7beb3f..0000000 --- a/modules/git/gitconfig +++ /dev/null @@ -1,4 +0,0 @@ -[user] - email = bryan@ramos.codes - name = Bryan Ramos - signingkey = F1F3466458452B2DF351F1E864D12BA95ACE1F2D diff --git a/modules/gpg/default.nix b/modules/gpg/default.nix deleted file mode 100644 index 6da48fc..0000000 --- a/modules/gpg/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, lib, config, ... }: - -with lib; -let cfg = config.modules.gpg; - -in { - options.modules.gpg = { enable = mkEnableOption "gpg"; }; - config = mkIf cfg.enable { - programs.gpg.enable = true; - }; -} diff --git a/modules/gtk/default.nix b/modules/gtk/default.nix deleted file mode 100644 index ce7f29b..0000000 --- a/modules/gtk/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ pkgs, lib, config, ... }: - -with lib; -let cfg = config.modules.PROGRAM; - -in { - options.modules.PROGRAM = { enable = mkEnableOption "PROGRAM"; }; - config = mkIf cfg.enable { - }; -} diff --git a/modules/home.nix b/modules/home.nix deleted file mode 100644 index a6f421a..0000000 --- a/modules/home.nix +++ /dev/null @@ -1,132 +0,0 @@ -{ config, pkgs, ... }: - -{ - programs.home-manager.enable = true; # Leave this set to true. - - home = { - username = "bryan"; - homeDirectory = "/home/bryan"; - stateVersion = "22.11"; # Do not edit this variable - }; - - home.packages = with pkgs; [ - firefox - google-chrome - (tor-browser-bundle-bin.override { - useHardenedMalloc = false; # Nix specific bug in tor browser requires disabling useHardenedMalloc - }) - - spotify - discord - - alacritty - ranger - highlight - imv - gimp - - android-studio - gh - - syncthing - rsync - wget - curl - btop - pciutils - tree - git - git-review - openssh - unzip - lsd - fping - calc - qrencode - mdbook - - bash-completion - pkg-config - docker - nix-init - lazygit - ripgrep - fd - luajit - - trezor-suite - trezorctl - electrum - - keepassxc - neofetch - evince - wireguard-tools - - nodejs - gcc - - ghc - cabal-install - haskellPackages.hoogle - cabal2nix - - python3 - -# LSPs - nodePackages.eslint - nodePackages.vscode-langservers-extracted - nodePackages.typescript-language-server - nodePackages.diagnostic-languageserver - nodePackages.pyright - nodePackages.purescript-language-server - nodePackages."@tailwindcss/language-server" - nodePackages.bash-language-server - haskell-language-server - nil - marksman - sumneko-lua-language-server - ]; - -# PROGRAM CONFIGS - -# DIRENV - programs.direnv = { - enable = true; - nix-direnv.enable = true; - }; - -# NEOVIM - programs.neovim = { - enable = true; -# plugins = with pkgs; [ -# vimPlugins.nvim-treesitter.withAllGrammars -# ]; - }; - -# SERVICES - -# GPG SSH AGENT - home.sessionVariables = { - SSH_AUTH_SOCK = "${config.xdg.dataHome}/gnupg/S.gpg-agent.ssh"; - }; - - -# DOTFILE SYMLINKS - home.file = { - ".gitconfig".source = ./dotfiles/gitconfig; - - ".config/" = { - source = ./dotfiles; - recursive = true; - }; - - ".bashrc".source = ./dotfiles/bash/bashrc; - ".bash_profile".source = ./dotfiles/bash/bash_profile; - - ".local/share/themes" = { - source = ./dotfiles/themes; - recursive = true; - }; - }; -} diff --git a/modules/nvim/default.nix b/modules/nvim/default.nix deleted file mode 100644 index 9950375..0000000 --- a/modules/nvim/default.nix +++ /dev/null @@ -1,228 +0,0 @@ -{ pkgs, lib, config, ... }: - -with lib; -let cfg = config.modules.neovim; - - github-theme = pkgs.vimUtils.buildVimPlugin { - name = "github-theme"; - src = pkgs.fetchFromGithub { - owner = "projekt0n"; - repo = "github-nvim-theme"; - rev = "ea713c37691b2519f56cd801a2330bdf66393d0f"; - sha256 = "0cwr3b5r2ac7aizxmwb3mlhdc2sh0pw670vcwps79x9jp52yrj2y"; - }; - }; -in { - options.modules.neovim = { enable = mkEnableOption "neovim"; }; - config = mkIf cfg.enable { - - home.file.".config/nvim" = { - source = ./nvim; - recursive = true; - }; - - programs.neovim = { - enable = true; - viAlias = true; - vimAlias = true; - - plugins = with pkgs.vimPlugins; [ - { - plugin = github-theme; - config = '' - lua << EOF - vim.cmd('colorscheme github_dark_high_contrast') - EOF - ''; - } - - { plugin = lazygit.nvim; } - - { - plugin = LazyVim; - config = '' - lua << EOF - return { - {'williamboman/mason.nvim', enabled = false }, - {'williamboman/mason-lspconfig.nvim', enabled = false }, - {'nvim-treesitter/nvim-treesitter', enabled = false }, - } - EOF - ''; - } - - { - plugin = lsp-zero-nvim; - config = '' - lua << EOF - branch = 'v2.x' - requires = { - {'neovim/nvim-lspconfig'}, - {'hrsh7th/nvim-cmp'}, - {'hrsh7th/cmp-nvim-lsp'}, - {'L3MON4D3/LuaSnip'}, - } - ''; - } - - { - plugin = nvim-treesitter.withAllGrammars; - config = '' - lua << EOF - require'nvim-treesitter.configs'.setup { - highlight = { - enable = true, - }, - } - EOF - ''; - } - ]; - - extraLuaConfig = '' - lua << EOF - vim.opt.tabstop = 2 - vim.opt.shiftwidth = 2 - vim.opt.expandtab = true - - vim.o.clipboard = "unnamedplus" - EOF - ''; - - generatedConfigs = { - lua = '' - require("config.lazy") - - local lsp = require("lsp-zero").preset({}) - - lsp.on_attach(function(client, bufnr) - lsp.default_keymaps({ buffer = bufnr }) - end) - - lsp.setup_servers({ - "tsserver", - "eslint", - "hls", - "pyright", - "nil_ls", - "cssls", - "html", - "jsonls", - "diagnosticls", - "lua_ls", - "marksman", - "purescriptls", - "tailwindcss", - "bashls", - }) - - require("lspconfig").lua_ls.setup(lsp.nvim_lua_ls()) - - lsp.setup() - - local cmp = require("cmp") - cmp.setup({ - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, - sources = { - { name = "nvim_lsp" }, - { name = "luasnip" }, - }, - }) - - vim.cmd([[ - au BufRead,BufNewFile *.purs set filetype=purescript - ]]) - - local has_words_before = function() - unpack = unpack or table.unpack - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil - end - - local luasnip = require("luasnip") - - cmp.setup({ - enabled = function() - -- disable completion in comments - local context = require("cmp.config.context") - -- keep command mode completion enabled when cursor is in a comment - if vim.api.nvim_get_mode().mode == "c" then - return true - else - return not context.in_treesitter_capture("comment") and not context.in_syntax_group("Comment") - end - end, - mapping = { - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() - -- they way you will only jump inside the snippet region - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, { "i", "s" }), - - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - - [""] = cmp.mapping({ - i = function(fallback) - if cmp.visible() and cmp.get_active_entry() then - cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false }) - else - fallback() - end - end, - s = cmp.mapping.confirm({ select = true }), - c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), - }), - }, - }) - - vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { - -- Disable virtual_text - virtual_text = false, - }) - - require("notify").setup({ - background_colour = "#000000", - }) - ''; - }; - }; - - home.packages = with pkgs; [ - nodePackages.eslint - nodePackages.vscode-langservers-extracted - nodePackages.typescript-language-server - nodePackages.diagnostic-languageserver - nodePackages.pyright - nodePackages.purescript-language-server - nodePackages."@tailwindcss/language-server" - nodePackages.bash-language-server - marksman - - nil nixfmt - - sumneko-lua-language-server stylua - - haskell-language-server hlint - ]; - }; -} diff --git a/sysConfig/desktop/partitions.nix b/sysConfig/desktop/disks.nix similarity index 67% rename from sysConfig/desktop/partitions.nix rename to sysConfig/desktop/disks.nix index 3b0d215..e641ba0 100644 --- a/sysConfig/desktop/partitions.nix +++ b/sysConfig/desktop/disks.nix @@ -1,4 +1,6 @@ -{ disks ? [ "/dev/nvme0n1" "/dev/sda" ], ... }: { +{ disks ? [ "/dev/nvme0n1" "/dev/sda" ], ... }: + +{ disko.devices = { disk = { one = { @@ -21,12 +23,31 @@ }; } { - name = "primary"; start = "100M"; + end = "100%FREE"; + content = { + type = "lvm_pv"; + vg = "stick"; + }; + } + ]; + }; + }; + }; + disk = { + two = { + type = "disk"; + device = builtins.elemAt disks 1; + content = { + type = "table"; + format = "gpt"; + partitions = [ + { + start = "0"; end = "100%"; content = { type = "lvm_pv"; - vg = "pool"; + vg = "ssd"; }; } ]; @@ -34,17 +55,8 @@ }; }; - disk = { - two = { - type = "disk"; - device = builtins.elemAt disks 1; - content = { - - } - }; - }; lvm_vg = { - pool = { + stick = { type = "lvm_vg"; lvs = { aaa = { @@ -54,8 +66,9 @@ size = "1M"; }; root = { - size = "100M"; + size = "100%"; content = { + name = "NixOS"; type = "filesystem"; format = "ext4"; mountpoint = "/"; @@ -64,9 +77,23 @@ ]; }; }; + }; + }; + }; + lvm_vg = { + ssd = { + type = "lvm_vg"; + lvs = { + aaa = { + size = "1M"; + }; + zzz = { + size = "1M"; + }; home = { - size = "100%FREE"; + size = "100%"; content = { + name = "home"; type = "filesystem"; format = "ext4"; mountpoint = "/home"; diff --git a/sysConfig/desktop/hardware.nix b/sysConfig/desktop/hardware.nix index 13fedf1..d591336 100644 --- a/sysConfig/desktop/hardware.nix +++ b/sysConfig/desktop/hardware.nix @@ -43,7 +43,6 @@ }; # GPU - programs.sway.extraOptions = "--unsupported-gpu"; services.xserver.videoDrivers = [ "nvidia" ]; hardware = { opengl.enable = true; diff --git a/sysConfig/desktop/system.nix b/sysConfig/desktop/system.nix index ed5f38d..b235c60 100644 --- a/sysConfig/desktop/system.nix +++ b/sysConfig/desktop/system.nix @@ -1,8 +1,9 @@ -{ pkgs, lib, config, ... }: -{ - system.stateVersion = "23.05"; +{ pkgs, lib, desktop, me, ... }: + +{ system.stateVersion = "22.11"; environment.defaultPackages = [ ]; +# Nix nix = { extraOptions = "experimental-features = nix-command flakes"; settings = { @@ -13,52 +14,9 @@ options = "weekly"; }; }; + environment.systemPackages = with pkgs; [ nix-init pavucontrol ]; - users.users.bryan = { - isNormalUser = true; - extraGroups = [ "wheel" "networkmanager" "home-manager" "input" "video" "audio" "kvm" "libvirtd" "docker" ]; - }; - - security.sudo.wheelNeedsPassword = false; - -# GUI - programs = { - sway = { - enable = true; - - extraPackages = with pkgs; [ - rofi-wayland - grim - slurp - wl-clipboard - - xdg-utils - - fontconfig - qogir-icon-theme - emote - - pavucontrol - ]; - - extraSessionCommands = '' - if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then - exec sway - fi - export _JAVA_AWT_WM_NONREPARENTING=1 - ''; - }; - xwayland.enable = true; - xdg.portal.wlr.enable = true; - - gnupg = { - agent = { - enable = true; - enableSSHSupport = true; - }; - }; - }; - +# Audio services.pipewire = { enable = true; audio.enable = true; @@ -70,19 +28,19 @@ alsa.enable = true; alsa.support32Bit = true; }; - - fonts = { - fonts = with pkgs; [ - terminus_font - nerdfonts - - noto-fonts - noto-fonts-cjk - - emojione - ]; + +# Users + users.users.${me} = { + isNormalUser = true; + extraGroups = [ "wheel" "networkmanager" "home-manager" "input" "video" "audio" "kvm" "libvirtd" "docker" ]; + openssh.authorizedKeys.keyFiles = [ /etc/ssh/authorized_keys ]; }; - + + security.sudo = { + wheelNeedsPassword = false; + execWheelOnly = true; + }; + # System Services services = { trezord.enable = true; @@ -90,16 +48,11 @@ cron = { enable = true; systemCronJobs = [ - "0 0 * * * bryan /home/bryan/Documents/scripts/lnbackup_script.sh" + "0 0 * * * ${me} /home/${me}/Documents/scripts/lnbackup_script.sh" ]; }; }; - console = { - font = "Lat2-Terminus16"; - useXkbConfig = true; - }; - # Locale time = { timeZone = "America/New_York"; @@ -117,11 +70,25 @@ i18n.defaultLocale = "en_US.UTF-8"; + console = { + font = "Lat2-Terminus16"; + useXkbConfig = true; + }; + # Networking networking = { - hostName = "socrates"; + hostName = desktop; useDHCP = lib.mkDefault true; networkmanager.enable = true; - firewall.enable = true; + firewall = { + enable = true; + allowedTCPPorts = [ 22 80 443 ]; + }; + }; + + services.openssh = { + enable = true; + startWhenNeeded = true; + settings.PasswordAuthentication = false; }; }