diff options
Diffstat (limited to 'modules/root')
-rw-r--r-- | modules/root/awesome.nix | 9 | ||||
-rw-r--r-- | modules/root/cups.nix | 9 | ||||
-rw-r--r-- | modules/root/default.nix | 36 | ||||
-rw-r--r-- | modules/root/doas.nix | 16 | ||||
-rw-r--r-- | modules/root/docker.nix | 17 | ||||
-rw-r--r-- | modules/root/grub.nix | 26 | ||||
-rw-r--r-- | modules/root/home-manager.nix | 11 | ||||
-rw-r--r-- | modules/root/hosts.nix | 5 | ||||
-rw-r--r-- | modules/root/localization.nix | 5 | ||||
-rw-r--r-- | modules/root/nix.nix | 11 | ||||
-rw-r--r-- | modules/root/pipewire.nix | 12 | ||||
-rw-r--r-- | modules/root/software/default.nix | 23 | ||||
-rw-r--r-- | modules/root/software/desktop-extra.nix | 16 | ||||
-rw-r--r-- | modules/root/software/desktop.nix | 22 | ||||
-rw-r--r-- | modules/root/software/dev-extra.nix | 16 | ||||
-rw-r--r-- | modules/root/software/dev.nix | 23 | ||||
-rw-r--r-- | modules/root/software/utils.nix | 30 | ||||
-rw-r--r-- | modules/root/virtualisation.nix | 10 | ||||
-rw-r--r-- | modules/root/wifi.nix | 10 | ||||
-rw-r--r-- | modules/root/x11/default.nix | 30 | ||||
-rw-r--r-- | modules/root/x11/xinit-startx-xdg.patch | 14 |
21 files changed, 351 insertions, 0 deletions
diff --git a/modules/root/awesome.nix b/modules/root/awesome.nix new file mode 100644 index 0000000..4db5230 --- /dev/null +++ b/modules/root/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/root/cups.nix b/modules/root/cups.nix new file mode 100644 index 0000000..39f8434 --- /dev/null +++ b/modules/root/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/root/default.nix b/modules/root/default.nix new file mode 100644 index 0000000..dd518d2 --- /dev/null +++ b/modules/root/default.nix @@ -0,0 +1,36 @@ +{ lib, ... }: { + imports = [ + ./awesome.nix + ./cups.nix + ./doas.nix + ./docker.nix + ./grub.nix + ./home-manager.nix + ./hosts.nix + ./localization.nix + ./nix.nix + ./pipewire.nix + ./software + ./virtualisation.nix + ./wifi.nix + ./x11 + ]; + + cups.enable = lib.mkDefault true; + doas.enable = lib.mkDefault true; + docker = { + enable = lib.mkDefault false; + btrfsSupport = lib.mkDefault true; + }; + grub = { + enable = lib.mkDefault true; + mode = lib.mkDefault "bios"; + biosDevice = lib.mkDefault "/dev/sda"; + }; + home-manager.enable = lib.mkDefault true; + pipewire.enable = lib.mkDefault true; + virtualisation.enable = lib.mkDefault false; + wifi.enable = lib.mkDefault true; + xserver.awesome.enable = lib.mkDefault true; + xserver.enable = lib.mkDefault true; +} diff --git a/modules/root/doas.nix b/modules/root/doas.nix new file mode 100644 index 0000000..2af324e --- /dev/null +++ b/modules/root/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/root/docker.nix b/modules/root/docker.nix new file mode 100644 index 0000000..d4b6272 --- /dev/null +++ b/modules/root/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/root/grub.nix b/modules/root/grub.nix new file mode 100644 index 0000000..47227d1 --- /dev/null +++ b/modules/root/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/root/home-manager.nix b/modules/root/home-manager.nix new file mode 100644 index 0000000..d271523 --- /dev/null +++ b/modules/root/home-manager.nix @@ -0,0 +1,11 @@ +{ pkgs, lib, config, ... }: { + options = { + home-manager.enable = lib.mkEnableOption "enables home-manager"; + }; + + config = lib.mkIf config.home-manager.enable { + environment.systemPackages = with pkgs; [ + home-manager + ]; + }; +} diff --git a/modules/root/hosts.nix b/modules/root/hosts.nix new file mode 100644 index 0000000..17e9cac --- /dev/null +++ b/modules/root/hosts.nix @@ -0,0 +1,5 @@ +{ + networking.extraHosts = '' + 192.168.1.30 localgit + ''; +} diff --git a/modules/root/localization.nix b/modules/root/localization.nix new file mode 100644 index 0000000..8313f07 --- /dev/null +++ b/modules/root/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/root/nix.nix b/modules/root/nix.nix new file mode 100644 index 0000000..ff8dd28 --- /dev/null +++ b/modules/root/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/root/pipewire.nix b/modules/root/pipewire.nix new file mode 100644 index 0000000..fd97d42 --- /dev/null +++ b/modules/root/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/root/software/default.nix b/modules/root/software/default.nix new file mode 100644 index 0000000..0ceef7f --- /dev/null +++ b/modules/root/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/root/software/desktop-extra.nix b/modules/root/software/desktop-extra.nix new file mode 100644 index 0000000..a3bf8fb --- /dev/null +++ b/modules/root/software/desktop-extra.nix @@ -0,0 +1,16 @@ +{ 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 + ]; + }; +} diff --git a/modules/root/software/desktop.nix b/modules/root/software/desktop.nix new file mode 100644 index 0000000..195d742 --- /dev/null +++ b/modules/root/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/root/software/dev-extra.nix b/modules/root/software/dev-extra.nix new file mode 100644 index 0000000..b027b37 --- /dev/null +++ b/modules/root/software/dev-extra.nix @@ -0,0 +1,16 @@ +{ pkgs, lib, config, ... }: { + options = { + software.dev.extra.enable = lib.mkEnableOption "enables extra 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/root/software/dev.nix b/modules/root/software/dev.nix new file mode 100644 index 0000000..b0dabcc --- /dev/null +++ b/modules/root/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/root/software/utils.nix b/modules/root/software/utils.nix new file mode 100644 index 0000000..1efdb18 --- /dev/null +++ b/modules/root/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/root/virtualisation.nix b/modules/root/virtualisation.nix new file mode 100644 index 0000000..d57d43e --- /dev/null +++ b/modules/root/virtualisation.nix @@ -0,0 +1,10 @@ +{ lib, config, ... }: { + options = { + virtualisation.enable = lib.mkEnableOption "enables virtualisation and virt-manager"; + }; + + config = lib.mkIf config.virtualisation.enable { + virtualisation.libvirtd.enable = true; + programs.virt-manager.enable = true; + }; +} diff --git a/modules/root/wifi.nix b/modules/root/wifi.nix new file mode 100644 index 0000000..54f9089 --- /dev/null +++ b/modules/root/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/root/x11/default.nix b/modules/root/x11/default.nix new file mode 100644 index 0000000..8fa1d27 --- /dev/null +++ b/modules/root/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/root/x11/xinit-startx-xdg.patch b/modules/root/x11/xinit-startx-xdg.patch new file mode 100644 index 0000000..c1bca97 --- /dev/null +++ b/modules/root/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 + |