initial setup with impermanence

This commit is contained in:
2025-06-07 16:05:38 +03:00
commit 86b4fcd2fc
19 changed files with 700 additions and 0 deletions
+64
View File
@@ -0,0 +1,64 @@
# 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" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
boot.kernelPackages = pkgs.linuxPackages_zen;
fileSystems."/" =
{ #device = "/dev/disk/by-uuid/3126fadd-b793-4110-bcb7-577b7978cba2";
#fsType = "btrfs";
#options = [ "subvol=@nixos" ];
device = "none";
fsType = "tmpfs";
options = [ "defaults" "size=1G" "mode=755" ];
};
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/3126fadd-b793-4110-bcb7-577b7978cba2";
fsType = "btrfs";
options = [ "subvol=@nix" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/595C-784B";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
fileSystems."/home/yaroslav" =
{ device = "none";
fsType = "tmpfs";
options = [ "defaults" "size=1G" "uid=1000" "gid=100" ];
};
fileSystems."/vol/Trash" = {
device = "/dev/mapper/yarikpc-trash";
fsType = "ext4";
options = [ "defaults" "size=1G" "uid=1000" "gid=100" ];
};
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.docker0.useDHCP = lib.mkDefault true;
# networking.interfaces.enp9s0.useDHCP = lib.mkDefault true;
# networking.interfaces.lxdbr0.useDHCP = lib.mkDefault true;
# networking.interfaces.veth9787cb37.useDHCP = lib.mkDefault true;
# networking.interfaces.virbr0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
networking.hostName = "Aphelion";
}
+17
View File
@@ -0,0 +1,17 @@
{ config, lib, ... }:
{
nixpkgs.config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) [
"nvidia-x11"
"nvidia-settings"
];
boot.initrd.kernelModules = [ "nvidia" ];
hardware.graphics.enable = true;
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = true;
open = true;
nvidiaSettings = true;
};
}
+55
View File
@@ -0,0 +1,55 @@
# 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" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "none";
fsType = "tmpfs";
options = ["defaults" "size=1G" "mode=755"];
};
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/067a8472-18d0-49d4-961d-dbe07d8cc1a7";
fsType = "btrfs";
options = [ "subvol=@nix" "compress=zstd"];
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/067a8472-18d0-49d4-961d-dbe07d8cc1a7";
fsType = "btrfs";
options = [ "subvol=@home" "compress=zstd"];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/67E3-17ED";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
fileSystems."/home/yaroslav/tmp" =
{
device = "nome";
fsType = "tmpfs";
};
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.wlp1s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
+35
View File
@@ -0,0 +1,35 @@
{ config, lib, pkgs, ... }:
{
nix.settings.experimental-features = [ "nix-command" "flakes"];
# loader setup
boot.loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
# timezone
time.timeZone = "Europe/Moscow";
programs.zsh.enable = true;
environment.systemPackages = with pkgs; [
git
wget
];
programs.neovim = {
enable = true;
defaultEditor = true;
};
services.openssh.enable = true;
# networking
networking.networkmanager.enable = true;
networking.firewall.allowedTCPPorts = [ 22 ];
networking.nftables.enable = true;
# locales
i18n.extraLocales = [ "en_US.UTF-8/UTF-8" "C.UTF-8/UTF-8" "ru_RU.UTF-8/UTF-8" ];
}
+23
View File
@@ -0,0 +1,23 @@
{ config, pkgs, ... }:
{
environment.persistence."/nix/persist" = {
hideMounts = true;
directories = [
"/var/log"
"/var/lib/bluetooth"
"/var/lib/nixos"
"/var/lib/systemd/coredump"
"/var/lib/systemd/timers"
"/etc/NetworkManager"
"/var/lib/sddm"
"/etc/ssh"
"/etc/nixos"
"/var/lib/incus"
{ directory = "/var/lib/colord"; user = "colord"; group = "colord"; mode = "u=rwx,g=rx,o="; }
];
files = [
"/etc/machine-id"
{ file = "/var/keys/secret_file"; parentDirectory = { mode = "u=rwx,g=,o="; }; }
];
};
}
+13
View File
@@ -0,0 +1,13 @@
{ config, pkgs, ... }:
{
users.users.yaroslav = {
isNormalUser = true;
extraGroups = [ "wheel" "incus-admin" "networkmanager" "libvirtd" ]; # Enable sudo for the user.
shell = pkgs.zsh;
packages = with pkgs; [
tree
];
initialHashedPassword = "$6$.r5fJE91KtrOA2T.$JVjtzlFWx.RsTsNmO5WOsi1MhK6TUTKo8K5F2GgG.bAXYuYjGu4sK3SMzhk4oJ9FBoAcnyHmk7sLMsgLbUeoE1";
};
}
+28
View File
@@ -0,0 +1,28 @@
{ pkgs, config, lib, ... }:
{
environment = {
systemPackages = [ pkgs.qemu ];
};
systemd.tmpfiles.rules = [ "L+ /var/lib/qemu/firmware - - - - ${pkgs.qemu}/share/qemu/firmware" ];
boot.binfmt.emulatedSystems = [
"aarch64-linux"
"riscv64-linux"
];
virtualisation.libvirtd = {
enable = true;
qemu = {
package = pkgs.qemu_kvm;
runAsRoot = true;
swtpm.enable = true;
ovmf = {
enable = true;
packages = [(pkgs.OVMF.override {
secureBoot = true;
tpmSupport = true;
}).fd];
};
};
};
boot.extraModprobeConfig = "options kvm_amd nested=1";
}