diff --git a/configuration.nix b/configuration.nix index a112e5f..d6d8687 100644 --- a/configuration.nix +++ b/configuration.nix @@ -3,17 +3,59 @@ # and in the NixOS manual (accessible by running ‘nixos-help’). { config, pkgs, ... }: +let + CORNER_RADIUS = "0"; + WAYBAR_MODULES_CORNER_RADIUS = "15"; + GAPS_IN = "5"; + GAPS_OUT = "10"; + BORDER_WIDTH = "2"; + BORDER_WIDTH_INT = 2; + # Colours + BG = "282828"; + BG0_H = "1d2021"; + BG0_S = "32302f"; + BG0 = "282828"; + BG1 = "3c3836"; + BG2 = "504945"; + BG3 = "665c54"; + BG4 = "7c6f64"; + DARK_GRAY = "928374"; + + FG = "ebdbb2"; + FG0 = "fbf1c7"; + FG1 = "ebdbb2"; + FG2 = "d5c4a1"; + FG3 = "bdae93"; + FG4 = "a89984"; + GRAY = "a89984"; + + DARK_RED = "cc241d"; + DARK_GREEN = "98971a"; + DARK_YELLOW = "d79921"; + DARK_BLUE = "458588"; + DARK_PURPLE = "b16286"; + DARK_AQUA = "689d6a"; + DARK_ORANGE = "d65d0e"; + RED = "db4934"; + GREEN = "b8bb26"; + YELLOW = "dabd2f"; + BLUE = "83a598"; + PURPLE = "d3869b"; + AQUA = "8ec07c"; + ORANGE = "fe8019"; + +in { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + ]; # Bootloader. - boot.loader.grub.enable = true; - boot.loader.grub.device = "/dev/nvme0n1"; - boot.loader.grub.useOSProber = true; + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; networking.hostName = "nixos"; # Define your hostname. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. @@ -25,8 +67,6 @@ # Enable networking networking.networkmanager.enable = true; - hardware.opengl.driSupport32Bit = true; - # Set your time zone. time.timeZone = "Europe/London"; @@ -48,14 +88,14 @@ # Enable the X11 windowing system. services.xserver.enable = true; - # Enable the Pantheon Desktop Environment. - services.xserver.displayManager.lightdm.enable = true; - services.xserver.desktopManager.pantheon.enable = true; + # Enable the GNOME Desktop Environment. + # services.xserver.displayManager.gdm.enable = true; + # services.xserver.desktopManager.gnome.enable = true; # Configure keymap in X11 services.xserver = { - layout = "gb"; - xkbVariant = ""; + xkb.layout = "gb"; + xkb.variant = ""; }; # Configure console keymap @@ -83,28 +123,773 @@ # Enable touchpad support (enabled default in most desktopManager). # services.xserver.libinput.enable = true; + + + + services.gpm.enable = true; # Mouse support in tty + + systemd.timers."copy-to-server" = { + wantedBy = [ "timers.target" ]; + timerConfig = { + OnBootSec = "1m"; + OnUnitActiveSec = "1m"; + Unit = "copy-to-server.service"; + }; + }; + systemd.services."hello-world" = { + script = ''scp $HOME/media/Pictures/other/serverUpload/* max@192.168.1.118:/srv/www/htdocs/images''; + serviceConfig = { + Type = "oneshot"; + User = "root"; + }; + }; + + # Enable dconf + programs.dconf.enable = true; # Define a user account. Don't forget to set a password with ‘passwd’. users.users.deadvey = { isNormalUser = true; - description = "Max Crawshaw"; + description = "Dave Smith"; extraGroups = [ "networkmanager" "wheel" ]; - packages = with pkgs; [ - firefox - # thunderbird - ]; }; + home-manager.users.deadvey = { pkgs, ... }: { + home.packages = with pkgs; [ + thunderbird + gramps + librewolf + keepassxc + nextcloud-client + gimp + eaglemode + gruvbox-plus-icons + gruvbox-gtk-theme + #emacsPackages.ement # Element client for emacs + cinny-desktop + crosswords + ]; + + wayland.windowManager.hyprland.enable = true; + + + home.stateVersion = "24.05"; - # Allow unfree packages - nixpkgs.config.allowUnfree = true; + + gtk = { + gtk2 = { + extraConfig = "gtk-application-prefer-dark-theme=0"; + }; + gtk3 = { + extraConfig = { + gtk-application-prefer-dark-theme=0; + }; + }; + gtk4 = { + extraConfig = { + gtk-application-prefer-dark-theme=0; + }; + }; + enable = true; + font.name = "Victor Mono SemiBold 12"; + theme = { + name = "gruvbox-gtk-theme"; + package = pkgs.gruvbox-gtk-theme; + }; + iconTheme = { + name = "gruvbox-plus-icons"; + package = pkgs.gruvbox-plus-icons; + }; + cursorTheme = { + name = "Adwaita"; + package = pkgs.gnome.adwaita-icon-theme; + size = 16; + }; + }; + + services.nextcloud-client = { + enable = true; + startInBackground = true; + }; + + programs.bash = { + enable = true; + shellAliases= { + emacs="emacs -nw"; + nixrc="sudo emacs -nw /etc/nixos/configuration.nix"; + rebuild="sudo nixos-rebuild switch"; + ls="lsd"; + }; + bashrcExtra = ''fastfetch + XDG_SCREENSHOTS_DIR="$HOME/media/Pictures/other/Screenshots" + export XDG_SCREENSHOTS_DIR''; + }; + programs.kitty = { + enable = true; + settings = { + cursor_shape = "underline"; + cursor_shape_unfocused = "hollow"; + foreground = "#${FG}"; + background = "#${BG}"; + selection_foreground = "#${BG}"; + selection_background = "#${FG}"; + + color0 = "#${BG1}"; + color8 = "#${BG0}"; + + color1 = "#${RED}"; + color9 = "#${DARK_RED}"; + + color2 = "#${GREEN}"; + color10 = "#${DARK_GREEN}"; + + color3 = "#${YELLOW}"; + color11 = "#${DARK_YELLOW}"; + + color4 = "#${BLUE}"; + color12 = "#${DARK_BLUE}"; + + color5 = "#${PURPLE}"; + color13 = "#${DARK_PURPLE}"; + + color6 = "#${BLUE}"; + color14 = "#${DARK_BLUE}"; + + color7 = "#${FG0}"; + color15 = "#${FG1}"; + }; + }; + + programs.git = { + enable = true; + userName = "deadvey"; + userEmail = "deadvey@deadvey.com"; + }; + + services.emacs = { + enable = true; + defaultEditor = true; + }; + + programs.wofi = { + enable = true; + settings = { + location = "center"; + allow_markup = true; + width = 250; + height = 500; + }; + style = '' + * { + color: #${FG}; + } + window { + border: ${BORDER_WIDTH}px solid #${FG}; + background-color: #${BG}; + border-radius: ${CORNER_RADIUS}; + } + + #input { + padding: 4px; + margin: 4px; + padding-left: 20px; + border: none; + color: #${FG}; + background-color: #${BG}; + outline: none; + border-radius: ${CORNER_RADIUS}; + } + + #inner-box { + margin: 4px; + border: 10px solid #${BG}; + background-color: #${BG}; + border-radius: ${CORNER_RADIUS}; + } + + #outer-box { + margin: 2px; + border: none; + background-color: #${BG}; + border-radius: ${CORNER_RADIUS}; + } + + #scroll { + margin: 0px; + border: none; + border-radius: ${CORNER_RADIUS}; + } + + #text:selected { + color: #${BG}; + margin: 0px 0px; + border: none; + border-radius: ${CORNER_RADIUS}; + } + + #entry { + margin: 0px 0px; + border: none; + border-radius: ${CORNER_RADIUS}; + } + + #entry:selected { + margin: 0px 0px; + border: none; + background-color: #${GREEN}; + border-radius: ${CORNER_RADIUS}; + } + ''; + }; + + services.dunst = { + enable = true; + iconTheme = { + name = "gruvbox-plus-icons"; + package = pkgs.gruvbox-plus-icons; + }; + settings = { + global = { + width = 300; + height = 300; + offset = "0x5"; + origin = "top-center"; + transparency = 0; + font = "Victor Mono SemiBold 12"; + }; + urgency_low = { + background = "#${GREEN}"; + foreground = "#${BG}"; + frame_color = "#${DARK_GREEN}"; + timout = 3; + }; + urgency_normal = { + background = "#${BLUE}"; + foreground = "#${BG}"; + frame_color = "#${DARK_BLUE}"; + timout = 10; + }; + urgency_critical = { + background = "#${DARK_RED}"; + foreground = "#${FG}"; + frame_color = "#${RED}"; + timout = 60; + }; + }; + }; + + services.hyprpaper = { + enable = true; + settings = { + #ipc = "on"; + #splash = false; + #splash_offset = 2.0; + + preload = + [ "$HOME/media/Pictures/wallpapers/steampunk.jpg" ]; + + wallpaper = [ + "HDMI-A-1,$HOME/media/Pictures/wallpapers/steampunk.jpg" + ]; + }; + }; + + programs.hyprlock = { + enable = true; + extraConfig = '' + general { + grace = 10 + } + + background { + path = $HOME/media/Pictures/wallpapers/steampunk.jpg + blur_size = 5 + blur_passes = 1 # 0 disables blurring + noise = 0.0117 + contrast = 1.3000 # Vibrant!!! + brightness = 0.8000 + vibrancy = 0.2100 + vibrancy_darkness = 0.0 + } + + input-field { + size = 250, 50 + outline_thickness = 3 + dots_size = 0.33 # Scale of input-field height, 0.2 - 0.8 + dots_spacing = 0.15 # Scale of dots' absolute size, 0.0 - 1.0 + dots_center = true + outer_color = "#${BG}" + inner_color = "#${FG}" + font_color = "#${BG}" + #fade_on_empty = true + placeholder_text = Password... # Text rendered in the input box when it's empty. + hide_input = false + +position = 0, 200 +halign = center +valign = bottom + } + # Date + label { + text = cmd[update:18000000] echo " "$(date +'%A, %-d %B %Y')" " + color = "#${FG}" + font_size = 34 + font_family = JetBrains Mono Nerd Font 10 + position = 0, -150 + halign = center + valign = top + } + + # Week + label { + text = cmd[update:18000000] echo " "$(date +'Week %U')" " + color = "#${FG}" + font_size = 24 + font_family = JetBrains Mono Nerd Font 10 + position = 0, -250 + halign = center + valign = top + } + + # Time + label { + text = cmd[update:1000] echo " $(date +"%I:%M:%S %p") " # AM/PM + #text = cmd[update:1000] echo " $(date +"%H:%M:%S") " # 24H + color = "#${FG}" + font_size = 94 + font_family = JetBrains Mono Nerd Font 10 + position = 0, 0 + halign = center + valign = center + } + + # User + label { + text =  $USER + color = $color12 + font_size = 18 + font_family = Inter Display Medium + position = 0, 100 + halign = center + valign = bottom + } + + # uptime + label { + text = cmd[update:60000] echo " "$(uptime -p || $Scripts/UptimeNixOS.sh)" " + color = "#${FG}" + font_size = 24 + font_family = JetBrains Mono Nerd Font 10 + position = 0, 0 + halign = right + valign = bottom + } + + # weather edit specific location. Note, this cause a 2-4 seconds delay in locking + label { + text = cmd[update:3600000] [ -f ~/.cache/.weather_cache ] && cat ~/.cache/.weather_cache + color = "#${FG}" + font_size = 24 + font_family = JetBrains Mono Nerd Font 10 + position = 50, 0 + halign = left + valign = bottom + } + + # Put a picture of choice here. Default is the current wallpaper + image { + path = $HOME/media/Pictures/other/steampunk.jpg + size = 230 + rounding = -1 + border_size = 2 + border_color = "#${FG}" + rotate = 0 + reload_time = -1 + position = 0, 300 + halign = center + valign = bottom + } + + ''; + }; + + wayland.windowManager.hyprland.settings = { + + "$mod" = "SUPER"; + bind = + [ + "$mod, F, exec, librewolf" + "$mod, Q, exec, kitty" + "$mod, Space, exec, fuzzel --background-color=${BG}ff --border-color=${DARK_BLUE}ff --border-width=${BORDER_WIDTH} --match-color=${RED}ff --selection-color=${FG}ff --selection-text-color=${BG}ff --text-color=${FG}ff --width 75 --lines 25 --icon-theme=Gruvbox-Plus-Dark --border-radius=${CORNER_RADIUS}" + "$mod, E, exec, wofi-emoji" + "$mod, W, killactive" + "$mod, M, fullscreen, 1" + "$mod SHIFT, M, fullscreen" + "$mod SHIFT, Q, exit" + "$mod, left, movefocus, l" + "$mod, right, movefocus, r" + "$mod, up, movefocus, u" + "$mod, down, movefocus, d" + "$mod SHIFT, left, movewindow, l" + "$mod SHIFT, right, movewindow, r" + "$mod SHIFT, up, movewindow, u" + "$mod SHIFT, down, movewindow, d" + "$mod, P, exec, grimshot savecopy area" + "$mod CONTROL, left, resizeactive, -20 0" + "$mod CONTROL, right, resizeactive, 20 0" + "$mod CONTROL, up, resizeactive, 0 -20" + "$mod CONTROL, down, resizeactive, 0 20" + "$mod, L, exec, hyprlock" + + ] + ++ ( + # workspaces + # binds $mod + [shift +] {1..10} to [move to] workspace {1..10} + builtins.concatLists (builtins.genList ( + x: let + ws = let + c = (x + 1) / 10; + in + builtins.toString (x + 1 - (c * 10)); + in [ + "$mod, ${ws}, workspace, ${toString (x + 1)}" + "$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}" + ] + ) + 10) + ); + + # Input + input.kb_layout=''gb''; + + # General + general.gaps_in=''${GAPS_IN}''; + general.gaps_out=''${GAPS_OUT}''; + general.border_size=''${BORDER_WIDTH}''; + general."col.active_border"=''rgba(${FG}ff)''; + general."col.inactive_border"=''rgba(${DARK_BLUE}ff)''; + + # Decoration + decoration.rounding=''${CORNER_RADIUS}''; + + }; + wayland.windowManager.hyprland.extraConfig = '' + exec-once=hyprpaper + exec-once=waybar + ''; + + programs.waybar = { + enable = true; + settings = { + rightBorder = { + layer = "bottom"; + position = "right"; + mode = "overlay"; + height = 0; + width = BORDER_WIDTH_INT; + margin-top = 0; + margin-bottom = 0; + }; + bottomBorder = { + layer = "bottom"; + position = "bottom"; + mode = "overlay"; + height = BORDER_WIDTH_INT; + margin-top = 0; + margin-bottom = 0; + }; + leftBorder = { + layer = "bottom"; + position = "left"; + mode = "overlay"; + height = 0; + width = BORDER_WIDTH_INT; + margin-top = 0; + margin-bottom = 0; + }; + topBar = { + layer = "top"; + position = "top"; + height = 35; + margin-top = 0; + margin-bottom = 0; + modules-left = ["network"]; + modules-center = ["clock"]; + modules-right = ["pulseaudio" "cpu" "memory" "tray"]; + + "clock" = { + format = "{:%d/%m/%Y %I:%M:%S}  "; + interval = 1; + format-alt = "{:%A, %B %d, %Y %I:%M:%S}  "; + tooltip-format = "{calendar}"; + calendar = { + mode = "year"; + mode-mon-col = 3; + weeks-pos = "right"; + on-scroll = 1; + format = { + months = "{}"; + days = "{}"; + weeks = "W{}"; + weekdays = "{}"; + today = "{}"; + }; + }; + }; + network = { + format-ethernet = "{ipaddr}  "; + tooltip-format = "{ifname} via {gwaddr} "; + format-linked = "{ifname} (No IP) "; + format-disconnected = "Disconnected ⚠"; + format-alt = "{ifname}: {ipaddr}/{cidr}"; + }; + tray = { + spacing = 12; + }; + memory = { + interval = 5; + format = " {}%"; + }; + cpu = { + interval = 5; + format = " {usage:2}%"; + tooltip = false; + }; + pulseaudio = { + format = "{icon} {volume}% {format_source}"; + format-bluetooth = "{volume}% {icon} {format_source}"; + format-bluetooth-muted = " {icon} {format_source}"; + format-muted = " {format_source}"; + format-source = " {volume}%"; + format-source-muted = ""; + format-icons = { + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + portable = ""; + car = ""; + default = ["" "" ""]; + }; + on-click = "pavucontrol"; + }; + }; + }; + style = '' + * { + font-size: 12px; + font-family: Font Awesome, Ubuntu Nerd Font, sans-serif; + font-weight: bold; + min-height: 0; + } + + window#waybar { + background-color: #000000; + border-bottom: ${BORDER_WIDTH}px solid #${FG}; + border-radius: 0px; + color: #f8f8f2; + } + window#waybar.right, + window#waybar.bottom, + window#waybar.left { + background-color: #${FG}; + border-bottom: ${BORDER_WIDTH}px; + } + #workspaces { + background: #${FG}; + margin: 5px 3px 5px 5px; + padding: 0px 1px; + border-radius: ${WAYBAR_MODULES_CORNER_RADIUS}px; + border: 0px; + font-style: normal; + color: #${BG}; + } + #custom-music.Playing { + background: #${DARK_BLUE}; + background-size: 400% 400%; + animation: gradient_f 9s cubic-bezier(.72, .39, .21, 1) infinite; + text-shadow: 0px 0px 5px rgba(0, 0, 0, 0.377); + font-weight: bold; + color: #fff; + } + + #custom-music.Paused, + #custom-music.Stopped { + background: #161925; + } + + #workspaces button { + padding: 0px 0px; + margin: 4px 3px; + border-radius: ${WAYBAR_MODULES_CORNER_RADIUS}px; + border: 0px; + color: #${BG}; + background-color: #${BLUE}; + opacity: 0.5; + transition: all 0.3s ease-in-out; + } + + #workspaces button.active { + color: #${DARK_BLUE}; + background: #${DARK_BLUE}; + border-radius: ${WAYBAR_MODULES_CORNER_RADIUS}px; + min-width: 40px; + transition: all 0.3s ease-in-out; + opacity: 1.0; + } + + #workspaces button:hover { + color: #${BG}; + background: #${BG}; + border-radius: ${WAYBAR_MODULES_CORNER_RADIUS}px; + opacity: 1.0; + } + + + tooltip { + background: #${BG}; + border: 1px solid #7aa2f7; + border-radius: 15px; + } + + tooltip label { + color: #c0caf5; + } + + #window { + color: #${BG}; + background: #c0caf5; + border-radius: ${WAYBAR_MODULES_CORNER_RADIUS}px; + margin: 5px; + padding: 2px 10px; + } + + #memory { + color: #${BG}; + background: #${ORANGE}; + border-radius: ${WAYBAR_MODULES_CORNER_RADIUS}px; + margin: 5px; + padding: 2px 10px; + } + + #clock, + #custom-bin-clock { + color: #${BG}; + background: #${PURPLE}; + border-radius: ${WAYBAR_MODULES_CORNER_RADIUS}px; + margin: 5px; + padding: 2px 10px; + } + + #cpu { + color: #${BG}; + background: #${BLUE}; + border-radius: ${WAYBAR_MODULES_CORNER_RADIUS}px; + margin: 5px; + padding: 2px 10px; + } + + #network { + color: #${BG}; + background: #${YELLOW}; + border-radius: ${WAYBAR_MODULES_CORNER_RADIUS}px; + margin: 5px; + padding: 2px 10px; + }u + + #tray { + color: #${BG}; + background: #${BG1}; + border-radius: ${WAYBAR_MODULES_CORNER_RADIUS}px; + margin: 5px; + padding: 2px 10px; + } + + #pulseaudio { + color: #${BG}; + background: #${FG3}; + border-radius: ${WAYBAR_MODULES_CORNER_RADIUS}px; + margin: 5px; + padding: 2px 10px; + } + + tooltip { + color: #${FG}; + background-color: #${BG}; + text-shadow: none; + } + + tooltip * { + color: #${FG}; + text-shadow: none; + } + ''; + }; +}; + + # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ - # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. - # wget + hyprlock + vim + cmus + wget + emacs + fastfetch + gparted + git + dunst + python3 + gcc + htop + hyprland + hyprpicker + xorg.xinit + wine + waybar + yazi + kitty + lxappearance + fuzzel + wtype + wofi + sway-contrib.grimshot + cron + xfce.thunar + wofi-emoji + dmenu + w3m + gpm # Mouse support in tty + grim + slurp + wl-clipboard + gtk3 + dbus + hyprpaper + dconf + feh + lsd + mpv + killall ]; + fonts.packages = with pkgs; [ + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + liberation_ttf + fira-code + fira-code-symbols + mplus-outline-fonts.githubRelease + dina-font + proggyfonts + font-awesome_4 + font-awesome + victor-mono + ]; + + # Some programs need SUID wrappers, can be configured further or are # started in user sessions. # programs.mtr.enable = true; @@ -130,6 +915,6 @@ # this value at the release version of the first install of this system. # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "23.05"; # Did you read the comment? + system.stateVersion = "24.05"; # Did you read the comment? } diff --git a/edit-config.sh b/edit-config.sh new file mode 100755 index 0000000..ec2a67a --- /dev/null +++ b/edit-config.sh @@ -0,0 +1,9 @@ +sudo emacs /etc/nixos/configuration.nix +sudo nixos-rebuild switch &>nixos-switch.log || ( + cat nixos-switch.log | grep --color error && false) +gen=$(nixos-rebuild list-generations | grep current) +sudo cp /etc/nixos/configuration.nix . +git add . +git commit -m "$gen" +git push + diff --git a/nixos-switch.log b/nixos-switch.log new file mode 100644 index 0000000..02b6d99 --- /dev/null +++ b/nixos-switch.log @@ -0,0 +1,3 @@ +building Nix... +building the system configuration... +error: interrupted by the user