Develop edison, standardize home-manager

This commit is contained in:
2023-09-15 00:21:07 +02:00
committed by Felix Albrigtsen
parent a0693ca9fc
commit acc446dfa3
11 changed files with 92 additions and 191 deletions

View File

@@ -1,4 +1,4 @@
{ config, pkgs, ... }:
{ config, pkgs, lib, ... }:
{
imports =
@@ -6,62 +6,30 @@
../../base.nix
../../common/metrics-exporters.nix
./hardware-configuration.nix
./desktop.nix
];
networking = {
hostName = "edison";
defaultGateway = "192.168.10.1";
nameservers = [ "192.168.11.100" "1.1.1.1" ];
interfaces.eno1.ipv4 = {
addresses = [
{ address = "192.168.10.170"; prefixLength = 24; }
];
};
hostId = "8f84a235";
# Networking / Wi-Fi is configured with NM for now. TODO
networkmanager.enable = true;
};
console.keyMap = "us";
# sops.defaultSopsFile = ../../secrets/edison/edison.yaml;
environment.variables = { EDITOR = "vim"; };
environment.systemPackages = with pkgs; [
((vim_configurable.override { }).customize{
name = "vim";
vimrcConfig.packages.myplugins = with pkgs.vimPlugins; {
start = [ vim-nix vim-lastplace vim-commentary ];
opt = [];
};
vimrcConfig.customRC = ''
" your custom vimrc
set number
set relativenumber
set nu rnu
set signcolumn=number
# environment.systemPackages = with pkgs; [
# ];
set hlsearch
set smartcase
set incsearch
set autoindent
set expandtab
set shiftwidth=2
set tabstop=2
set smartindent
set smarttab
set ruler
set undolevels=1000
set nocompatible
set backspace=indent,eol,start
" Turn on syntax highlighting by default
syntax on
" ...
'';
}
)
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"nvidia-x11"
"nvidia-settings"
];
networking.firewall.allowedTCPPorts = [ 22 ];
system.stateVersion = "23.05";

11
hosts/edison/desktop.nix Normal file
View File

@@ -0,0 +1,11 @@
{ config, pkgs, lib, ... }:
{
services.xserver = {
enable = true;
desktopManager.xfce.enable = true;
#displayManager.ly.enable = true;
videoDrivers = [ "nvidia" ];
};
services.picom.enable = true;
hardware.opengl.enable = true;
}

23
hosts/edison/home.nix Normal file
View File

@@ -0,0 +1,23 @@
{ pkgs, lib, ... }:
{
home.packages = with pkgs; [
bat
bottom
ncdu
neofetch
nix-index
];
imports = [
./../../home/base.nix
];
programs = {
alacritty.enable = true;
firefox.enable = true;
rofi.enable = true;
zsh.shellAliases."rebuild" = "nixos-rebuild switch --flake /config";
};
home.stateVersion = "23.05";
}

View File

@@ -5,8 +5,7 @@
, ...
}: {
imports = [
./neovim.nix
./zsh.nix
./../../home/base.nix
];
home.packages = with pkgs; [
@@ -27,33 +26,7 @@
vscode
];
programs.git = {
enable = true;
extraConfig = {
pull.rebase = true;
push.autoSetupRemote = true;
color.ui = "auto";
init.defaultBranch = "main";
lfs.enable = true;
user = {
name = "Felix Albrigtsen";
email = "felix@albrigtsen.it";
};
};
ignores = [
"*~"
"*.swp"
".DS_Store"
".vscode"
];
};
programs.nix-index = {
enable = true;
enableZshIntegration = true;
};
programs.zsh.shellAliases."rebuild" = "darwin-rebuild switch --flake /Users/felixalb/nix";
# Copy Applications to ~/Applications to allow them to be launched from Spotlight
disabledModules = [ "targets/darwin/linkapps.nix" ];

View File

@@ -1,107 +0,0 @@
{ pkgs, lib, inputs, config, ...}:
{
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
plugins = with pkgs.vimPlugins; [
lightline-vim
vim-lightline-coc
vim-commentary
vim-fugitive
nerdtree
nerdtree-git-plugin
vim-devicons
nvim-lspconfig
copilot-vim
nvim-treesitter
coc-css
coc-go
coc-html
coc-json
coc-nvim
coc-pyright
vim-nix
];
extraConfig = ''
let mapleader = ','
set number
set shiftwidth=2
set tabstop=2
set expandtab
" Integrate status with lightline
let g:lightline = {
\ 'active': {
\ 'left': [[ 'coc_info', 'coc_hints', 'coc_errors', 'coc_warnings', 'coc_ok' ], [ 'coc_status' ]]
\ }
\ }
" register components:
call lightline#coc#register()
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window.
nnoremap <silent> K :call ShowDocumentation()<CR>
function! ShowDocumentation()
if CocAction('hasProvider', 'hover')
call CocActionAsync('doHover')
else
call feedkeys('K', 'in')
endif
endfunction
" Enable syntax folding with coc
command! -nargs=* Fold :call CocAction('fold', <f-args>)
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)
" Use CTRL-S for selections ranges.
" Requires 'textDocument/selectionRange' support of language server.
nmap <silent> <C-s> <Plug>(coc-range-select)
xmap <silent> <C-s> <Plug>(coc-range-select)
" Step through diagnostics
nmap <silent> <g <Plug>(coc-diagnostic-prev)
nmap <silent> >g <Plug>(coc-diagnostic-next)
" Nerdtree-settings
" Toggle nerdtree on Ctrl+t
nmap <silent> <C-t> :NERDTreeToggle<CR>
autocmd VimEnter * NERDTree " Autostart nerdtree on vim startup
autocmd VimEnter * wincmd p " Unselect nerdtree window
" Close vim is Nerdtree is the only buffer left
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" List and switch buffers on Ctrl+k
nnoremap <C-k> :set nomore <Bar> :ls <Bar> :set more <CR>:b<Space>
" Show trailing whitespace
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
" Disable search highlights
map <Leader><Space> :noh<CR>
'';
};
}

View File

@@ -1,58 +0,0 @@
{ pkgs, lib, inputs, config, ... }: {
programs = {
zsh = {
enable = true;
prezto = {
enable = true;
editor = {
keymap = "vi";
dotExpansion = true;
};
prompt = {
theme = "paradox";
pwdLength = "long";
showReturnVal = true;
};
terminal.autoTitle = true;
pmodules = [
"environment"
"terminal"
"editor"
"history"
"directory"
"spectrum"
"utility"
"ssh"
"completion"
"git"
"autosuggestions"
"syntax-highlighting"
"history-substring-search"
"prompt"
];
};
initExtra = ''
# Autocomplete ../
zstyle ':completion:*' special-dirs true
export PATH="$HOME/.config/emacs/bin:$PATH"
'';
shellAliases = {
l = "exa -l";
tree = "exa --tree --icons";
rebuild = "darwin-rebuild switch --flake /Users/felixalb/nix";
s = "nix-shell --run zsh";
sp = "nix-shell --run zsh -p";
em = "emacsclient -c";
emnw = "emacsclient -nw";
gst = "git status -sb";
gcm = "git commit -m";
gps = "git push";
gpl = "git pull";
};
};
};
}