Install nh and friends, modularize nixos conf.

This commit is contained in:
CronyAkatsuki 2025-01-29 21:26:50 +01:00
parent ea86d38cd1
commit 5054b13564
14 changed files with 302 additions and 209 deletions

View file

@ -0,0 +1,108 @@
{
inputs,
pkgs,
...
}: {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
inputs.home-manager.nixosModules.home-manager
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Get nicer hostname
networking.hostName = "nixos"; # Define your hostname.
# Enable flakes
nix.settings.experimental-features = ["nix-command" "flakes"];
# Setup gpu
hardware.graphics = {
enable = true;
enable32Bit = true;
};
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/Zagreb";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "hr_HR.UTF-8";
LC_IDENTIFICATION = "hr_HR.UTF-8";
LC_MEASUREMENT = "hr_HR.UTF-8";
LC_MONETARY = "hr_HR.UTF-8";
LC_NAME = "hr_HR.UTF-8";
LC_NUMERIC = "hr_HR.UTF-8";
LC_PAPER = "hr_HR.UTF-8";
LC_TELEPHONE = "hr_HR.UTF-8";
LC_TIME = "hr_HR.UTF-8";
};
# Enable the X11 windowing system.
services.xserver.enable = true;
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "";
options = "caps:escape";
};
# Enable sound with pipewire.
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
# Define a user account. Don't forget to set a password with passwd.
users.users.crony = {
isNormalUser = true;
description = "Crony";
extraGroups = ["networkmanager" "wheel" "video" "input" "audio" "libvirtd"];
};
# Setup home manager
home-manager = {
extraSpecialArgs = {inherit inputs;};
backupFileExtension = "backup";
users = {
crony = import ./home.nix;
};
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile
environment.systemPackages = with pkgs; [
neovim
mangohud
];
# Enable nixd to see nixpkgs path
nix.nixPath = ["nixpkgs=${inputs.nixpkgs}"];
# Enable zram swap device
zramSwap.enable = true;
# Nfs share
fileSystems."/mnt/share" = {
device = "192.168.0.4:/mnt/nfs";
fsType = "nfs";
};
# DO NOT CHANGE
system.stateVersion = "24.11";
}

View file

@ -0,0 +1,43 @@
# 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 + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod"];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = [];
fileSystems."/" = {
device = "/dev/disk/by-uuid/0fbf752d-9234-42bd-9e04-8246de85e8d6";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/3156-31B6";
fsType = "vfat";
options = ["fmask=0077" "dmask=0077"];
};
swapDevices = [];
# 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.enp3s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

257
hosts/nixos/home.nix Normal file
View file

@ -0,0 +1,257 @@
{
config,
pkgs,
inputs,
...
}: {
imports = [inputs.nvf.homeManagerModules.default];
# Some info
home.username = "crony";
home.homeDirectory = "/home/crony";
# PACKAGES
home.packages = with pkgs; [
librewolf
thunderbird
qbittorrent
alejandra
keepassxc
restic
age
nh
nix-output-monitor
nvd
];
# Enable programs to get their themes
programs.foot.enable = true;
# Setup nice view for mangohud
programs.mangohud = {
enable = true;
settings = {
fps_limit = "0,30,60,120,144";
gpu_stats = true;
gpu_temp = true;
gpu_core_clock = true;
gpu_power = true;
gpu_text = "GPU";
gpu_load_change = true;
cpu_stats = true;
cpu_temps = true;
cpu_text = "CPU";
cpu_mhz = true;
cpu_load_change = true;
vram = true;
ram = true;
fps = true;
fps_sampling_period = "1000";
fps_color_change = true;
gpu_name = true;
vulka_driver = true;
round_corder = "10";
offset_x = "10";
offset_y = "10";
width = "250";
};
};
# Enable theming chromium + use ungoogled chromium package
programs.chromium = {
enable = true;
package = pkgs.ungoogled-chromium;
};
# Enable git
programs.git = {
enable = true;
userName = "Crony Akatsuki";
userEmail = "crony@cronyakatsuki.xyz";
};
# Setup neovim
programs.nvf = {
enable = true;
settings = {
vim = {
# Enable the aliases, I love them
viAlias = true;
vimAlias = true;
# Changing some basic settings
options = {
tabstop = 2;
shiftwidth = 2;
updatetime = 50;
};
# Enable the undo file
undoFile = {
enable = true;
};
binds = {
# Setup whichkey
whichKey.enable = true;
};
# Enable gitsings
git.gitsigns = {
enable = true;
};
# Enable lsp
lsp = {
enable = true;
lspkind.enable = true;
};
# Setup the theme
theme = {
enable = true;
name = "gruvbox";
style = "dark";
};
# Setup lsp's and languages
languages = {
enableLSP = true;
enableTreesitter = true;
enableFormat = true;
nix = {
enable = true;
};
bash.enable = true;
go.enable = true;
markdown = {
enable = true;
extensions.render-markdown-nvim.enable = true;
};
};
# Enable mini modules ( mini is amazing )
mini = {
statusline.enable = true;
comment.enable = true;
notify.enable = true;
surround.enable = true;
diff.enable = true;
pairs.enable = true;
indentscope.enable = true;
bufremove.enable = true;
git.enable = true;
};
# Use telescope
telescope.enable = true;
# Enable autocompletion
autocomplete.nvim-cmp = {
enable = true;
mappings = {
close = null;
complete = null;
confirm = "<C-l>";
next = "<C-j>";
previous = "<C-k>";
};
};
};
};
};
# Enable syncthing
services.syncthing.enable = true;
# Setup zsh
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
historySubstringSearch.enable = true;
dotDir = ".config/zsh";
initExtra = ''
# VI Mode escape timeout fix
export KEYTIMEOUT=1
# Substring search settings
export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND="bg=blue,fg=black,bold"
export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=black,bold'
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
'';
zplug = {
enable = true;
plugins = [
{name = "zap-zsh/supercharge";}
{name = "zap-zsh/completions";}
{name = "zap-zsh/vim";}
{name = "chivalryq/git-alias";}
{name = "zdharma-continuum/fast-syntax-highlighting";}
{name = "zsh-users/zsh-history-substring-search";}
{name = "MichaelAquilina/zsh-you-should-use";}
];
};
};
# Install fzf
programs.fzf = {
enable = true;
enableZshIntegration = true;
};
# Install starship
programs.starship = {
enable = true;
enableZshIntegration = true;
settings = {
add_newline = false;
};
};
# Install zoxide
programs.zoxide = {
enable = true;
enableZshIntegration = true;
};
# Install eza
programs.eza = {
enable = true;
enableZshIntegration = true;
git = true;
icons = true;
};
# Install direnv
programs.direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};
# Default environmental variables
home.sessionVariables = {
EDITOR = "nvim";
FLAKE = "/home/crony/Repos/nixos";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# Fix gtkrc-2.0 collision
home.file."/home/crony/.gtkrc-2.0".force = true;
# DO NOT CHANGE ALSO
home.stateVersion = "24.11"; # Please read the comment before changing.
}