Initial code and config files
This commit is contained in:
commit
043b436ba7
8 changed files with 294 additions and 0 deletions
152
.gitignore
vendored
Normal file
152
.gitignore
vendored
Normal file
|
@ -0,0 +1,152 @@
|
||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
# C extensions
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Distribution / packaging
|
||||||
|
.Python
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
wheels/
|
||||||
|
share/python-wheels/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
MANIFEST
|
||||||
|
|
||||||
|
# PyInstaller
|
||||||
|
# Usually these files are written by a python script from a template
|
||||||
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
|
*.manifest
|
||||||
|
*.spec
|
||||||
|
|
||||||
|
# Installer logs
|
||||||
|
pip-log.txt
|
||||||
|
pip-delete-this-directory.txt
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
htmlcov/
|
||||||
|
.tox/
|
||||||
|
.nox/
|
||||||
|
.coverage
|
||||||
|
.coverage.*
|
||||||
|
.cache
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
*.cover
|
||||||
|
*.py,cover
|
||||||
|
.hypothesis/
|
||||||
|
.pytest_cache/
|
||||||
|
cover/
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
*.mo
|
||||||
|
*.pot
|
||||||
|
|
||||||
|
# Django stuff:
|
||||||
|
*.log
|
||||||
|
local_settings.py
|
||||||
|
db.sqlite3
|
||||||
|
db.sqlite3-journal
|
||||||
|
|
||||||
|
# Flask stuff:
|
||||||
|
instance/
|
||||||
|
.webassets-cache
|
||||||
|
|
||||||
|
# Scrapy stuff:
|
||||||
|
.scrapy
|
||||||
|
|
||||||
|
# Sphinx documentation
|
||||||
|
docs/_build/
|
||||||
|
|
||||||
|
# PyBuilder
|
||||||
|
.pybuilder/
|
||||||
|
target/
|
||||||
|
|
||||||
|
# Jupyter Notebook
|
||||||
|
.ipynb_checkpoints
|
||||||
|
|
||||||
|
# IPython
|
||||||
|
profile_default/
|
||||||
|
ipython_config.py
|
||||||
|
|
||||||
|
# pyenv
|
||||||
|
# For a library or package, you might want to ignore these files since the code is
|
||||||
|
# intended to run in multiple environments; otherwise, check them in:
|
||||||
|
# .python-version
|
||||||
|
|
||||||
|
# pipenv
|
||||||
|
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||||
|
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||||
|
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||||
|
# install all needed dependencies.
|
||||||
|
#Pipfile.lock
|
||||||
|
|
||||||
|
# poetry
|
||||||
|
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||||
|
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||||
|
# commonly ignored for libraries.
|
||||||
|
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||||
|
#poetry.lock
|
||||||
|
|
||||||
|
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
||||||
|
__pypackages__/
|
||||||
|
|
||||||
|
# Celery stuff
|
||||||
|
celerybeat-schedule
|
||||||
|
celerybeat.pid
|
||||||
|
|
||||||
|
# SageMath parsed files
|
||||||
|
*.sage.py
|
||||||
|
|
||||||
|
# Environments
|
||||||
|
.env
|
||||||
|
.venv
|
||||||
|
env/
|
||||||
|
venv/
|
||||||
|
ENV/
|
||||||
|
env.bak/
|
||||||
|
venv.bak/
|
||||||
|
|
||||||
|
# Spyder project settings
|
||||||
|
.spyderproject
|
||||||
|
.spyproject
|
||||||
|
|
||||||
|
# Rope project settings
|
||||||
|
.ropeproject
|
||||||
|
|
||||||
|
# mkdocs documentation
|
||||||
|
/site
|
||||||
|
|
||||||
|
# mypy
|
||||||
|
.mypy_cache/
|
||||||
|
.dmypy.json
|
||||||
|
dmypy.json
|
||||||
|
|
||||||
|
# Pyre type checker
|
||||||
|
.pyre/
|
||||||
|
|
||||||
|
# pytype static type analyzer
|
||||||
|
.pytype/
|
||||||
|
|
||||||
|
# Cython debug symbols
|
||||||
|
cython_debug/
|
||||||
|
|
||||||
|
# PyCharm
|
||||||
|
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
|
||||||
|
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||||
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||||
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
|
#.idea/
|
60
autoconfig/__main__.py
Normal file
60
autoconfig/__main__.py
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
import argparse
|
||||||
|
import configparser
|
||||||
|
import logging
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import pathlib
|
||||||
|
import os
|
||||||
|
import getpass
|
||||||
|
import tempfile
|
||||||
|
|
||||||
|
|
||||||
|
# CLI Args Parsing
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description='Automatically configure ArchLinux install')
|
||||||
|
parser.add_argument('-V', '--version', action='version', version='v0.1')
|
||||||
|
parser.add_argument('-v', '--verbose', action='count', default=0)
|
||||||
|
parser.add_argument('-c', '--config', type=pathlib.Path, default='config.ini',
|
||||||
|
help='Configuration file')
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
# Config File Parsing
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
config.read(args.config)
|
||||||
|
|
||||||
|
# Logging Setup
|
||||||
|
logging.basicConfig()
|
||||||
|
log = logging.getLogger('autoconfig')
|
||||||
|
|
||||||
|
# Get minimum level from CLI and File Configs
|
||||||
|
log.setLevel(config.get('log', 'level', fallback=None))
|
||||||
|
log.setLevel(min(
|
||||||
|
30-10*args.verbose, log.level,
|
||||||
|
))
|
||||||
|
|
||||||
|
# Pacman
|
||||||
|
if config.getboolean('pacman', 'install_yay', fallback=False):
|
||||||
|
log.info('Installing yay')
|
||||||
|
with tempfile.TemporaryDirectory() as yay_folder:
|
||||||
|
log.info('Cloning yay')
|
||||||
|
subprocess.run(('git', 'clone', 'https://aur.archlinux.org/yay', yay_folder))
|
||||||
|
subprocess.run(('makepkg', '-rcsi'), cwd=yay_folder)
|
||||||
|
|
||||||
|
if config.getboolean('pacman', 'install_pkg', fallback=False):
|
||||||
|
with open(config.get('pacman', 'pkg_list', fallback=''), 'r') as pkg_file:
|
||||||
|
pkg_list = pkg_file.read().splitlines()
|
||||||
|
log.info('Installing packages')
|
||||||
|
subprocess.run(('yay', '-Syu', *pkg_list))
|
||||||
|
|
||||||
|
# Config files
|
||||||
|
if 'config' in config:
|
||||||
|
log.info('Copying config files')
|
||||||
|
config_root = pathlib.Path(config['config'].pop('root'))
|
||||||
|
for item in config['config'].values():
|
||||||
|
src, dst = item.split(':')
|
||||||
|
src = config_root.joinpath(src)
|
||||||
|
dst = pathlib.Path(dst).expanduser()
|
||||||
|
log.debug(f'Copying {src} -> {dst}')
|
||||||
|
dst.parent.mkdir(exist_ok=True)
|
||||||
|
shutil.copy2(src, dst)
|
14
config.ini
Normal file
14
config.ini
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
[pacman]
|
||||||
|
install_yay = True
|
||||||
|
install_pkg = False
|
||||||
|
pkg_list = pacman.list
|
||||||
|
|
||||||
|
[config]
|
||||||
|
root = config
|
||||||
|
kitty = kitty.conf:~/.config/kitty/kitty.conf
|
||||||
|
kitty-theme = kitty-theme.conf:~/.config/kitty/theme.conf
|
||||||
|
neovim = init.vim:~/.config/nvim/init.vim
|
||||||
|
git = gitconfig:~/.gitconfig
|
||||||
|
|
||||||
|
[log]
|
||||||
|
level = INFO
|
8
config/gitconfig
Normal file
8
config/gitconfig
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[user]
|
||||||
|
name = Edgar P. Burkhart
|
||||||
|
email = git@edgarpierre.fr
|
||||||
|
signingkey = 9833D3C5A25BD227
|
||||||
|
[commit]
|
||||||
|
gpgsign = true
|
||||||
|
[tag]
|
||||||
|
gpgsign = true
|
27
config/init.vim
Normal file
27
config/init.vim
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
"Clipboard
|
||||||
|
set clipboard+=unnamedplus
|
||||||
|
|
||||||
|
"Tabulations
|
||||||
|
set tabstop=2
|
||||||
|
set shiftwidth=2
|
||||||
|
|
||||||
|
set noexpandtab
|
||||||
|
|
||||||
|
"Mouse
|
||||||
|
set mouse=a
|
||||||
|
|
||||||
|
"Search
|
||||||
|
set ignorecase
|
||||||
|
|
||||||
|
"Completion
|
||||||
|
set wildmode=longest,list,full
|
||||||
|
|
||||||
|
"Line numbers
|
||||||
|
set number
|
||||||
|
|
||||||
|
"Color column
|
||||||
|
set cc=80
|
||||||
|
|
||||||
|
"Split side
|
||||||
|
set splitright
|
||||||
|
set splitbelow
|
23
config/kitty-theme.conf
Normal file
23
config/kitty-theme.conf
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# Theme ported from the Mac Terminal application.
|
||||||
|
|
||||||
|
background #79241d
|
||||||
|
foreground #d6c8a7
|
||||||
|
cursor #ffffff
|
||||||
|
selection_background #a4a390
|
||||||
|
color0 #000000
|
||||||
|
color8 #545454
|
||||||
|
color1 #ff3e00
|
||||||
|
color9 #ba0000
|
||||||
|
color2 #00ba00
|
||||||
|
color10 #00ba00
|
||||||
|
color3 #e6af00
|
||||||
|
color11 #e6af00
|
||||||
|
color4 #0071ff
|
||||||
|
color12 #0071ae
|
||||||
|
color5 #ba00ba
|
||||||
|
color13 #ff54ff
|
||||||
|
color6 #00baba
|
||||||
|
color14 #54ffff
|
||||||
|
color7 #bababa
|
||||||
|
color15 #ffffff
|
||||||
|
selection_foreground #79241d
|
8
config/kitty.conf
Normal file
8
config/kitty.conf
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
font_family Fira Code
|
||||||
|
font_size 12
|
||||||
|
include ./theme.conf
|
||||||
|
|
||||||
|
map ctrl+f2 detach_window
|
||||||
|
map ctrl+f3 detach_window new-tab
|
||||||
|
map ctrl+shift+t new_tab_with_cwd
|
||||||
|
map ctrl+shift+enter new_window_with_cwd
|
2
pacman.list
Normal file
2
pacman.list
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
git
|
||||||
|
fish
|
Reference in a new issue