commit a43b5a6a1ae52d256ef88547f8caf8b66162a04a Author: Marty Sluijtman Date: Sat Dec 16 19:26:15 2023 +0100 Initial commit diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..2b4aa38 --- /dev/null +++ b/flake.nix @@ -0,0 +1,7 @@ +{ description = "A few settings"; + outputs = _: { + nixosModules = { + voidcruiser = import ./modules/desktop; + }; + }; +} diff --git a/modules/audio.nix b/modules/audio.nix new file mode 100644 index 0000000..626672f --- /dev/null +++ b/modules/audio.nix @@ -0,0 +1,20 @@ +{ lib, config, ... }: +with lib; +let cfg = config.voidcruiser.audio; +in { + options.voidcruiser.audio = { + enable = mkEnableOption "Enable all the audio daemons"; + }; + config = mkIf cfg.enable { + sound.enable = true; + hardware.pulseaudio.enable = false; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + wireplumber.enable = true; + }; + }; +} diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..4d8bcb4 --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,12 @@ +{...}:{ + imports = [ + ./audio.nix + ./font.nix + ./nix-settings.nix + ./nvidia.nix + ./services.nix + ./vim.nix + ./xconfig.nix + ./zsh.nix + ]; +} diff --git a/modules/font.nix b/modules/font.nix new file mode 100644 index 0000000..fa82349 --- /dev/null +++ b/modules/font.nix @@ -0,0 +1,82 @@ +{ pkgs, config, lib, ... }: +with lib; +let cfg = config.voidcruiser.fontConfig; +in { + options.voidcruiser.fontConfig = { + enable = mkEnableOption "Enable opinionated font configuration"; + joyPixels = mkEnableOption "Enables the JoyPixels font"; + }; + config = mkIf cfg.enable { + fonts = { + fontDir.enable = true; + packages = with pkgs; [ + (nerdfonts.override { fonts = [ "FiraCode" "Iosevka" ]; }) + jetbrains-mono + iosevka + fira-code + fira + font-awesome + liberation_ttf + libertine + libertinus + vollkorn + noto-fonts-emoji + noto-fonts + ipafont + bqn386 + blackout + prociono + mplus-outline-fonts.githubRelease + mononoki + uiua386 + ]; + fontconfig = { + enable = true; + includeUserConf = true; + antialias = true; + hinting.enable = true; + + defaultFonts = { + serif = [ "Vollkorn" "Fira Code" "IPAMincho" "Noto Color Emoji" ]; + sansSerif = [ "FiraSans" "Fira Code" "IPAGothic" "Noto Color Emoji" ]; + monospace = [ "Fira Code" "JetBrains Mono" "Iosevka" "IPAGothic" "Noto Color Emoji" ]; + emoji = [ "Noto Color Emoji" (mkIf cfg.joyPixels "JoyPixels") ]; + }; + + localConf = '' + + + + + APL385 Unicode + + + 100 + + + + + + BQN386 Unicode + + + 100 + + + + + + Uiua386 + + + 100 + + + + + ''; + + }; + }; + }; +} diff --git a/modules/images/city.png b/modules/images/city.png new file mode 100644 index 0000000..90784df Binary files /dev/null and b/modules/images/city.png differ diff --git a/modules/misc/bqn b/modules/misc/bqn new file mode 100644 index 0000000..90866f4 --- /dev/null +++ b/modules/misc/bqn @@ -0,0 +1,73 @@ +// XKB configuration file +// +// ┌────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬─────────┐ +// │~ ¬ │! ⎉ │@ ⚇ │# ⍟ │$ ◶ │% ⊘ │^ ⎊ │& ⍎ │* ⍕ │( ⟨ │) ⟩ │_ √ │+ ⋆ │Backspace│ +// │` ˜ │1 ˘ │2 ¨ │3 ⁼ │4 ⌜ │5 ´ │6 ˝ │7 │8 ∞ │9 ¯ │0 • │- ÷ │= × │ │ +// ├────┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬──────┤ +// │Tab │Q ↙ │W 𝕎 │E ⍷ │R 𝕣 │T ⍋ │Y │U │I ⊑ │O ⊒ │P ⍳ │{ ⊣ │} ⊢ │| │ +// │ │q ⌽ │w 𝕨 │e ∊ │r ↑ │t ∧ │y │u ⊔ │i ⊏ │o ⊐ │p π │[ ← │] → │\ │ +// ├───────┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴──────┤ +// │Caps │A ↖ │S 𝕊 │D │F 𝔽 │G 𝔾 │H « │J │K ⌾ │L » │: · │" ˙ │Enter │ +// │Lock │a ⍉ │s 𝕤 │d ↕ │f 𝕗 │g 𝕘 │h ⊸ │j ∘ │k ○ │l ⟜ │; ⋄ │' ↩ │ │ +// ├────────┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──────────┤ +// │Shift │Z ⋈ │X 𝕏 │C │V ⍒ │B ⌈ │N │M ≢ │< ≤ │> ≥ │? ⇐ │Shift │ +// │ │z ⥊ │x 𝕩 │c ↓ │v ∨ │b ⌊ │n │m ≡ │, ∾ │. ≍ │/ ≠ │ │ +// └───────────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────────────┘ +// Space: ‿ + +xkb_symbols "bqn" { + name[Group1]= "bqn"; + + key { [ U0203F ] }; // space ‿ + key { [ U002DC, U000AC ] }; // `˜¬ + key { [ U002D8, U02389 ] }; // 1˘⎉ + key { [ U000A8, U02687 ] }; // 2¨⚇ + key { [ U0207C, U0235F ] }; // 3⁼⍟ + key { [ U0231C, U025F6 ] }; // 4⌜ + key { [ U000B4, U02298 ] }; // 5´⊘ + key { [ U002DD, U0238A ] }; // 6˝⎊ + key { [ U000AF, U0234E ] }; // 7 ⍎ + key { [ U0221E, U02355 ] }; // 8∞⍕ + key { [ U000AF, U027E8 ] }; // 9¯⟨ + key { [ U02022, U027E9 ] }; // 0•⟩ + key { [ U000F7, U0221A ] }; // -÷√ + key { [ U000D7, U022C6 ] }; // =×⋆ + + key { [ U0233D, U02199 ] }; // Q⌽↙ + key { [ U1D568, U1D54E ] }; // W𝕨𝕎 + key { [ U0220A, U02377 ] }; // E∊⍷ + key { [ U02191, U1D563 ] }; // R↑𝕣 + key { [ U02227, U0234B ] }; // T∧⍋ + key { [ ] }; // Y + key { [ U02294 ] }; // U⊔ + key { [ U0228F, U02291 ] }; // I⊏⊑ + key { [ U02290, U02292 ] }; // O⊐⊒ + key { [ U003C0, U02373 ] }; // Pπ⍳ + key { [ U02190, U022A3 ] }; // [←⊣ + key { [ U02192, U022A2 ] }; // ]→⊢ + + key { [ U02349, U02196 ] }; // A⍉↖ + key { [ U1D564, U1D54A ] }; // S𝕤𝕊 + key { [ U02195 ] }; // D↕ + key { [ U1D557, U1D53D ] }; // F𝕗𝔽 + key { [ U1D558, U1D53E ] }; // G𝕘𝔾 + key { [ U022B8, U000AB ] }; // H⊸« + key { [ U02218 ] }; // J∘ + key { [ U025CB, U0233E ] }; // K○⌾ + key { [ U027DC, U000BB ] }; // L⟜» + key { [ U022C4, U000B7 ] }; // ;⋄· + key { [ U021A9, U002D9 ] }; // '↩˙ + key { [ ] }; // / + + key { [ U0294A, U022C8 ] }; // Z⥊⋈ + key { [ U1D569, U1D54F ] }; // X𝕩𝕏 + key { [ U02193 ] }; // C↓ + key { [ U02228, U02352 ] }; // V∨⍒ + key { [ U0230A, U02308 ] }; // B⌊⌈ + key { [ ] }; // N + key { [ U02261, U02262 ] }; // M≡≢ + key { [ U0223E, U02264 ] }; // ,∾≤ + key { [ U0224D, U02265 ] }; // .≍≥ + key { [ U02260, U021D0 ] }; // /≠⇐ + key { [ U02264, U02265 ] }; // <≤≥ +}; diff --git a/modules/nix-settings.nix b/modules/nix-settings.nix new file mode 100644 index 0000000..b0a1371 --- /dev/null +++ b/modules/nix-settings.nix @@ -0,0 +1,41 @@ +{ lib, config, ... }: +with lib; +let cfg = config.nixSettings; +in { + options.nixSettings = { + gc = { + automatic = mkOption { + type = types.bool; + default = true; + description = "Enables automatic garbage collection"; + }; + dates = mkOption { + type = types.str; + default = "weekly"; + example = "03:15"; + description = mdDoc '' + How often or when garbage collection is performed. For most desktop and server systems + a sufficient garbage collection is once a week. + + The format is described in + {manpage}`systemd.time(7)`. + ''; + }; + }; + }; + config = { + nix = { + settings = { + trusted-users = [ + "root" + "@wheel" + ]; + }; + gc = { + automatic = cfg.gc.automatic; + dates = cfg.gc.dates; + }; + settings.experimental-features = [ "flakes" "nix-command" ]; + }; + }; +} diff --git a/modules/nvidia.nix b/modules/nvidia.nix new file mode 100644 index 0000000..f9a87a9 --- /dev/null +++ b/modules/nvidia.nix @@ -0,0 +1,27 @@ +{ lib, config, ... }: +with lib; +let cfg = config.voidcruiser.nvidia; +in { + options.voidcruiser.nvidia = { + enable = mkEnableOption "Enables proprietary Nvidia drivers and related config"; + }; + config = mkIf cfg.enable { + hardware = { + opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; + nvidia = { + package = config.boot.kernelPackages.nvidiaPackages.stable; + powerManagement = { + enable = false; + finegrained = false; + }; + open = false; + nvidiaSettings = true; + }; + }; + services.xserver.videoDrivers = ["nvidia"]; + }; +} diff --git a/modules/services.nix b/modules/services.nix new file mode 100644 index 0000000..fa278b2 --- /dev/null +++ b/modules/services.nix @@ -0,0 +1,114 @@ +{ config, lib, pkgs, ... }: +with lib; +let cfg = config.voidcruiser.services; +in { + options.voidcruiser.services = { + + flatpak = { + enable = mkEnableOption "Enables basic flatpak configuration"; + }; + + yggdrasil = { + enable = mkEnableOption "Enables opinionated Yggdrasil configuration"; + persistentKeys = mkEnableOption "Prevents keys from being randomised"; + }; + + i2p = { + enable = mkEnableOption "Enables opinionated i2p container config"; + autoStart = mkEnableOption "Enables autostart for container"; + }; + + ssh = { + enable = mkEnableOption "Enables opinionated ssh config"; + passwordLogin = mkEnableOption "Enables password login"; + }; + + }; + config = { + +# flatpak + + xdg.portal = mkIf cfg.flatpak.enable { + enable = true; + wlr.enable = true; + extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + config.common.default = "*"; + }; + +# ssh + + programs.ssh = mkIf cfg.ssh.enable { + startAgent = true; + }; + + services = { + +# flatpak + + flatpak.enable = cfg.flatpak.enable; + dbus.enable = cfg.flatpak.enable; + +# yggdrasil + + yggdrasil = mkIf cfg.yggdrasil.enable { + enable = true; + persistentKeys = cfg.yggdrasil.persistentKeys; + settings = { + Peers = [ + "tls://109.107.173.235:9111" + "tls://94.103.82.150:8080" + "tcp://vpn.itrus.su:7991" + "tls://45.147.198.155:6010" + "tcp://ygg-nl.incognet.io:8883" + "tls://ygg-nl.incognet.io:8884" + "tls://23.137.249.65:443" + "tls://aaoth.xyz:25565" + "tcp://aaoth.xyz:7777" + "tls://23.137.251.45:5222" + "tls://x-ams-0.sergeysedoy97.ru:65535" + "tls://s-ams-0.sergeysedoy97.ru:65535" + "tls://89.22.237.91:65535" + "tls://[2a0d:8480:1:f9::]:65535" + "tls://x-ams-1.sergeysedoy97.ru:65535" + "tls://s-ams-1.sergeysedoy97.ru:65535" + "tls://79.137.194.94:65535" + ]; + }; + }; + openssh = mkIf cfg.ssh.enable { + enable = true; + settings = { + PasswordAuthentication = cfg.ssh.passwordLogin; + }; + }; + }; + +# i2p container + + containers.i2pd-container = mkIf cfg.i2p.enable { + autoStart = cfg.i2p.autoStart; + config = { + system.stateVersion = "23.11"; # Did you read the comment? + + networking.firewall.allowedTCPPorts = [ + 7656 + 7070 + 4447 + 4444 + ]; + + services.i2pd = { + enable = true; + address = "127.0.0.1"; + proto = { + socksProxy.enable = true; + httpProxy.enable = true; + http.enable = true; + sam.enable = true; + }; + }; + + }; + }; + }; +} diff --git a/modules/vim.nix b/modules/vim.nix new file mode 100644 index 0000000..afc04db --- /dev/null +++ b/modules/vim.nix @@ -0,0 +1,64 @@ +{ config, lib, pkgs, ... }: +with lib; +let cfg = config.voidcruiser.vim; +in { + options.voidcruiser.vim = { + enable = mkEnableOption "Enables opinionated vim configuration"; + enableNvim = mkEnableOption "Enables neovim and alias"; + setEnvVar = mkOption { + type = types.bool; + default = true; + description = '' + Set 'vim' as $EDITOR + ''; + }; + }; + + config = mkIf cfg.enable { + + programs.nano.enable = false; + + environment = { + + variables = mkIf cfg.setEnvVar { EDITOR = "vim"; }; + + systemPackages = with pkgs; [ + + (mkIf cfg.enableNvim (neovim.override { vimAlias = true; })) + + ((vim_configurable.override { }).customize { + name = "vim"; + vimrcConfig = { + packages.myplugs = with pkgs.vimPlugins; { + start = [ vim-nix ]; + opt = []; + }; + customRC = '' + syntax on + set nocompatible + set ignorecase + set hlsearch + set incsearch + set autoindent + set smartindent + set wildmenu + set expandtab + set shiftwidth=4 + set tabstop=4 + set number + set relativenumber + set mouse= + set listchars=tab:│\ ,trail:· + set list + set scrolloff=3 + set notimeout + set backspace=2 + au FileType nix setlocal shiftwidth=2 tabstop=2 expandtab + au FileType haskell,tex setlocal shiftwidth=4 tabstop=4 expandtab + ''; + }; + }) + ]; + }; + }; +} diff --git a/modules/xconfig.nix b/modules/xconfig.nix new file mode 100644 index 0000000..bb6505b --- /dev/null +++ b/modules/xconfig.nix @@ -0,0 +1,68 @@ +{ config, lib, ... }: +with lib; +let cfg = config.voidcruiser.xconfig; +in { + options.voidcruiser.xconfig = { + + enable = mkEnableOption "Enables opinionated xorg config"; + + bqn.enable = mkEnableOption "Enables bqn layout"; + + touchpad.enableProperConfig = mkEnableOption "Enable the only correct touchpad settings"; + + mouse.accelProfile = mkOption { + type = types.enum [ "flat" "adaptive" ]; + default = "flat"; + example = "adaptive"; + description = '' + Use addaptive on trackball and touchpad; and flat on any normal mouse. + ''; + }; + + displayManager.background = mkOption { + default = ./images/city.png; + type = types.path; + description = '' + Display manager background. + ''; + }; + + }; + + config = mkIf cfg.enable { + + services.xserver = { + + extraLayouts.bqn = mkIf cfg.bqn.enable { + description = "BQN layout"; + languages = [ "bqn" ]; + symbolsFile = ./misc/bqn; + }; + layout = (if cfg.bqn.enable then "us,bqn" else "us"); + xkbOptions = mkIf cfg.bqn.enable "grp:switch"; + + enable = true; + autoRepeatDelay = 250; + autoRepeatInterval = 30; + windowManager = { + windowmaker.enable = true; + xmonad.enable = true; + }; + displayManager.lightdm = { + enable = true; + greeters.gtk.enable = true; + background = cfg.displayManager.background; + }; + libinput = { + mouse = { + accelProfile = cfg.mouse.accelProfile; + middleEmulation = false; + }; + touchpad = mkIf cfg.touchpad.enableProperConfig { + tapping = false; + disableWhileTyping = true; + }; + }; + }; + }; +} diff --git a/modules/zsh.nix b/modules/zsh.nix new file mode 100644 index 0000000..3926a6f --- /dev/null +++ b/modules/zsh.nix @@ -0,0 +1,42 @@ +{ config, lib, ... }: +with lib; +let cfg = config.voidcruiser.zsh; +in { + options.voidcruiser.zsh = { + enable = mkEnableOption "Enables opinionated zsh configuration"; + skim.enable = mkEnableOption "Enables skim support for shell history"; + highlightStyle = mkOption { + type = types.str; + default = "fg=magenta,bg=black,bold,underline"; + description = '' + Colors for zsh autosuggestions. Check the documentation for more info. + ''; + }; + }; + config = mkIf cfg.enable { + programs = { + skim.keybindings = cfg.skim.enable; + zsh = { + enable = true; + enableCompletion = true; + autosuggestions = { + enable = true; + highlightStyle = cfg.highlightStyle; + async = true; + }; + syntaxHighlighting = { + enable = true; + }; + shellAliases = { + ls = "ls --color=tty"; + l = "ls -lah"; + la = "ls -a"; + lr = "ls -rt"; + llr = "ls -lhrt"; + llar = "ls -lhArt"; + grep = "grep --color=auto"; + }; + }; + }; + }; +}