refactor(flake)!: machines -> hosts

This commit is contained in:
reo101 2024-07-27 13:04:48 +03:00
parent 703cd0264b
commit a881c5d7e1
Signed by: reo101
GPG key ID: 675AA7EF13964ACB
33 changed files with 52 additions and 45 deletions

View file

@ -0,0 +1,248 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ inputs, outputs, lib, pkgs, config, ... }:
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
];
### Set boot options
boot = {
# Use the systemd-boot boot loader.
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
# Enable running aarch64 binaries using qemu
binfmt = {
emulatedSystems = [
"aarch64-linux"
"wasm32-wasi"
"x86_64-windows"
];
};
# Clean temporary directory on boot
tmp = {
cleanOnBoot = true;
};
# Enable support for nfs and ntfs
supportedFilesystems = [
"cifs"
"ntfs"
"nfs"
];
};
networking.hostName = "homix"; # Define your hostname.
### Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
### Set your time zone.
time.timeZone = "Europe/Sofia";
### Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
### Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# useXkbConfig = true; # use xkbOptions in tty.
# };
nix = {
package = pkgs.nixVersions.stable;
# Enable flakes, the new `nix` commands and better support for flakes in it
extraOptions = ''
experimental-features = nix-command flakes
'';
# This will add each flake input as a registry
# To make nix3 commands consistent with your flake
registry = lib.mapAttrs (_: value: { flake = value; }) inputs;
# This will additionally add your inputs to the system's legacy channels
# Making legacy nix commands consistent as well, awesome!
nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry;
settings = {
trusted-users = [
"root"
"reo101"
];
# Add nix-community and rix101 cachix caches
substituters = [
"https://rix101.cachix.org"
"https://nix-community.cachix.org"
];
trusted-public-keys = [
"rix101.cachix.org-1:2u9ZGi93zY3hJXQyoHkNBZpJK+GiXQyYf9J5TLzCpFY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
};
### Fonts
fonts.fontconfig.enable = true;
### NVIDIA
services.xserver = {
videoDrivers = [ "nvidia" ];
};
hardware.graphics.enable = true;
hardware.nvidia = {
open = true;
# powerManagement.enable = true;
modesetting.enable = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
# package = config.boot.kernelPackages.nvidiaPackages.beta;
};
environment.sessionVariables = {
"_JAVA_AWT_WM_NONREPARENTING" = "1";
"LIBVA_DRIVER_NAME" = "nvidia";
"XDG_SESSION_TYPE" = "wayland";
"GBM_BACKEND" = "nvidia-drm";
"__GLX_VENDOR_LIBRARY_NAME" = "nvidia";
"WLR_NO_HARDWARE_CURSORS" = "1";
"MOZ_DISABLE_RDD_SANDBOX" = "1";
"MOZ_ENABLE_WAYLAND" = "1";
"EGL_PLATFORM" = "wayland";
"XDG_CURRENT_DESKTOP" = "sway"; # river
"XKB_DEFAULT_LAYOUT" = "us,bg";
"XKB_DEFAULT_VARIANT" = ",phonetic";
"XKB_DEFAULT_OPTIONS" = "caps:escape,grp:lalt_lshift_toggle";
# "WLR_RENDERER" = "vulkan"; # BUG: river crashes
};
### Wayland specific
services.xserver = {
enable = true;
displayManager = {
defaultSession = "river";
sessionPackages = with pkgs; [
river
];
gdm = {
enable = true;
wayland = true;
};
};
};
# Enable desktop portal
xdg.portal = {
enable = true;
wlr = {
enable = true;
};
extraPortals = [
pkgs.xdg-desktop-portal-gtk
pkgs.xdg-desktop-portal-wlr
];
# TODO: research <https://github.com/flatpak/xdg-desktop-portal/blob/1.18.1/doc/portals.conf.rst.in>
config.common.default = "*";
};
## X11 specific
services.xserver = {
layout = "us,bg";
xkbVariant = ",phonetic";
xkbOptions = "grp:lalt_lshift_toggle";
};
### Enable the OpenSSH daemon.
services.openssh.enable = true;
### Enable CUPS to print documents.
# services.printing.enable = true;
### Enable sound.
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
pulse = {
enable = true;
};
jack = {
enable = true;
};
};
services.dbus = {
enable = true;
packages = [ pkgs.dconf ];
};
### Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Virtualisation
virtualisation.docker.enable = true;
### Define a user account. Don't forget to set a password with `passwd`.
users.users.reo101 = {
isNormalUser = true;
shell = pkgs.zsh;
extraGroups = [ "wheel" "docker" ];
};
programs.zsh = {
enable = true;
};
### Enable plymouth (bootscreen customizations)
boot.plymouth = {
enable = true;
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
river
xdg-desktop-portal
xdg-desktop-portal-wlr
neovim
wget
git
];
### Jellyfin
reo101.jellyfin = {
enable = true;
};
### Transmission
services.transmission = {
enable = true;
};
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.11"; # Did you read the comment?
}

View file

@ -0,0 +1,40 @@
# 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.
{ lib, pkgs, config, 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/7f720420-41d8-4efd-bdf2-f445e52db998";
fsType = "ext4";
};
fileSystems."/boot" =
{
device = "/dev/disk/by-uuid/5BF4-74EF";
fsType = "vfat";
};
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.eno1.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -0,0 +1,124 @@
{ inputs, outputs, lib, pkgs, config, ... }:
{
imports = [
inputs.wired.homeManagerModules.default
];
home = {
username = "reo101";
homeDirectory = "/home/reo101";
stateVersion = "22.11";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
home.packages = with pkgs; [
## WM
# river
# swww # wallpaper deamon
# # wired-notify # dunst on wayland
# waybar # status bar
# xwayland
# wl-clipboard
# slurp # select regions from wayland
# grim # grap images from regions
# playerctl # music control
## Terminals
# wezterm
foot
## Core
neovim
fennel-language-server
git
gnupg
firefox
discord
armcord # modded discord
vifm # file editor
pciutils # lspci
usbutils # lsusb
(uutils-coreutils.override { prefix = ""; }) # coreutils in rust
## Shell
# zsh
# starship
# zoxide
ripgrep
## Dhall
dhall
# dhall-lsp-server
## Nix
nil
direnv
## Torrents
tremc
## Rust
rustc
cargo
rust-analyzer
clang
openssl
pkg-config
## Vim FMI
vim-fmi-cli
## Zig
# zigpkgs."0.10.1"
zigpkgs.master
# inputs.zls-overlay.packages.x86_64-linux.default
];
# Enable the GPG Agent daemon.
services.gpg-agent = {
enable = true;
defaultCacheTtl = 1800;
enableSshSupport = true;
};
programs.git = {
enable = true;
userName = "reo101";
userEmail = "pavel.atanasov2001@gmail.com";
};
reo101 = {
shell = {
enable = true;
direnv = true;
zoxide = true;
};
river = {
enable = true;
};
wezterm = {
enable = true;
};
};
home.file = {
".config/nvim" = {
source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.local/src/reovim";
};
};
# home.file.".stack/config.yaml".text = lib.generators.toYAML {} {
# templates = {
# scm-init = "git";
# params = with config.programs.git; {
# author-name = userName;
# author-email = userEmail;
# github-username = userName;
# };
# };
# nix.enable = true;
# };
}