diff options
| -rw-r--r-- | config/qutebrowser/config.py | 4 | ||||
| -rw-r--r-- | config/zsh/aliases/dev.zsh | 1 | ||||
| -rw-r--r-- | config/zsh/paths.zsh | 6 | ||||
| -rw-r--r-- | configuration.nix | 1 | ||||
| -rw-r--r-- | hardware-configuration.nix | 1 | ||||
| -rw-r--r-- | modules/login.nix | 1 | ||||
| -rw-r--r-- | packages.nix | 3 | ||||
| -rwxr-xr-x | scripts/commands/:snippets | 91 | ||||
| -rwxr-xr-x | scripts/sound.sh | 1 | ||||
| -rw-r--r-- | shell/rust.nix | 45 |
10 files changed, 129 insertions, 25 deletions
diff --git a/config/qutebrowser/config.py b/config/qutebrowser/config.py index ad412f2..5f80067 100644 --- a/config/qutebrowser/config.py +++ b/config/qutebrowser/config.py @@ -272,7 +272,7 @@ config.set('content.media.video_capture', True, '*://meet.google.com') c.url.default_page = '~/.config/qutebrowser/homepage/index.html' c.url.start_pages = [c.url.default_page] -DEFAULT_SEARCH_ENGINE = 'br' +DEFAULT_SEARCH_ENGINE = 'd' c.url.searchengines = { # Main general 'd': 'https://duckduckgo.com/?q={}', @@ -322,7 +322,7 @@ nmap(leader + 'tr', 'config-source') # Reload config nmap(leader + 'ti', 'devtools window') # Inspector nmap(leader + 'ts', 'view-source') # View page source -# Json formatter +# Json formatter {{{ c.aliases['format-json'] = 'spawn --userscript format_json'; nmap(leader + 'tj', 'format-json') # }}} diff --git a/config/zsh/aliases/dev.zsh b/config/zsh/aliases/dev.zsh index 4b6108b..083fa3e 100644 --- a/config/zsh/aliases/dev.zsh +++ b/config/zsh/aliases/dev.zsh @@ -42,6 +42,7 @@ p__run_npm_script() { [[ ! -f "package.json" ]] && return 1; local commands=$(node -e 'const pkg = require("./package.json"); Object.entries(pkg.scripts || {}).map(([key, value]) => console.log(`${key}\t\t "${value}"`))'); + # cat package.json | jq -r '.scripts | to_entries | map([.key, .value] | join("\t\t\t")) | .[]' | fzf | cut -f1 local result=$(echo -e "$commands" | fzf | cut -f1); diff --git a/config/zsh/paths.zsh b/config/zsh/paths.zsh index 98ad154..9270ce2 100644 --- a/config/zsh/paths.zsh +++ b/config/zsh/paths.zsh @@ -22,9 +22,9 @@ PATH="$COMMANDS_DIR:$PATH"; export PATH; # Android/JVM garbage TODO: Remove if not needed -export ANDROID_HOME=$HOME/dump/android-sdk; -PATH=$PATH:$HOME/.config/android-sdk/platform-tools; -PATH=$HOME/dump/flutter/bin:$PATH; +# export ANDROID_HOME=$HOME/dump/android-sdk; +# PATH=$PATH:$HOME/.config/android-sdk/platform-tools; +# PATH=$HOME/dump/flutter/bin:$PATH; export PATH; diff --git a/configuration.nix b/configuration.nix index c71508d..80fc533 100644 --- a/configuration.nix +++ b/configuration.nix @@ -100,6 +100,7 @@ in virtualisation = { docker.enable = true; lxd.enable = false; + virtualbox.host.enable = true; #anbox.enable = true; }; diff --git a/hardware-configuration.nix b/hardware-configuration.nix index 6beaa45..40fd0aa 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -24,6 +24,7 @@ boot.extraModprobeConfig = '' options snd slots=snd-hda-intel ''; + boot.supportedFilesystems = [ "ntfs" ]; services.udev = { packages = [ diff --git a/modules/login.nix b/modules/login.nix index d22d67f..35997ea 100644 --- a/modules/login.nix +++ b/modules/login.nix @@ -35,6 +35,7 @@ in "jackaudio" "plugdev" "adbusers" + "vboxusers" ]; shell = pkgs.zsh; }; diff --git a/packages.nix b/packages.nix index bb01006..6f827d0 100644 --- a/packages.nix +++ b/packages.nix @@ -27,6 +27,7 @@ let docker-compose gibo direnv + gh gcc gnumake @@ -76,7 +77,7 @@ let dunst gotop tremc - zathura + # zathura # Broken on 9th April 2020 ]; utils = with pkgs; [ diff --git a/scripts/commands/:snippets b/scripts/commands/:snippets new file mode 100755 index 0000000..12e3df1 --- /dev/null +++ b/scripts/commands/:snippets @@ -0,0 +1,91 @@ +#!/usr/bin/env node +const { promises: { readFile, writeFile } } = require('fs') +const path = require('path') +const { homedir } = require('os') + +const util = require('util'); +const { exec } = require('child_process') + +const JSON_FILE = path.resolve(homedir(), 'nixos/snippets.json') + +const $ = async (cmd, input) => { + const stdout = await (new Promise((resolve, reject) => { + const ps = exec(cmd, (err, stdout) => err ? reject(err) : resolve(stdout)) + if (typeof input === 'string') { + ps.stdin.end(input) + } + })) + + return `${stdout}`.toString().trim() +} + +const getSelection = () => $(`xclip -o`) + +const saveToClipboard = text => $('xclip -i -selection clipboard', text) + +const promptName = () => $(`sh -c 'echo -n "" | dmenu -p "Name :: "'`) // TODO: use input + +// TODO: Show current tags +const promptTags = () => $(`sh -c 'echo -n "" | dmenu -p "Tags :: "'`) + .then(input => `${input}`.split(/\s+/g).filter(Boolean)) + +const getCurrentJson = async () => { + try { + const contents = await readFile(JSON_FILE, 'utf8') + return JSON.parse(contents.toString()) + } catch(_) { + return {} + } +} + +const setCurrentJson = (data) => + writeFile(JSON_FILE, JSON.stringify(data, null, 2)) + +const promptSelect = async ls => $(`dmenu -p "Snippets :: "`, ls.join('\n')) + +const saveSnippets = async () => { + const contents = await getSelection() + const currentSnippets = await getCurrentJson() + + const name = await promptName() + const tags = await promptTags() + + const data = { + ...currentSnippets, + [name]: { + contents, + tags, + }, + } + + await setCurrentJson(data) +} + +const loadSnippets = async () => { + const currentSnippets = await getCurrentJson() + const seperator = ' :: ' + + const menuInput = Object.entries(currentSnippets) + .map(([ name, { tags } ]) => `${name}${seperator}(${tags.join(', ')})`) + + const selection = await promptSelect(menuInput) + + if (selection) { + const name = selection.split(seperator)[0].trim() + const { contents } = currentSnippets[name] || {} + console.log(contents) + await saveToClipboard(contents) + } +} + +const main = async () => { + try { + await saveToClipboard('foobaraa') + // await loadSnippets() + } catch(_) { + console.log('cancelled') + } +} + +main() + diff --git a/scripts/sound.sh b/scripts/sound.sh index 090a805..cda805a 100755 --- a/scripts/sound.sh +++ b/scripts/sound.sh @@ -21,6 +21,7 @@ case "$1" in volume) case "$2" in up) amixer sset Master '5%+' ;; down) amixer sset Master '5%-' ;; + perc) amixer sset Master "$3%" ;; esac ;; *) echo "Wrong command" ;; esac diff --git a/shell/rust.nix b/shell/rust.nix index e36c70a..1e9c2f2 100644 --- a/shell/rust.nix +++ b/shell/rust.nix @@ -1,27 +1,34 @@ -# with import <nixpkgs> {}; -# let src = fetchFromGitHub { -# owner = "mozilla"; -# repo = "nixpkgs-mozilla"; -# rev = "9f35c4b09fd44a77227e79ff0c1b4b6a69dff533"; -# sha256 = "18h0nvh55b5an4gmlgfbvwbyqj91bklf1zymis6lbdh75571qaz0"; -# }; +# with import <nixpkgs> { }; +# let +# src = fetchFromGitHub { +# owner = "mozilla"; +# repo = "nixpkgs-mozilla"; +# rev = "15b7a05f20aab51c4ffbefddb1b448e862dccb7d"; # 10th April 2022 +# sha256 = "sha256-YeN4bpPvHkVOpQzb8APTAfE7/R+MFMwJUMkqmfvytSk="; +# }; +# moz = import "${src.out}/rust-overlay.nix" pkgs pkgs; +# rust = moz.latest.rustChannels.nightly.rust.override { +# extensions = [ "rust-src" ]; +# }; # in -# with import "${src.out}/rust-overlay.nix" pkgs pkgs; -# stdenv.mkDerivation { -# name = "rust-env"; +# mkShell rec { # buildInputs = [ -# # Note: to use use stable, just replace `nightly` with `stable` -# latest.rustChannels.nightly.rust -# -# # Add some extra dependencies from `pkgs` -# pkgconfig openssl +# # Build tools +# rust +# +# # Lib deps +# pkg-config +# libclang # ]; -# -# # Set Environment Variables -# RUST_BACKTRACE = 1; +# nativeBuildInputs = [ clang ]; +# +# # RUST_SRC_PATH = rust.packages.stable.rustPlatform.rustLibSrc; +# # RUST_BACKTRACE = 1; +# LIBCLANG_PATH = "${libclang.lib}/lib"; +# LD_LIBRARY_PATH = lib.makeLibraryPath (buildInputs ++ nativeBuildInputs); # } -with import <nixpkgs> {}; +with import <nixpkgs> { }; mkShell rec { buildInputs = [ # Build tools |
