reorganize files

This commit is contained in:
Noah Masur 2022-07-25 23:15:26 -04:00
parent 2a4a8efa48
commit 6353ac188e
35 changed files with 61 additions and 68 deletions

View File

@ -72,9 +72,7 @@
# Format and install from nothing # Format and install from nothing
apps = forAllSystems (system: apps = forAllSystems (system:
let pkgs = import nixpkgs { inherit system; }; let pkgs = import nixpkgs { inherit system; };
in { in { installer = import ./apps/installer.nix { inherit pkgs; }; });
installer = import ./modules/system/installer.nix { inherit pkgs; };
});
# Used to run commands and edit files in this repo # Used to run commands and edit files in this repo
devShells = forAllSystems (system: devShells = forAllSystems (system:

View File

@ -1,6 +1,11 @@
{ config, lib, pkgs, ... }: { { config, lib, pkgs, ... }: {
imports = [ ../modules/shell ../modules/editor ../modules/mail/himalaya.nix ]; imports = [
../modules/shell
../modules/neovim
../modules/repositories/notes.nix
../modules/repositories/dotfiles.nix
];
options = with lib; { options = with lib; {
user = mkOption { user = mkOption {
@ -50,7 +55,8 @@
}; };
}; };
config = { config = let stateVersion = "22.11";
in {
# Enable features in Nix commands # Enable features in Nix commands
nix.extraOptions = "experimental-features = nix-command flakes"; nix.extraOptions = "experimental-features = nix-command flakes";
@ -69,10 +75,9 @@
nixpkgs.config.allowUnfreePredicate = pkg: nixpkgs.config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) config.unfreePackages; builtins.elem (lib.getName pkg) config.unfreePackages;
# Set a variable for dotfiles repo, not necessary but convenient # Pin a state version to prevent warnings
home-manager.users.${config.user} = { home-manager.users.${config.user}.home.stateVersion = stateVersion;
home.sessionVariables = { DOTS = config.dotfilesPath; }; home-manager.users.root.home.stateVersion = stateVersion;
};
}; };

View File

@ -27,10 +27,11 @@ nixpkgs.lib.nixosSystem {
./hardware-configuration.nix ./hardware-configuration.nix
../common.nix ../common.nix
../../modules/hardware ../../modules/hardware
../../modules/system ../../modules/nixos
../../modules/graphical ../../modules/graphical
../../modules/gaming ../../modules/gaming
../../modules/applications ../../modules/applications
../../modules/mail/himalaya.nix
../../modules/services/keybase.nix ../../modules/services/keybase.nix
../../modules/services/gnupg.nix ../../modules/services/gnupg.nix
../../modules/services/mullvad.nix ../../modules/services/mullvad.nix

View File

@ -17,6 +17,7 @@ darwin.lib.darwinSystem {
../../modules/darwin ../../modules/darwin
../../modules/applications/alacritty.nix ../../modules/applications/alacritty.nix
../../modules/applications/discord.nix ../../modules/applications/discord.nix
../../modules/mail/himalaya.nix
../../modules/programming/nix.nix ../../modules/programming/nix.nix
../../modules/programming/terraform.nix ../../modules/programming/terraform.nix
../../modules/programming/python.nix ../../modules/programming/python.nix

View File

@ -6,7 +6,6 @@ nixpkgs.lib.nixosSystem {
specialArgs = { }; specialArgs = { };
modules = [ modules = [
globals globals
home-manager.nixosModules.home-manager
wsl.nixosModules.wsl wsl.nixosModules.wsl
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ {
@ -20,14 +19,15 @@ nixpkgs.lib.nixosSystem {
automountPath = "/mnt"; automountPath = "/mnt";
defaultUser = globals.user; defaultUser = globals.user;
startMenuLaunchers = true; startMenuLaunchers = true;
wslConf.network.generateResolvConf = true; # Turn off if breaking VPN wslConf.network.generateResolvConf = true; # Turn off if it breaks VPN
interop.includePath = interop.includePath =
false; # Including Windows PATH will slow down Neovim false; # Including Windows PATH will slow down Neovim command mode
}; };
} }
../common.nix ../common.nix
../../modules/wsl ../../modules/wsl
../../modules/system ../../modules/nixos
../../modules/mail/himalaya.nix
../../modules/programming/nix.nix ../../modules/programming/nix.nix
../../modules/programming/lua.nix ../../modules/programming/lua.nix
]; ];

View File

@ -18,19 +18,5 @@
base0D = "#83a598"; # blue base0D = "#83a598"; # blue
base0E = "#d3869b"; # purple base0E = "#d3869b"; # purple
base0F = "#d65d0e"; # brown base0F = "#d65d0e"; # brown
neovimConfig = '' neovimConfig = ./neovim.lua;
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
'';
} }

View 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

View File

@ -12,7 +12,4 @@
./utilities.nix ./utilities.nix
]; ];
home-manager.users.${config.user}.home.stateVersion = "22.11";
home-manager.users.root.home.stateVersion = "22.11";
} }

View File

@ -14,11 +14,16 @@
kubectl kubectl
k9s k9s
noti # Create notifications programmatically noti # Create notifications programmatically
(pkgs.writeShellScriptBin "ocr"
(builtins.readFile ../shell/bash/scripts/ocr.sh))
]; ];
programs.fish.shellAbbrs = { programs.fish.shellAbbrs = {
# Add noti for ghpr in Darwin # Add noti for ghpr in Darwin
ghpr = lib.mkForce "gh pr create && sleep 3 && noti gh run watch"; ghpr = lib.mkForce "gh pr create && sleep 3 && noti gh run watch";
# Shortcut to edit hosts file
hosts = "sudo nvim /etc/hosts";
}; };
}; };

View File

@ -1,5 +0,0 @@
{ ... }: {
imports = [ ./neovim ./notes.nix ./dotfiles.nix ];
}

View File

@ -1,7 +1,7 @@
{ config, pkgs, lib, ... }: { { config, pkgs, lib, ... }: {
# Timezone required for Redshift schedule # Timezone required for Redshift schedule
imports = [ ../system/timezone.nix ]; imports = [ ../nixos/timezone.nix ];
config = lib.mkIf config.gui.enable { config = lib.mkIf config.gui.enable {

View File

@ -15,7 +15,7 @@
source = ./lua; source = ./lua;
recursive = true; # Allows adding more files 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"; programs.git.extraConfig.core.editor = "nvim";

View 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;
}

View File

@ -16,6 +16,9 @@
}; };
# Set a variable for dotfiles repo, not necessary but convenient
home.sessionVariables.DOTS = config.dotfilesPath;
}; };
} }

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env nix-shell
#!nix-shell -i bash -p tesseract
# Yoinked from https://github.com/JJGO/dotfiles # Yoinked from https://github.com/JJGO/dotfiles
# Adapted from https://github.com/sdushantha/bin # Adapted from https://github.com/sdushantha/bin
@ -13,18 +14,6 @@ function notify-send() {
PATH="/usr/local/bin/:$PATH" PATH="/usr/local/bin/:$PATH"
# Check if the needed dependencies are installed
dependencies=(tesseract)
for dependency in "${dependencies[@]}"; do
type -p "$dependency" &>/dev/null || {
# The reason why we are sending the error as a notification is because
# user is most likely going to run this script by binding it to their
# keyboard, therefor they cant see any text that is outputed using echo
notify-send "ocr" "Could not find '${dependency}', is it installed?"
exit 1
}
done
# Take screenshot by selecting the area # Take screenshot by selecting the area
screencapture -i "$IMAGE_FILE" screencapture -i "$IMAGE_FILE"
@ -47,7 +36,7 @@ tesseract "$IMAGE_FILE" "${TEXT_FILE//\.txt/}"
# Check if the text was detected by checking number # Check if the text was detected by checking number
# of lines in the file # of lines in the file
LINES=$(wc -l < $TEXT_FILE) LINES=$(wc -l <$TEXT_FILE)
if [ "$LINES" -eq 0 ]; then if [ "$LINES" -eq 0 ]; then
notify-send "ocr" "no text was detected" notify-send "ocr" "no text was detected"
exit 1 exit 1
@ -55,10 +44,10 @@ fi
# Copy text to clipboard # Copy text to clipboard
# xclip -selection clip < "$TEXT_FILE" # xclip -selection clip < "$TEXT_FILE"
pbcopy < "$TEXT_FILE" pbcopy <"$TEXT_FILE"
# Send a notification with the text that was grabbed using OCR # Send a notification with the text that was grabbed using OCR
# notify-send "ocr" "$(cat $TEXT_FILE)" notify-send "ocr" "$(cat $TEXT_FILE)"
# Clean up # Clean up
# "Always leave the area better than you found it" # "Always leave the area better than you found it"

View File

@ -46,7 +46,6 @@
}; };
# Provides "command-not-found" options # Provides "command-not-found" options
# Requires activating a manual download
programs.nix-index = { programs.nix-index = {
enable = true; enable = true;
enableFishIntegration = 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}" ]; }; nix = { nixPath = [ "nixpkgs=${pkgs.path}" ]; };
} }

View File

@ -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";
}

View File

@ -1,5 +1,6 @@
{ config, lib, ... }: { { config, lib, ... }: {
# Systemd doesn't work in WSL so these must be disabled
services.geoclue2.enable = lib.mkForce false; services.geoclue2.enable = lib.mkForce false;
location = { provider = lib.mkForce "manual"; }; location = { provider = lib.mkForce "manual"; };
services.localtimed.enable = lib.mkForce false; services.localtimed.enable = lib.mkForce false;
@ -8,7 +9,8 @@
# home-manager.users.${config.user}.home.sessionPath = # home-manager.users.${config.user}.home.sessionPath =
# [ "/mnt/c/Program Files/win32yank/" ]; # [ "/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 = '' system.activationScripts.configDir.text = ''
rm -rf /etc/nixos rm -rf /etc/nixos
ln --symbolic --no-dereference --force ${config.dotfilesPath} /etc/nixos ln --symbolic --no-dereference --force ${config.dotfilesPath} /etc/nixos