feat(nixos): add initial NixOS configuration and hardware setup

This commit is contained in:
ada
2026-03-09 20:33:58 +03:00
parent dfdef1c493
commit ac5c59ee76
3 changed files with 221 additions and 0 deletions
+168
View File
@@ -0,0 +1,168 @@
{
config,
pkgs,
lib,
...
}:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Bootloader.
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
boot.loader.grub.useOSProber = true;
boot.kernelParams = [ "quiet" ];
boot.extraModulePackages = [ config.boot.kernelPackages.amneziawg ];
boot.kernelModules = [ "amneziawg" ];
programs.nix-ld.enable = true;
programs.nix-ld.libraries = with pkgs; [
stdenv.cc.cc
zlib
fuse3
icu
nss
openssl
curl
expat
];
networking.hostName = "nixos-vm";
networking.networkmanager.enable = true;
time.timeZone = "Europe/Moscow";
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "ru_RU.UTF-8";
LC_IDENTIFICATION = "ru_RU.UTF-8";
LC_MEASUREMENT = "ru_RU.UTF-8";
LC_MONETARY = "ru_RU.UTF-8";
LC_NAME = "ru_RU.UTF-8";
LC_NUMERIC = "ru_RU.UTF-8";
LC_PAPER = "ru_RU.UTF-8";
LC_TELEPHONE = "ru_RU.UTF-8";
LC_TIME = "ru_RU.UTF-8";
};
services.xserver.enable = true;
services.xserver.displayManager.sddm.enable = true;
services.xserver.displayManager.sddm.wayland.enable = true;
services.xserver.desktopManager.plasma5.enable = true;
environment.sessionVariables.NIXOS_OZONE_WL = "1";
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "";
};
# Enable CUPS to print documents.
services.printing.enable = true;
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.ada = {
isNormalUser = true;
description = "ada";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [
vim
neovim
code
jetbrains.idea-community
tmux
zsh
oh-my-zsh
fzf
ripgrep
fd
bat
eza
lsd
git
gh
lazygit
curl
wget
jq
nix-output-monitor
nvd
nix-tree
comma
htop
btop
tree
];
};
environment.systemPackages = with pkgs; [
vim
wget
git
curl
amneziawg-tools
nix-output-monitor
nvd
nix-tree
comma
htop
neofetch
];
nix = {
package = pkgs.nix;
settings = {
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
};
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
};
nixpkgs.config.allowUnfree = true;
programs.firefox.enable = true;
programs.amnezia-vpn.enable = true;
programs.mtr.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
services.openssh = {
enable = true;
settings = {
PasswordAuthentication = false;
PubkeyAuthentication = true;
};
};
# Open ports in the firewall.
networking.firewall.allowedTCPPorts = [ 22 ];
virtualisation.virtualbox.guest.enable = true;
virtualisation.virtualbox.guest.dragAndDrop = true;
virtualisation.virtualbox.guest.clipboard = true;
system.stateVersion = "25.05";
}
+23
View File
@@ -0,0 +1,23 @@
{
description = "NixOS Configuration Flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:nixos/nixos-hardware";
};
outputs = { self, nixpkgs, nixos-hardware }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in
{
nixosConfigurations.nixos-vm = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./nixos/configuration.nix
];
};
};
}
+30
View File
@@ -0,0 +1,30 @@
# 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 = [ ];
boot.initrd.availableKernelModules = [ "ata_piix" "ohci_pci" "ehci_pci" "ahci" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/2bb3bd25-1bc0-408f-945e-9150e4a10255";
fsType = "ext4";
};
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.enp0s3.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
virtualisation.virtualbox.guest.enable = true;
}