Nix : Use modules.

This commit is contained in:
Dmitry Voronin 2024-01-24 21:04:59 +03:00
parent d43eb4e37d
commit 0c0923a977
12 changed files with 180 additions and 131 deletions

View file

@ -0,0 +1,9 @@
{ ... }:
{
boot.initrd.kernelModules = [ "amdgpu" ];
services.xserver.videoDrivers = [ "amdgpu" ];
hardware.opengl.extraPackages = with pkgs; [
amdvlk
];
}

View file

@ -0,0 +1,64 @@
# Help: man configuration.nix or https://nixos.org/nixos/options.html
{ config, pkgs, ... }:
{
# System packages.
environment.systemPackages = with pkgs; [
android-tools
appimage-run
binwalk
btop
ddrescue
git
jdk11
jdk19
lm_sensors
lshw
gnumake
lsof
ncdu
neovim
nmap
parallel
pv
ripgrep
scanmem
smartmontools
steam-run
sqlite
testdisk
tmux
virt-manager
wget
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Network.
networking.networkmanager.enable = true;
# Firewall.
networking.firewall.enable = false;
# Locale.
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";
};
# Nix.
nixpkgs.config.allowUnfree = true;
nix.settings.auto-optimise-store = true;
}

View file

@ -0,0 +1,5 @@
{ ... }:
{
virtualisation.docker.enable = true;
}

View file

@ -0,0 +1,9 @@
{ ... }:
{
virtualisation.docker.enable = true;
virtualisation.docker.rootless = {
enable = true;
setSocketVariable = true;
};
}

View file

@ -0,0 +1,5 @@
{ ... }:
{
services.flatpak.enable = true;
}

View file

@ -0,0 +1,23 @@
{ ... }:
{
# GUI.
services.xserver.enable = true;
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
services.xserver = {
layout = "us";
xkbVariant = "";
};
# Sound.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
}

View file

@ -0,0 +1,15 @@
{ pkgs, ... }:
{
systemd.services.powersave = {
enable = true;
description = "AMD Disable Boost";
serviceConfig = {
Type = "simple";
RemainAfterExit = "yes";
ExecStart = "${pkgs.bash}/bin/bash -c 'echo 0 > /sys/devices/system/cpu/cpufreq/boost'";
ExecStop = "${pkgs.bash}/bin/bash -c 'echo 1 > /sys/devices/system/cpu/cpufreq/boost'";
};
wantedBy = [ "multi-user.target" ];
};
}

View file

@ -0,0 +1,15 @@
{ pkgs, ... }:
{
systemd.services.powersave = {
enable = true;
description = "Intel Disable Boost";
serviceConfig = {
Type = "simple";
RemainAfterExit = "yes";
ExecStart = "${pkgs.bash}/bin/bash -c 'echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo'";
ExecStop = "${pkgs.bash}/bin/bash -c 'echo 0 > /sys/devices/system/cpu/intel_pstate/no_turbo'";
};
wantedBy = [ "multi-user.target" ];
};
}

View file

@ -0,0 +1,11 @@
{ ... }:
{
services.printing = {
enable = true;
clientConf = ''
DigestOptions DenyMD5
ServerName 192.168.1.2
'';
};
}

View file

@ -0,0 +1,5 @@
{ ... }:
{
services.openssh.enable = true;
}

View file

@ -0,0 +1,12 @@
{ ... }:
{
users.users.voronind = {
isNormalUser = true;
description = "Dmitry Voronin";
extraGroups = [ "networkmanager" ];
packages = with pkgs; [
gnome.gnome-tweaks
];
};
}

View file

@ -1,134 +1,20 @@
{ config, pkgs, ... }:
# Help: man configuration.nix or https://nixos.org/nixos/options.html
{
imports = [
./hardware-configuration.nix
../Common.nix
../PowersaveAmd.nix
../Print.nix
../Gnome.nix
../Voronind.nix
../Flatpak.nix
../DockerRootless.nix
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.initrd.kernelModules = [ "amdgpu" ];
# Network.
networking.networkmanager.enable = true;
networking.hostName = "desktop";
# Locale.
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";
};
# GUI.
services.xserver.enable = true;
services.xserver.videoDrivers = [ "amdgpu" ];
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
services.xserver = {
layout = "us";
xkbVariant = "";
};
hardware.opengl.extraPackages = with pkgs; [
amdvlk
];
# Printing.
services.printing = {
enable = true;
clientConf = ''
DigestOptions DenyMD5
ServerName 192.168.1.2
'';
};
# Sound.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
# User.
users.users.voronind = {
isNormalUser = true;
description = "Dmitry Voronin";
extraGroups = [ "networkmanager" ];
packages = with pkgs; [
gnome.gnome-tweaks
];
};
# Flatpak.
services.flatpak.enable = true;
# System packages.
environment.systemPackages = with pkgs; [
android-tools
appimage-run
binwalk
btop
ddrescue
git
jdk11
jdk19
lm_sensors
lshw
gnumake
lsof
ncdu
neovim
nmap
parallel
pv
ripgrep
scanmem
smartmontools
steam-run
sqlite
testdisk
tmux
virt-manager
wget
];
# Docker.
virtualisation.docker.enable = true;
# users.extraGroups.docker.members = [ "voronind" ];
virtualisation.docker.rootless = {
enable = true;
setSocketVariable = true;
};
# Systemd.
systemd.services.powersave = {
enable = true;
description = "AMD Disable Boost";
unitConfig = {
Type = "simple";
};
serviceConfig = {
RemainAfterExit = "yes";
ExecStart = "${pkgs.bash}/bin/bash -c 'echo 0 > /sys/devices/system/cpu/cpufreq/boost'";
ExecStop = "${pkgs.bash}/bin/bash -c 'echo 1 > /sys/devices/system/cpu/cpufreq/boost'";
};
wantedBy = [ "multi-user.target" ];
};
# Filesystems.
fileSystems."/storage/hot" = {
device = "/dev/storage/hot";
@ -148,16 +34,6 @@
options = [ "noauto" "nofail" ];
};
# Openssh server.
services.openssh.enable = false;
# Firewall.
networking.firewall.enable = false;
# Nix.
nixpkgs.config.allowUnfree = true;
nix.settings.auto-optimise-store = true;
# Do not touch ever.
system.stateVersion = "23.11";
}