Initial commit

This commit is contained in:
Nox Sluijtman 2023-12-16 19:26:15 +01:00
commit a43b5a6a1a
12 changed files with 550 additions and 0 deletions

7
flake.nix Normal file
View file

@ -0,0 +1,7 @@
{ description = "A few settings";
outputs = _: {
nixosModules = {
voidcruiser = import ./modules/desktop;
};
};
}

20
modules/audio.nix Normal file
View file

@ -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;
};
};
}

12
modules/default.nix Normal file
View file

@ -0,0 +1,12 @@
{...}:{
imports = [
./audio.nix
./font.nix
./nix-settings.nix
./nvidia.nix
./services.nix
./vim.nix
./xconfig.nix
./zsh.nix
];
}

82
modules/font.nix Normal file
View file

@ -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 = ''
<fontconfig>
<match target="scan">
<test name="family">
<string>APL385 Unicode</string>
</test>
<edit name="spacing">
<int>100</int>
</edit>
</match>
<match target="scan">
<test name="family">
<string>BQN386 Unicode</string>
</test>
<edit name="spacing">
<int>100</int>
</edit>
</match>
<match target="scan">
<test name="family">
<string>Uiua386</string>
</test>
<edit name="spacing">
<int>100</int>
</edit>
</match>
</fontconfig>
'';
};
};
};
}

BIN
modules/images/city.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

73
modules/misc/bqn Normal file
View file

@ -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 <SPCE> { [ U0203F ] }; // space ‿
key <TLDE> { [ U002DC, U000AC ] }; // `˜¬
key <AE01> { [ U002D8, U02389 ] }; // 1˘⎉
key <AE02> { [ U000A8, U02687 ] }; // 2¨⚇
key <AE03> { [ U0207C, U0235F ] }; // 3⁼⍟
key <AE04> { [ U0231C, U025F6 ] }; // 4⌜
key <AE05> { [ U000B4, U02298 ] }; // 5´
key <AE06> { [ U002DD, U0238A ] }; // 6˝⎊
key <AE07> { [ U000AF, U0234E ] }; // 7 ⍎
key <AE08> { [ U0221E, U02355 ] }; // 8∞⍕
key <AE09> { [ U000AF, U027E8 ] }; // 9¯⟨
key <AE10> { [ U02022, U027E9 ] }; // 0•⟩
key <AE11> { [ U000F7, U0221A ] }; // -÷√
key <AE12> { [ U000D7, U022C6 ] }; // =×⋆
key <AD01> { [ U0233D, U02199 ] }; // Q⌽↙
key <AD02> { [ U1D568, U1D54E ] }; // W𝕨𝕎
key <AD03> { [ U0220A, U02377 ] }; // E∊⍷
key <AD04> { [ U02191, U1D563 ] }; // R↑𝕣
key <AD05> { [ U02227, U0234B ] }; // T∧⍋
key <AD06> { [ ] }; // Y
key <AD07> { [ U02294 ] }; // U⊔
key <AD08> { [ U0228F, U02291 ] }; // I⊏⊑
key <AD09> { [ U02290, U02292 ] }; // O⊐⊒
key <AD10> { [ U003C0, U02373 ] }; // Pπ
key <AD11> { [ U02190, U022A3 ] }; // [←⊣
key <AD12> { [ U02192, U022A2 ] }; // ]→⊢
key <AC01> { [ U02349, U02196 ] }; // A⍉↖
key <AC02> { [ U1D564, U1D54A ] }; // S𝕤𝕊
key <AC03> { [ U02195 ] }; // D↕
key <AC04> { [ U1D557, U1D53D ] }; // F𝕗𝔽
key <AC05> { [ U1D558, U1D53E ] }; // G𝕘𝔾
key <AC06> { [ U022B8, U000AB ] }; // H⊸«
key <AC07> { [ U02218 ] }; // J∘
key <AC08> { [ U025CB, U0233E ] }; // K○⌾
key <AC09> { [ U027DC, U000BB ] }; // L⟜»
key <AC10> { [ U022C4, U000B7 ] }; // ;⋄·
key <AC11> { [ U021A9, U002D9 ] }; // '↩˙
key <AC12> { [ ] }; // /
key <AB01> { [ U0294A, U022C8 ] }; // Z⥊⋈
key <AB02> { [ U1D569, U1D54F ] }; // X𝕩𝕏
key <AB03> { [ U02193 ] }; // C↓
key <AB04> { [ U02228, U02352 ] }; // V
key <AB05> { [ U0230A, U02308 ] }; // B⌊⌈
key <AB06> { [ ] }; // N
key <AB07> { [ U02261, U02262 ] }; // M≡≢
key <AB08> { [ U0223E, U02264 ] }; // ,∾≤
key <AB09> { [ U0224D, U02265 ] }; // .≍≥
key <AB10> { [ U02260, U021D0 ] }; // /≠⇐
key <LSGT> { [ U02264, U02265 ] }; // <≤≥
};

41
modules/nix-settings.nix Normal file
View file

@ -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" ];
};
};
}

27
modules/nvidia.nix Normal file
View file

@ -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"];
};
}

114
modules/services.nix Normal file
View file

@ -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;
};
};
};
};
};
}

64
modules/vim.nix Normal file
View file

@ -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
'';
};
})
];
};
};
}

68
modules/xconfig.nix Normal file
View file

@ -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;
};
};
};
};
}

42
modules/zsh.nix Normal file
View file

@ -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";
};
};
};
};
}