Develop edison, standardize home-manager

This commit is contained in:
Felix Albrigtsen 2023-09-15 00:21:07 +02:00
parent 823be3c82c
commit 55f82fc68b
11 changed files with 92 additions and 191 deletions

View File

@ -7,7 +7,7 @@
networking = {
domain = "home.feal.no";
useDHCP = false;
useDHCP = lib.mkDefault false;
};
time.timeZone = "Europe/Oslo";
@ -15,7 +15,7 @@
console = {
font = "Lat2-Terminus16";
keyMap = "no";
keyMap = lib.mkDefault "no";
};
nix = {
@ -78,6 +78,7 @@
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHkLmJIkBM6AMbYM/hYm27Flgya81UiGqh9/owYWmrbZ home.feal.no"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH5M7hYl3saBNMAo6sczgfUvASEJWFHuERB7xvf4gxst nix-builder-voyager-worf"
];
shell = pkgs.zsh;
};
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
}

View File

@ -58,6 +58,11 @@
./hosts/edison/configuration.nix
sops-nix.nixosModules.sops
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users."felixalb" = import ./hosts/edison/home.nix;
}
];
};
chapel = nixpkgs.lib.nixosSystem {

36
home/base.nix Normal file
View File

@ -0,0 +1,36 @@
{ pkgs, ... }:
{
imports = [
./neovim.nix
./zsh.nix
];
programs.nix-index = {
enable = true;
enableZshIntegration = true;
};
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"
];
};
}

View File

@ -1,46 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./nvim.nix
];
home.username = "felixalb";
home.homeDirectory = "/home/felixalb";
home.stateVersion = "22.11";
programs = {
home-manager.enable = true;
alacritty = {
enable = true;
};
firefox.enable = true;
rofi.enable = true;
zsh = {
enable = true;
enableAutosuggestions = true;
enableSyntaxHighlighting = true;
prezto = {
enable = true;
prompt.theme = "paradox";
};
# initExtra = ''
# bindkey "''${key[Up]}" up-line-or-search
# bindkey "''${key[Down]}" down-line-or-search
# '';
};
git = {
enable = true;
userName = "Felix Albrigtsen";
userEmail = "felixalbrigtsen@gmail.com";
};
};
services = {
redshift = {
enable = true;
tray = true;
duskTime = "19:30-20:30";
dawnTime = "7:30-8:30";
};
};
}

View File

@ -1,69 +0,0 @@
{ pkgs, config, ... }
{
programs.neovim = {
enable = true;
vimAlias = true;
extraConfig = ''
set number " Show line numbers
set number relativenumber " Enable hybrid line numbers
set nu rnu
set signcolumn=number
set showmatch " Highlight matching brace
set errorbells " Beep or flash screen on errors
set hlsearch " Highlight all search results
set smartcase " Enable smart-case search
set incsearch " Searches for strings incrementally
set autoindent " Auto-indent new lines
set expandtab " Use spaces instead of tabs
set shiftwidth=2 " Number of auto-indent spaces
set smartindent " Enable smart-indent
set smarttab " Enable smart-tabs
set softtabstop=0 " Number of spaces per Tab, auto
set updatetime=300 " Time interval for updating buffers
set ruler " Show row and column ruler information
set undolevels=1000 " Number of undo levels
set backspace=indent,eol,start " Backspace behaviour
'';
plugins = with pkgs.vimPlugins; [
vim-nix
vim-commentary
vim-devicons
{ plugin = nerdtree;
config = "
nmap <silent> <C-t> :NERDTreeToggle<CR>
autocmd VimEnter * NERDTree \" Autostart nerdtree on vim startup
autocmd VimEnter * wincmd p \" Unselect nerdtree window
\" Close vim if Nerdtree is the only buffer left
autocmd bufenter * if (winnr(\"$\") == 1 && exists(\"b:NERDTree\") && b:NERDTree.isTabTree()) | q | endif
";
}
];
withNodeJs = true;
coc = {
enable = true;
settings = {
"suggest.enablePreview" = true;
"suggest.enablePreselect" = true;
};
package = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "coc.nvim";
version = "2022-05-21";
src = pkgs.fetchFromGitHub {
owner = "neoclide";
repo = "coc.nvim";
rev = "791c9f673b882768486450e73d8bda10e391401d";
sha256 = "sha256-MobgwhFQ1Ld7pFknsurSFAsN5v+vGbEFojTAYD/kI9c=";
};
meta.homepage = "https://github.com/neoclide/coc.nvim/";
};
};
};
}

View File

@ -43,7 +43,6 @@
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";

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" ];