diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..157f3fc --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "C_Cpp.intelliSenseEngineFallback": "Disabled" +} diff --git a/configs/bspwm.nix b/configs/bspwm.nix index 877f6f9..8963832 100644 --- a/configs/bspwm.nix +++ b/configs/bspwm.nix @@ -6,6 +6,7 @@ in { services = { + blueman.enable = true; xserver = { enable = true; displayManager = { @@ -39,7 +40,41 @@ in }; }; + environment.systemPackages = with unstable.pkgs; [ + lightlocker + pulseaudio-ctl + ]; + home-manager.users.alex = { pkgs, ... }: { + home = { + packages = with unstable.pkgs; [ + arandr + evince + gnome.eog + gnome.file-roller + gnome.gnome-calculator + keepassxc + libnotify + gnome.cheese + ]; + }; + + gtk = { + enable = true; + font = { + name = "Liberation Sans Regular"; + size = 12; + }; + gtk3 = { + extraConfig = { gtk-application-prefer-dark-theme = 1; }; + }; + iconTheme = { + package = pkgs.pantheon.elementary-icon-theme; + name = "elementary"; + }; + theme = { name = "Adwaita-dark"; }; + }; + services = { # picom = { # enable = true; @@ -50,44 +85,45 @@ in dunst = { enable = true; + package = unstable.dunst; + iconTheme = { + package = pkgs.pantheon.elementary-icon-theme; + name = "elementary"; + }; settings = { global = { - font = "SF Pro Display Regular 12"; - markup = "yes"; - format = "%s %p\n%b"; - sort = "yes"; - indicate_hidden = "no"; alignment = "center"; - bounce_freq = 0; - show_age_threshold = 60; - word_wrap = "yes"; - ignore_newline = "no"; - geometry = "300x0-5-5"; - shrink = "yes"; - transparency = 0; - idle_threshold = 120; - monitor = 0; follow = "mouse"; - sticky_history = "yes"; - history_length = 20; - show_indicators = "no"; - line_height = 0; - separator_height = 1; - stack_duplicates = "no"; - padding = 8; + font = "SF Pro Display Regular 12"; + format = "%s %p %b"; + width = "(0,300)"; + # height = 300; + origin = "bottom-right"; + notification_limit = 5; + offset = "4x4"; horizontal_padding = 8; - separator_color = "frame"; - startup_notification = true; - # dmenu = /usr/bin/dmenu -p dunst; - # browser = /usr/bin/firefox -new-tab; icon_position = "left"; - icon_path = "/usr/share/icons/Arc"; + idle_threshold = 120; + ignore_newline = "no"; + indicate_hidden = "no"; + line_height = 0; + markup = "yes"; max_icon_size = 64; - }; - - frame = { - width = 1; - color = "#A6A6A6"; + monitor = 0; + padding = 8; + separator_color = "frame"; + separator_height = 1; + show_age_threshold = 60; + show_indicators = "no"; + shrink = "yes"; + sort = "yes"; + stack_duplicates = "no"; + startup_notification = true; + sticky_history = "yes"; + transparency = 0; + word_wrap = "yes"; + frame_width = 2; + frame_color = "#A6A6A6"; }; urgency_low = { @@ -150,10 +186,32 @@ in }; }; - nextcloud-client = { - enable = true; - startInBackground = true; - }; + # nextcloud-client = { + # enable = true; + # startInBackground = true; + # }; + + # polybar = { + # enable = true; + # script = "polybar bar &"; + # settings = { + # "bar/top" = { + # monitor = "\${env:MONITOR:DisplayPort-1}"; + # width = "100%"; + # height = "3%"; + # radius = 0; + # modules-center = "date"; + # }; + + # "module/date" = { + # type = "internal/date"; + # internal = 5; + # date = "%d.%m.%y"; + # time = "%H:%M"; + # label = "%time% %date%"; + # }; + # }; + # }; redshift = { enable = true; @@ -189,7 +247,7 @@ in ''; settings = { border_width = 4; - window_gap = 5; + window_gap = 4; top_padding = 0; left_padding = 0; right_padding = 0; diff --git a/configs/common.nix b/configs/common.nix index 3556681..4dbcfd6 100644 --- a/configs/common.nix +++ b/configs/common.nix @@ -72,7 +72,7 @@ in nix-du nix-tree nmap - nodejs-16_x + nodejs parallel pciutils ruby diff --git a/configs/gui.nix b/configs/gui.nix index 9714ce4..e852d4a 100644 --- a/configs/gui.nix +++ b/configs/gui.nix @@ -21,12 +21,9 @@ in glxinfo gparted libsecret - lightlocker networkmanager-openconnect openconnect - ponymix pulseaudio-ctl - python39Packages.pyyaml ]; programs = { @@ -83,40 +80,47 @@ in fontDir.enable = true; fonts = with pkgs; [ + # (nerdfonts.override { fonts = [ "Liberation" ]; }) + nerdfonts # corefonts - font-awesome google-fonts liberation_ttf - meslo-lg - nerdfonts noto-fonts noto-fonts-cjk noto-fonts-emoji + noto-fonts-extra + open-sans stix-two twemoji-color-font ]; - fontconfig = { - enable = true; - antialias = true; - defaultFonts = { - # monospace = [ "Fira Mono" ]; - serif = [ "Linux Libertine" ]; - sansSerif = [ "Open Sans" ]; - emoji = [ "Twitter Color Emoji" ]; - }; - }; + # fontconfig = { + # enable = true; + # antialias = true; + # defaultFonts = { + # # monospace = [ "Fira Mono" ]; + # serif = [ "Linux Libertine" ]; + # sansSerif = [ "Open Sans" ]; + # emoji = [ "Twitter Color Emoji" ]; + # }; + # }; }; hardware.bluetooth.enable = true; services = { - blueman.enable = true; + mullvad-vpn.enable = true; + gvfs.enable = true; udev.packages = with pkgs; [ gnome.gnome-settings-daemon ]; printing = { enable = true; drivers = [ pkgs.brlaser ]; }; + etesync-dav = { + enable = true; + apiUrl = "https://etesync.szczepan.ski/"; + }; }; + } diff --git a/configs/pantheon.nix b/configs/pantheon.nix new file mode 100644 index 0000000..693c082 --- /dev/null +++ b/configs/pantheon.nix @@ -0,0 +1,23 @@ +{ config, pkgs, lib, ... }: + +{ + programs.pantheon-tweaks.enable = true; + services = { + xserver = { + enable = true; + displayManager = { + lightdm = { + enable = true; + greeters.pantheon.enable = true; + }; + }; + + desktopManager.pantheon.enable = true; + layout = "us"; + + # Enable touchpad support. + libinput.enable = true; + updateDbusEnvironment = true; + }; + }; +} diff --git a/configs/user-gui-applications.nix b/configs/user-gui-applications.nix index 90cc74b..fbe61d5 100644 --- a/configs/user-gui-applications.nix +++ b/configs/user-gui-applications.nix @@ -18,15 +18,14 @@ in font-manager freecad fslint - gnome.cheese homebank insomnia kdenlive libreoffice lutris - mangohud + # mangohud meld - obs-studio + # obs-studio pinta prusa-slicer rpi-imager diff --git a/configs/user-gui.nix b/configs/user-gui.nix index 604f402..fcac91b 100644 --- a/configs/user-gui.nix +++ b/configs/user-gui.nix @@ -1,6 +1,16 @@ { config, pkgs, lib, ... }: -let unstable = import { config.allowUnfree = true; }; +with builtins; let + unstable = import { config.allowUnfree = true; }; + rofiPin = import + (pkgs.fetchFromGitHub { + owner = "NixOS"; + repo = "nixpkgs"; + rev = "42ded9d56bf0f56bebfcd49b4e942e7ffba4d5fc"; + sha256 = "KK/LIcEIU4mKYuGxXSqyBRA/fVplsRs3gnmtdUCqKxU="; + fetchSubmodules = true; + }) + { }; in { imports = [ ]; @@ -10,19 +20,15 @@ in file = { ".bin/rofi-default-sink.sh" = { executable = true; - source = ./bin/rofi-default-sink.sh; + source = ../home/bin/rofi-default-sink.sh; }; }; packages = with unstable.pkgs; [ - arandr baobab barrier - evince - gnome.eog - gnome.file-roller - gnome.gnome-calculator keepassxc - libnotify + ponymix #rofi-default + mullvad-vpn ]; }; @@ -40,31 +46,6 @@ in }; }; - gtk = { - enable = true; - font = { - name = "Liberation Sans Regular"; - size = 12; - }; - gtk3 = { - # bookmarks = [ - # "file:///home/alex/Downloads" - # "file:///home/alex/Nextcloud" - # "file:///mnt/second" - # "smb://192.168.0.100/storage/" - # "file:///home/alex/Workspace" - # "file:///home/alex/3D%20Print" - # "file:///home/alex/Sync" - # ]; - extraConfig = { gtk-application-prefer-dark-theme = 1; }; - }; - iconTheme = { - package = pkgs.pantheon.elementary-icon-theme; - name = "elementary"; - }; - theme = { name = "Adwaita-dark"; }; - }; - programs = { vscode = { enable = true; @@ -87,6 +68,7 @@ in rofi = { enable = true; font = "Liberation Sans Regular 20"; + package = rofiPin.rofi; extraConfig = { modi = "drun,window"; show-icons = true; diff --git a/configs/user.nix b/configs/user.nix index 747df7f..b3b0592 100644 --- a/configs/user.nix +++ b/configs/user.nix @@ -26,7 +26,6 @@ in home-manager.users.alex = { pkgs, ... }: { home = { - enableNixpkgsReleaseCheck = false; packages = with unstable.pkgs; [ exa broot @@ -44,10 +43,22 @@ in pstree ranger sshfs - tree unrar youtube-dl ]; + sessionPath = [ + "$HOME/.npm-packages" + "$HOME/.bin" + ]; + file = { + ".npmrc" = { + source = ../home/npmrc; + }; + ".bin/git-redate" = { + executable = true; + source = ../home/bin/git-redate; + }; + }; }; programs = { diff --git a/configs/bin/fzip b/home/bin/fzip similarity index 100% rename from configs/bin/fzip rename to home/bin/fzip diff --git a/home/bin/git-redate b/home/bin/git-redate new file mode 100755 index 0000000..77fc6a0 --- /dev/null +++ b/home/bin/git-redate @@ -0,0 +1,208 @@ +#!/usr/bin/env bash + +is_git_repo() { + git rev-parse --show-toplevel > /dev/null 2>&1 + result=$? + if test $result != 0; then + >&2 echo 'Not a git repo!' + exit $result + fi +} + +is_git_repo + +make_editor_choice() { + + echo "Which editor do you want to use for this repo?\n"; + echo "1. VI\n"; + echo "2. NANO\n"; + echo "3. Your own\n" + echo "You Choose: "; + + read CHOOSE_EDITOR +} + +get_editor_executable() { + + echo "What is the path to your prefered test editor?\n"; + read EDITOR_PATH +} + +is_has_editor() { + SETTINGS_FILE="~/.redate-settings"; + if [ -f "$SETTINGS_FILE" ] + then + OUR_EDITOR=$(cat ${SETTINGS_FILE}); + elif [ ! -z "$EDITOR" ] + then + OUR_EDITOR="$EDITOR"; + else + make_editor_choice; + if [ ${CHOOSE_EDITOR} == 3 ] || [ ${CHOOSE_EDITOR} == "3" ]; then + get_editor_executable + OUR_EDITOR=${EDITOR_PATH} + elif [ ${CHOOSE_EDITOR} == 1 ] || [ ${CHOOSE_EDITOR} == "1" ]; then + OUR_EDITOR="vi"; + else + OUR_EDITOR="nano"; + fi + echo ${OUR_EDITOR} > ${SETTINGS_FILE} + fi +} + +is_has_editor + + +ALL=0 +DEBUG=0 +LIMITCHUNKS=20 + +while [[ $# -ge 1 ]] +do +key="$1" + +case $key in + -c| --commits) + COMMITS="$2" + if [ -z "${COMMITS}" ]; then COMMITS="5"; fi; + shift + ;; + -l| --limit) + LIMITCHUNKS="$2" + if [ -z "${LIMITCHUNKS}" ]; then LIMITCHUNKS="20"; fi; + shift + ;; + -d| --debug) + DEBUG=1 + shift + ;; + -a| --all) + ALL=1 + shift + ;; + *) + # unknown option + ;; +esac +shift +done + +die () { + echo >&2 `basename $0`: $* + exit 1 +} + +tmpfile=$(mktemp gitblah-XXXX) +[ -f "$tmpfile" ] || die "could not get tmpfile=[$tmpfile]" +trap "rm -f $tmpfile" EXIT + + +datefmt=%cI +if [ "`git log -n1 --pretty=format:"$datefmt"`" == "$datefmt" ]; +then + datefmt=%ci +fi + +if [ "${ALL}" -eq 1 ]; +then + git log --pretty=format:"$datefmt | %H | %s" > $tmpfile; +else + if [ -n "${COMMITS+set}" ]; + then git log -n ${COMMITS} --pretty=format:"$datefmt | %H | %s" > $tmpfile; + else git log -n 5 --pretty=format:"$datefmt | %H | %s" > $tmpfile; + fi +fi + +${VISUAL:-${EDITOR:-${OUR_EDITOR}}} $tmpfile + + +ITER=0 +COLITER=0 +declare -a COLLECTION + +COUNTCOMMITS=$(awk 'END {print NR}' $tmpfile) + +while read commit || [ -n "$commit" ]; do + + IFS="|" read date hash message <<< "$commit" + shopt -s nocasematch + if [[ "$date" == 'now' ]]; then + date=$(date +%Y-%m-%dT%H:%M:%S%z); + fi + shopt -u nocasematch + if [ "$datefmt" == "%cI" ] + then + DATE_NO_SPACE="$(echo "${date}" | tr -d '[[:space:]]')" + else + DATE_NO_SPACE="$(echo "${date}")" + fi + + + COMMIT_ENV=$(cat <<-END +if [ \$GIT_COMMIT = $hash ]; +then + export GIT_AUTHOR_DATE="$DATE_NO_SPACE" + export GIT_COMMITTER_DATE="$DATE_NO_SPACE"; +fi; +END +) + + ((ITER++)) + + if [ "${DEBUG}" -eq 1 ] && [ $((ITER % LIMITCHUNKS)) == $((LIMITCHUNKS - 1)) ]; + then + echo "Chunk $COLITER Finished" + fi + + if [ $((ITER % LIMITCHUNKS)) == 0 ] + then + ((COLITER++)) + + if [ "${DEBUG}" -eq 1 ]; + then + echo "Chunk $COLITER Started" + fi + + fi + + COLLECTION[$COLITER]=${COLLECTION[COLITER]}"$COMMIT_ENV" + if [ "${DEBUG}" -eq 1 ] + then + echo "Commit $ITER/$COUNTCOMMITS Collected" + fi + +done < $tmpfile + +ITERATOR=0 +for each in "${COLLECTION[@]}" +do + + ((ITERATOR++)) + + if [ "${ALL}" -eq 1 ]; + then + if [ "${DEBUG}" -eq 1 ]; + then + echo "Chunk $ITERATOR/"${#COLLECTION[@]}" Started" + git filter-branch -f --env-filter "$each" -- --all + echo "Chunk $ITERATOR/"${#COLLECTION[@]}" Finished" + else + git filter-branch -f --env-filter "$each" -- --all >/dev/null + fi + else + if [ "${DEBUG}" -eq 1 ]; + then + echo "Chunk $ITERATOR/"${#COLLECTION[@]}" Started" + git filter-branch -f --env-filter "$each" HEAD~${COMMITS}..HEAD + echo "Chunk $ITERATOR/"${#COLLECTION[@]}" Finished" + else + git filter-branch -f --env-filter "$each" HEAD~${COMMITS}..HEAD >/dev/null + fi + fi +done + +if [ $? = 0 ] ; then + echo "Git commit dates updated. Run 'git push -f BRANCH_NAME' to push your changes." +else + echo "Git redate failed. Please make sure you run this on a clean working directory." +fi diff --git a/configs/bin/rofi-default-sink.sh b/home/bin/rofi-default-sink.sh similarity index 100% rename from configs/bin/rofi-default-sink.sh rename to home/bin/rofi-default-sink.sh diff --git a/home/npmrc b/home/npmrc new file mode 100644 index 0000000..dc3f6fb --- /dev/null +++ b/home/npmrc @@ -0,0 +1 @@ +prefix = ${HOME}/.npm-packages diff --git a/machine/desktop.nix b/machine/desktop.nix index 905160b..b13e67d 100644 --- a/machine/desktop.nix +++ b/machine/desktop.nix @@ -17,6 +17,7 @@ in ../configs/user-gui.nix ../configs/user.nix ../configs/bspwm.nix + #../configs/pantheon.nix ]; # Use the systemd-boot EFI boot loader. @@ -43,13 +44,12 @@ in initrd.kernelModules = [ "amdgpu" ]; plymouth.enable = true; - extraModulePackages = with pkgs.linuxPackages_5_14; [ it87 ]; + extraModulePackages = with pkgs.linuxPackages; [ it87 ]; kernelModules = [ "it87" "v4l2loopback" ]; - kernelPackages = pkgs.linuxPackages_5_14; }; networking = { - hostName = "desktop"; # Define your hostname. + hostName = "desktop"; useDHCP = false; wireguard.interfaces = { wg0 = { @@ -118,12 +118,13 @@ in sound.enable = true; services = { + netdata.enable = true; printing.enable = true; xserver.videoDrivers = [ "amdgpu" ]; - xserver.deviceSection = '' - Option "TearFree" "true" - ''; - hardware.xow.enable = true; + # xserver.deviceSection = '' + # Option "TearFree" "true" + # ''; + # hardware.xow.enable = true; borgbackup.jobs.home = rec { compression = "auto,zstd"; encryption = { @@ -146,5 +147,5 @@ in }; }; - system.stateVersion = "21.05"; + system.stateVersion = "21.11"; } diff --git a/machine/thinkpad.nix b/machine/thinkpad.nix index b377186..2771905 100644 --- a/machine/thinkpad.nix +++ b/machine/thinkpad.nix @@ -26,30 +26,49 @@ in ../configs/user-gui.nix ../configs/user-gui-applications.nix ../configs/bspwm.nix + # ../configs/pantheon.nix ]; - # boot.initrd.luks.devices = { - # root = { - # preLVM = true; - # device = "/dev/disk/by-uuid/b59e9746-b9b4-4de1-94f6-84a387b9d72e"; - # allowDiscards = true; - # }; - # }; - - fileSystems."/".options = [ "noatime" "discard" ]; - boot = { loader = { - grub.enable = true; - grub.version = 2; - grub.device = "nodev"; - grub.efiSupport = true; - efi.canTouchEfiVariables = true; - grub.gfxmodeEfi = "1024x768"; + grub = { + enable = true; + device = "nodev"; + version = 2; + efiSupport = true; + enableCryptodisk = true; + gfxmodeEfi = "1024x768"; + }; + efi = { + canTouchEfiVariables = true; + efiSysMountPoint = "/boot/efi"; + }; }; kernelPackages = pkgs.linuxPackages_5_14; plymouth.enable = true; + initrd = { + luks.devices."root" = { + device = "/dev/disk/by-uuid/9e93feb7-8134-4b62-a05b-1aeade759880"; + keyFile = "/keyfile0.bin"; + allowDiscards = true; + }; + secrets = { + "keyfile0.bin" = "/etc/secrets/initrd/keyfile0.bin"; + "keyfile1.bin" = "/etc/secrets/initrd/keyfile1.bin"; + }; + }; + }; + + # Data mount + fileSystems."/data" = { + device = "/dev/disk/by-uuid/33693f43-076d-41fc-a612-f49ab6870ccb"; # UUID for /dev/mapper/crypted-data + encrypted = { + enable = true; + label = "crypted-data"; + blkDev = "/dev/disk/by-uuid/9bf1d00e-1edc-4de3-9d5e-71a6722ef193"; # UUID for /dev/sda1 + keyFile = "/keyfile1.bin"; + }; }; networking.hostName = "thinkpad"; # Define your hostname. @@ -152,13 +171,14 @@ in # ''; }; power-profiles-daemon.enable = false; - tlp = { - enable = true; - settings = { - START_CHARGE_THRESH_BAT0 = 80; - STOP_CHARGE_THRESH_BAT0 = 90; - }; - }; + auto-cpufreq.enable = true; + # tlp = { + # enable = true; + # settings = { + # START_CHARGE_THRESH_BAT0 = 80; + # STOP_CHARGE_THRESH_BAT0 = 90; + # }; + # }; borgbackup.jobs.home = rec { compression = "auto,zstd"; encryption = { @@ -197,5 +217,7 @@ in networking.firewall.enable = false; + powerManagement.powertop.enable = true; + system.stateVersion = "21.05"; }