From 21ef85821efa604a6f8aaf798347b94df5ee8607 Mon Sep 17 00:00:00 2001 From: caandt Date: Fri, 18 Oct 2024 22:42:11 -0500 Subject: [PATCH] organization --- flake.nix | 2 +- system/audio.nix | 18 +++++++ system/bash.nix | 9 ++++ system/boot.nix | 12 +++++ system/configuration.nix | 105 --------------------------------------- system/default.nix | 17 +++++++ system/display.nix | 20 ++++++++ system/locale.nix | 24 +++++++++ system/plasma.nix | 13 +++++ system/security.nix | 11 ++++ system/users.nix | 8 +++ system/virt.nix | 16 ++++++ 12 files changed, 149 insertions(+), 106 deletions(-) create mode 100644 system/audio.nix create mode 100644 system/bash.nix create mode 100644 system/boot.nix create mode 100644 system/default.nix create mode 100644 system/display.nix create mode 100644 system/locale.nix create mode 100644 system/plasma.nix create mode 100644 system/security.nix create mode 100644 system/users.nix create mode 100644 system/virt.nix diff --git a/flake.nix b/flake.nix index eb0f4db..bf2a1cd 100644 --- a/flake.nix +++ b/flake.nix @@ -21,7 +21,7 @@ specialArgs = { inherit pkgs-stable; }; - modules = [ system/configuration.nix ]; + modules = [ ./system ]; }; homeConfigurations.ahnwuoa = home-manager.lib.homeManagerConfiguration { inherit pkgs; diff --git a/system/audio.nix b/system/audio.nix new file mode 100644 index 0000000..64c32ca --- /dev/null +++ b/system/audio.nix @@ -0,0 +1,18 @@ +{ ... }: + +{ + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + security.rtkit.enable = true; + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + settings.General = { + Enable = "Source,Sink,Media,Socket"; + }; + }; +} diff --git a/system/bash.nix b/system/bash.nix new file mode 100644 index 0000000..a0c28cb --- /dev/null +++ b/system/bash.nix @@ -0,0 +1,9 @@ +{ lib, ... }: + +{ + programs.bash = { + completion.enable = true; + promptInit = ''PS1="[\u \W] \[\e[32;1m\]\$\[\e[0m\] "''; + }; + environment.etc.bashrc.text = lib.mkAfter ''[ -f ~/.config/bash/bashrc ] && . ~/.config/bash/bashrc''; +} diff --git a/system/boot.nix b/system/boot.nix new file mode 100644 index 0000000..90fc5ba --- /dev/null +++ b/system/boot.nix @@ -0,0 +1,12 @@ +{ ... }: + +{ + boot.loader = { + grub.enable = true; + grub.device = "nodev"; + grub.efiSupport = true; + grub.useOSProber = true; + efi.canTouchEfiVariables = true; + }; + environment.etc.issue.text = "\nNixOS \\r (\\m) - \\l\n\n"; +} diff --git a/system/configuration.nix b/system/configuration.nix index b1fce7f..d7009ce 100644 --- a/system/configuration.nix +++ b/system/configuration.nix @@ -1,22 +1,11 @@ { config, pkgs, lib, ... }: { - imports = [ ./hardware-configuration.nix ]; - nix.settings = { experimental-features = [ "nix-command" "flakes" ]; use-xdg-base-directories = true; }; - boot.loader = { - grub.enable = true; - grub.device = "nodev"; - grub.efiSupport = true; - grub.useOSProber = true; - efi.canTouchEfiVariables = true; - }; - environment.etc.issue.text = "\nNixOS \\r (\\m) - \\l\n\n"; - environment.pathsToLink = [ "/libexec" ]; environment.localBinInPath = true; @@ -27,59 +16,6 @@ time.timeZone = "America/Chicago"; - i18n.defaultLocale = "en_US.UTF-8"; - i18n.supportedLocales = [ - "en_US.UTF-8/UTF-8" - "ja_JP.UTF-8/UTF-8" - ]; - i18n.inputMethod = { - enable = true; - type = "fcitx5"; - fcitx5.addons = with pkgs; [ - fcitx5-mozc - fcitx5-gtk - ]; - }; - fonts.packages = with pkgs; [ - noto-fonts - noto-fonts-cjk - source-han-sans - source-han-serif - (nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) - ]; - - services.xserver = { - enable = true; - autorun = false; - displayManager.sx.enable = true; - windowManager.awesome.enable = true; - desktopManager.plasma5.enable = true; - autoRepeatDelay = 200; - autoRepeatInterval = 30; - videoDrivers = [ "amdgpu" ]; - deviceSection = ''Option "TearFree" "true"''; - }; - services.libinput = { - enable = true; - mouse.accelProfile = "flat"; - }; - services.xserver.wacom.enable = true; - - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - }; - security.rtkit.enable = true; - hardware.bluetooth = { - enable = true; - powerOnBoot = true; - settings.General = { - Enable = "Source,Sink,Media,Socket"; - }; - }; - environment.systemPackages = with pkgs; [ neovim wget @@ -93,52 +29,11 @@ home-manager ]; documentation.dev.enable = true; - programs.bash = { - completion.enable = true; - promptInit = ''PS1="[\u \W] \[\e[32;1m\]\$\[\e[0m\] "''; - }; - environment.etc.bashrc.text = lib.mkAfter ''[ -f ~/.config/bash/bashrc ] && . ~/.config/bash/bashrc''; - - users.users.ahnwuoa = { - isNormalUser = true; - extraGroups = [ "wheel" "podman" ]; - }; xdg.terminal-exec = { enable = true; settings.default = [ "Alacritty.desktop" ]; }; - programs.partition-manager = { - enable = true; - package = pkgs.libsForQt5.partitionmanager; - }; - services.udisks2.enable = true; - - virtualisation.containers.enable = true; - virtualisation = { - podman = { - enable = true; - dockerCompat = true; - defaultNetwork.settings.dns_enabled = true; - }; - }; - virtualisation.libvirtd.enable = true; - programs.virt-manager.enable = true; - programs.nix-ld.enable = true; - hardware.graphics.enable32Bit = true; - - security.doas = { - enable = true; - extraRules = [ - { groups = [ "wheel" ]; persist = true; } - ]; - }; - security.polkit.enable = true; - - systemd.user.services = { - plasma-kactivitymanagerd.enable = false; - plasma-xdg-desktop-portal-kde.enable = false; - }; system.stateVersion = "24.05"; } diff --git a/system/default.nix b/system/default.nix new file mode 100644 index 0000000..f5fb311 --- /dev/null +++ b/system/default.nix @@ -0,0 +1,17 @@ +{ ... }: + +{ + imports = [ + ./audio.nix + ./bash.nix + ./boot.nix + ./configuration.nix + ./display.nix + ./hardware-configuration.nix + ./locale.nix + ./plasma.nix + ./security.nix + ./users.nix + ./virt.nix + ]; +} diff --git a/system/display.nix b/system/display.nix new file mode 100644 index 0000000..67b25ac --- /dev/null +++ b/system/display.nix @@ -0,0 +1,20 @@ +{ ... }: + +{ + services.xserver = { + enable = true; + autorun = false; + displayManager.sx.enable = true; + windowManager.awesome.enable = true; + desktopManager.plasma5.enable = true; + autoRepeatDelay = 200; + autoRepeatInterval = 30; + videoDrivers = [ "amdgpu" ]; + deviceSection = ''Option "TearFree" "true"''; + }; + services.libinput = { + enable = true; + mouse.accelProfile = "flat"; + }; + services.xserver.wacom.enable = true; +} diff --git a/system/locale.nix b/system/locale.nix new file mode 100644 index 0000000..aab26bd --- /dev/null +++ b/system/locale.nix @@ -0,0 +1,24 @@ +{ pkgs, ... }: + +{ + i18n.defaultLocale = "en_US.UTF-8"; + i18n.supportedLocales = [ + "en_US.UTF-8/UTF-8" + "ja_JP.UTF-8/UTF-8" + ]; + i18n.inputMethod = { + enable = true; + type = "fcitx5"; + fcitx5.addons = with pkgs; [ + fcitx5-mozc + fcitx5-gtk + ]; + }; + fonts.packages = with pkgs; [ + noto-fonts + noto-fonts-cjk + source-han-sans + source-han-serif + (nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) + ]; +} diff --git a/system/plasma.nix b/system/plasma.nix new file mode 100644 index 0000000..8b16d2d --- /dev/null +++ b/system/plasma.nix @@ -0,0 +1,13 @@ +{ pkgs, ... }: + +{ + programs.partition-manager = { + enable = true; + package = pkgs.libsForQt5.partitionmanager; + }; + services.udisks2.enable = true; + systemd.user.services = { + plasma-kactivitymanagerd.enable = false; + plasma-xdg-desktop-portal-kde.enable = false; + }; +} diff --git a/system/security.nix b/system/security.nix new file mode 100644 index 0000000..510262a --- /dev/null +++ b/system/security.nix @@ -0,0 +1,11 @@ +{ ... }: + +{ + security.doas = { + enable = true; + extraRules = [ + { groups = [ "wheel" ]; persist = true; } + ]; + }; + security.polkit.enable = true; +} diff --git a/system/users.nix b/system/users.nix new file mode 100644 index 0000000..de9fb17 --- /dev/null +++ b/system/users.nix @@ -0,0 +1,8 @@ +{ ... }: + +{ + users.users.ahnwuoa = { + isNormalUser = true; + extraGroups = [ "wheel" "podman" ]; + }; +} diff --git a/system/virt.nix b/system/virt.nix new file mode 100644 index 0000000..28caa71 --- /dev/null +++ b/system/virt.nix @@ -0,0 +1,16 @@ +{ ... }: + +{ + virtualisation.containers.enable = true; + virtualisation = { + podman = { + enable = true; + dockerCompat = true; + defaultNetwork.settings.dns_enabled = true; + }; + }; + virtualisation.libvirtd.enable = true; + programs.virt-manager.enable = true; + programs.nix-ld.enable = true; + hardware.graphics.enable32Bit = true; +}