summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorTim Keller <tjk@tjkeller.xyz>2024-10-02 21:29:37 -0500
committerTim Keller <tjk@tjkeller.xyz>2024-10-02 21:29:37 -0500
commit34b0bb8df42194a0ea433592e3cac27546f0af4e (patch)
treef584369db3a6accb74b1a9288c2480f8fd411671 /modules
parent4e4b8068825044ebfd435ec8a6f0e84f5c0c8801 (diff)
downloadnixos-34b0bb8df42194a0ea433592e3cac27546f0af4e.tar.xz
nixos-34b0bb8df42194a0ea433592e3cac27546f0af4e.zip
modularize conf and stuff
Diffstat (limited to 'modules')
-rw-r--r--modules/awesome.nix9
-rw-r--r--modules/cups.nix9
-rw-r--r--modules/default.nix32
-rw-r--r--modules/doas.nix16
-rw-r--r--modules/docker.nix17
-rw-r--r--modules/grub.nix26
m---------modules/home-manager/arkenfox0
-rw-r--r--modules/hosts.nix5
-rw-r--r--modules/localization.nix5
-rw-r--r--modules/nix.nix11
-rw-r--r--modules/pipewire.nix12
-rw-r--r--modules/software/default.nix23
-rw-r--r--modules/software/desktop-extra.nix17
-rw-r--r--modules/software/desktop.nix22
-rw-r--r--modules/software/dev-extra.nix16
-rw-r--r--modules/software/dev.nix23
-rw-r--r--modules/software/utils.nix30
-rw-r--r--modules/wifi.nix10
-rw-r--r--modules/x11/default.nix30
-rw-r--r--modules/x11/xinit-startx-xdg.patch14
20 files changed, 327 insertions, 0 deletions
diff --git a/modules/awesome.nix b/modules/awesome.nix
new file mode 100644
index 0000000..4db5230
--- /dev/null
+++ b/modules/awesome.nix
@@ -0,0 +1,9 @@
+{ lib, config, ... }: {
+ options = {
+ xserver.awesome.enable = lib.mkEnableOption "enables awesomewm";
+ };
+
+ config = lib.mkIf config.xserver.awesome.enable {
+ services.xserver.windowManager.awesome.enable = true;
+ };
+}
diff --git a/modules/cups.nix b/modules/cups.nix
new file mode 100644
index 0000000..39f8434
--- /dev/null
+++ b/modules/cups.nix
@@ -0,0 +1,9 @@
+{ lib, config, ... }: {
+ options = {
+ cups.enable = lib.mkEnableOption "enables printing";
+ };
+
+ config = lib.mkIf config.cups.enable {
+ services.printing.enable = true;
+ };
+}
diff --git a/modules/default.nix b/modules/default.nix
new file mode 100644
index 0000000..1f878d9
--- /dev/null
+++ b/modules/default.nix
@@ -0,0 +1,32 @@
+{ lib, ... }: {
+ imports = [
+ ./awesome.nix
+ ./cups.nix
+ ./doas.nix
+ ./docker.nix
+ ./grub.nix
+ ./hosts.nix
+ ./localization.nix
+ ./nix.nix
+ ./pipewire.nix
+ ./software.nix
+ ./wifi.nix
+ ./x11
+ ];
+
+ cups.enable = lib.mkDefault true;
+ doas.enable = lib.mkDefault true;
+ docker = {
+ enable = lib.mkDefault true;
+ btrfsSupport = lib.mkDefault true;
+ };
+ grub = {
+ enable = lib.mkDefault true;
+ mode = lib.mkDefault "bios";
+ biosDevice = lib.mkDefault "/dev/sda";
+ };
+ pipewire.enable = lib.mkDefault true;
+ wifi.enable = lib.mkDefault true;
+ xserver.awesome.enable = lib.mkDefault true;
+ xserver.enable = lib.mkDefault true;
+}
diff --git a/modules/doas.nix b/modules/doas.nix
new file mode 100644
index 0000000..2af324e
--- /dev/null
+++ b/modules/doas.nix
@@ -0,0 +1,16 @@
+{ lib, config, ... }: {
+ options = {
+ doas.enable = lib.mkEnableOption "enables doas";
+ sudo.enable = lib.mkEnableOption "enables sudo";
+ };
+
+ config = lib.mkIf config.doas.enable {
+ security.doas.enable = true;
+ security.sudo.enable = config.sudo.enable;
+ security.doas.extraRules = [{
+ groups = ["wheel"];
+ keepEnv = true;
+ noPass = true;
+ }];
+ };
+}
diff --git a/modules/docker.nix b/modules/docker.nix
new file mode 100644
index 0000000..d4b6272
--- /dev/null
+++ b/modules/docker.nix
@@ -0,0 +1,17 @@
+{ pkgs, lib, config, ... }: {
+ options = {
+ docker.enable = lib.mkEnableOption "enables docker";
+ docker.btrfsSupport = lib.mkEnableOption "changes docker storageDriver to btrfs";
+ };
+
+ config = lib.mkIf config.docker.enable {
+ virtualisation.docker = {
+ enable = true;
+ storageDriver = lib.mkIf config.docker.btrfsSupport "btrfs";
+ };
+
+ environment.systemPackages = with pkgs; [
+ docker-compose
+ ];
+ };
+}
diff --git a/modules/grub.nix b/modules/grub.nix
new file mode 100644
index 0000000..47227d1
--- /dev/null
+++ b/modules/grub.nix
@@ -0,0 +1,26 @@
+{ lib, config, ... }: {
+ options = {
+ grub.enable = lib.mkEnableOption "enables docker";
+ grub.mode = lib.mkOption {
+ type = lib.types.enum [ "efi" "bios" ];
+ default = "efi";
+ description = "grub mode efi or bios";
+ };
+ grub.biosDevice = lib.mkOption {
+ type = lib.types.str;
+ description = "device to install grub on";
+ };
+ };
+
+ config = lib.mkIf config.grub.enable {
+ boot.loader = {
+ grub = {
+ enable = true;
+ efiSupport = config.grub.mode == "efi";
+ efiInstallAsRemovable = config.grub.mode == "efi";
+ device = if config.grub.mode == "bios" then config.grub.biosDevice else "nodev";
+ };
+ efi.efiSysMountPoint = "/boot/efi";
+ };
+ };
+}
diff --git a/modules/home-manager/arkenfox b/modules/home-manager/arkenfox
deleted file mode 160000
-Subproject 72addd96455cce49c0c8524c53aecd02cf20ade
diff --git a/modules/hosts.nix b/modules/hosts.nix
new file mode 100644
index 0000000..17e9cac
--- /dev/null
+++ b/modules/hosts.nix
@@ -0,0 +1,5 @@
+{
+ networking.extraHosts = ''
+ 192.168.1.30 localgit
+ '';
+}
diff --git a/modules/localization.nix b/modules/localization.nix
new file mode 100644
index 0000000..8313f07
--- /dev/null
+++ b/modules/localization.nix
@@ -0,0 +1,5 @@
+{
+ time.timeZone = "America/Chicago";
+ i18n.defaultLocale = "en_US.UTF-8";
+ services.xserver.xkb.layout = "us";
+}
diff --git a/modules/nix.nix b/modules/nix.nix
new file mode 100644
index 0000000..ff8dd28
--- /dev/null
+++ b/modules/nix.nix
@@ -0,0 +1,11 @@
+{
+ nix.settings = {
+ experimental-features = [ "nix-command" "flakes" ];
+ use-xdg-base-directories = true;
+ };
+ nix.gc = {
+ automatic = true;
+ dates = "weekly";
+ options = "--delete-older-than 30d";
+ };
+}
diff --git a/modules/pipewire.nix b/modules/pipewire.nix
new file mode 100644
index 0000000..fd97d42
--- /dev/null
+++ b/modules/pipewire.nix
@@ -0,0 +1,12 @@
+{ lib, config, ... }: {
+ options = {
+ pipewire.enable = lib.mkEnableOption "enables pipewire";
+ };
+
+ config = lib.mkIf config.pipewire.enable {
+ services.pipewire = {
+ enable = true;
+ pulse.enable = true;
+ };
+ };
+}
diff --git a/modules/software/default.nix b/modules/software/default.nix
new file mode 100644
index 0000000..0ceef7f
--- /dev/null
+++ b/modules/software/default.nix
@@ -0,0 +1,23 @@
+{ lib, ... }: {
+ imports = [
+ ./desktop.nix
+ ./desktop-extra.nix
+ ./dev.nix
+ ./dev-extra.nix
+ ./utils.nix
+ ];
+
+ software = {
+ desktop = {
+ enable = lib.mkDefault true;
+ extra.enable = lib.mkDefault false;
+ };
+ dev = {
+ enable = lib.mkDefault true;
+ extra.enable = lib.mkDefault false;
+ };
+ utils = {
+ enable = lib.mkDefault true;
+ };
+ };
+}
diff --git a/modules/software/desktop-extra.nix b/modules/software/desktop-extra.nix
new file mode 100644
index 0000000..5347696
--- /dev/null
+++ b/modules/software/desktop-extra.nix
@@ -0,0 +1,17 @@
+{ pkgs, lib, config, ... }: {
+ options = {
+ software.desktop.extra.enable = lib.mkEnableOption "enables extra desktop apps";
+ };
+
+ config = lib.mkIf config.software.desktop.extra.enable {
+ environment.systemPackages = with pkgs; [
+ geeqie
+ gimp
+ inkscape
+ qbittorrent
+ qdirstat
+ ungoogled-chromium
+ virt-manager
+ ];
+ };
+}
diff --git a/modules/software/desktop.nix b/modules/software/desktop.nix
new file mode 100644
index 0000000..195d742
--- /dev/null
+++ b/modules/software/desktop.nix
@@ -0,0 +1,22 @@
+{ pkgs, lib, config, ... }: {
+ options = {
+ software.desktop.enable = lib.mkEnableOption "enables desktop apps";
+ };
+
+ config = lib.mkIf config.software.desktop.enable {
+ programs.dconf.enable = true; # For home-manager to configure gtk
+
+ environment.systemPackages = with pkgs; [
+ alacritty
+ arandr
+ dmenu
+ firefox
+ mpv
+ pavucontrol
+ pcmanfm
+ redshift
+ sxiv
+ zathura
+ ];
+ };
+}
diff --git a/modules/software/dev-extra.nix b/modules/software/dev-extra.nix
new file mode 100644
index 0000000..259ae98
--- /dev/null
+++ b/modules/software/dev-extra.nix
@@ -0,0 +1,16 @@
+{ pkgs, lib, config, ... }: {
+ options = {
+ software.dev.enable = lib.mkEnableOption "enables dev apps";
+ };
+
+ config = lib.mkIf config.software.dev.extra.enable {
+ environment.systemPackages = with pkgs; [
+ android-tools
+ cargo
+ hugo
+ #python-pip
+ uhubctl
+ wireguard-tools
+ ];
+ };
+}
diff --git a/modules/software/dev.nix b/modules/software/dev.nix
new file mode 100644
index 0000000..b0dabcc
--- /dev/null
+++ b/modules/software/dev.nix
@@ -0,0 +1,23 @@
+{ pkgs, lib, config, ... }: {
+ options = {
+ software.dev.enable = lib.mkEnableOption "enables dev apps";
+ };
+
+ config = lib.mkIf config.software.dev.enable {
+ environment.systemPackages = with pkgs; [
+ dash # TODO should be default /bin/sh
+ entr
+ gcc
+ git
+ gnumake
+ jq
+ lm_sensors
+ nmap
+ openssl
+ python3
+ sassc
+ sslscan
+ wget
+ ];
+ };
+}
diff --git a/modules/software/utils.nix b/modules/software/utils.nix
new file mode 100644
index 0000000..1efdb18
--- /dev/null
+++ b/modules/software/utils.nix
@@ -0,0 +1,30 @@
+{ pkgs, lib, config, ... }: {
+ options = {
+ software.utils.enable = lib.mkEnableOption "enables dev apps";
+ };
+
+ config = lib.mkIf config.software.utils.enable {
+ programs.zsh.enable = true;
+ users.defaultUserShell = pkgs.zsh;
+ services.openssh.enable = true;
+
+ environment.systemPackages = with pkgs; [
+ ddcutil # TODO
+ fastfetch
+ htop
+ light
+ neovim
+ p7zip
+ powertop
+ pv
+ rsync
+ screen
+ scrot
+ smartmontools
+ stress
+ testdisk
+ tmux
+ xxHash
+ ];
+ };
+}
diff --git a/modules/wifi.nix b/modules/wifi.nix
new file mode 100644
index 0000000..54f9089
--- /dev/null
+++ b/modules/wifi.nix
@@ -0,0 +1,10 @@
+{ pkgs, lib, config, ... }: {
+ options = {
+ wifi.enable = lib.mkEnableOption "enables wifi";
+ };
+
+ config = lib.mkIf config.wifi.enable {
+ # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
+ networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
+ };
+}
diff --git a/modules/x11/default.nix b/modules/x11/default.nix
new file mode 100644
index 0000000..8fa1d27
--- /dev/null
+++ b/modules/x11/default.nix
@@ -0,0 +1,30 @@
+{ pkgs, lib, config, ... }: {
+ options = {
+ xserver.enable = lib.mkEnableOption "enables xserver";
+ };
+
+ config = lib.mkIf config.xserver.enable {
+ services.xserver.enable = true;
+ services.xserver.displayManager.startx.enable = true;
+ services.libinput.enable = true; # Enable touchpad support
+
+ environment.systemPackages = with pkgs; [
+ unclutter
+ xcape
+ xclip
+ xdotool
+ xorg.setxkbmap
+ xorg.xinput
+ xorg.xkill
+ xorg.xrandr
+ xorg.xset
+ xwallpaper
+ # Patch startx to be compliant with xdg base dir spec
+ (xorg.xinit.overrideAttrs (old: rec {
+ patches = [
+ ./xinit-startx-xdg.patch
+ ];
+ }))
+ ];
+ };
+}
diff --git a/modules/x11/xinit-startx-xdg.patch b/modules/x11/xinit-startx-xdg.patch
new file mode 100644
index 0000000..c1bca97
--- /dev/null
+++ b/modules/x11/xinit-startx-xdg.patch
@@ -0,0 +1,14 @@
+diff --git a/startx.cpp b/startx.cpp
+index dfbebe1..472a1b0 100644
+--- a/startx.cpp
++++ b/startx.cpp
+@@ -272,7 +272,7 @@ if [ x"$enable_xauth" = x1 ] ; then
+ dummy=0
+
+ XCOMM create a file with auth information for the server. ':0' is a dummy.
+- xserverauthfile=$HOME/.serverauth.$$
++ xserverauthfile="${XAUTHORITY:-$HOME/.Xauthority}"
+ trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP BUS TERM
+ xauth -q -f "$xserverauthfile" << EOF
+ add :$dummy . $mcookie
+