Modularize configuration
This commit is contained in:
parent
48223c6eb8
commit
934c78b494
@ -20,6 +20,9 @@
|
|||||||
loft = inputs.nixpkgs.lib.nixosSystem {
|
loft = inputs.nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = [
|
modules = [
|
||||||
|
./modules/common.nix
|
||||||
|
./modules/containers.nix
|
||||||
|
|
||||||
./machines/loft/configuration.nix
|
./machines/loft/configuration.nix
|
||||||
];
|
];
|
||||||
specialArgs = { inherit inputs; };
|
specialArgs = { inherit inputs; };
|
||||||
|
@ -10,15 +10,6 @@
|
|||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# Use the systemd-boot EFI boot loader.
|
|
||||||
boot.loader.systemd-boot.enable = true;
|
|
||||||
boot.loader.efi.canTouchEfiVariables = false;
|
|
||||||
boot.plymouth.enable = true;
|
|
||||||
|
|
||||||
# Enable automatic updates
|
|
||||||
system.autoUpgrade.enable = true;
|
|
||||||
system.autoUpgrade.allowReboot = false;
|
|
||||||
|
|
||||||
# Auto cleanup
|
# Auto cleanup
|
||||||
nix = {
|
nix = {
|
||||||
package = pkgs.nixUnstable;
|
package = pkgs.nixUnstable;
|
||||||
@ -33,18 +24,9 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.hostName = "loft"; # Define your hostname.
|
nixpkgs.config = {
|
||||||
networking.firewall = {
|
allowUnfree = true;
|
||||||
enable = true;
|
|
||||||
allowedTCPPorts = [ 80 8080 8000 443 8888 ];
|
|
||||||
allowedTCPPortRanges = [
|
|
||||||
{ from = 1714; to = 1764; }
|
|
||||||
];
|
|
||||||
allowedUDPPortRanges = [
|
|
||||||
{ from = 1714; to = 1764; }
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
|
||||||
|
|
||||||
# Set your time zone.
|
# Set your time zone.
|
||||||
time.timeZone = "America/New_York";
|
time.timeZone = "America/New_York";
|
||||||
@ -56,29 +38,29 @@
|
|||||||
HibernateMode=platform shutdown
|
HibernateMode=platform shutdown
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nixpkgs.config = {
|
##############
|
||||||
allowUnfree = true;
|
# NETWORKING #
|
||||||
};
|
##############
|
||||||
|
|
||||||
# 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.
|
|
||||||
networking.useDHCP = false;
|
networking.useDHCP = false;
|
||||||
networking.interfaces.enp0s20u5u4.useDHCP = true;
|
networking.interfaces.enp0s20u5u4.useDHCP = true;
|
||||||
networking.interfaces.enp4s0.useDHCP = true;
|
networking.interfaces.enp4s0.useDHCP = true;
|
||||||
networking.interfaces.wlp5s0.useDHCP = true;
|
networking.interfaces.wlp5s0.useDHCP = true;
|
||||||
|
|
||||||
|
networking.hostName = "loft"; # Define your hostname.
|
||||||
|
networking.firewall = {
|
||||||
|
enable = true;
|
||||||
|
allowedTCPPorts = [ 80 8080 8000 443 8888 ];
|
||||||
|
allowedTCPPortRanges = [
|
||||||
|
{ from = 1714; to = 1764; }
|
||||||
|
];
|
||||||
|
allowedUDPPortRanges = [
|
||||||
|
{ from = 1714; to = 1764; }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
# Configure network proxy if necessary
|
# Configure network proxy if necessary
|
||||||
# networking.proxy.default = "http://user:password@proxy:port/";
|
# networking.proxy.default = "http://user:password@proxy:port/";
|
||||||
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
|
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
|
||||||
|
|
||||||
# Enable Avahi Network Discovery
|
|
||||||
services.avahi = {
|
|
||||||
enable = true;
|
|
||||||
nssmdns = true;
|
|
||||||
publish.enable = true;
|
|
||||||
publish.addresses = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Select internationalisation properties.
|
# Select internationalisation properties.
|
||||||
# i18n.defaultLocale = "en_US.UTF-8";
|
# i18n.defaultLocale = "en_US.UTF-8";
|
||||||
@ -86,59 +68,17 @@
|
|||||||
# font = "Lat2-Terminus16";
|
# font = "Lat2-Terminus16";
|
||||||
# keyMap = "us";
|
# keyMap = "us";
|
||||||
# };
|
# };
|
||||||
|
|
||||||
# Enable the GNOME Desktop Environment.
|
|
||||||
services.xserver.enable = true;
|
|
||||||
services.xserver.displayManager.gdm.enable = true;
|
|
||||||
services.xserver.desktopManager.gnome.enable = true;
|
|
||||||
services.gnome.chrome-gnome-shell.enable = true;
|
|
||||||
programs.dconf.enable = true;
|
|
||||||
|
|
||||||
# Font Settings
|
|
||||||
fonts = {
|
|
||||||
fonts = with pkgs; [
|
|
||||||
roboto
|
|
||||||
inter
|
|
||||||
];
|
|
||||||
fontconfig = {
|
|
||||||
localConf = ''
|
|
||||||
<alias>
|
|
||||||
<family>system-ui</family>
|
|
||||||
<prefer>
|
|
||||||
<family>Inter</family>
|
|
||||||
<family>Roboto</family>
|
|
||||||
<family>Cantarell</family>
|
|
||||||
<family>Liberation Sans</family>
|
|
||||||
<family>DejaVu Sans</family>
|
|
||||||
</prefer>
|
|
||||||
</alias>
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Configure keymap in X11
|
# Configure keymap in X11
|
||||||
# services.xserver.layout = "us";
|
# services.xserver.layout = "us";
|
||||||
# services.xserver.xkbOptions = "eurosign:e";
|
# services.xserver.xkbOptions = "eurosign:e";
|
||||||
|
|
||||||
# Enable CUPS to print documents.
|
|
||||||
services.printing = {
|
|
||||||
enable = true;
|
|
||||||
drivers = [ pkgs.epson-escpr2 ];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Enable sound.
|
|
||||||
sound.enable = true;
|
|
||||||
hardware.pulseaudio.enable = true;
|
|
||||||
|
|
||||||
# Enable touchpad support (enabled default in most desktopManager).
|
# Enable touchpad support (enabled default in most desktopManager).
|
||||||
# services.xserver.libinput.enable = true;
|
# services.xserver.libinput.enable = true;
|
||||||
|
|
||||||
# Enable Docker
|
|
||||||
virtualisation.docker.enable = true;
|
|
||||||
|
|
||||||
programs.zsh.enable = true;
|
programs.zsh.enable = true;
|
||||||
|
|
||||||
# users.defaultUserShell = pkgs.zsh;
|
users.defaultUserShell = pkgs.zsh;
|
||||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||||
users.users.michael = {
|
users.users.michael = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
@ -166,11 +106,6 @@
|
|||||||
|
|
||||||
# List services that you want to enable:
|
# List services that you want to enable:
|
||||||
|
|
||||||
# Enable Flatpak support
|
|
||||||
services.flatpak.enable = true;
|
|
||||||
services.fwupd.enable = true;
|
|
||||||
appstream.enable = true;
|
|
||||||
|
|
||||||
# Enable the OpenSSH daemon.
|
# Enable the OpenSSH daemon.
|
||||||
# services.openssh.enable = true;
|
# services.openssh.enable = true;
|
||||||
|
|
||||||
|
5
modules/auto-upgrades.nix
Normal file
5
modules/auto-upgrades.nix
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
# Enable automatic updates
|
||||||
|
system.autoUpgrade.enable = true;
|
||||||
|
system.autoUpgrade.allowReboot = false;
|
||||||
|
}
|
9
modules/avahi.nix
Normal file
9
modules/avahi.nix
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
# Enable Avahi Network Discovery
|
||||||
|
services.avahi = {
|
||||||
|
enable = true;
|
||||||
|
nssmdns = true;
|
||||||
|
publish.enable = true;
|
||||||
|
publish.addresses = true;
|
||||||
|
};
|
||||||
|
}
|
6
modules/bootloader.nix
Normal file
6
modules/bootloader.nix
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
# Use the systemd-boot EFI boot loader.
|
||||||
|
boot.loader.systemd-boot.enable = true;
|
||||||
|
boot.loader.efi.canTouchEfiVariables = false;
|
||||||
|
boot.plymouth.enable = true;
|
||||||
|
}
|
12
modules/common.nix
Normal file
12
modules/common.nix
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./auto-upgrades.nix
|
||||||
|
./avahi.nix
|
||||||
|
./bootloader.nix
|
||||||
|
./cups.nix
|
||||||
|
./flatpak.nix
|
||||||
|
./fonts.nix
|
||||||
|
./gnome.nix
|
||||||
|
./sound.nix
|
||||||
|
];
|
||||||
|
}
|
5
modules/containers.nix
Normal file
5
modules/containers.nix
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
# Enable Docker
|
||||||
|
# TODO: podman
|
||||||
|
virtualisation.docker.enable = true;
|
||||||
|
}
|
7
modules/cups.nix
Normal file
7
modules/cups.nix
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{ pkgs, ... }: {
|
||||||
|
# Enable CUPS to print documents.
|
||||||
|
services.printing = {
|
||||||
|
enable = true;
|
||||||
|
drivers = [ pkgs.epson-escpr2 ];
|
||||||
|
};
|
||||||
|
}
|
6
modules/flatpak.nix
Normal file
6
modules/flatpak.nix
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
# Enable Flatpak support
|
||||||
|
services.flatpak.enable = true;
|
||||||
|
services.fwupd.enable = true;
|
||||||
|
appstream.enable = true;
|
||||||
|
}
|
23
modules/fonts.nix
Normal file
23
modules/fonts.nix
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{ pkgs, ... }: {
|
||||||
|
# Font Settings
|
||||||
|
fonts = {
|
||||||
|
fonts = with pkgs; [
|
||||||
|
roboto
|
||||||
|
inter
|
||||||
|
];
|
||||||
|
fontconfig = {
|
||||||
|
localConf = ''
|
||||||
|
<alias>
|
||||||
|
<family>system-ui</family>
|
||||||
|
<prefer>
|
||||||
|
<family>Inter</family>
|
||||||
|
<family>Roboto</family>
|
||||||
|
<family>Cantarell</family>
|
||||||
|
<family>Liberation Sans</family>
|
||||||
|
<family>DejaVu Sans</family>
|
||||||
|
</prefer>
|
||||||
|
</alias>
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
8
modules/gnome.nix
Normal file
8
modules/gnome.nix
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
# Enable the GNOME Desktop Environment.
|
||||||
|
services.xserver.enable = true;
|
||||||
|
services.xserver.displayManager.gdm.enable = true;
|
||||||
|
services.xserver.desktopManager.gnome.enable = true;
|
||||||
|
services.gnome.chrome-gnome-shell.enable = true;
|
||||||
|
programs.dconf.enable = true;
|
||||||
|
}
|
5
modules/sound.nix
Normal file
5
modules/sound.nix
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
# Enable sound.
|
||||||
|
sound.enable = true;
|
||||||
|
hardware.pulseaudio.enable = true;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user