diff --git a/README.md b/README.md index 56c28ba..c42c555 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,6 @@ toggle_oppacity.sh Other dotfiles that I learned / copy from: - [Frost-Phoenix/nixos-config](https://github.com/Frost-Phoenix/nixos-config): This is the repository that I cloned and changed to my needs. Their credits are in their repository's readme. -- [IvarWithoutBones/dotfiles](https://github.com/IvarWithoutBones/dotfiles) - [notthebee/nix-config](https://github.com/notthebee/nix-config) - [mrusme/dotfiles](https://github.com/mrusme/dotfiles) diff --git a/hosts/sakura/default.nix b/hosts/sakura/default.nix index 41fb1a0..1c150ac 100644 --- a/hosts/sakura/default.nix +++ b/hosts/sakura/default.nix @@ -12,6 +12,7 @@ ./../../modules/core/virtualization.nix ./../../modules/services/tailscale.nix ./../../modules/services/mpd.nix + ./../../modules/services/syncthing.nix ./../../modules/services/smart-monitoring.nix inputs.nixos-hardware.nixosModules.framework-13-7040-amd ]; @@ -48,7 +49,7 @@ networking = { hostName = "sakura"; - # networkmanager.ethernet.macAddress = "13:37:6a:8a:ed:a4"; + networkmanager.ethernet.macAddress = "13:37:13:37:13:37"; }; powerManagement = { diff --git a/modules/core/system.nix b/modules/core/system.nix index 664a91a..71ecb33 100644 --- a/modules/core/system.nix +++ b/modules/core/system.nix @@ -29,19 +29,18 @@ libraries = with pkgs; [ ]; }; - nixpkgs = { - overlays = [ - self.overlays.default - # inputs.nur.overlay - ]; - }; + # nixpkgs = { + # overlays = [ + # self.overlays.default + # inputs.nur.overlay + # ]; + # }; nixpkgs.config = { allowUnfree = true; permittedInsecurePackages = [ "jitsi-meet-1.0.8043" "olm-3.2.16" - "libsoup-2.74.3" ]; overlays = [ self.overlays.default diff --git a/modules/home/hyprland/config.nix b/modules/home/hyprland/config.nix index b538f0c..5452bb1 100644 --- a/modules/home/hyprland/config.nix +++ b/modules/home/hyprland/config.nix @@ -8,7 +8,6 @@ pkgs.noto-fonts-emoji pkgs.swww pkgs.swaylock - pkgs.pywal16 ]; gtk = { diff --git a/modules/home/packages.nix b/modules/home/packages.nix index 34db02f..9fa833f 100644 --- a/modules/home/packages.nix +++ b/modules/home/packages.nix @@ -62,6 +62,7 @@ reader nmap speedtest-go + delta powertop android-tools sshpass diff --git a/modules/home/scripts/scripts/setbg b/modules/home/scripts/scripts/setbg index e796894..c0e7277 100644 --- a/modules/home/scripts/scripts/setbg +++ b/modules/home/scripts/scripts/setbg @@ -1,5 +1,4 @@ #!/usr/bin/env bash magick convert "$1" ~/.local/share/bg.png -wal -i "$1" swww img ~/.local/share/bg.png --transition-type fade diff --git a/modules/home/zsh.nix b/modules/home/zsh.nix index 8a4e5de..35d8bb5 100644 --- a/modules/home/zsh.nix +++ b/modules/home/zsh.nix @@ -3,7 +3,6 @@ config, pkgs, host, - lib, ... }: { @@ -47,8 +46,6 @@ }; initContent = '' - export export PATH="''${PATH}:''${HOME}/.local/bin/:''${HOME}/.cargo/bin/:''${HOME}/.fzf/bin/" - autoload -U add-zsh-hook autoload -U compinit zmodload zsh/complist @@ -138,11 +135,7 @@ fi } - # Enter a 'nix shell' with packages selected by fzf - source ${pkgs.nix-search-fzf.zsh-shell-widget} - zle -N nix-search-fzf-shell-widget - bindkey '^O' nix-search-fzf-shell-widget - + export export PATH="''${PATH}:''${HOME}/.local/bin/:''${HOME}/.cargo/bin/:''${HOME}/.fzf/bin/" # if [[ $(which sxiv&>/dev/null && echo 1) == "1" ]]; then # alias imv="sxiv" @@ -156,6 +149,7 @@ enable = true; abbreviations = { mkdir = "mkdir -p"; + mv = "mv --interactive"; vim = "nvim"; v = "nvim"; vi = "nvim"; @@ -204,19 +198,13 @@ yt-dlp-audio = "yt-dlp -f 'ba' -x --audio-format mp3"; open = "xdg-open"; tree = "eza --icons --tree --group-directories-first"; + # nvim = "nix run /home/liv/Development/nixvim --"; + vim = "nvim"; doas = "sudo"; sxiv = "nsxiv"; enby = "man"; woman = "man"; mkcd = "mkdir $1 && cd $1"; - du = "dust"; - cp = "cp -i -v"; - mv = "mv -i -v"; - rm = "rm -i -v"; - cat = "${lib.getExe pkgs.bat} --plain"; - diff = "${lib.getExe pkgs.delta} --color-only"; - battery-left = "${lib.getExe pkgs.acpi} | cut -d' ' -f5"; - github-actions = "${lib.getExe pkgs.act} -s GITHUB_TOKEN=\"$(${lib.getExe pkgs.github-cli} auth token)\""; # NixOS ns = "nix-shell --run zsh"; @@ -261,11 +249,4 @@ enableZshIntegration = true; }; }; - home.packages = with pkgs; [ - dust - fd - delta - bat - nix-search-fzf.zsh-shell-widget - ]; } diff --git a/modules/services/dandelion.nix b/modules/services/dandelion.nix index c11eff1..ec6d4a1 100644 --- a/modules/services/dandelion.nix +++ b/modules/services/dandelion.nix @@ -7,6 +7,7 @@ ++ [ (import ./home-assistant.nix) ] ++ [ (import ./monitoring.nix) ] ++ [ (import ./smart-monitoring.nix) ] + ++ [ (import ./syncthing.nix) ] ++ [ (import ./tailscale.nix) ] ++ [ (import ./nfs.nix) ] ++ [ (import ./hd-idle.nix) ]; diff --git a/overlays/default.nix b/overlays/default.nix index 9086c35..29457b4 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,3 +1,3 @@ { - addition = final: _: import ../pkgs/default.nix { pkgs = final; }; + addition = final: _: import ../pkgs { pkgs = final; }; } diff --git a/pkgs/createScript/default.nix b/pkgs/createScript/default.nix deleted file mode 100644 index f69f894..0000000 --- a/pkgs/createScript/default.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ - lib, - runCommand, - makeWrapper, -}: - -# A function which creates a shell script with optional dependencies added to PATH. - -name: src: -{ - dependencies ? [ ], - ... -}@attrs: - -runCommand name - ( - { - inherit src; - nativeBuildInputs = lib.optionals (dependencies != [ ]) (attrs.nativeBuildInputs or [ ]) ++ [ - makeWrapper - ]; - - meta = { - mainProgram = name; - } // attrs.meta or { }; - } - // (builtins.removeAttrs attrs [ - "nativeBuildInputs" - "meta" - ]) - ) - '' - mkdir -p $out/bin - install -Dm755 $src $out/bin/$name - patchShebangs $out/bin/$name - - ${lib.optionalString (dependencies != [ ]) '' - wrapProgram $out/bin/$name --prefix PATH : ${lib.makeBinPath dependencies} - ''} - '' diff --git a/pkgs/default.nix b/pkgs/default.nix index 7d89d6c..ec41d4e 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,5 +1,4 @@ -{ pkgs }: +{ pkgs } : { - createScript = pkgs.callPackage ./createScript/default.nix { }; - nix-search-fzf = pkgs.callPackage ./nix-search-fzf/default.nix { }; + wikit = pkgs.callPackage ./wikit/default.nix { }; } diff --git a/pkgs/nix-search-fzf/default.nix b/pkgs/nix-search-fzf/default.nix deleted file mode 100644 index 63e4a37..0000000 --- a/pkgs/nix-search-fzf/default.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ - createScript, - replaceVars, - gnused, - jq, - fzf, - nix, - coreutils, - bash, - nix-search-fzf, - writeShellScript, -}: - -let - previewText = createScript "fzf-preview" ./fzf-preview.sh { }; - src = replaceVars ./nix-search-fzf.sh { - previewText = "${previewText}/bin/fzf-preview"; - }; -in -createScript "nix-search-fzf" src { - dependencies = [ - gnused - jq - fzf - nix - coreutils - bash - ]; - - # Enter a 'nix shell' with packages selected by this script - passthru.zsh-shell-widget = writeShellScript "nix-search-fzf-shell-widget" '' - nix-search-fzf-shell-widget() { - setopt localoptions pipefail no_aliases 2> /dev/null - local cmd="$(eval "${nix-search-fzf}/bin/nix-search-fzf -c")" - if [[ -z "$cmd" ]]; then - zle redisplay - return 0 - fi - zle push-line - BUFFER="''${cmd}" - zle accept-line - local ret=$? - unset cmd - zle reset-prompt - return $ret - } - ''; - - meta.description = "a wrapper around 'nix {run,shell,edit}' with autocomplete using fzf"; -} diff --git a/pkgs/nix-search-fzf/fzf-preview.sh b/pkgs/nix-search-fzf/fzf-preview.sh deleted file mode 100644 index fabdc12..0000000 --- a/pkgs/nix-search-fzf/fzf-preview.sh +++ /dev/null @@ -1,73 +0,0 @@ -#! /usr/bin/env nix-shell -#! nix-shell -i bash -p -# shellcheck shell=bash - -set -euo pipefail - -PKG_NAME="$1" -FLAKE="$2" -FLAKE_PATH="${FLAKE}#${PKG_NAME}" - -removeQuotes() { - local flag="$*" - flag="${flag%\"}" - echo "${flag#\"}" -} - -newlinesToCommaSeperated() { - echo "$@" | sed ':a;N;$!ba;s/\n/, /g' -} - -evalAttr() { - local attr data - attr="$1" - data="$(nix eval "$FLAKE_PATH"."$attr" 2>/dev/null)" - [[ $data != "null" && $data != "false" && -n $data ]] && removeQuotes "$data" -} - -evalJsonAttr() { - local attr jqArgs data - attr="$1" - jqArgs="$2" - data="$(nix eval --json "$FLAKE_PATH"."$attr" 2>/dev/null | jq -r "$jqArgs")" - [[ $data != "null" && -n $data ]] && echo "$data" -} - -evalNixpkgsLib() { - local function data - function="$1" - # Impure is needed to import the flake reference - data="$(nix eval --raw --impure --expr "let pkgs = (builtins.getFlake \"flake:$FLAKE\"); in pkgs.lib.$function pkgs.$PKG_NAME" 2>/dev/null)" - [[ $data != "null" && -n $data ]] && echo "$data" -} - -maybeEcho() { - local -r prefix="$1" - local flag="$2" - local -r commaSeperated="${3:-false}" - [[ $commaSeperated == "true" ]] && flag="$(newlinesToCommaSeperated "$flag")" - test -n "$flag" && echo "$prefix $flag" -} - -test -n "$(evalAttr "meta.broken")" && echo "broken: true" -test -n "$(evalAttr "meta.insecure")" && echo "insecure: true" - -version="$(evalAttr "version")" -# Derive the version from "name" using 'lib.getVersion' if it's not set -test -z "$version" && version="$(evalNixpkgsLib "getVersion")" -maybeEcho "version:" "$version" - -homepage="$(evalAttr "meta.homepage")" -maybeEcho "homepage:" "$homepage" - -description="$(evalAttr "meta.description")" -maybeEcho "description:" "$description" - -license="$(evalJsonAttr "meta.license" 'if type=="array" then .[].fullName else .fullName end')" -maybeEcho "license:" "$license" true - -maintainers="$(evalJsonAttr "meta.maintainers" '.[].github')" -maybeEcho "maintainers:" "$maintainers" true - -platforms="$(evalJsonAttr "meta.platforms" 'if type=="array" then .[] else . end')" -maybeEcho "platforms:" "$platforms" true diff --git a/pkgs/nix-search-fzf/nix-search-fzf.sh b/pkgs/nix-search-fzf/nix-search-fzf.sh deleted file mode 100644 index b7a3036..0000000 --- a/pkgs/nix-search-fzf/nix-search-fzf.sh +++ /dev/null @@ -1,161 +0,0 @@ -#!/usr/bin/env bash - -# An fzf script with autocomplete from "nix search" which allows for interactive fuzzy searching of derivations. -# After the search a nix subcommand is executed on the selected derivation(s), e.g. "nix shell" or "nix run". - -set -eou pipefail - -FLAKE="nixpkgs" # The default flake to use. TODO: make this configurable -NIX_SUBCOMMAND="shell" # The default nix subcommand to execute -MULTIPLE_SELECTION=true # Whether to allow the user to select multiple derivations -PRINT_COMMAND=false # Only print the command that would be executed, don't execute it - -if [ -n "${XDG_CACHE_HOME-}" ]; then - CACHE_PATH="$XDG_CACHE_HOME/nix-search-fzf/cache.txt" -else - CACHE_PATH="$HOME/.cache/nix-search-fzf/cache.txt" -fi - -# Because fzf executes commands from keybindings in a subprocess, we cannot directly change this scripts state. -# Instead we can use a temporary file as an IPC mechanism, to change which subcommand to execute. -TMP_FILE="$(mktemp --dry-run --suffix "-nix-search-fzf")" -trap 'rm -f "$TMP_FILE"' EXIT INT TERM - -handleArguments() { - while (("$#" > 0)); do - case "$1" in - -s | shell | --shell) - NIX_SUBCOMMAND="shell" - ;; - -b | build | --build) - NIX_SUBCOMMAND="build" - ;; - -r | run | --run) - NIX_SUBCOMMAND="run" - MULTIPLE_SELECTION=false - ;; - -e | edit | --edit) - NIX_SUBCOMMAND="edit" - MULTIPLE_SELECTION=false - ;; - -c | command | --command) - PRINT_COMMAND=true - ;; - -u | update | --update) - manageCache true - exit - ;; - -h | help | --help) - echo "Usage: $(basename "$0") [--shell|--build|--run|--edit|--update]" - echo " --shell: enter a nix shell with the selected package(s). This is the default" - echo " --build: build the selected package(s) with nix build" - echo " --run: run the selected package with nix run" - echo " --edit: edit the selected package with nix edit" - echo " --command: only print the command that would be executed, don't execute it" - echo " --update: update the nix search cache, this is done automatically every 10 days" - echo " --help: show this help message" - exit 0 - ;; - *) - echo "Unknown option '$1'" - exit 1 - ;; - esac - shift 1 - done -} - -runColored() { - printf "\e[32m\$ %s\n\e[0m" "$1" - eval "$1" -} - -manageCache() { - local doUpdate="${1:-false}" - mkdir -p "$(dirname "$CACHE_PATH")" - - if [ ! -f "$CACHE_PATH" ] || [ ! -s "$CACHE_PATH" ]; then - doUpdate="true" - echo "attribute path cache does not exist, generating..." >&2 - elif (($(date -r "$CACHE_PATH" +%s) < $(date -d "now - 10 days" +%s))); then - doUpdate="true" - echo "cache file is older than 10 days, updating..." >&2 - fi - - if [ "$doUpdate" == "true" ]; then - echo "caching attribute paths..." >&2 - # Create a list of all attribute paths with "legacyPackages.$arch" stripped - # In the future this could contain metadata as well, doing a "nix-eval" for each is not the fastest - nix search "$FLAKE" "^" --quiet --json | jq -r 'keys[]' | cut -d'.' -f3- >"$CACHE_PATH" - echo "successfully generated attribute path cache" >&2 - fi -} - -fzfBindingFlag() { - local tmpFile="$1" - local -A bindings=( - ["shell"]="ctrl-s" - ["build"]="ctrl-b" - ["edit"]="ctrl-e" - ["run"]="ctrl-r" - ) - - local result="--bind=" - for subCommand in "${!bindings[@]}"; do - local binding="${bindings[$subCommand]}" - # When pressed, write the appropriate command to our temporary IPC file, and change the prompt accordingly - result+="$binding:execute-silent(echo $subCommand > $tmpFile)+change-prompt($subCommand > )," - done - echo "${result%,}" -} - -runFzf() { - local multi_flag - if [ "$MULTIPLE_SELECTION" == true ]; then - multi_flag="--multi" - else - multi_flag="--no-multi" - fi - - fzf "$multi_flag" \ - --height 40% \ - --preview-window right,70% \ - --border rounded \ - --prompt "$NIX_SUBCOMMAND > " \ - --preview "bash -c \"@previewText@ {} $FLAKE\"" \ - "$(fzfBindingFlag "$TMP_FILE")" <"$CACHE_PATH" -} - -runNix() { - local packages selectedPkgs command - readarray -t selectedPkgs <<<"$@" - ((${#selectedPkgs[@]} == 0)) && exit 0 - - if [ "$MULTIPLE_SELECTION" == true ] && ((${#selectedPkgs[@]} > 1)); then - # Build a brace expansion string - local pkg_list="{" - for pkg in "${selectedPkgs[@]}"; do - pkg_list+="$pkg," - done - packages="${pkg_list%,}}" - else - packages="${selectedPkgs[0]}" - fi - - ((${#packages} == 0)) && exit 0 - - # Update what subcommand to execute, in case it was changed by a keybinding from fzf - [ -s "$TMP_FILE" ] && NIX_SUBCOMMAND="$(<"$TMP_FILE")" - - command="NIXPKGS_ALLOW_UNFREE=1 nix $NIX_SUBCOMMAND $FLAKE#$packages --impure" - if [ "$PRINT_COMMAND" == true ]; then - echo "$command" - exit 0 - else - runColored "$command" - fi -} - -handleArguments "$@" -manageCache -runNix "$(runFzf)" diff --git a/pkgs/wikit/default.nix b/pkgs/wikit/default.nix new file mode 100644 index 0000000..fa9ab39 --- /dev/null +++ b/pkgs/wikit/default.nix @@ -0,0 +1,16 @@ +{ lib, ... }: +with lib; +let + src = fetchFromGitHub { + owner = "KorySchneider"; + repo = "wikit"; + rev = "6432c6020606868cc5f240d0317040e38b992292"; + }; +in { + wikit = mkYarnPackage { + name = "wikit"; + inherit src; + packageJSON = src + "./package.json"; + yarnLock = src + "./yarn.lock"; + }; +} diff --git a/roles/gui.nix b/roles/gui.nix index de10ee3..387ed07 100644 --- a/roles/gui.nix +++ b/roles/gui.nix @@ -49,10 +49,6 @@ in # Not GUI but specific to GUI usage sshuttle - sshfs - - # try out for a bit - niri ]; }; }