mirror of
https://github.com/nmasur/dotfiles
synced 2025-07-05 16:10:14 +00:00
reorganize files
This commit is contained in:
@ -18,19 +18,5 @@
|
||||
base0D = "#83a598"; # blue
|
||||
base0E = "#d3869b"; # purple
|
||||
base0F = "#d65d0e"; # brown
|
||||
neovimConfig = ''
|
||||
local M = {}
|
||||
|
||||
M.packer = function(use)
|
||||
use({
|
||||
"lifepillar/vim-gruvbox8",
|
||||
config = function()
|
||||
vim.g.gruvbox_italicize_strings = 0
|
||||
vim.cmd("colorscheme gruvbox8")
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
'';
|
||||
neovimConfig = ./neovim.lua;
|
||||
}
|
||||
|
13
modules/colorscheme/gruvbox/neovim.lua
Normal file
13
modules/colorscheme/gruvbox/neovim.lua
Normal file
@ -0,0 +1,13 @@
|
||||
local M = {}
|
||||
|
||||
M.packer = function(use)
|
||||
use({
|
||||
"lifepillar/vim-gruvbox8",
|
||||
config = function()
|
||||
vim.g.gruvbox_italicize_strings = 0
|
||||
vim.cmd("colorscheme gruvbox8")
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
@ -12,7 +12,4 @@
|
||||
./utilities.nix
|
||||
];
|
||||
|
||||
home-manager.users.${config.user}.home.stateVersion = "22.11";
|
||||
home-manager.users.root.home.stateVersion = "22.11";
|
||||
|
||||
}
|
||||
|
@ -14,11 +14,16 @@
|
||||
kubectl
|
||||
k9s
|
||||
noti # Create notifications programmatically
|
||||
(pkgs.writeShellScriptBin "ocr"
|
||||
(builtins.readFile ../shell/bash/scripts/ocr.sh))
|
||||
];
|
||||
|
||||
programs.fish.shellAbbrs = {
|
||||
# Add noti for ghpr in Darwin
|
||||
ghpr = lib.mkForce "gh pr create && sleep 3 && noti gh run watch";
|
||||
|
||||
# Shortcut to edit hosts file
|
||||
hosts = "sudo nvim /etc/hosts";
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -1,5 +0,0 @@
|
||||
{ ... }: {
|
||||
|
||||
imports = [ ./neovim ./notes.nix ./dotfiles.nix ];
|
||||
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
{ config, pkgs, lib, ... }: {
|
||||
|
||||
# Timezone required for Redshift schedule
|
||||
imports = [ ../system/timezone.nix ];
|
||||
imports = [ ../nixos/timezone.nix ];
|
||||
|
||||
config = lib.mkIf config.gui.enable {
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
source = ./lua;
|
||||
recursive = true; # Allows adding more files
|
||||
};
|
||||
"nvim/lua/packer/colors.lua".text = config.gui.colorscheme.neovimConfig;
|
||||
"nvim/lua/packer/colors.lua".source = config.gui.colorscheme.neovimConfig;
|
||||
};
|
||||
|
||||
programs.git.extraConfig.core.editor = "nvim";
|
9
modules/nixos/default.nix
Normal file
9
modules/nixos/default.nix
Normal file
@ -0,0 +1,9 @@
|
||||
{ config, ... }: {
|
||||
|
||||
imports = [ ./user.nix ./timezone.nix ./doas.nix ];
|
||||
|
||||
# Pin a state version to prevent warnings
|
||||
system.stateVersion =
|
||||
config.home-manager.users.${config.user}.home.stateVersion;
|
||||
|
||||
}
|
@ -16,6 +16,9 @@
|
||||
|
||||
};
|
||||
|
||||
# Set a variable for dotfiles repo, not necessary but convenient
|
||||
home.sessionVariables.DOTS = config.dotfilesPath;
|
||||
|
||||
};
|
||||
|
||||
}
|
56
modules/shell/bash/scripts/ocr.sh
Executable file
56
modules/shell/bash/scripts/ocr.sh
Executable file
@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p tesseract
|
||||
|
||||
# Yoinked from https://github.com/JJGO/dotfiles
|
||||
# Adapted from https://github.com/sdushantha/bin
|
||||
|
||||
set -x
|
||||
TEXT_FILE="/tmp/ocr.txt"
|
||||
IMAGE_FILE="/tmp/ocr.png"
|
||||
|
||||
function notify-send() {
|
||||
osascript -e "display notification \"$2\" with title \"OCR\""
|
||||
}
|
||||
|
||||
PATH="/usr/local/bin/:$PATH"
|
||||
|
||||
# Take screenshot by selecting the area
|
||||
screencapture -i "$IMAGE_FILE"
|
||||
|
||||
# Get the exit code of the previous command.
|
||||
# So in this case, it is the screenshot command. If it did not exit with an
|
||||
# exit code 0, then it means the user canceled the process of taking a
|
||||
# screenshot by doing something like pressing the escape key
|
||||
STATUS=$?
|
||||
|
||||
# If the user pressed the escape key or did something to terminate the proccess
|
||||
# taking a screenshot, then just exit
|
||||
[ $STATUS -ne 0 ] && exit 1
|
||||
|
||||
# Do the magic (∩^o^)⊃━☆゚.*・。゚
|
||||
# Notice how I have removing the extension .txt from the file path. This is
|
||||
# because tesseract adds .txt to the given file path anyways. So if we were to
|
||||
# specify /tmp/ocr.txt as the file path, tesseract would out the text to
|
||||
# /tmp/ocr.txt.txt
|
||||
tesseract "$IMAGE_FILE" "${TEXT_FILE//\.txt/}"
|
||||
|
||||
# Check if the text was detected by checking number
|
||||
# of lines in the file
|
||||
LINES=$(wc -l <$TEXT_FILE)
|
||||
if [ "$LINES" -eq 0 ]; then
|
||||
notify-send "ocr" "no text was detected"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Copy text to clipboard
|
||||
# xclip -selection clip < "$TEXT_FILE"
|
||||
pbcopy <"$TEXT_FILE"
|
||||
|
||||
# Send a notification with the text that was grabbed using OCR
|
||||
notify-send "ocr" "$(cat $TEXT_FILE)"
|
||||
|
||||
# Clean up
|
||||
# "Always leave the area better than you found it"
|
||||
# - My first grade teacher
|
||||
rm "$TEXT_FILE"
|
||||
rm "$IMAGE_FILE"
|
@ -46,7 +46,6 @@
|
||||
};
|
||||
|
||||
# Provides "command-not-found" options
|
||||
# Requires activating a manual download
|
||||
programs.nix-index = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
@ -54,7 +53,7 @@
|
||||
|
||||
};
|
||||
|
||||
# Set system channels for nix-shell
|
||||
# Set system channels, used for nix-shell commands
|
||||
nix = { nixPath = [ "nixpkgs=${pkgs.path}" ]; };
|
||||
|
||||
}
|
||||
|
@ -1,10 +0,0 @@
|
||||
{ config, ... }: {
|
||||
|
||||
imports = [ ./user.nix ./timezone.nix ./doas.nix ];
|
||||
|
||||
# Pin a state version to prevent warnings
|
||||
system.stateVersion = "22.11";
|
||||
home-manager.users.${config.user}.home.stateVersion = "22.11";
|
||||
home-manager.users.root.home.stateVersion = "22.11";
|
||||
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
{ pkgs, ... }: {
|
||||
|
||||
# Inspired by https://github.com/cleverca22/nix-tests/blob/master/kexec/justdoit.nix
|
||||
# This script will partition and format drives; use at your own risk!
|
||||
|
||||
type = "app";
|
||||
|
||||
program = pkgs.writeShellScriptBin "installer" ''
|
||||
#!${pkgs.stdenv.shell}
|
||||
|
||||
set -e
|
||||
|
||||
DISK=$1
|
||||
FLAKE=$2
|
||||
PARTITION_PREFIX=""
|
||||
|
||||
if [ -z "$DISK" ] || [ -z "$FLAKE" ]; then
|
||||
echo "Missing required parameter."
|
||||
echo "Usage: installer -- <disk> <host>"
|
||||
echo "Example: installer -- nvme0n1 desktop"
|
||||
echo "Flake example: nix run github:nmasur/dotfiles#installer -- nvme0n1 desktop"
|
||||
echo "(exiting)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$DISK" in nvme*)
|
||||
PARTITION_PREFIX="p"
|
||||
esac
|
||||
|
||||
parted /dev/''${DISK} -- mklabel gpt
|
||||
parted /dev/''${DISK} -- mkpart primary 512MiB 100%
|
||||
parted /dev/''${DISK} -- mkpart ESP fat32 1MiB 512MiB
|
||||
parted /dev/''${DISK} -- set 3 esp on
|
||||
mkfs.ext4 -L nixos /dev/''${DISK}''${PARTITION_PREFIX}1
|
||||
mkfs.fat -F 32 -n boot /dev/''${DISK}''${PARTITION_PREFIX}2
|
||||
|
||||
mount /dev/disk/by-label/nixos /mnt
|
||||
mkdir --parents /mnt/boot
|
||||
mount /dev/disk/by-label/boot /mnt/boot
|
||||
|
||||
nixos-install --flake github:nmasur/dotfiles#''${FLAKE}
|
||||
'';
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
{ config, lib, ... }: {
|
||||
|
||||
# Systemd doesn't work in WSL so these must be disabled
|
||||
services.geoclue2.enable = lib.mkForce false;
|
||||
location = { provider = lib.mkForce "manual"; };
|
||||
services.localtimed.enable = lib.mkForce false;
|
||||
@ -8,7 +9,8 @@
|
||||
# home-manager.users.${config.user}.home.sessionPath =
|
||||
# [ "/mnt/c/Program Files/win32yank/" ];
|
||||
|
||||
# Replace config directory with our repo
|
||||
# Replace config directory with our repo, since it sources from config on
|
||||
# every launch
|
||||
system.activationScripts.configDir.text = ''
|
||||
rm -rf /etc/nixos
|
||||
ln --symbolic --no-dereference --force ${config.dotfilesPath} /etc/nixos
|
||||
|
Reference in New Issue
Block a user