diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | flake.lock | 27 | ||||
-rw-r--r-- | flake.nix | 12 | ||||
-rw-r--r-- | hosts/ades/common.nix | 60 | ||||
-rw-r--r-- | hosts/ades/default.nix | 24 | ||||
-rw-r--r-- | hosts/ades/firefox-prefs.nix | 51 | ||||
-rw-r--r-- | hosts/ades/hardware.nix | 23 | ||||
-rw-r--r-- | hosts/ades/styx.nix | 21 | ||||
-rw-r--r-- | hosts/default.nix | 41 | ||||
-rw-r--r-- | hosts/thyme/default.nix | 41 | ||||
-rw-r--r-- | hosts/thyme/hardware.nix | 41 | ||||
-rw-r--r-- | hosts/thyme/packages.nix | 51 | ||||
-rw-r--r-- | modules/default.nix | 42 | ||||
-rw-r--r-- | modules/envfs.nix | 12 | ||||
-rw-r--r-- | modules/gui.nix | 20 | ||||
-rw-r--r-- | modules/hosts.nix | 25 | ||||
-rw-r--r-- | modules/laptop.nix | 16 | ||||
-rw-r--r-- | modules/locales.nix | 60 | ||||
-rw-r--r-- | modules/overlays/default.nix | 8 | ||||
-rw-r--r-- | modules/overlays/emacs.nix | 25 | ||||
-rw-r--r-- | modules/overlays/g45_h264.nix | 25 | ||||
-rw-r--r-- | modules/pc.nix | 39 | ||||
-rw-r--r-- | modules/rsyslogd.conf | 23 | ||||
-rw-r--r-- | modules/sets.nix | 170 | ||||
-rw-r--r-- | modules/syslog.nix | 19 | ||||
-rw-r--r-- | users/default.nix | 41 |
26 files changed, 918 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b25c15b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*~ diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..283709a --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1746557022, + "narHash": "sha256-QkNoyEf6TbaTW5UZYX0OkwIJ/ZMeKSSoOMnSDPQuol0=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "1d3aeb5a193b9ff13f63f4d9cc169fb88129f860", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..329ddfc --- /dev/null +++ b/flake.nix @@ -0,0 +1,12 @@ +{ + description = ""; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; + }; + + outputs = { self, nixpkgs }: { + nixosConfigurations = + import ./hosts { inherit nixpkgs; }; + }; +} diff --git a/hosts/ades/common.nix b/hosts/ades/common.nix new file mode 100644 index 0000000..1a32da0 --- /dev/null +++ b/hosts/ades/common.nix @@ -0,0 +1,60 @@ +{ lib, pkgs, ... }: + +{ + this.pc.enable = true; + this.overlays.emacs.enable = lib.mkForce false; + this.gui.enable = true; + + this.locales.default = "us"; + + time.timeZone = "America/Chicago"; + + this.sets = { + arch.tools = true; + cli.tools.full = true; + net.tools.minimal = true; + sound.tools = true; + sys.tools = true; + }; + environment.systemPackages = with pkgs; [ + emacs + jre + rxvt-unicode + nethack + sil-q + ppsspp + wesnoth + minetest + gzdoom + teeworlds + superTuxKart + mindustry + shattered-pixel-dungeon + bzflag + xonotic-glx + mgba + taisei + unvanquished + ]; + + programs.firefox = { + enable = true; + package = pkgs.firefox-esr; + } // + import ./firefox-prefs.nix {}; + + services.xserver = { + enable = true; + windowManager.awesome = { + enable = true; + }; + }; + + services.joycond.enable = true; + + this.hosts = { + mine = true; + }; + + system.stateVersion = "24.11"; +} diff --git a/hosts/ades/default.nix b/hosts/ades/default.nix new file mode 100644 index 0000000..b4cae58 --- /dev/null +++ b/hosts/ades/default.nix @@ -0,0 +1,24 @@ +{ mkHost, hosts, nixpkgs }: + +let inherit (nixpkgs.lib.attrsets) + mergeAttrsList; +in +mergeAttrsList + ((map (h: mkHost "x86_64-linux" h + [ ./common.nix ]) + [ + "acheron" + "asphodel" + "cocytus" + "elysium" + "lethe" + "makaron" + "oneiron" + "tartarus" + ]) + ++ + (map (h: mkHost "x86_64-linux" h + [ ./common.nix ./${h}.nix ]) + [ + "styx" + ])) diff --git a/hosts/ades/firefox-prefs.nix b/hosts/ades/firefox-prefs.nix new file mode 100644 index 0000000..47a10c6 --- /dev/null +++ b/hosts/ades/firefox-prefs.nix @@ -0,0 +1,51 @@ +{ ... }: + +{ + policies = { + SearchBar = "separate"; + SearchEngines = { + Remove = ["Google" "Amazon.com" "Bing" "EBay"]; + Default = "DuckDuckGo"; + }; + DisableTelemetry = true; + EnableTrackingProtection = { Value = true; }; + OverrideFirstRunPage = ""; + OverridePostUpdatePage = ""; + NoDefaultBookmarks = true; + FirefoxSuggest = { + WebSuggestions = false; + SponsoredSuggestions = false; + ImproveSuggest = false; + }; + FirefoxHome = { + Search = true; + TopSites = false; + SponsoredTopSites = false; + Highlights = false; + Pocket = false; + SponsoredPocket = false; + Snippets = false; + }; + UserMessaging = { + WhatsNew = false; + ExtensionRecommendations = false; + FeatureRecommendations = false; + UrlbarInterventions = false; + SkipOnboarding = true; + MoreFromMozilla = false; + }; + ExtensionSettings."uBlock@raymondhill.net" = { + installation_mode = "force_installed"; + install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; + }; + }; + + preferencesStatus = "default"; + preferences = { + "browser.aboutConfig.showWarning" = false; + "browser.uidensity" = 1; + "browser.backspace_action" = 1; + "browser.ctrlTab.sortByRecentlyUsed" = true; + "browser.startup.page" = 3; + }; +} diff --git a/hosts/ades/hardware.nix b/hosts/ades/hardware.nix new file mode 100644 index 0000000..4698ae8 --- /dev/null +++ b/hosts/ades/hardware.nix @@ -0,0 +1,23 @@ +{ pkgs, ... }: + +{ + boot.initrd.availableKernelModules = []; + boot.initrd.kernelModules = [ + "iwlwifi" + ]; + boot.kernelModules = [ + "kvm-intel" + ]; + boot.extraModulePackages = []; + + hardware.graphics.extraPackages = [pkgs.intel-vaapi-driver]; + services.xserver.videoDrivers = ["intel"]; + + hardware.firmware = with pkgs; [ + linux-firmware + ]; + + hardware.bluetooth.enable = true; + + nixpkgs.hostPlatform = "x86_64-linux"; +} diff --git a/hosts/ades/styx.nix b/hosts/ades/styx.nix new file mode 100644 index 0000000..ba35edd --- /dev/null +++ b/hosts/ades/styx.nix @@ -0,0 +1,21 @@ +{ lib, ... }: + +let swapPart = "/dev/sda2"; +in +{ + boot.resumeDevice = swapPart; + + fileSystems."/" = lib.mkForce { + device = "/dev/sda1"; + fsType = "ext4"; + }; + + fileSystems."/home" = lib.mkForce { + device = "/dev/sda3"; + fsType = "ext4"; + }; + + swapDevices = [ + { device = swapPart; } + ]; +} diff --git a/hosts/default.nix b/hosts/default.nix new file mode 100644 index 0000000..deba17c --- /dev/null +++ b/hosts/default.nix @@ -0,0 +1,41 @@ +{ nixpkgs }: + +let + mkHost = system: hostname: modules: { + "${hostname}" = nixpkgs.lib.nixosSystem { + inherit system; + modules = [ ../modules ../users ] ++ modules; + specialArgs = { + inherit hostname nixpkgs; + }; + }; + }; + + inherit (nixpkgs.lib.attrsets) + mergeAttrsList; + inherit (builtins) + concatLists + attrValues + mapAttrs + map; + + hosts = systemsHosts: + mergeAttrsList + (concatLists + (attrValues + (mapAttrs + (system: hostnames: + map (h: mkHost system h [./${h}]) hostnames) + systemsHosts))); + + hostsImport = file: + import file { + inherit nixpkgs mkHost hosts; + }; +in +hosts { + "x86_64-linux" = [ + "thyme" + ]; +} // +hostsImport ./ades diff --git a/hosts/thyme/default.nix b/hosts/thyme/default.nix new file mode 100644 index 0000000..adc65e7 --- /dev/null +++ b/hosts/thyme/default.nix @@ -0,0 +1,41 @@ +{ pkgs, ... }: + +{ + imports = [ + ./hardware.nix + ./packages.nix + ]; + + this.pc.enable = true; + this.laptop.enable = true; + this.gui.enable = true; + + networking.domain = "alef.zoar.cx"; + + this.locales = { + default = "us"; + extra = ["it" "jp"]; + dictionaries.extra = ["grc" "la"]; + }; + + boot.loader.grub.enable = true; + boot.loader.grub.device = "nodev"; + + time.timeZone = "America/Chicago"; + + this.users.enabled = ["simon"]; + + fonts.fontconfig.defaultFonts = { + serif = []; + sansSerif = []; + monospace = []; + emoji = []; + }; + + this.hosts = { + lan.home = true; + mine = true; + }; + + system.stateVersion = "24.11"; +} diff --git a/hosts/thyme/hardware.nix b/hosts/thyme/hardware.nix new file mode 100644 index 0000000..50956c6 --- /dev/null +++ b/hosts/thyme/hardware.nix @@ -0,0 +1,41 @@ +{ pkgs, ... }: + +let swapPart = "/dev/sda5"; +in +{ + boot.initrd.availableKernelModules = []; + boot.initrd.kernelModules = []; + boot.kernelModules = [ + "kvm-intel" + "uinput" # work around rules bug + ]; + boot.extraModulePackages = []; + boot.resumeDevice = swapPart; + + fileSystems."/" = { + device = "/dev/sda1"; + fsType = "ext4"; + }; + + fileSystems."/home" = { + device = "/dev/sda6"; + fsType = "ext4"; + }; + + swapDevices = [ + { device = swapPart; } + ]; + + hardware.enableAllFirmware = false; + + this.overlays.g45_h264.enable = true; + hardware.graphics.extraPackages = [pkgs.intel-vaapi-driver]; + services.xserver.videoDrivers = ["intel"]; + + hardware.firmware = with pkgs; [ + alsa-firmware + ath9k-htc-blobless-firmware + ]; + + nixpkgs.hostPlatform = "x86_64-linux"; +} diff --git a/hosts/thyme/packages.nix b/hosts/thyme/packages.nix new file mode 100644 index 0000000..13fc13e --- /dev/null +++ b/hosts/thyme/packages.nix @@ -0,0 +1,51 @@ +{ pkgs, ... }: + +{ + this.sets = { + arch.tools = true; + cli.tools.full = true; + cli.shell = true; + comm.im = true; + de.utils = true; + gui.full = true; + gui.theme = true; + gui.fonts = true; + image.utils = true; + image.tools = true; + manga.dl = true; + media.tools = true; + net.tools.full = true; + script.utils = true; + sound.tools = true; + sys.tools = true; + writing.tools = true; + }; + + environment.systemPackages = with pkgs; [ + emacs + emacsPackages.pdf-tools + jre + ruby + sbcl + python3 + rclone + keymapper + nethack + sil-q + notmuch + emacsPackages.notmuch + mu + emacsPackages.mu4e + isync + ppsspp + wesnoth + ]; + + programs.firefox = { + enable = true; + package = pkgs.firefox-esr; + nativeMessagingHosts.packages = with pkgs; [ + passff-host + ]; + }; +} diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..e57947a --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,42 @@ +{ nixpkgs, hostname, lib, config, ... }: + +{ + imports = [ + ./gui.nix + ./laptop.nix + ./locales.nix + ./envfs.nix + ./pc.nix + ./sets.nix + ./syslog.nix + ./hosts.nix + ./overlays + ]; + + options = { + this.defaults.enable = lib.mkEnableOption "default settings" // { + default = true; + }; + }; + + config = lib.mkIf config.this.defaults.enable { + networking.hostName = hostname; + + security.sudo.enable = false; + + services.logind.lidSwitch = "ignore"; + services.logind.powerKey = "suspend"; + + services.udev.extraRules = '' + KERNEL=="uinput", MODE="0660", GROUP="input" + ''; + + nix = { + channel.enable = false; + #registry.nixpkgs.flake = nixpkgs; + settings = { + experimental-features = [ "nix-command" "flakes" ]; + }; + }; + }; +} diff --git a/modules/envfs.nix b/modules/envfs.nix new file mode 100644 index 0000000..638d1a0 --- /dev/null +++ b/modules/envfs.nix @@ -0,0 +1,12 @@ +{ config, lib, ... }: + +{ + options = { + this.envfs.enable = lib.mkEnableOption "envfs"; + }; + + config = lib.mkIf config.this.envfs.enable { + services.envfs.enable = true; + environment.variables.ENVFS_RESOLVE_ALWAYS = 1; + }; +} diff --git a/modules/gui.nix b/modules/gui.nix new file mode 100644 index 0000000..376afb5 --- /dev/null +++ b/modules/gui.nix @@ -0,0 +1,20 @@ +{ lib, pkgs, config, ... }: + +{ + options = { + this.gui.enable = lib.mkEnableOption "GUI"; + this.gui.extraPackages = lib.mkOption { + type = with lib.types; listOf package; + default = with pkgs; [ xorg.xmodmap xorg.xkbcomp ]; + }; + }; + + config = lib.mkIf config.this.gui.enable { + services.xserver.enable = true; + services.xserver.displayManager.startx.enable = true; + services.speechd.enable = false; + services.openssh.settings.X11Forwarding = true; + + environment.systemPackages = config.this.gui.extraPackages; + }; +} diff --git a/modules/hosts.nix b/modules/hosts.nix new file mode 100644 index 0000000..0c66c70 --- /dev/null +++ b/modules/hosts.nix @@ -0,0 +1,25 @@ +{ lib, config, ... }: + +let cfg = config.this.hosts; +in +{ + options = { + this.hosts.lan.home = lib.mkEnableOption "Home LAN /etc/hosts"; + this.hosts.mine = lib.mkEnableOption "my /etc/hosts"; + this.hosts.alef.zoar.cx = lib.mkEnableOption "alef.zoar.cx /etc/hosts"; + }; + + config = { + networking.hosts = + lib.optionalAttrs cfg.lan.home { + "172.19.0.14" = ["sage.alef.zoar.cx" "sage"]; + "192.168.1.5" = ["rosemary.alef.zoar.cx" "rosemary"]; + } // + lib.optionalAttrs cfg.mine { + "45.61.184.234" = ["alfheim"]; + } // + lib.optionalAttrs cfg.alef.zoar.cx { + "173.16.167.196" = ["sage.alef.zoar.cx" "sage"]; + }; + }; +} diff --git a/modules/laptop.nix b/modules/laptop.nix new file mode 100644 index 0000000..28d0708 --- /dev/null +++ b/modules/laptop.nix @@ -0,0 +1,16 @@ +{ lib, config, pkgs, ... }: + +{ + options = { + this.laptop.enable = lib.mkEnableOption "laptop settings"; + }; + + config = lib.mkIf config.this.laptop.enable { + powerManagement.enable = true; + powerManagement.powertop.enable = true; + services.tlp.enable = true; + environment.systemPackages = with pkgs; [ + acpi + ]; + }; +} diff --git a/modules/locales.nix b/modules/locales.nix new file mode 100644 index 0000000..73627f8 --- /dev/null +++ b/modules/locales.nix @@ -0,0 +1,60 @@ +{ lib, config, pkgs, ... }: + +let localeMap = { + c = "C.UTF-8"; + us = "en_US.UTF-8"; + it = "it_IT.UTF-8"; + jp = "ja_JP.UTF-8"; + }; + + dictOverlay = with pkgs.aspellDicts; { + us = en; + }; + dicts = pkgs.aspellDicts // dictOverlay; + + getSafe' = with builtins; + (key: attrs: if hasAttr key attrs then [(getAttr key attrs)] else []); + + inherit (lib) types; + cfg = config.this.locales; +in +{ + options = { + this.locales = { + default = lib.mkOption { + type = types.str; + default = "us"; + }; + extra = lib.mkOption { + type = types.listOf types.str; + default = []; + }; + dictionaries = { + enable = lib.mkEnableOption "dictionaries"; + extra = lib.mkOption { + type = types.listOf types.str; + default = []; + }; + }; + + all = lib.mkOption { + description = "READ-ONLY!"; + default = ["c" cfg.default] ++ cfg.extra; + }; + }; + }; + + config = { + i18n = { + defaultLocale = localeMap.${cfg.default}; + supportedLocales = + builtins.map (l: localeMap.${l} + "/UTF-8") cfg.all; + }; + + environment.systemPackages = + (lib.optionals cfg.dictionaries.enable + (builtins.concatMap (l: getSafe' l dicts) + cfg.all)) + ++ builtins.map (d: pkgs.aspellDicts.${d}) cfg.dictionaries.extra; + }; +} diff --git a/modules/overlays/default.nix b/modules/overlays/default.nix new file mode 100644 index 0000000..60253ca --- /dev/null +++ b/modules/overlays/default.nix @@ -0,0 +1,8 @@ +{ ... }: + +{ + imports = [ + ./emacs.nix + ./g45_h264.nix + ]; +} diff --git a/modules/overlays/emacs.nix b/modules/overlays/emacs.nix new file mode 100644 index 0000000..7ed9658 --- /dev/null +++ b/modules/overlays/emacs.nix @@ -0,0 +1,25 @@ +{ lib, config, ... }: + +{ + options = { + this.overlays.emacs.enable = lib.mkEnableOption "custom-built Emacs overlay"; + }; + + config = lib.mkIf config.this.overlays.emacs.enable { + nixpkgs.overlays = [ + (final: prev: { + emacs = (prev.emacs.override { + withNativeCompilation = false; + withXwidgets = false; + withX = true; + withGTK3 = false; + withAthena = false; + }).overrideAttrs (attrs: with builtins; with attrs; { + configureFlags = filter (f: !elem f + ["--with-x-toolkit=lucid" "--with-toolkit-scroll-bars"]) + configureFlags ++ ["--with-x-toolkit=no" "--without-toolkit-scroll-bars"]; + }); + }) + ]; + }; +} diff --git a/modules/overlays/g45_h264.nix b/modules/overlays/g45_h264.nix new file mode 100644 index 0000000..9df5ae1 --- /dev/null +++ b/modules/overlays/g45_h264.nix @@ -0,0 +1,25 @@ +{ lib, config, pkgs, ... }: + +{ + options = { + this.overlays.g45_h264.enable = lib.mkEnableOption "intel-vaapi-driver with h264 support on gm45"; + }; + + config = lib.mkIf config.this.overlays.g45_h264.enable { + nixpkgs.overlays = [ + (final: prev: { + intel-vaapi-driver = + prev.intel-vaapi-driver.overrideAttrs + (attrs: attrs // { + src = pkgs.fetchzip { + url = "https://bitbucket.org/alium/g45-h264/downloads/intel-driver-g45-h264-2.4.1.tar.gz"; + sha256 = "h23mQV7WdtQjhkpUlnyHcwVTz+T3BZSuqfuKru4LClo="; + name = "intel-driver-g45-h264-2.4.1-source"; + }; + version = "2.4.1-g45-h264"; + preBuild = "patchShebangs src"; + }); + }) + ]; + }; +} diff --git a/modules/pc.nix b/modules/pc.nix new file mode 100644 index 0000000..0b31149 --- /dev/null +++ b/modules/pc.nix @@ -0,0 +1,39 @@ +{ lib, config, pkgs, ... }: + +let cfg = config.this.pc; +in +{ + imports = [ + ./locales.nix + ./syslog.nix + ./overlays + ]; + + options = { + this.pc.enable = lib.mkEnableOption "PC-specific settings"; + this.pc.minimal = lib.mkEnableOption "limited set of features"; + }; + + config = lib.mkIf cfg.enable { + networking.networkmanager.enable = true; + networking.firewall.enable = false; + + services.openssh.enable = true; + + services.chrony.enable = !cfg.minimal; + services.atd.enable = !cfg.minimal; + this.syslog.enable = !cfg.minimal; + this.envfs.enable = !cfg.minimal; + + services.locate = { + enable = !cfg.minimal; + pruneBindMounts = true; + package = pkgs.plocate; + localuser = null; + }; + + this.overlays.emacs.enable = !cfg.minimal; + + this.locales.dictionaries.enable = !cfg.minimal; + }; +} diff --git a/modules/rsyslogd.conf b/modules/rsyslogd.conf new file mode 100644 index 0000000..b9da515 --- /dev/null +++ b/modules/rsyslogd.conf @@ -0,0 +1,23 @@ +# This more-or-less copies Debian's syslog configuration + +module(load="imklog") # provides kernel logging support + +# Set the default permissions for all log files. +$FileOwner root +$FileGroup adm +$FileCreateMode 0640 +$DirCreateMode 0755 +$Umask 0022 + +# Log anything besides private authentication messages to a single log file +*.*;auth,authpriv.none -/var/log/syslog + +# Log commonly used facilities to their own log file +auth,authpriv.* /var/log/auth.log +cron.* -/var/log/cron.log +kern.* -/var/log/kern.log +mail.* -/var/log/mail.log +user.* -/var/log/user.log + +# Emergencies are sent to everybody logged in. +*.emerg :omusrmsg:* diff --git a/modules/sets.nix b/modules/sets.nix new file mode 100644 index 0000000..65ca568 --- /dev/null +++ b/modules/sets.nix @@ -0,0 +1,170 @@ +{ lib, config, pkgs, ... }: + +let + cfg = config.this.sets; + + attrFromPath' = (path: attrs: + (lib.hasAttrByPath path attrs) && + (lib.getAttrFromPath path attrs)); + doSets = (sets: + let recur = (path: a: + if (builtins.typeOf a) == "set" then + builtins.attrValues + (builtins.mapAttrs (k: v: recur (path++[k]) v) a) + else + lib.optionals (attrFromPath' path cfg) a + ); in + lib.flatten (recur [] sets)); +in +{ + imports = [ + ./locales.nix + ]; + + options.this.sets = { + arch.tools = lib.mkEnableOption "package set"; + cli.tools.minimal = lib.mkEnableOption "package set" // { default = cfg.cli.tools.full; }; + cli.tools.full = lib.mkEnableOption "package set"; + cli.shell = lib.mkEnableOption "package set"; + comm.im = lib.mkEnableOption "package set"; + de.utils = lib.mkEnableOption "package set"; + gui.minimal = lib.mkEnableOption "package set" // { default = cfg.gui.full; }; + gui.full = lib.mkEnableOption "package set"; + gui.theme = lib.mkEnableOption "package set"; + gui.fonts = lib.mkEnableOption "package set"; + image.utils = lib.mkEnableOption "package set"; + image.tools = lib.mkEnableOption "package set"; + manga.dl = lib.mkEnableOption "package set"; + media.tools = lib.mkEnableOption "package set"; + net.tools.minimal = lib.mkEnableOption "package set" // { default = cfg.net.tools.full; }; + net.tools.full = lib.mkEnableOption "package set"; + script.utils = lib.mkEnableOption "package set"; + sound.tools = lib.mkEnableOption "package set"; + sys.tools = lib.mkEnableOption "package set"; + writing.tools = lib.mkEnableOption "package set"; + + gui.usePicom = lib.mkEnableOption "picom package" // { default = true; }; + gui.useEmoji = lib.mkEnableOption "emoji font package" // { default = true; }; + }; + + config = { + environment.systemPackages = + with pkgs; + doSets { + arch.tools = [ + p7zip + unrar-free + unzip + zip + ]; + cli.tools.minimal = [ + pv + wget + ]; + cli.tools.full = [ + git + lftp + gnumake + jq + rsync + sshfs + tmux + ]; + cli.shell = [ + fzf + ]; + comm.im = [ + gajim + ]; + de.utils = [ + aspell + feh + pass + ]; + gui.minimal = [ + autocutsel + dunst + rxvt-unicode + unclutter-xfixes + ]; + gui.full = [ + arandr + redshift + screenkey + tigervnc + x11vnc + ]; + gui.theme = [ + adwaita-icon-theme + papirus-icon-theme + pywal + xsettingsd + ] ++ lib.optional cfg.gui.usePicom picom; + image.utils = [ + imagemagick + ]; + image.tools = [ + gimp + inkscape + ]; + manga.dl = [ + gallery-dl + img2pdf + ]; + media.tools = [ + beets + exiftool + mpv + yt-dlp + ]; + net.tools.minimal = [ + host + traceroute + whois + ]; + net.tools.full = [ + nmap + ]; + script.utils = [ + espeak-ng + firejail + ruby + ]; + sound.tools = [ + alsa-tools + pulseaudio + pulsemixer + ]; + sys.tools = [ + lsof + pciutils + usbutils + vim + ]; + writing.tools = [ + pandoc + proselint + ]; + }; + programs.mosh.enable = cfg.cli.tools.full; + programs.zsh = { + enable = cfg.cli.shell; + syntaxHighlighting.enable = cfg.cli.shell; + }; + programs.gnupg.agent = { + enable = cfg.de.utils; + pinentryPackage = pkgs.pinentry-qt; + }; + + fonts.packages = lib.optionals cfg.gui.fonts ( + lib.optional cfg.gui.useEmoji + pkgs.noto-fonts-emoji ++ + lib.optional (builtins.elem "jp" config.this.locales.all) + pkgs.noto-fonts-cjk-sans + ++ [ + pkgs.dejavu_fonts + pkgs.unifont + ]); + fonts.enableDefaultPackages = lib.mkIf cfg.gui.fonts false; + }; +} diff --git a/modules/syslog.nix b/modules/syslog.nix new file mode 100644 index 0000000..13783eb --- /dev/null +++ b/modules/syslog.nix @@ -0,0 +1,19 @@ +{ lib, config, ... }: + +let cfg = config.this.syslog; +in +{ + options = { + this.syslog.enable = lib.mkEnableOption "syslogger"; + }; + + config = lib.mkIf cfg.enable { + services.rsyslogd = { + enable = true; + defaultConfig = builtins.readFile ./rsyslogd.conf; + }; + services.logrotate = { + enable = true; + }; + }; +} diff --git a/users/default.nix b/users/default.nix new file mode 100644 index 0000000..5c1a272 --- /dev/null +++ b/users/default.nix @@ -0,0 +1,41 @@ +{ lib, config, pkgs, ... }: + +let inherit (lib) types; + cfg = config.this.users; + userP = (name: builtins.elem name cfg.enabled); +in +{ + options.this.users = { + enabled = lib.mkOption { + type = types.listOf types.str; + default = []; + }; + }; + + config = lib.mkMerge [ + (lib.mkIf (userP "simon") { + users.groups.simon = { + gid = 1000; + + }; + users.users.simon = { + description = "Simon Parri"; + group = "simon"; + isNormalUser = true; + uid = 1000; + shell = pkgs.zsh; + homeMode = "755"; + extraGroups = [ + "users" + "adm" + "kvm" + "disk" "cdrpm" + "audio" "video" + "input" + "lp" + "networkmanager" + ]; + }; + }) + ]; +} |