diff --git a/.config/linux/system/flake.nix b/.config/linux/system/flake.nix index bbe2f70..301cf87 100644 --- a/.config/linux/system/flake.nix +++ b/.config/linux/system/flake.nix @@ -2,11 +2,25 @@ # inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; inputs.nixpkgs.url = "github:nixos/nixpkgs/952b64947e0b1300600dda555db35d09122b9612"; # NOTE: This is due to AMDGPU bug: https://github.com/NixOS/nixpkgs/issues/284403 outputs = { self, nixpkgs }@inputs: { + nixosModules.common.imports = [ + ./module/common/Bootloader.nix + ./module/common/Firewall.nix + ./module/common/Kernel.nix + ./module/common/Ld.nix + ./module/common/Locale.nix + ./module/common/Network.nix + ./module/common/Nix.nix + ./module/common/Packages.nix + ./module/common/Root.nix + ./module/common/Swap.nix + ./module/common/Users.nix + ]; + nixosConfigurations.dasha = nixpkgs.lib.nixosSystem { modules = [ + self.nixosModules.common ./host/dasha/Configuration.nix ./module/AmdGpu.nix - ./module/Common.nix ./module/Dasha.nix ./module/DockerRootless.nix ./module/Flatpak.nix @@ -21,9 +35,9 @@ nixosConfigurations.desktop = nixpkgs.lib.nixosSystem { modules = [ + self.nixosModules.common ./host/desktop/Configuration.nix ./module/AmdGpu.nix - ./module/Common.nix ./module/DockerRootless.nix ./module/Flatpak.nix ./module/Gnome.nix @@ -38,9 +52,9 @@ nixosConfigurations.home = nixpkgs.lib.nixosSystem { modules = [ + self.nixosModules.common ./host/home/Configuration.nix ./module/AmdGpu.nix - ./module/Common.nix ./module/Docker.nix ./module/Flatpak.nix ./module/Ftpd.nix @@ -55,9 +69,9 @@ nixosConfigurations.laptop = nixpkgs.lib.nixosSystem { modules = [ + self.nixosModules.common ./host/laptop/Configuration.nix ./module/AmdGpu.nix - ./module/Common.nix ./module/Dasha.nix ./module/DockerRootless.nix ./module/Flatpak.nix @@ -73,8 +87,8 @@ nixosConfigurations.work = nixpkgs.lib.nixosSystem { modules = [ + self.nixosModules.common ./host/work/Configuration.nix - ./module/Common.nix ./module/DockerRootless.nix ./module/Flatpak.nix ./module/Gnome.nix diff --git a/.config/linux/system/module/common/Bootloader.nix b/.config/linux/system/module/common/Bootloader.nix new file mode 100644 index 0000000..96381f6 --- /dev/null +++ b/.config/linux/system/module/common/Bootloader.nix @@ -0,0 +1,6 @@ +{ ... }: + +{ + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; +} diff --git a/.config/linux/system/module/common/Firewall.nix b/.config/linux/system/module/common/Firewall.nix new file mode 100644 index 0000000..390d07b --- /dev/null +++ b/.config/linux/system/module/common/Firewall.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + networking.firewall.enable = false; +} diff --git a/.config/linux/system/module/Common.nix b/.config/linux/system/module/common/Kernel.nix similarity index 50% rename from .config/linux/system/module/Common.nix rename to .config/linux/system/module/common/Kernel.nix index 835e90e..72e419c 100644 --- a/.config/linux/system/module/Common.nix +++ b/.config/linux/system/module/common/Kernel.nix @@ -1,55 +1,7 @@ -# Help: man configuration.nix or https://nixos.org/nixos/options.html - -{ config, pkgs, stdenv, lib, ... }: +{ pkgs, ... }: { - # System packages. - environment.systemPackages = with pkgs; [ - android-tools - appimage-run - binwalk - btop - cryptsetup - ddrescue - distrobox - gcc - git - jdk11 - jdk19 - lm_sensors - lshw - gnome.gnome-tweaks - gnumake - imagemagick - lsof - ncdu - neovim - nmap - parallel - pv - ripgrep - scanmem - smartmontools - steam-run - sqlite - testdisk - tmux - tree - virt-manager - wget - wl-clipboard - zip unzip - ]; - - # Root user. - users.mutableUsers = false; - users.users.root.hashedPassword = "$y$j9T$oqCB16i5E2t1t/HAWaFd5.$tTaHtAcifXaDVpTcRv.yH2/eWKxKE9xM8KcqXHfHrD7"; # Use `mkpasswd`. - - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - # Latest kernel. + # Use latest kernel. boot.kernelPackages = pkgs.linuxPackages_latest; # Sysctl. @@ -106,35 +58,4 @@ "net.ipv6.conf.lo.disable_ipv6" = 1; "net.ipv6.conf.eth0.disable_ipv6" = 1; }; - - # Network. - networking.networkmanager.enable = true; - - # Ld. - programs.nix-ld.enable = true; - - # Zram. - zramSwap.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; } diff --git a/.config/linux/system/module/common/Ld.nix b/.config/linux/system/module/common/Ld.nix new file mode 100644 index 0000000..d0995db --- /dev/null +++ b/.config/linux/system/module/common/Ld.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + programs.nix-ld.enable = true; +} diff --git a/.config/linux/system/module/common/Locale.nix b/.config/linux/system/module/common/Locale.nix new file mode 100644 index 0000000..d77b29e --- /dev/null +++ b/.config/linux/system/module/common/Locale.nix @@ -0,0 +1,17 @@ +{ ... }: + +{ + 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"; + }; +} diff --git a/.config/linux/system/module/common/Network.nix b/.config/linux/system/module/common/Network.nix new file mode 100644 index 0000000..2db5041 --- /dev/null +++ b/.config/linux/system/module/common/Network.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + networking.networkmanager.enable = true; +} diff --git a/.config/linux/system/module/common/Nix.nix b/.config/linux/system/module/common/Nix.nix new file mode 100644 index 0000000..cb8af05 --- /dev/null +++ b/.config/linux/system/module/common/Nix.nix @@ -0,0 +1,6 @@ +{ ... }: + +{ + nixpkgs.config.allowUnfree = true; + nix.settings.auto-optimise-store = true; +} diff --git a/.config/linux/system/module/common/Packages.nix b/.config/linux/system/module/common/Packages.nix new file mode 100644 index 0000000..c6ff854 --- /dev/null +++ b/.config/linux/system/module/common/Packages.nix @@ -0,0 +1,40 @@ +{ pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + android-tools + appimage-run + binwalk + btop + cryptsetup + ddrescue + distrobox + gcc + git + jdk11 + jdk19 + lm_sensors + lshw + gnome.gnome-tweaks + gnumake + imagemagick + lsof + ncdu + neovim + nmap + parallel + pv + ripgrep + scanmem + smartmontools + steam-run + sqlite + testdisk + tmux + tree + virt-manager + wget + wl-clipboard + zip unzip + ]; +} diff --git a/.config/linux/system/module/common/Root.nix b/.config/linux/system/module/common/Root.nix new file mode 100644 index 0000000..948b3a0 --- /dev/null +++ b/.config/linux/system/module/common/Root.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + users.users.root.hashedPassword = "$y$j9T$oqCB16i5E2t1t/HAWaFd5.$tTaHtAcifXaDVpTcRv.yH2/eWKxKE9xM8KcqXHfHrD7"; # Use `mkpasswd`. +} diff --git a/.config/linux/system/module/common/Swap.nix b/.config/linux/system/module/common/Swap.nix new file mode 100644 index 0000000..8eb4a44 --- /dev/null +++ b/.config/linux/system/module/common/Swap.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + zramSwap.enable = true; +} diff --git a/.config/linux/system/module/common/Users.nix b/.config/linux/system/module/common/Users.nix new file mode 100644 index 0000000..a9d193f --- /dev/null +++ b/.config/linux/system/module/common/Users.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + users.mutableUsers = false; +}