diff options
author | Tim Keller <tjk@tjkeller.xyz> | 2024-10-02 21:29:37 -0500 |
---|---|---|
committer | Tim Keller <tjk@tjkeller.xyz> | 2024-10-02 21:29:37 -0500 |
commit | 34b0bb8df42194a0ea433592e3cac27546f0af4e (patch) | |
tree | f584369db3a6accb74b1a9288c2480f8fd411671 | |
parent | 4e4b8068825044ebfd435ec8a6f0e84f5c0c8801 (diff) | |
download | nixos-34b0bb8df42194a0ea433592e3cac27546f0af4e.tar.xz nixos-34b0bb8df42194a0ea433592e3cac27546f0af4e.zip |
modularize conf and stuff
-rw-r--r-- | configuration.nix | 174 | ||||
-rw-r--r-- | flake.nix | 1 | ||||
-rw-r--r-- | home.nix | 3 | ||||
-rw-r--r-- | modules/awesome.nix | 9 | ||||
-rw-r--r-- | modules/cups.nix | 9 | ||||
-rw-r--r-- | modules/default.nix | 32 | ||||
-rw-r--r-- | modules/doas.nix | 16 | ||||
-rw-r--r-- | modules/docker.nix | 17 | ||||
-rw-r--r-- | modules/grub.nix | 26 | ||||
m--------- | modules/home-manager/arkenfox | 0 | ||||
-rw-r--r-- | modules/hosts.nix | 5 | ||||
-rw-r--r-- | modules/localization.nix | 5 | ||||
-rw-r--r-- | modules/nix.nix | 11 | ||||
-rw-r--r-- | modules/pipewire.nix | 12 | ||||
-rw-r--r-- | modules/software/default.nix | 23 | ||||
-rw-r--r-- | modules/software/desktop-extra.nix | 17 | ||||
-rw-r--r-- | modules/software/desktop.nix | 22 | ||||
-rw-r--r-- | modules/software/dev-extra.nix | 16 | ||||
-rw-r--r-- | modules/software/dev.nix | 23 | ||||
-rw-r--r-- | modules/software/utils.nix | 30 | ||||
-rw-r--r-- | modules/wifi.nix | 10 | ||||
-rw-r--r-- | modules/x11/default.nix | 30 | ||||
-rw-r--r-- | modules/x11/xinit-startx-xdg.patch (renamed from xinit-startx-xdg.patch) | 0 | ||||
-rw-r--r-- | todo | 22 |
24 files changed, 337 insertions, 176 deletions
diff --git a/configuration.nix b/configuration.nix index 02cd660..fecb7e6 100644 --- a/configuration.nix +++ b/configuration.nix @@ -10,82 +10,7 @@ ./hardware-configuration.nix ]; - nix.settings = { - experimental-features = [ "nix-command" "flakes" ]; - use-xdg-base-directories = true; - }; - nix.gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 30d"; - }; - - # Use the GRUB 2 boot loader. - boot.loader.grub.enable = true; - # boot.loader.grub.efiSupport = true; - # boot.loader.grub.efiInstallAsRemovable = true; - # boot.loader.efi.efiSysMountPoint = "/boot/efi"; - # Define on which hard drive you want to install Grub. - boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only - # networking.hostName = "nixos"; # Define your hostname. - # Pick only one of the below networking options. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. - - # Set your time zone. - time.timeZone = "America/Chicago"; - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - # console = { - # font = "Lat2-Terminus16"; - # keyMap = "us"; - # useXkbConfig = true; # use xkb.options in tty. - # }; - - # Enable the X11 windowing system. - services.xserver.enable = true; - services.xserver.displayManager.startx.enable = true; - services.xserver.windowManager.awesome.enable = true; - - - - - # Configure keymap in X11 - services.xserver.xkb.layout = "us"; - # services.xserver.xkb.options = "eurosign:e,caps:escape"; - - # Enable CUPS to print documents. - # services.printing.enable = true; - - # Enable sound. - # hardware.pulseaudio.enable = true; - # OR - services.pipewire = { - enable = true; - pulse.enable = true; - }; - - # Enable touchpad support (enabled default in most desktopManager). - services.libinput.enable = true; - - #nixpkgs.overlays = [ - # # startx xdg patch - # (final: prev: { - # xorg.xinit = prev.xorg.xinit.overrideAttrs (old: { - # # Apply the patch - # patches = old.patches or [] ++ [ - # ./startx-xdg.patch - # ]; - # }); - # }) - #]; - # Define a user account. Don't forget to set a password with ‘passwd’. users.users.timmy = { @@ -93,104 +18,9 @@ isNormalUser = true; extraGroups = [ "wheel" "docker" ]; # Enable ‘sudo’ for the user. packages = with pkgs; [ - firefox - tree - alacritty - arandr - cups - dmenu - geeqie - #gimp - #inkscape - #keepassxc - mpv - pavucontrol - pcmanfm - #qbittorrent - #qdirstat - redshift - sxiv - #syncthing - #virt-manager - zathura - #additional dev tools - #android-tools - #cargo - #hugo - #python-pip - #wireguard-tools - python3 ]; }; - programs.zsh.enable = true; - users.defaultUserShell = pkgs.zsh; - - programs.dconf.enable = true; # For home-manager to configure gtk - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - home-manager - neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. - wget - light - dash # TODO should be default /bin/sh - ddcutil # TODO - entr - jq - lm_sensors - nmap - openssl - pv - rsync - sassc - sslscan - stress - wget - xxHash - htop - fastfetch - p7zip - gcc - gnumake - powertop - smartmontools - testdisk - uhubctl - xcape - xwallpaper - screen - tmux - scrot - xorg.setxkbmap - unclutter - xclip - xdotool - xorg.xinput - xorg.xkill - xorg.xrandr - xorg.xset - zsh - docker-compose - git - (xorg.xinit.overrideAttrs (old: rec { - patches = [ - ./xinit-startx-xdg.patch - ]; - })) - ]; - - security.doas.enable = true; - #security.sudo.enable = false; - security.doas.extraRules = [{ - groups = ["wheel"]; - keepEnv = true; - noPass = true; - }]; - - virtualisation.docker.enable = true; - virtualisation.docker.storageDriver = "btrfs"; # TODO this does not function boot.initrd.systemd.extraBin = { @@ -198,10 +28,9 @@ vim = "${pkgs.neovim}/bin/nvim"; }; - # Some programs need SUID wrappers, can be configured further or are # started in user sessions. - programs.mtr.enable = true; + #programs.mtr.enable = true; # programs.gnupg.agent = { # enable = true; # enableSSHSupport = true; @@ -210,7 +39,6 @@ # List services that you want to enable: # Enable the OpenSSH daemon. - services.openssh.enable = true; # Open ports in the firewall. # networking.firewall.allowedTCPPorts = [ ... ]; @@ -27,6 +27,7 @@ specialArgs = { inherit inputs; }; modules = [ ./configuration.nix + ./modules ]; }; @@ -4,8 +4,6 @@ homeDirectory = "/home/timmy"; stateVersion = "24.05"; activation = { - # TODO TODO - #cloneRepos = lib.hm.dag.entryAfter ["writeBoundary" "installPackages"] ''${builtins.readFile ./home-config/activate-scripts/clone-repos.sh}''; cloneRepos = lib.hm.dag.entryAfter ["writeBoundary"] '' export PATH="${config.home.path}/bin:$PATH" ${builtins.readFile ./home-config/activation-scripts/clone-repos.sh} @@ -55,7 +53,6 @@ "0100"."0104"."browser.newtabpage.enabled".enable = false; }; settings = { - # checkdefaultbrowser "toolkit.legacyUserProfileCustomizations.stylesheets" = true; "browser.compactmode.show" = true; "browser.uidensity" = 1; # Compact 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/xinit-startx-xdg.patch b/modules/x11/xinit-startx-xdg.patch index c1bca97..c1bca97 100644 --- a/xinit-startx-xdg.patch +++ b/modules/x11/xinit-startx-xdg.patch @@ -0,0 +1,22 @@ +wifi nets +wpa supplicant? over nm +ssh keys +install zsh as root +fstab for net shares +shutdownprompt on power button press (handlepowerkey ignore in /etc/systemd/logind.conf) +fix screen turning off when playing video for extended period + +sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target + ^- systemctl restart systemd-logind.service + +autologin +git repo remotes +inputleap for t495 +thunderbird +ff violentmonkey userscripts +printers +pcmanfm config +wireguard + +lowbat +pavolctrld |