refac: add more modules for system
This commit is contained in:
parent
7903732c09
commit
19dccaf985
11 changed files with 183 additions and 175 deletions
|
@ -7,7 +7,12 @@ in
|
||||||
imports = [
|
imports = [
|
||||||
# Include the results of the hardware scan.
|
# Include the results of the hardware scan.
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
../common.nix
|
../modules/common.nix
|
||||||
|
../modules/sound.nix
|
||||||
|
../modules/window_manager.nix
|
||||||
|
../modules/fonts.nix
|
||||||
|
../modules/gnupg.nix
|
||||||
|
../modules/nix.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# Use latest kernel
|
# Use latest kernel
|
||||||
|
@ -23,10 +28,13 @@ in
|
||||||
hostName = "laptop"; # Define your hostname.
|
hostName = "laptop"; # Define your hostname.
|
||||||
inherit (secrets.networking) extraHosts;
|
inherit (secrets.networking) extraHosts;
|
||||||
|
|
||||||
|
useDHCP = false;
|
||||||
interfaces = {
|
interfaces = {
|
||||||
enp3s0.useDHCP = true;
|
enp3s0.useDHCP = true;
|
||||||
wlp2s0.useDHCP = true;
|
wlp2s0.useDHCP = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
networkmanager.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# enable bluetooth
|
# enable bluetooth
|
||||||
|
@ -36,12 +44,12 @@ in
|
||||||
# configure mouse and touchpad
|
# configure mouse and touchpad
|
||||||
services.xserver.libinput = {
|
services.xserver.libinput = {
|
||||||
enable = true;
|
enable = true;
|
||||||
mouse = {
|
|
||||||
accelSpeed = "1.0";
|
|
||||||
};
|
|
||||||
touchpad = {
|
touchpad = {
|
||||||
accelSpeed = "0.5";
|
accelSpeed = "0.5";
|
||||||
disableWhileTyping = true;
|
disableWhileTyping = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Enable the Docker
|
||||||
|
virtualisation.docker.enable = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,160 +0,0 @@
|
||||||
# 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’).
|
|
||||||
|
|
||||||
{ config, pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
networking = {
|
|
||||||
networkmanager.enable = true;
|
|
||||||
|
|
||||||
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
|
|
||||||
# Per-interface useDHCP will be mandatory in the future, so this generated config
|
|
||||||
# replicates the default behaviour.
|
|
||||||
useDHCP = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Select internationalisation properties.
|
|
||||||
i18n.defaultLocale = "en_US.UTF-8";
|
|
||||||
|
|
||||||
# Set your time zone.
|
|
||||||
time.timeZone = "Europe/Moscow";
|
|
||||||
|
|
||||||
fonts = {
|
|
||||||
enableDefaultFonts = true;
|
|
||||||
fonts = with pkgs; [
|
|
||||||
ubuntu_font_family
|
|
||||||
fira-code
|
|
||||||
(nerdfonts.override { fonts = [ "FiraCode" ]; })
|
|
||||||
];
|
|
||||||
fontconfig = {
|
|
||||||
defaultFonts = {
|
|
||||||
monospace = [
|
|
||||||
"Fira Code"
|
|
||||||
"emoji"
|
|
||||||
"FiraCode Nerd Font Mono"
|
|
||||||
];
|
|
||||||
serif = [ "Ubuntu" "emoji" ];
|
|
||||||
sansSerif = [ "Ubuntu" "emoji" ];
|
|
||||||
emoji = [ "Noto Color Emoji" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Configure network proxy if necessary
|
|
||||||
# networking.proxy.default = "http://user:password@proxy:port/";
|
|
||||||
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
|
|
||||||
|
|
||||||
console.useXkbConfig = true;
|
|
||||||
|
|
||||||
# Enable the X11 windowing system.
|
|
||||||
services = {
|
|
||||||
# Xmonad
|
|
||||||
dbus = {
|
|
||||||
enable = true;
|
|
||||||
packages = [ pkgs.dconf ];
|
|
||||||
};
|
|
||||||
|
|
||||||
xserver = {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
xkbModel = "pc105";
|
|
||||||
layout = "us,us";
|
|
||||||
xkbVariant = "dvorak,";
|
|
||||||
xkbOptions = "grp:win_space_toggle";
|
|
||||||
|
|
||||||
displayManager = {
|
|
||||||
defaultSession = "none+xmonad";
|
|
||||||
};
|
|
||||||
|
|
||||||
windowManager.xmonad.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Enable sound.
|
|
||||||
sound = {
|
|
||||||
enable = true;
|
|
||||||
mediaKeys.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
hardware.pulseaudio = {
|
|
||||||
enable = true;
|
|
||||||
package = pkgs.pulseaudioFull;
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.zsh.enable = true;
|
|
||||||
|
|
||||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
|
||||||
|
|
||||||
# List packages installed in system profile. To search, run:
|
|
||||||
# $ nix search wget
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
gnumake
|
|
||||||
vim
|
|
||||||
wget
|
|
||||||
];
|
|
||||||
|
|
||||||
# Enable the OpenSSH daemon.
|
|
||||||
services.openssh.enable = true;
|
|
||||||
|
|
||||||
# Some programs need SUID wrappers, can be configured further or are
|
|
||||||
# started in user sessions.
|
|
||||||
# programs.mtr.enable = true;
|
|
||||||
programs.gnupg.agent = {
|
|
||||||
enable = true;
|
|
||||||
enableSSHSupport = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
virtualisation = {
|
|
||||||
docker.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
nix = {
|
|
||||||
settings = {
|
|
||||||
auto-optimise-store = true;
|
|
||||||
|
|
||||||
trusted-users = [ "root" ];
|
|
||||||
|
|
||||||
experimental-features = [ "nix-command" "flakes" ];
|
|
||||||
|
|
||||||
# To protect nix-shell against garbage collection
|
|
||||||
# Source: https://github.com/nix-community/nix-direnv#installation
|
|
||||||
keep-derivations = true;
|
|
||||||
keep-outputs = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
registry =
|
|
||||||
let
|
|
||||||
gitple = "https://git.pleshevski.ru";
|
|
||||||
mkRegistry = id: url: {
|
|
||||||
from = { type = "indirect"; inherit id; };
|
|
||||||
to = { type = "git"; inherit url; };
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
templates = mkRegistry "tmpl" "${gitple}/mynix/templates";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
users.mutableUsers = false;
|
|
||||||
|
|
||||||
# Open ports in the firewall.
|
|
||||||
# networking.firewall.allowedTCPPorts = [ ... ];
|
|
||||||
# networking.firewall.allowedUDPPorts = [ ... ];
|
|
||||||
# Or disable the firewall altogether.
|
|
||||||
# networking.firewall.enable = false;
|
|
||||||
|
|
||||||
# Copy the NixOS configuration file and link it from the resulting system
|
|
||||||
# (/run/current-system/configuration.nix). This is useful in case you
|
|
||||||
# accidentally delete configuration.nix.
|
|
||||||
# system.copySystemConfiguration = true;
|
|
||||||
|
|
||||||
# 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. It‘s 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?
|
|
||||||
|
|
||||||
}
|
|
|
@ -8,7 +8,6 @@ in
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
|
|
||||||
extraModules = [
|
extraModules = [
|
||||||
../modules/garbage-collector.nix
|
|
||||||
../users/jan
|
../users/jan
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -30,5 +29,4 @@ in
|
||||||
local.alacritty.fontSize = 6.0;
|
local.alacritty.fontSize = 6.0;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,35 +7,44 @@ in
|
||||||
imports = [
|
imports = [
|
||||||
# Include the results of the hardware scan.
|
# Include the results of the hardware scan.
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
../common.nix
|
../modules/common.nix
|
||||||
|
../modules/sound.nix
|
||||||
|
../modules/window_manager.nix
|
||||||
|
../modules/fonts.nix
|
||||||
|
../modules/gnupg.nix
|
||||||
|
../modules/nix.nix
|
||||||
|
../modules/garbage-collector.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Configure kernel
|
||||||
boot = {
|
boot = {
|
||||||
# Use the GRUB 2 boot loader.
|
|
||||||
loader.grub = {
|
|
||||||
enable = true;
|
|
||||||
version = 2;
|
|
||||||
device = "/dev/sdb";
|
|
||||||
};
|
|
||||||
|
|
||||||
kernelPackages = pkgs.linuxPackages_latest;
|
kernelPackages = pkgs.linuxPackages_latest;
|
||||||
extraModulePackages = with config.boot.kernelPackages; [
|
extraModulePackages = with config.boot.kernelPackages; [
|
||||||
rtl88x2bu
|
rtl88x2bu
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Use the GRUB 2 boot loader.
|
||||||
|
boot.loader.grub = {
|
||||||
|
enable = true;
|
||||||
|
version = 2;
|
||||||
|
device = "/dev/sdb";
|
||||||
|
};
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
hostName = "home"; # Define your hostname.
|
hostName = "home"; # Define your hostname.
|
||||||
inherit (secrets.networking) extraHosts;
|
inherit (secrets.networking) extraHosts;
|
||||||
|
|
||||||
|
useDHCP = false;
|
||||||
interfaces = {
|
interfaces = {
|
||||||
enp3s0.useDHCP = true;
|
enp3s0.useDHCP = true;
|
||||||
wlp11s0f3u2.useDHCP = true;
|
wlp11s0f3u2.useDHCP = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
networkmanager.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "cnijfilter2" ];
|
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "cnijfilter2" ];
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
avahi = {
|
avahi = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -67,4 +76,7 @@ in
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Enable the Docker
|
||||||
|
virtualisation.docker.enable = true;
|
||||||
}
|
}
|
||||||
|
|
42
machines/modules/common.nix
Normal file
42
machines/modules/common.nix
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# Select internationalisation properties.
|
||||||
|
i18n.defaultLocale = "en_US.UTF-8";
|
||||||
|
# Set your time zone.
|
||||||
|
time.timeZone = "Europe/Moscow";
|
||||||
|
|
||||||
|
users.mutableUsers = false;
|
||||||
|
|
||||||
|
programs.zsh.enable = true;
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
gnumake
|
||||||
|
vim
|
||||||
|
wget
|
||||||
|
];
|
||||||
|
|
||||||
|
# Enable the OpenSSH daemon.
|
||||||
|
services.openssh.enable = true;
|
||||||
|
|
||||||
|
|
||||||
|
# Open ports in the firewall.
|
||||||
|
# networking.firewall.allowedTCPPorts = [ ... ];
|
||||||
|
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||||
|
# Or disable the firewall altogether.
|
||||||
|
# networking.firewall.enable = false;
|
||||||
|
|
||||||
|
# Copy the NixOS configuration file and link it from the resulting system
|
||||||
|
# (/run/current-system/configuration.nix). This is useful in case you
|
||||||
|
# accidentally delete configuration.nix.
|
||||||
|
# system.copySystemConfiguration = true;
|
||||||
|
|
||||||
|
# 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. It‘s 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?
|
||||||
|
|
||||||
|
}
|
24
machines/modules/fonts.nix
Normal file
24
machines/modules/fonts.nix
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
fonts = {
|
||||||
|
enableDefaultFonts = true;
|
||||||
|
fonts = with pkgs; [
|
||||||
|
ubuntu_font_family
|
||||||
|
fira-code
|
||||||
|
(nerdfonts.override { fonts = [ "FiraCode" ]; })
|
||||||
|
];
|
||||||
|
fontconfig = {
|
||||||
|
defaultFonts = {
|
||||||
|
monospace = [
|
||||||
|
"Fira Code"
|
||||||
|
"emoji"
|
||||||
|
"FiraCode Nerd Font Mono"
|
||||||
|
];
|
||||||
|
serif = [ "Ubuntu" "emoji" ];
|
||||||
|
sansSerif = [ "Ubuntu" "emoji" ];
|
||||||
|
emoji = [ "Noto Color Emoji" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
8
machines/modules/gnupg.nix
Normal file
8
machines/modules/gnupg.nix
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{ config, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
programs.gnupg.agent = {
|
||||||
|
enable = true;
|
||||||
|
enableSSHSupport = config.services.openssh.enable;
|
||||||
|
};
|
||||||
|
}
|
40
machines/modules/nix.nix
Normal file
40
machines/modules/nix.nix
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
{ lib, config, ... }:
|
||||||
|
|
||||||
|
let cfg = config.local.nix; in
|
||||||
|
{
|
||||||
|
options.local.nix = with lib; {
|
||||||
|
enableMyRegistry = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Enable my custom nix registry";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
nix = {
|
||||||
|
settings = {
|
||||||
|
auto-optimise-store = true;
|
||||||
|
|
||||||
|
trusted-users = [ "root" ];
|
||||||
|
|
||||||
|
experimental-features = [ "nix-command" "flakes" ];
|
||||||
|
|
||||||
|
# To protect nix-shell against garbage collection
|
||||||
|
# Source: https://github.com/nix-community/nix-direnv#installation
|
||||||
|
keep-derivations = true;
|
||||||
|
keep-outputs = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
registry = lib.mkIf cfg.enableMyRegistry (
|
||||||
|
let
|
||||||
|
gitple = "https://git.pleshevski.ru";
|
||||||
|
mkRegistry = id: url: {
|
||||||
|
from = { type = "indirect"; inherit id; };
|
||||||
|
to = { type = "git"; inherit url; };
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{ templates = mkRegistry "tmpl" "${gitple}/mynix/templates"; }
|
||||||
|
);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
14
machines/modules/sound.nix
Normal file
14
machines/modules/sound.nix
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# Enable sound.
|
||||||
|
sound = {
|
||||||
|
enable = true;
|
||||||
|
mediaKeys.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
hardware.pulseaudio = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.pulseaudioFull;
|
||||||
|
};
|
||||||
|
}
|
22
machines/modules/window_manager.nix
Normal file
22
machines/modules/window_manager.nix
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
services.dbus = {
|
||||||
|
enable = true;
|
||||||
|
packages = [ pkgs.dconf ];
|
||||||
|
};
|
||||||
|
|
||||||
|
services.xserver = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
xkbModel = "pc105";
|
||||||
|
layout = "us,us";
|
||||||
|
xkbVariant = "dvorak,";
|
||||||
|
xkbOptions = "grp:win_space_toggle";
|
||||||
|
|
||||||
|
displayManager.defaultSession = "none+xmonad";
|
||||||
|
windowManager.xmonad.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
console.useXkbConfig = true;
|
||||||
|
}
|
Loading…
Reference in a new issue