diff --git a/flake.nix b/flake.nix
index 2ab78dc..563d9a0 100644
--- a/flake.nix
+++ b/flake.nix
@@ -20,6 +20,9 @@
loft = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
+ ./modules/common.nix
+ ./modules/containers.nix
+
./machines/loft/configuration.nix
];
specialArgs = { inherit inputs; };
diff --git a/machines/loft/configuration.nix b/machines/loft/configuration.nix
index 2634a54..863c546 100644
--- a/machines/loft/configuration.nix
+++ b/machines/loft/configuration.nix
@@ -10,15 +10,6 @@
./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
nix = {
package = pkgs.nixUnstable;
@@ -33,18 +24,9 @@
};
};
- 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; }
- ];
+ nixpkgs.config = {
+ allowUnfree = true;
};
- # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Set your time zone.
time.timeZone = "America/New_York";
@@ -56,29 +38,29 @@
HibernateMode=platform shutdown
'';
- nixpkgs.config = {
- allowUnfree = 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.
+ ##############
+ # NETWORKING #
+ ##############
networking.useDHCP = false;
networking.interfaces.enp0s20u5u4.useDHCP = true;
networking.interfaces.enp4s0.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
# networking.proxy.default = "http://user:password@proxy:port/";
# 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.
# i18n.defaultLocale = "en_US.UTF-8";
@@ -86,59 +68,17 @@
# font = "Lat2-Terminus16";
# 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 = ''
-
- system-ui
-
- Inter
- Roboto
- Cantarell
- Liberation Sans
- DejaVu Sans
-
-
- '';
- };
- };
# Configure keymap in X11
# services.xserver.layout = "us";
# 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).
# services.xserver.libinput.enable = true;
- # Enable Docker
- virtualisation.docker.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’.
users.users.michael = {
isNormalUser = true;
@@ -166,11 +106,6 @@
# 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.
# services.openssh.enable = true;
diff --git a/modules/auto-upgrades.nix b/modules/auto-upgrades.nix
new file mode 100644
index 0000000..e0bec0d
--- /dev/null
+++ b/modules/auto-upgrades.nix
@@ -0,0 +1,5 @@
+{
+ # Enable automatic updates
+ system.autoUpgrade.enable = true;
+ system.autoUpgrade.allowReboot = false;
+}
\ No newline at end of file
diff --git a/modules/avahi.nix b/modules/avahi.nix
new file mode 100644
index 0000000..67b3c81
--- /dev/null
+++ b/modules/avahi.nix
@@ -0,0 +1,9 @@
+{
+ # Enable Avahi Network Discovery
+ services.avahi = {
+ enable = true;
+ nssmdns = true;
+ publish.enable = true;
+ publish.addresses = true;
+ };
+}
\ No newline at end of file
diff --git a/modules/bootloader.nix b/modules/bootloader.nix
new file mode 100644
index 0000000..bce9aab
--- /dev/null
+++ b/modules/bootloader.nix
@@ -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;
+}
\ No newline at end of file
diff --git a/modules/common.nix b/modules/common.nix
new file mode 100644
index 0000000..0a86359
--- /dev/null
+++ b/modules/common.nix
@@ -0,0 +1,12 @@
+{
+ imports = [
+ ./auto-upgrades.nix
+ ./avahi.nix
+ ./bootloader.nix
+ ./cups.nix
+ ./flatpak.nix
+ ./fonts.nix
+ ./gnome.nix
+ ./sound.nix
+ ];
+}
\ No newline at end of file
diff --git a/modules/containers.nix b/modules/containers.nix
new file mode 100644
index 0000000..db20045
--- /dev/null
+++ b/modules/containers.nix
@@ -0,0 +1,5 @@
+{
+ # Enable Docker
+ # TODO: podman
+ virtualisation.docker.enable = true;
+}
\ No newline at end of file
diff --git a/modules/cups.nix b/modules/cups.nix
new file mode 100644
index 0000000..4987385
--- /dev/null
+++ b/modules/cups.nix
@@ -0,0 +1,7 @@
+{ pkgs, ... }: {
+ # Enable CUPS to print documents.
+ services.printing = {
+ enable = true;
+ drivers = [ pkgs.epson-escpr2 ];
+ };
+}
\ No newline at end of file
diff --git a/modules/flatpak.nix b/modules/flatpak.nix
new file mode 100644
index 0000000..06fce59
--- /dev/null
+++ b/modules/flatpak.nix
@@ -0,0 +1,6 @@
+{
+ # Enable Flatpak support
+ services.flatpak.enable = true;
+ services.fwupd.enable = true;
+ appstream.enable = true;
+}
\ No newline at end of file
diff --git a/modules/fonts.nix b/modules/fonts.nix
new file mode 100644
index 0000000..704fcc9
--- /dev/null
+++ b/modules/fonts.nix
@@ -0,0 +1,23 @@
+{ pkgs, ... }: {
+ # Font Settings
+ fonts = {
+ fonts = with pkgs; [
+ roboto
+ inter
+ ];
+ fontconfig = {
+ localConf = ''
+
+ system-ui
+
+ Inter
+ Roboto
+ Cantarell
+ Liberation Sans
+ DejaVu Sans
+
+
+ '';
+ };
+ };
+}
\ No newline at end of file
diff --git a/modules/gnome.nix b/modules/gnome.nix
new file mode 100644
index 0000000..3d50616
--- /dev/null
+++ b/modules/gnome.nix
@@ -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;
+}
\ No newline at end of file
diff --git a/modules/sound.nix b/modules/sound.nix
new file mode 100644
index 0000000..149fcee
--- /dev/null
+++ b/modules/sound.nix
@@ -0,0 +1,5 @@
+{
+ # Enable sound.
+ sound.enable = true;
+ hardware.pulseaudio.enable = true;
+}
\ No newline at end of file