Change host folder name to match hostName, update flake.lock

This commit is contained in:
Théo Barnouin 2024-09-13 10:36:37 +02:00
parent 9d1ece672f
commit 1d792a7329
4 changed files with 245 additions and 3 deletions

View file

@ -0,0 +1,105 @@
{ config, lib, pkgs, ... }:
{ imports = [ ./hardware-configuration.nix ];
nix = {
settings = {
experimental-features = [ "nix-command" "flakes" ];
trusted-users = [ "@wheel" ];
auto-optimise-store = true;
};
gc = {
automatic = true;
dates = "daily";
options = "--delete older-than 3d";
};
};
security.sudo.wheelNeedsPassword = false;
networking= {
useNetworkd = true;
firewall.allowedTCPPorts = [ 22 ];
};
systemd.network = {
enable = true;
netdevs."br0" = {
netdevConfig = {
Name = "br0";
Kind = "bridge";
};
};
networks = {
"10-lan" = {
matchConfig.Name = ["enp1s0" "vm-*"];
networkConfig = {
Bridge = "br0";
};
};
"10-lan-bridge" = {
matchConfig.Name = "br0";
networkConfig = {
Address = ["192.168.1.66/24"];
Gateway = "192.168.1.254";
DNS = ["192.168.1.254"];
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";
};
};
system.stateVersion = "24.05"; # Did you read the comment?
}

View file

@ -0,0 +1,49 @@
{ lib, system, ... }:
{
boot = {
# use latest kernel
# kernelPackages = pkgs.linuxPackages_latest;
supportedFilesystems = [ "ext4" "btrfs" "xfs" "fat" "vfat" "cifs" "nfs" ];
growPartition = true;
kernelModules = [ "kvm-intel" ];
kernelParams = lib.mkForce [ ];
loader = {
grub = {
enable = true;
device = "nodev";
efiSupport = true;
efiInstallAsRemovable = true;
};
timeout = lib.mkForce 3;
};
initrd = {
availableKernelModules = [ "9p" "9pnet_virtio" "ata_piix" "uhci_hcd" "virtio_blk" "virtio_mmio" "virtio_net" "virtio_pci" "virtio_scsi" ];
kernelModules = [ "virtio_balloon" "virtio_console" "virtio_rng" ];
};
tmp.cleanOnBoot = true;
};
fileSystems = {
"/" = {
device = "/dev/disk/by-label/nixos";
autoResize = true;
fsType = "ext4";
};
"/boot" = {
device = "/dev/disk/by-label/ESP";
fsType = "vfat";
};
};
services.fstrim = {
enable = true;
interval = "weekly";
};
nixpkgs.hostPlatform = lib.mkDefault system;
}

View file

@ -0,0 +1,97 @@
{ 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
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";
};
oh-my-zsh = {
enable = true;
plugins =
[
"git"
"terraform"
"sudo"
"docker"
"pip"
"python"
"pyenv"
"pipenv"
];
theme = "bira";
};
};
tmux = {
enable = true;
mouse = true;
};
};
}