Nix : Use modules.
This commit is contained in:
parent
d43eb4e37d
commit
0c0923a977
9
.config/linux/nix/AmdGpu.nix
Normal file
9
.config/linux/nix/AmdGpu.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
boot.initrd.kernelModules = [ "amdgpu" ];
|
||||
services.xserver.videoDrivers = [ "amdgpu" ];
|
||||
hardware.opengl.extraPackages = with pkgs; [
|
||||
amdvlk
|
||||
];
|
||||
}
|
64
.config/linux/nix/Common.nix
Normal file
64
.config/linux/nix/Common.nix
Normal 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;
|
||||
}
|
5
.config/linux/nix/Docker.nix
Normal file
5
.config/linux/nix/Docker.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
virtualisation.docker.enable = true;
|
||||
}
|
9
.config/linux/nix/DockerRootless.nix
Normal file
9
.config/linux/nix/DockerRootless.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
virtualisation.docker.enable = true;
|
||||
virtualisation.docker.rootless = {
|
||||
enable = true;
|
||||
setSocketVariable = true;
|
||||
};
|
||||
}
|
5
.config/linux/nix/Flatpak.nix
Normal file
5
.config/linux/nix/Flatpak.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
services.flatpak.enable = true;
|
||||
}
|
23
.config/linux/nix/Gnome.nix
Normal file
23
.config/linux/nix/Gnome.nix
Normal 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;
|
||||
};
|
||||
}
|
15
.config/linux/nix/PowersaveAmd.nix
Normal file
15
.config/linux/nix/PowersaveAmd.nix
Normal 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" ];
|
||||
};
|
||||
}
|
15
.config/linux/nix/PowersaveIntel.nix
Normal file
15
.config/linux/nix/PowersaveIntel.nix
Normal 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" ];
|
||||
};
|
||||
}
|
11
.config/linux/nix/Print.nix
Normal file
11
.config/linux/nix/Print.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
services.printing = {
|
||||
enable = true;
|
||||
clientConf = ''
|
||||
DigestOptions DenyMD5
|
||||
ServerName 192.168.1.2
|
||||
'';
|
||||
};
|
||||
}
|
5
.config/linux/nix/Sshd.nix
Normal file
5
.config/linux/nix/Sshd.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
services.openssh.enable = true;
|
||||
}
|
12
.config/linux/nix/Voronind.nix
Normal file
12
.config/linux/nix/Voronind.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
users.users.voronind = {
|
||||
isNormalUser = true;
|
||||
description = "Dmitry Voronin";
|
||||
extraGroups = [ "networkmanager" ];
|
||||
packages = with pkgs; [
|
||||
gnome.gnome-tweaks
|
||||
];
|
||||
};
|
||||
}
|
|
@ -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";
|
||||
}
|
||||
|
|
Reference in a new issue