Try to separate hosts
This commit is contained in:
parent
ff8a4d23a9
commit
38fba61f9c
4 changed files with 2 additions and 2 deletions
102
hosts/nixos/configuration.nix
Normal file
102
hosts/nixos/configuration.nix
Normal file
|
@ -0,0 +1,102 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{ imports =
|
||||
[ # Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
nix.settings = {
|
||||
experimental-features = [ "nix-command" "flakes" ];
|
||||
trusted-users = [ "@wheel" ];
|
||||
};
|
||||
|
||||
boot.loader.grub.enable = true;
|
||||
boot.loader.grub.device = "/dev/vda"; # or "nodev" for efi only
|
||||
boot.kernel.sysctl."vm.swapiness" = 1;
|
||||
|
||||
networking.useNetworkd = true;
|
||||
|
||||
systemd.network.enable = true;
|
||||
systemd.network.networks."10-lan" = {
|
||||
matchConfig.Name = ["enp1s0" "vm-*"];
|
||||
networkConfig = {
|
||||
Bridge = "br0";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.network.netdevs."br0" = {
|
||||
netdevConfig = {
|
||||
Name = "br0";
|
||||
Kind = "bridge";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.network.networks."10-lan-bridge" = {
|
||||
matchConfig.Name = "br0";
|
||||
networkConfig = {
|
||||
Address = ["192.168.122.31/24"];
|
||||
Gateway = "192.168.122.1";
|
||||
DNS = ["192.168.122.1"];
|
||||
IPv6AcceptRA = true;
|
||||
};
|
||||
linkConfig.RequiredForOnline = "routable";
|
||||
};
|
||||
|
||||
time.timeZone = "Europe/Paris";
|
||||
i18n.defaultLocale = "fr_FR.UTF-8"; console = {
|
||||
useXkbConfig = true; # use xkb.options in tty.
|
||||
};
|
||||
|
||||
users.users = {
|
||||
tbarnouin = {
|
||||
isNormalUser = true;
|
||||
description = "Théo Barnouin";
|
||||
extraGroups = [
|
||||
"networkmanager"
|
||||
"wheel"
|
||||
"libvirtd"
|
||||
"docker"
|
||||
"render"
|
||||
"video"
|
||||
];
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAxccGxdfOFXeEClqz3ULl94ubzaJnk4pUus+ek18G0B tbarnouin@nixos"
|
||||
];
|
||||
};
|
||||
root = {
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAxccGxdfOFXeEClqz3ULl94ubzaJnk4pUus+ek18G0B tbarnouin@nixos"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim
|
||||
htop
|
||||
wget
|
||||
curl
|
||||
git
|
||||
neofetch
|
||||
libvirt
|
||||
qemu_kvm
|
||||
nmap
|
||||
];
|
||||
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
PasswordAuthentication = false;
|
||||
X11Forwarding = false;
|
||||
PermitRootLogin = "prohibit-password";
|
||||
};
|
||||
};
|
||||
|
||||
# Open ports in the firewall.
|
||||
networking.firewall.allowedTCPPorts = [ 22 ];
|
||||
#networking.firewall.allowedUDPPorts = [ ... ];
|
||||
# Or disable the firewall altogether. networking.firewall.enable = false;
|
||||
|
||||
system.stateVersion = "24.05"; # Did you read the comment?
|
||||
|
||||
}
|
||||
|
33
hosts/nixos/hardware-configuration.nix
Normal file
33
hosts/nixos/hardware-configuration.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/profiles/qemu-guest.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/cd191c1d-d2d7-44ae-8a9a-75ad7d8228a4";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
swapDevices =
|
||||
[ { device = "/dev/disk/by-uuid/335e1191-f20f-4afc-bc2b-b156cf8dc2c2"; }
|
||||
];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
# still possible to use this option, but it's recommended to use it in conjunction
|
||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
}
|
116
hosts/nixos/home.nix
Normal file
116
hosts/nixos/home.nix
Normal file
|
@ -0,0 +1,116 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
home = {
|
||||
username = "tbarnouin";
|
||||
stateVersion = "24.05";
|
||||
sessionPath = [
|
||||
"$HOME/.local/bin"
|
||||
];
|
||||
file.".ssh/authorized_keys".text = ''
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAxccGxdfOFXeEClqz3ULl94ubzaJnk4pUus+ek18G0B tbarnouin@nixos
|
||||
'';
|
||||
};
|
||||
programs = {
|
||||
git = {
|
||||
enable = true;
|
||||
};
|
||||
vim = {
|
||||
enable = true;
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
vim-airline
|
||||
vim-airline-themes
|
||||
vim-bufferline
|
||||
vim-markdown
|
||||
markdown-preview-nvim
|
||||
tabular
|
||||
];
|
||||
settings = {
|
||||
expandtab = true;
|
||||
ignorecase = true;
|
||||
smartcase = true;
|
||||
number = true;
|
||||
shiftwidth = 2;
|
||||
tabstop = 2;
|
||||
};
|
||||
extraConfig = ''
|
||||
set nocompatible
|
||||
filetype on
|
||||
filetype plugin on
|
||||
filetype indent on
|
||||
syntax on
|
||||
set nobackup
|
||||
set showcmd
|
||||
set showmode
|
||||
set showmatch
|
||||
set hlsearch
|
||||
set wrap
|
||||
set linebreak
|
||||
set textwidth=0
|
||||
set wrapmargin=0
|
||||
set scrolloff=15
|
||||
|
||||
highlight ExtraWhitespace ctermbg=red guibg=red
|
||||
autocmd BufWritePre * :%s/\s\+$//e
|
||||
|
||||
inoremap " ""<left>
|
||||
inoremap \' \'\'<left>
|
||||
inoremap ( ()<left>
|
||||
inoremap [ []<left>
|
||||
inoremap { {}<left>
|
||||
|
||||
let g:vim_markdown_folding_disabled = 1
|
||||
let g:mkdp_auto_start = 1
|
||||
let g:mkdp_auto_close = 1
|
||||
let g:airline_theme='molokai'
|
||||
'';
|
||||
};
|
||||
zsh = {
|
||||
enable = true;
|
||||
shellAliases = {
|
||||
ll = "ls -l";
|
||||
lla = "ls -lah";
|
||||
terraform = "tofu";
|
||||
# Nixos
|
||||
update = "sudo nixos-rebuild switch";
|
||||
upgrade = "sudo nix-channel --update && sudo nixos-rebuild switch --upgrade";
|
||||
# Kitty
|
||||
#ssh = "kitten ssh";
|
||||
icat = "kitten icat";
|
||||
};
|
||||
oh-my-zsh = {
|
||||
enable = true;
|
||||
plugins =
|
||||
[
|
||||
"git"
|
||||
"terraform"
|
||||
"sudo"
|
||||
"docker"
|
||||
"pip"
|
||||
"python"
|
||||
"pyenv"
|
||||
"pipenv"
|
||||
];
|
||||
theme = "bira";
|
||||
};
|
||||
initExtra = ''
|
||||
export MAMBA_EXE="/etc/profiles/per-user/tbarnouin/bin/micromamba";
|
||||
export MAMBA_ROOT_PREFIX="/home/tbarnouin/micromamba";
|
||||
__mamba_setup="$("$MAMBA_EXE" shell hook --shell zsh --prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)"
|
||||
if [ $? -eq 0 ]; then
|
||||
eval "$__mamba_setup"
|
||||
else
|
||||
if [ -f "/home/tbarnouin/micromamba/etc/profile.d/micromamba.sh" ]; then
|
||||
. "/home/tbarnouin/micromamba/etc/profile.d/micromamba.sh"
|
||||
else
|
||||
export PATH="/home/tbarnouin/micromamba/bin:$PATH"
|
||||
fi
|
||||
fi
|
||||
unset __mamba_setup
|
||||
'';
|
||||
};
|
||||
tmux = {
|
||||
enable = true;
|
||||
mouse = true;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue