From 25af328bfa9b3d76b347e0df568ea5edb323d17d Mon Sep 17 00:00:00 2001 From: asnev Date: Mon, 12 Oct 2026 14:03:35 +0700 Subject: [PATCH] semi-major-ish cleanup throughout tree --- flake.lock | 34 +++++++++ flake.nix | 26 ++++--- home/coyote/default.nix | 75 +++++++++++++++++--- home/coyote/vim.nix | 25 ++++--- hosts/phostron/configuration.nix | 9 ++- hosts/phostron/default.nix | 2 + modules/common.nix | 69 ++++++------------ modules/users/coyote/default.nix | 36 +++------- modules/users/coyote/home-manager-module.nix | 1 + 9 files changed, 170 insertions(+), 107 deletions(-) diff --git a/flake.lock b/flake.lock index b3a1c32..baa0e20 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,23 @@ { "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -55,10 +73,26 @@ }, "root": { "inputs": { + "flake-utils": "flake-utils", "home-manager": "home-manager", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 9865bc4..0897f85 100644 --- a/flake.nix +++ b/flake.nix @@ -12,6 +12,9 @@ url = "github:nix-community/home-manager/release-26.05"; inputs.nixpkgs.follows = "nixpkgs"; }; + flake-utils = { + url = "github:numtide/flake-utils"; + }; }; outputs = inputs @ { @@ -19,15 +22,20 @@ nixpkgs, nixpkgs-unstable, home-manager, + flake-utils, ... - }: { - nixosConfigurations.phostron = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs;}; - modules = [ - ./hosts/phostron - ./modules/users/coyote - ./modules/users/coyote/home-manager-module.nix - ]; + }: + flake-utils.lib.eachDefaultSystem (system: let + pkgs = nixpkgs.legacyPackages.${system}; + in { + formatter = pkgs.alejandra; + }) + // { + nixosConfigurations.phostron = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs;}; + modules = [ + ./hosts/phostron + ]; + }; }; - }; } diff --git a/home/coyote/default.nix b/home/coyote/default.nix index a371f5d..930328e 100644 --- a/home/coyote/default.nix +++ b/home/coyote/default.nix @@ -1,10 +1,4 @@ -{ - pkgs, - config, - lib, - inputs, - ... -}: { +{pkgs, ...}: { imports = [ ./vim.nix ]; @@ -45,14 +39,58 @@ ]; programs = { + home-manager.enable = true; + + ssh = { + enable = true; + enableDefaultConfig = false; + settings."*" = { + ForwardAgent = false; + AddKeysToAgent = "yes"; # no passphrase, silent auto-add + Compression = false; + ServerAliveInterval = 0; + ServerAliveCountMax = 3; + HashKnownHosts = false; + UserKnownHostsFile = "~/.ssh/known_hosts"; + ControlMaster = "no"; + ControlPath = "~/.ssh/master-%r@%n:%p"; + ControlPersist = "no"; + }; + }; + + git = { + enable = true; + userName = "asnev"; + userEmail = "notasnev@proton.me"; + signing = { + key = "/home/coyote/.ssh/id_ed25519.pub"; + format = "ssh"; + }; + includes = [ + { + condition = "gitdir:/home/coyote/NixOS/"; + contents.core.sshCommand = "ssh -i /home/coyote/.ssh/id_ed25519"; + } + ]; + }; + + fish.enable = true; + fish.shellAbbrs = { + l = "eza --grid --all"; + ll = "eza --long --all"; + ls = "eza"; + ".." = "cd .."; + "..." = "cd ../.."; + }; + tmux = { enable = true; clock24 = true; baseIndex = 1; shortcut = "a"; keyMode = "vi"; - terminal = "screen-256color"; - escapeTime = 0; + terminal = "tmux-256color"; + escapeTime = 10; extraConfig = '' set -g pane-base-index 1 set-window-option -g pane-base-index 1 @@ -67,13 +105,28 @@ yt-dlp.enable = true; yt-dlp.package = pkgs.unstable.yt-dlp; - starship.package = pkgs.unstable.starship; + starship = { + enable = true; + package = pkgs.unstable.starship; + enableTransience = true; + settings = { + "$schema" = "https://starship.rs/config-schema.json"; + git_status = { + ahead = ">"; + behind = "<"; + diverged = "<>"; + renamed = "r"; + deleted = "d"; + }; + character.success_symbol = "[λ](bold green)"; + character.error_symbol = "[λ](bold red)"; + }; + }; obs-studio.enable = true; obs-studio.plugins = with pkgs.obs-studio-plugins; [ input-overlay droidcam-obs - wlrobs ]; fastfetch.enable = true; diff --git a/home/coyote/vim.nix b/home/coyote/vim.nix index fc97f1a..ab03bd3 100644 --- a/home/coyote/vim.nix +++ b/home/coyote/vim.nix @@ -4,11 +4,7 @@ packageConfigurable = pkgs.unstable.vim-full; defaultEditor = true; - plugins = with pkgs.unstable.vimPlugins; [ - gruvbox - rainbow - undotree - ]; + plugins = with pkgs.unstable.vimPlugins; [gruvbox vim-nix undotree]; extraConfig = '' set nocompatible @@ -21,6 +17,9 @@ syntax on set ruler + set number + set relativenumber + set cursorline set showcmd set showmode set laststatus=1 @@ -31,7 +30,6 @@ filetype plugin indent on set autoindent - set smartindent set expandtab set smarttab set tabstop=4 @@ -50,20 +48,21 @@ colorscheme gruvbox let g:terminal_ansi_colors = ['#282828', '#cc241d', '#98971a', '#d79921', '#458588', '#b16286', '#689d6a', '#a89984', '#928374', '#fb4934', '#b8bb26', '#fabd2f', '#83a598', '#d3869b', '#8ec07c', '#ebdbb2'] - let g:rainbow_active = 1 + set showmatch + + set lispwords+=defun,defmacro,defvar,defparameter,defmethod,define-syntax,lambda,let,let*,letrec,flet,labels,progn,when,unless,if,cond augroup coyote_filetype_settings autocmd! - autocmd FileType javascript,typescript,html,css,json,nix,vim + autocmd FileType javascript,javascriptreact,typescript,typescriptreact,html,css,scss,json,jsonc,vue,svelte,yaml,toml,markdown,nix,vim,ruby,eruby,dart,haskell,elm \ setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2 - autocmd FileType python,rust,java,lua,c,cpp,h,hpp + autocmd FileType python,rust,java,lua,c,cpp,cs,php,kotlin,swift,scala,perl \ setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 - autocmd FileType go,make + autocmd FileType go,gomod,make \ setlocal noexpandtab tabstop=4 shiftwidth=4 softtabstop=0 - autocmd FileType lisp,scheme,clojure,racket + autocmd FileType lisp,scheme,clojure,racket,fennel \ setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2 - \ lisp autoindent showmatch - \ lispwords+=defun,defmacro,defvar,defparameter,defmethod,define-syntax,lambda,let,let*,letre,flet,labels,progn,when,unless,if,cond + \ lisp autoindent augroup END ''; }; diff --git a/hosts/phostron/configuration.nix b/hosts/phostron/configuration.nix index c2a87a9..c047547 100644 --- a/hosts/phostron/configuration.nix +++ b/hosts/phostron/configuration.nix @@ -10,14 +10,21 @@ networking.networkmanager.enable = true; networking.firewall.enable = true; - services.printing.enable = true; services.printing.drivers = [pkgs.epson-escpr]; hardware.bluetooth.enable = true; hardware.sane.enable = true; hardware.sane.extraBackends = [pkgs.epsonscan2]; + hardware.graphics.enable = true; + hardware.graphics.enable32Bit = true; + hardware.enableRedistributableFirmware = true; + + services.fstrim.enable = true; + zramSwap.enable = true; + # SDDM look, specific to this machine + # NOTE: Wayland for SDDM intentionally left disabled (experimental) services.displayManager.sddm.settings.Theme.Font = "Inter"; services.displayManager.sddm.settings.Theme.CursorSize = 18; } diff --git a/hosts/phostron/default.nix b/hosts/phostron/default.nix index 29ac9f8..fe311c8 100644 --- a/hosts/phostron/default.nix +++ b/hosts/phostron/default.nix @@ -2,6 +2,8 @@ imports = [ ../../modules/common.nix ../../modules/desktop/kde-plasma.nix + ../../modules/users/coyote + ../../modules/users/coyote/home-manager-module.nix ./hardware-configuration.nix ./configuration.nix ]; diff --git a/modules/common.nix b/modules/common.nix index e6a3b54..c93b9d0 100644 --- a/modules/common.nix +++ b/modules/common.nix @@ -7,7 +7,11 @@ }: { nix.settings.experimental-features = ["nix-command" "flakes"]; nix.settings.auto-optimise-store = true; - nix.package = pkgs.lixPackageSets.stable.lix; + + nix.gc.automatic = true; + nix.gc.dates = "weekly"; + nix.gc.options = "--delete-older-than 14d"; + nix.optimise.automatic = true; nixpkgs.config.allowUnfree = true; nixpkgs.overlays = [ @@ -17,15 +21,6 @@ config.allowUnfree = true; }; }) - (final: prev: { - inherit - (prev.lixPackageSets.stable) - nixpkgs-review - nix-eval-jobs - nix-fast-build - colmena - ; - }) ]; boot = { @@ -33,10 +28,7 @@ loader.systemd-boot.configurationLimit = 10; loader.efi.canTouchEfiVariables = true; loader.timeout = 2; - kernelParams = ["quiet" "rd.udev.log_level=3" "rd.systemd.show_status=auto"]; - initrd.verbose = false; - consoleLogLevel = 3; - kernelPackages = pkgs.linuxPackages; + kernelPackages = pkgs.linuxPackages_latest; }; time.timeZone = "Asia/Jakarta"; @@ -48,7 +40,6 @@ locate.enable = true; printing.enable = true; openssh.enable = false; - pulseaudio.enable = false; pipewire.enable = true; pipewire.alsa.enable = true; @@ -102,16 +93,6 @@ eza ]; - environment.shellAliases = { - sudo = "doas"; - l = "eza --grid --all"; - ll = "eza --long --all"; - ls = "eza --long"; - ".." = "cd .."; - "..." = "cd ../.."; - cat = "bat"; - }; - programs = { fish.enable = true; @@ -119,22 +100,6 @@ atuin.settings.sync_address = "https://api.atuin.sh"; atuin.settings.enter_accept = true; - starship.enable = true; - starship.transientPrompt.enable = true; - starship.transientPrompt.left = "starship module character"; - starship.settings = { - "$schema" = "https://starship.rs/config-schema.json"; - git_status = { - ahead = ">"; - behind = "<"; - diverged = "<>"; - renamed = "r"; - deleted = "d"; - }; - character.success_symbol = "[λ](bold green)"; - character.error_symbol = "[λ](bold red)"; - }; - git.enable = true; git.config = { init.defaultBranch = "main"; @@ -147,17 +112,26 @@ # one-off options that would live in the Home Manager section if the # relevant modules existed there obs-studio.enableVirtualCamera = true; + + # NOTE: services.openssh.enable = false above only disables the SSH *server* + # This still starts the ssh-agent user service (SSH_AUTH_SOCK=%t/ssh-agent) ssh.startAgent = true; nix-ld.enable = true; - nix-ld.libraries = with pkgs; [fuse e2fsprogs]; + nix-ld.libraries = with pkgs; [ + fuse + e2fsprogs + stdenv.cc.cc + zlib + alsa-lib + expat + ]; }; fonts.packages = with pkgs; [ # GUI fonts inter corefonts - vista-fonts roboto cantarell-fonts # fonts for i18n @@ -175,8 +149,9 @@ fonts.fontconfig.antialias = true; fonts.fontconfig.subpixel.rgba = "rgb"; - - xdg.portal.enable = true; - xdg.portal.config.common.default = ["gtk"]; - xdg.portal.extraPortals = with pkgs; [xdg-desktop-portal-wlr]; + fonts.fontconfig.hinting.enable = true; + fonts.fontconfig.defaultFonts = { + sansSerif = ["Inter"]; + monospace = ["Iosevka Nerd Font"]; + }; } diff --git a/modules/users/coyote/default.nix b/modules/users/coyote/default.nix index 92ab002..85a6f2b 100644 --- a/modules/users/coyote/default.nix +++ b/modules/users/coyote/default.nix @@ -1,33 +1,17 @@ -{ - pkgs, - config, - ... -}: let - USER_ID = 1000; - KEY_FILE = "id_ed25519"; -in { +{pkgs, ...}: { + # Password set imperatively via `passwd` + # so `mutableUsers = false` doesn't accidentally lock out SDDM/TTY + users.mutableUsers = true; + users.users.coyote = { isNormalUser = true; description = "coyote"; - extraGroups = ["wheel" "networkmanager" "lp" "scanner"]; - uid = USER_ID; + extraGroups = ["wheel" "networkmanager" "lp" "scanner" "video" "render" "input" "audio" "kvm"]; + uid = 1000; }; - users.defaultUserShell = pkgs.unstable.fish; + users.defaultUserShell = pkgs.fish; - # daemon blurb to get SSH for Git working - environment.sessionVariables.SSH_AUTH_SOCK = "/run/user/${builtins.toString USER_ID}/ssh-agent"; - - systemd.user.services.ssh-add-key = { - wantedBy = ["default.target"]; - after = ["ssh-agent.service"]; - serviceConfig = { - Type = "oneshot"; - ExecStartPre = "${pkgs.coreutils-full}/bin/sleep 1"; - ExecStart = [ - "${pkgs.openssh}/bin/ssh-add ${config.users.users.coyote.home}/.ssh/${KEY_FILE}" - ]; - Restart = "on-failure"; - RestartSec = 1; - }; + environment.sessionVariables = { + NH_FLAKE = "/home/coyote/NixOS"; }; } diff --git a/modules/users/coyote/home-manager-module.nix b/modules/users/coyote/home-manager-module.nix index fefabde..1159582 100644 --- a/modules/users/coyote/home-manager-module.nix +++ b/modules/users/coyote/home-manager-module.nix @@ -3,6 +3,7 @@ home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; + home-manager.backupFileExtension = "backup"; home-manager.extraSpecialArgs = {inherit inputs;}; home-manager.users.coyote.imports = [../../../home/coyote]; }