Format the entire project.

This commit is contained in:
Kevin Baensch 2023-09-11 20:23:04 +02:00
parent 1dc50ae17d
commit 6f9db5e3a4
Signed by: derped
GPG key ID: C0F1D326C7626543
115 changed files with 3451 additions and 2901 deletions

View file

@ -1,10 +1,12 @@
{ config, lib, pkgs, ... }:
with lib;
{
config,
lib,
pkgs,
...
}:
with lib; {
environment.etc = mkIf (elem "etcfiles" config.machine.conffiles) {
"rofi.rasi".source = (import ./etc/rofi.rasi.nix { inherit pkgs; });
"rofi.rasi".source = import ./etc/rofi.rasi.nix {inherit pkgs;};
"i3/py3status".source = ./etc/i3/py3status;
"sway/config".source = mkDefault ./etc/sway/config;
"mpv/input.conf".source = ./etc/mpv/input.conf;

View file

@ -1,96 +1,94 @@
{ pkgs, ... }:
{pkgs, ...}: (pkgs.writeText "config" ''
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
(pkgs.writeText "config" ''
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
exec redshift-gtk -l 51.0504:13.7373
exec redshift-gtk -l 51.0504:13.7373
### START USER CONFIG ###
set $mod Mod4
workspace "HDMI" output HDMI1
workspace_auto_back_and_forth yes
new_window pixel
hide_edge_borders both
### START USER CONFIG ###
set $mod Mod4
workspace "HDMI" output HDMI1
workspace_auto_back_and_forth yes
new_window pixel
hide_edge_borders both
exec setxkbmap de
exec setxkbmap de
#exec compton -f
exec ${pkgs.feh}/bin/feh --bg-scale $(xdg-user-dir PICTURES)/wallpaper.jpg
#exec pulseaudio -D
exec fcitx5
#exec env=LC_CTYPE=zh_CN.UTF-8 emacs --daemon
#exec conky -c $HOME/.my_little_conky/.conkyrc
#exec xsnow -nosanta -norudolf -notrees
#exec $LOCK
#exec compton -f
exec ${pkgs.feh}/bin/feh --bg-scale $(xdg-user-dir PICTURES)/wallpaper.jpg
#exec pulseaudio -D
exec fcitx5
#exec env=LC_CTYPE=zh_CN.UTF-8 emacs --daemon
#exec conky -c $HOME/.my_little_conky/.conkyrc
#exec xsnow -nosanta -norudolf -notrees
#exec $LOCK
### END USER CONFIG ###
### END USER CONFIG ###
### START USER PROGRAMMS ###
### START USER PROGRAMMS ###
### END USER PROGRAMMS ###
### END USER PROGRAMMS ###
### START MEDIA BINDSYM ###
### START MEDIA BINDSYM ###
bindsym XF86AudioPlay exec ${pkgs.playerctl}/bin/playerctl play
bindsym XF86AudioPause exec ${pkgs.playerctl}/bin/playerctl pause
bindsym XF86AudioNext exec ${pkgs.playerctl}/bin/playerctl next
bindsym XF86AudioPrev exec ${pkgs.playerctl}/bin/playerctl previous
bindsym XF86AudioPlay exec ${pkgs.playerctl}/bin/playerctl play
bindsym XF86AudioPause exec ${pkgs.playerctl}/bin/playerctl pause
bindsym XF86AudioNext exec ${pkgs.playerctl}/bin/playerctl next
bindsym XF86AudioPrev exec ${pkgs.playerctl}/bin/playerctl previous
bindsym $mod+Mod1+space exec ${pkgs.playerctl}/bin/playerctl play-pause
bindsym $mod+Mod1+Left exec ${pkgs.playerctl}/bin/playerctl position 10-
bindsym $mod+Mod1+Right exec ${pkgs.playerctl}/bin/playerctl position 10+
bindsym $mod+Mod1+Down exec ${pkgs.playerctl}/bin/playerctl next
bindsym $mod+Mod1+Up exec ${pkgs.playerctl}/bin/playerctl previous
bindsym $mod+Mod1+space exec ${pkgs.playerctl}/bin/playerctl play-pause
bindsym $mod+Mod1+Left exec ${pkgs.playerctl}/bin/playerctl position 10-
bindsym $mod+Mod1+Right exec ${pkgs.playerctl}/bin/playerctl position 10+
bindsym $mod+Mod1+Down exec ${pkgs.playerctl}/bin/playerctl next
bindsym $mod+Mod1+Up exec ${pkgs.playerctl}/bin/playerctl previous
bindsym $mod+Shift+w sticky toggle
bindsym $mod+Shift+B floating enable; border none; resize set 900 600; move position 1020 19
bindsym $mod+Shift+w sticky toggle
bindsym $mod+Shift+B floating enable; border none; resize set 900 600; move position 1020 19
### END MEDIA BINDSYM ###
### END MEDIA BINDSYM ###
### START BINDSYM ###
### START BINDSYM ###
bindsym $mod+b border toggle
bindsym $mod+m bar mode toggle
bindsym $mod+y move container to output left
bindsym $mod+x move container to output right
bindsym $mod+Shift+y move workspace to output left
bindsym $mod+Shift+x move workspace to output right
bindsym $mod+l exec ${pkgs.i3lock}/bin/i3lock -efc 000000
bindsym $mod+minus exec ${pkgs.alsa-utils}/bin/amixer -c 0 sset Master 1%-
bindsym $mod+plus exec ${pkgs.alsa-utils}/bin/amixer -c 0 sset Master 1%+
bindsym $mod+Mod1+minus exec ${pkgs.alsa-utils}/bin/amixer -D pulse sset Master 1%-
bindsym $mod+Mod1+plus exec ${pkgs.alsa-utils}/bin/amixer -D pulse sset Master 1%+
bindsym $mod+Shift+minus exec ${pkgs.acpilight}/bin/xbacklight -5
bindsym $mod+Shift+plus exec ${pkgs.acpilight}/bin/xbacklight +5
bindsym $mod+Ctrl+0 exec ${pkgs.acpilight}/bin/xbacklight -set 0
bindsym $mod+Ctrl+1 exec ${pkgs.acpilight}/bin/xbacklight -set 10
bindsym $mod+Ctrl+2 exec ${pkgs.acpilight}/bin/xbacklight -set 20
bindsym $mod+Ctrl+3 exec ${pkgs.acpilight}/bin/xbacklight -set 30
bindsym $mod+Ctrl+4 exec ${pkgs.acpilight}/bin/xbacklight -set 40
bindsym $mod+Ctrl+5 exec ${pkgs.acpilight}/bin/xbacklight -set 50
bindsym $mod+Ctrl+6 exec ${pkgs.acpilight}/bin/xbacklight -set 60
bindsym $mod+Ctrl+7 exec ${pkgs.acpilight}/bin/xbacklight -set 70
bindsym $mod+Ctrl+8 exec ${pkgs.acpilight}/bin/xbacklight -set 80
bindsym $mod+Ctrl+9 exec ${pkgs.acpilight}/bin/xbacklight -set 90
bindsym $mod+p move scratchpad
bindsym $mod+Shift+p scratchpad show
bindsym --release $mod+Ctrl+s exec scrot
bindsym --release $mod+Ctrl+d exec "scrot --select"
bindsym --release $mod+Ctrl+a exec "scrot -s '/tmp/%F_%T_$wx$h.png' -e 'xclip -selection clipboard -target image/png -i $f && rm $f'"
bindsym $mod+o exec pcmanfm
bindsym $mod+Mod1+1 exec luxa fade --speed 50 '00ff00'
bindsym $mod+Mod1+2 exec luxa fade --speed 50 'ffff00'
bindsym $mod+Mod1+3 exec luxa fade --speed 50 'ff0000'
bindsym $mod+Mod1+4 exec luxa fade --speed 50 '0000ff'
bindsym $mod+Mod1+5 exec luxa fade --speed 50 'ffffff'
### END BINDSYM ###
bindsym $mod+b border toggle
bindsym $mod+m bar mode toggle
bindsym $mod+y move container to output left
bindsym $mod+x move container to output right
bindsym $mod+Shift+y move workspace to output left
bindsym $mod+Shift+x move workspace to output right
bindsym $mod+l exec ${pkgs.i3lock}/bin/i3lock -efc 000000
bindsym $mod+minus exec ${pkgs.alsa-utils}/bin/amixer -c 0 sset Master 1%-
bindsym $mod+plus exec ${pkgs.alsa-utils}/bin/amixer -c 0 sset Master 1%+
bindsym $mod+Mod1+minus exec ${pkgs.alsa-utils}/bin/amixer -D pulse sset Master 1%-
bindsym $mod+Mod1+plus exec ${pkgs.alsa-utils}/bin/amixer -D pulse sset Master 1%+
bindsym $mod+Shift+minus exec ${pkgs.acpilight}/bin/xbacklight -5
bindsym $mod+Shift+plus exec ${pkgs.acpilight}/bin/xbacklight +5
bindsym $mod+Ctrl+0 exec ${pkgs.acpilight}/bin/xbacklight -set 0
bindsym $mod+Ctrl+1 exec ${pkgs.acpilight}/bin/xbacklight -set 10
bindsym $mod+Ctrl+2 exec ${pkgs.acpilight}/bin/xbacklight -set 20
bindsym $mod+Ctrl+3 exec ${pkgs.acpilight}/bin/xbacklight -set 30
bindsym $mod+Ctrl+4 exec ${pkgs.acpilight}/bin/xbacklight -set 40
bindsym $mod+Ctrl+5 exec ${pkgs.acpilight}/bin/xbacklight -set 50
bindsym $mod+Ctrl+6 exec ${pkgs.acpilight}/bin/xbacklight -set 60
bindsym $mod+Ctrl+7 exec ${pkgs.acpilight}/bin/xbacklight -set 70
bindsym $mod+Ctrl+8 exec ${pkgs.acpilight}/bin/xbacklight -set 80
bindsym $mod+Ctrl+9 exec ${pkgs.acpilight}/bin/xbacklight -set 90
bindsym $mod+p move scratchpad
bindsym $mod+Shift+p scratchpad show
bindsym --release $mod+Ctrl+s exec scrot
bindsym --release $mod+Ctrl+d exec "scrot --select"
bindsym --release $mod+Ctrl+a exec "scrot -s '/tmp/%F_%T_$wx$h.png' -e 'xclip -selection clipboard -target image/png -i $f && rm $f'"
bindsym $mod+o exec pcmanfm
bindsym $mod+Mod1+1 exec luxa fade --speed 50 '00ff00'
bindsym $mod+Mod1+2 exec luxa fade --speed 50 'ffff00'
bindsym $mod+Mod1+3 exec luxa fade --speed 50 'ff0000'
bindsym $mod+Mod1+4 exec luxa fade --speed 50 '0000ff'
bindsym $mod+Mod1+5 exec luxa fade --speed 50 'ffffff'
### END BINDSYM ###
### START MODES ###
### START MODES ###
mode "ACPI Events" {
mode "ACPI Events" {
bindsym p exec systemctl poweroff; mode "default"
bindsym h exec systemctl hibernate; mode "default"
bindsym s exec systemctl suspend; mode "default"
@ -101,138 +99,138 @@ mode "ACPI Events" {
bindsym Return mode "default"
bindsym Escape mode "default"
}
}
mode "Power Mode"{
mode "Power Mode"{
bindsym s exec xbacklight -set 5; exec rfkill block all ; exec xset -b +dpms; mode "default"
bindsym p exec xbacklight -set 100; exec rfkill unblock all; exec xset -dpms; mode "default"
bindsym Return mode "default"
bindsym Escape mode "default"
}
}
mode "No Keybinds" {
mode "No Keybinds" {
bindsym $mod+Shift+Escape mode "default"
}
}
bindsym $mod+F12 mode "ACPI Events"
bindsym $mod+F11 mode "No Keybinds"
bindsym $mod+F10 mode "Power Mode"
bindsym $mod+F12 mode "ACPI Events"
bindsym $mod+F11 mode "No Keybinds"
bindsym $mod+F10 mode "Power Mode"
### END MODES ###
### END MODES ###
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
#font pango:monospace 8
#font pango:System San Francisco Display 8
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
#font pango:monospace 8
#font pango:System San Francisco Display 8
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
font pango:DejaVu Sans Mono 8
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
font pango:DejaVu Sans Mono 8
# Before i3 v4.8, we used to recommend this one as the default:
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# The font above is very space-efficient, that is, it looks good, sharp and
# clear in small sizes. However, its unicode glyph coverage is limited, the old
# X core fonts rendering does not support right-to-left and this being a bitmap
# font, it doesnt scale on retina/hidpi displays.
# Before i3 v4.8, we used to recommend this one as the default:
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# The font above is very space-efficient, that is, it looks good, sharp and
# clear in small sizes. However, its unicode glyph coverage is limited, the old
# X core fonts rendering does not support right-to-left and this being a bitmap
# font, it doesnt scale on retina/hidpi displays.
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# start a terminal
bindsym $mod+Shift+Return exec emacsclient -c
bindsym $mod+Mod1+Return exec emacsclient -c -e '(eshell t)'
bindsym $mod+Return exec alacritty
# start a terminal
bindsym $mod+Shift+Return exec emacsclient -c
bindsym $mod+Mod1+Return exec emacsclient -c -e '(eshell t)'
bindsym $mod+Return exec alacritty
# kill focused window
bindsym $mod+Shift+q kill
# kill focused window
bindsym $mod+Shift+q kill
# start dmenu (a program launcher)
bindsym $mod+d exec ${pkgs.rofi}/bin/rofi -config /etc/rofi.rasi -show combi
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
# start dmenu (a program launcher)
bindsym $mod+d exec ${pkgs.rofi}/bin/rofi -config /etc/rofi.rasi -show combi
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+odiaeresis move right
#bindsym $mod+Shift+semicolon1 move right
# move focused window
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+odiaeresis move right
#bindsym $mod+Shift+semicolon1 move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split in horizontal orientation
bindsym $mod+h split h
# split in horizontal orientation
bindsym $mod+h split h
# split in vertical orientation
bindsym $mod+v split v
# split in vertical orientation
bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+q layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+q layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
bindsym $mod+s focus child
# focus the child container
bindsym $mod+s focus child
# switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10
# switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
# resize window (you can also use the mouse for that)
mode "resize" {
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windows width.
@ -253,13 +251,13 @@ mode "resize" {
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
}
bindsym $mod+r mode "resize"
bindsym $mod+r mode "resize"
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
position top
status_command py3status -c /etc/i3/py3status
tray_output primary
@ -273,14 +271,14 @@ bar {
inactive_workspace #002b36 #002b36 #aea79f
urgent_workspace #77216f #77216f #ffffff
}
}
client.focused #008666 #000000 #ffffff
client.focused_inactive #000000 #222222 #ffffff
client.unfocused #002b36 #333333 #ffffff #ffffff
client.urgent #aa0000 y#990000 #ffffff
}
client.focused #008666 #000000 #ffffff
client.focused_inactive #000000 #222222 #ffffff
client.unfocused #002b36 #333333 #ffffff #ffffff
client.urgent #aa0000 y#990000 #ffffff
#client.focused #586e75 #586e75 #fdf6e3 #268bd2
#client.focused_inactive #073642 #073642 #93a1a1 #002b36
#client.unfocused #002b36 #002b36 #586e75 #002b36
#client.urgent #dc322f #dc322f #fdf6e3 #dc322f
#client.focused #586e75 #586e75 #fdf6e3 #268bd2
#client.focused_inactive #073642 #073642 #93a1a1 #002b36
#client.unfocused #002b36 #002b36 #586e75 #002b36
#client.urgent #dc322f #dc322f #fdf6e3 #dc322f
'')

View file

@ -1,6 +1,4 @@
{ pkgs }:
let
{pkgs}: let
tabMode = pkgs.writeScript "tab-finder.sh" (with pkgs; ''
#!/usr/bin/env bash
if [ -z ''${1} ]; then
@ -14,12 +12,12 @@ let
exit 0;
'');
in (pkgs.writeText "rofi.rasi" ''
configuration {
configuration {
modi: "combi,window,drun,ssh,tabFinder:${tabMode}";
font: "hack 10";
combi-modi: "window,drun,ssh,tabFinder";
icon-theme: "Papirus";
show-icons: true;
}
@theme "solarized"
}
@theme "solarized"
'')

View file

@ -1,8 +1,11 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
with lib;
mkIf (elem "fonts" config.machine.conffiles) {
mkIf (elem "fonts" config.machine.conffiles) {
fonts = {
fontDir.enable = true;
enableGhostscriptFonts = true;
@ -32,11 +35,11 @@ mkIf (elem "fonts" config.machine.conffiles) {
source-han-sans-korean
source-han-sans-simplified-chinese
source-han-sans-traditional-chinese
# source-sans-pro
# source-sans-pro
symbola
ubuntu_font_family
wqy_microhei
wqy_zenhei
];
};
}
}

View file

@ -1,13 +1,18 @@
{ config, pkgs, ... }:
{
config,
pkgs,
...
}: {
console.keyMap = "de";
i18n = {
defaultLocale = "en_US.UTF-8";
supportedLocales = [ "all" ];
supportedLocales = ["all"];
inputMethod = {
enabled = if config.services.xserver.enable then "fcitx5" else null;
fcitx5.addons = with pkgs; [ fcitx5-chinese-addons fcitx5-mozc fcitx5-table-extra ];
enabled =
if config.services.xserver.enable
then "fcitx5"
else null;
fcitx5.addons = with pkgs; [fcitx5-chinese-addons fcitx5-mozc fcitx5-table-extra];
};
};
}

View file

@ -1,10 +1,11 @@
{ config, lib, ... }:
with lib;
let
{
config,
lib,
...
}:
with lib; let
networkD = config.machine.networkD;
in{
in {
networking = {
hostName = config.machine.hostName;
useNetworkd = networkD.enable;
@ -20,7 +21,7 @@ in{
DHCP = "yes";
DNSSEC = "yes";
DNSOverTLS = "yes";
DNS = [ "1.1.1.1" "1.0.0.1" ];
DNS = ["1.1.1.1" "1.0.0.1"];
};
in {
"40-wired" = {
@ -58,7 +59,8 @@ in{
systemd.services."systemd-networkd-wait-online" = {
enable = mkForce networkD.waitOnline;
serviceConfig.ExecStart = [
"" "${config.systemd.package}/lib/systemd/systemd-networkd-wait-online --any"
""
"${config.systemd.package}/lib/systemd/systemd-networkd-wait-online --any"
];
};
}

View file

@ -1,6 +1,12 @@
{ nixpkgs, nixpkgs-git, nixpkgs-stable, pkgs, config, lib, ... }:
let
{
nixpkgs,
nixpkgs-git,
nixpkgs-stable,
pkgs,
config,
lib,
...
}: let
cfg = config.machine;
emptyGlobalRegistry = pkgs.writeText "registry.json" ''{ "flakes": [], "version": 2 }'';
in {
@ -16,15 +22,19 @@ in {
cores = 1;
sandbox = true;
auto-optimise-store = true;
trusted-substituters = [
trusted-substituters =
[
"https://cache.nixos.org"
] ++ cfg.binaryCaches;
]
++ cfg.binaryCaches;
# TODO: integrate into sops
# trusted-public-keys = [ (lib.fileContents "${cfg.secretPath}/hydra_cache.pub") ];
substituters = [
substituters =
[
"https://cache.nixos.org"
] ++ cfg.binaryCaches;
allowed-users = [ "root" ] ++ (map (n: n.name) cfg.administrators);
]
++ cfg.binaryCaches;
allowed-users = ["root"] ++ (map (n: n.name) cfg.administrators);
};
extraOptions = ''
build-timeout = 86400 # 24 hours

View file

@ -1,10 +1,12 @@
{ config, lib, ... }:
{
config,
lib,
...
}:
with lib;
mkIf (elem "security" config.machine.conffiles) {
mkIf (elem "security" config.machine.conffiles) {
security = {
audit.enable = true;
auditd.enable = true;
};
}
}

View file

@ -1,8 +1,11 @@
{ config, lib, fn, pkgs, ... }:
with lib;
let
{
config,
lib,
fn,
pkgs,
...
}:
with lib; let
withDocker = config.virtualisation.docker.enable;
withPodman = config.virtualisation.podman.enable;
administrators = user: {
@ -14,15 +17,22 @@ let
isNormalUser = true;
name = user.name;
uid = user.id;
subUidRanges = (optional withPodman { startUid = 100000; count = 65536; });
subGidRanges = (optional withPodman { startGid = 100000; count = 65536; });
subUidRanges = optional withPodman {
startUid = 100000;
count = 65536;
};
subGidRanges = optional withPodman {
startGid = 100000;
count = 65536;
};
home = builtins.toPath "/home/${user.name}";
createHome = true;
description = "Administrative user ${user.name}.";
group = user.name;
extraGroups = [ "audio" "wheel" "network" ]
extraGroups =
["audio" "wheel" "network"]
++ (optionals cfg.xserver.enable ["input" "video"])
++ (optionals cfg.printing.enable [ "cups" "lp" ])
++ (optionals cfg.printing.enable ["cups" "lp"])
++ (optional (withDocker && !withPodman) "docker")
++ (optional withPodman "podman");
shell = "${pkgs.zsh}/bin/zsh";
@ -35,14 +45,15 @@ let
value = {
name = user.name;
gid = user.id;
members = [ user.name ];
members = [user.name];
};
};
in {
sops.secrets = (fn.sopsHelper
sops.secrets =
fn.sopsHelper
(user: "users/${user.name}/password")
config.machine.administrators
{ neededForUsers = true; });
{neededForUsers = true;};
users = {
mutableUsers = false;
users = listToAttrs (map administrators config.machine.administrators);

View file

@ -1,8 +1,10 @@
{ config, lib, ... }:
{
config,
lib,
...
}:
with lib;
mkIf (elem "zsh" config.machine.conffiles) {
mkIf (elem "zsh" config.machine.conffiles) {
programs.zsh = {
enable = true;
autosuggestions.enable = true;
@ -29,8 +31,8 @@ mkIf (elem "zsh" config.machine.conffiles) {
ohMyZsh = {
enable = true;
plugins = [ "cabal" "docker" "gitfast" "python" "pip" "sudo" "systemd" "man" ];
plugins = ["cabal" "docker" "gitfast" "python" "pip" "sudo" "systemd" "man"];
theme = "gentoo";
};
};
}
}

View file

@ -1,32 +1,46 @@
{ lib, ... }:
{lib, ...}:
with builtins;
with lib;
let
fn = import (toString ./fn.nix) { inherit lib; };
with lib; let
fn = import (toString ./fn.nix) {inherit lib;};
# Cannot use <hostName> here as those evaluations only work with existing paths >.<
# hostName and secretPtah can be set with -I hostName=$HOSTNAME and -I secretPath=$SECRETPATH respectively
# , defaults to the contents of /secret/hostName
secretPath = fn.ifelse ((tryEval (toString <secretPath>)).value != false)
secretPath =
fn.ifelse ((tryEval (toString <secretPath>)).value != false)
(toString <secretPath>)
(toString /secret);
hostName = (
hostName =
(
findFirst
(elem: elem.prefix == "hostName")
{ path = (fileContents "${secretPath}/hostName"); }
{path = fileContents "${secretPath}/hostName";}
nixPath
).path;
machinePath = (builtins.toPath (./machines + ("/" + hostName)));
machineFiles = fn.lst { p = machinePath; b = true; };
configFiles = fn.lst { p = (toString ./config); b = true; };
pkgsFiles = fn.lst { p = (toString ./pkgs); b = true; };
serviceFiles = fn.lst { p = (toString ./services); b = true; };
)
.path;
machinePath = builtins.toPath (./machines + ("/" + hostName));
machineFiles = fn.lst {
p = machinePath;
b = true;
};
configFiles = fn.lst {
p = toString ./config;
b = true;
};
pkgsFiles = fn.lst {
p = toString ./pkgs;
b = true;
};
serviceFiles = fn.lst {
p = toString ./services;
b = true;
};
in {
imports = [
imports =
[
./options/machine.nix
./services/mailserver/default.nix
] ++ machineFiles
]
++ machineFiles
++ configFiles
++ pkgsFiles
++ serviceFiles;

View file

@ -15,27 +15,53 @@
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, alejandra, mailserver, sops-nix, ... }@attrs: let
outputs = {
self,
nixpkgs,
alejandra,
mailserver,
sops-nix,
...
} @ attrs: let
lib = nixpkgs.lib;
fn = import ./fn.nix { inherit lib; };
fn = import ./fn.nix {inherit lib;};
mappedFormatter = builtins.mapAttrs (arch: packages: packages.default) alejandra.packages;
system = "x86_64-linux";
machineList = fn.lst { p = (toString ./machines); t = "directory"; b = false; };
configFiles = fn.lst { p = (toString ./config); b = true; };
pkgsFiles = fn.lst { p = (toString ./pkgs); b = true; };
serviceFiles = fn.lst { p = (toString ./services); b = true; };
machineList = fn.lst {
p = toString ./machines;
t = "directory";
b = false;
};
configFiles = fn.lst {
p = toString ./config;
b = true;
};
pkgsFiles = fn.lst {
p = toString ./pkgs;
b = true;
};
serviceFiles = fn.lst {
p = toString ./services;
b = true;
};
nixosSystemFor = machine: {
name = machine;
value = let
machinePath = lib.concatStringsSep "/" [(toString ./.) "machines" machine];
machineFiles = lib.filter (name: lib.strings.hasSuffix ".nix" name) (fn.lst { p = machinePath; b = true; });
in nixpkgs.lib.nixosSystem {
machineFiles = lib.filter (name: lib.strings.hasSuffix ".nix" name) (fn.lst {
p = machinePath;
b = true;
});
in
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = attrs // { fn = fn; };
modules = [
specialArgs = attrs // {fn = fn;};
modules =
[
(toString ./options/machine.nix)
sops-nix.nixosModules.sops
] ++ machineFiles
]
++ machineFiles
++ configFiles
++ pkgsFiles
++ serviceFiles;

93
fn.nix
View file

@ -1,27 +1,40 @@
{ lib }:
{lib}:
with builtins;
with lib;
rec {
ifelse = a: b: c: if a then b else c;
with lib; rec {
ifelse = a: b: c:
if a
then b
else c;
fileContentsOr = a: b: (ifelse
(pathIsRegularFile a)
a b);
a
b);
cwd = builtins.getEnv "PWD";
# lst (string PATH) (string FILETYPE) (bool RETURNFULLPATH)
lst = { p ? cwd, t ? "regular", b ? false }: (lists.forEach
lst = {
p ? cwd,
t ? "regular",
b ? false,
}: (lists.forEach
(attrNames
(filterAttrs (n: v: v == t)
(readDir p)))
(v: ((optionalString b "${p}/") + v)));
lsf = p: (lst { p = p; });
lsd = p: (lst { p = p; t = "directory"; b = true; });
lsfRec = p: b: flatten ((map (np: lsfRec np b) (lsd p)) ++ (lst { p = p; b = b; }));
lsf = p: (lst {p = p;});
lsd = p: (lst {
p = p;
t = "directory";
b = true;
});
lsfRec = p: b:
flatten ((map (np: lsfRec np b) (lsd p))
++ (lst {
p = p;
b = b;
}));
hasAttrs = aList: d: (map
(a:
(ifelse (isList a)
(a: (ifelse (isList a)
(hasAttrByPath a d)
(hasAttr a d)))
aList);
@ -30,36 +43,59 @@ rec {
# This might be a tad bit inefficient.
# TODO: look for better implementation (map is a builtin function so checking that probably won't help)
# Sequentially checks elements of list (l) for condition (cond) and executes do on first match.
meetsConDo = cond: do: l: ifelse (l == []) false
meetsConDo = cond: do: l:
ifelse (l == []) false
(let
h = (head l);
t = (tail l);
in ifelse (cond h) (do h)
(meetsConDo (cond) (do) (t)));
deps = p: ifelse (isAttrs p) (filter (p: isAttrs p)
h = head l;
t = tail l;
in
ifelse (cond h) (do h)
(meetsConDo cond do t));
deps = p:
ifelse (isAttrs p) (
filter (p: isAttrs p)
(p.buildInputs ++ p.nativeBuildInputs ++ p.propagatedBuildInputs ++ p.propagatedNativeBuildInputs)
) [];
importFilter = l: p: filter (n: elem (nameFromURL (toString n) ".") l) p;
depsRec = ld: ifelse (ld == []) [] ((toList ld) ++ (depsRec (lists.unique (lists.flatten (map (d: deps d) (toList ld))))));
isBroken = p: meetsConDo (s: ((hasAttrByPath s.path p) && (s.check (getAttrFromPath s.path p)))) (s: s.msg)
isBroken = p:
meetsConDo (s: ((hasAttrByPath s.path p) && (s.check (getAttrFromPath s.path p)))) (s: s.msg)
[
{ path = ["meta" "broken"]; msg = (warn "Package ${p.name} is marked as broken." true); check = m: m; }
{ path = ["meta" "knownVulnerabilities" ]; msg = (warn "Package ${p.name} has known Vulnerabilities.." true); check = m: m != []; }
{ path = ["name"]; msg = (warn "${p.name}: python2 is depricated." false); check = m: (strings.hasInfix "python2" m) || (strings.hasInfix "python-2" m); }
{
path = ["meta" "broken"];
msg = warn "Package ${p.name} is marked as broken." true;
check = m: m;
}
{
path = ["meta" "knownVulnerabilities"];
msg = warn "Package ${p.name} has known Vulnerabilities.." true;
check = m: m != [];
}
{
path = ["name"];
msg = warn "${p.name}: python2 is depricated." false;
check = m: (strings.hasInfix "python2" m) || (strings.hasInfix "python-2" m);
}
# not sure if the following test creates false positives (AFAIK every derivation/package needs to have an outPath)
# , definitely should catch all corner cases/everything that fails to evaluate.
{ path = [ "outPath" ]; msg = (warn "Package ${p.name} has no outPath" true); check = m: !(tryEval m).success; }
{
path = ["outPath"];
msg = warn "Package ${p.name} has no outPath" true;
check = m: !(tryEval m).success;
}
];
depsBroken = p: lists.any (p: (isBroken p)) (deps p);
# No more magic 🧙 here 😢
# But at least it now (hopefully) checks ONLY dependencies (and all of them at that).
depsBrokenRec = p: (meetsConDo
depsBrokenRec = p: (
meetsConDo
(p: ifelse (depsBroken p) true (depsBrokenRec (deps p)))
(p: true) (deps p)
);
sopsHelper = template: names: options: let
optionsIsFunction = (typeOf options) == "lambda";
in listToAttrs (map
in
listToAttrs (map
(name: {
name = template name;
value = ifelse optionsIsFunction (options name) options;
@ -74,11 +110,12 @@ rec {
true)
))
ld);
makeOptionTypeList = path: (lists.forEach
makeOptionTypeList = path: (
lists.forEach
# get a list of all files ending in .nix in path
(filter (filePath: hasSuffix ".nix" filePath)
(lsfRec path true))
# remove leading path and trailing ".nix", replace every slash with "::"
(replaceStrings [ "${path}/" "/" ".nix" ] [ "" "::" "" ])
(replaceStrings ["${path}/" "/" ".nix"] ["" "::" ""])
);
}

View file

@ -1,6 +1,8 @@
{ pkgs, lib, ... }:
{
pkgs,
lib,
...
}: {
services.cron.enable = false;
networking.dhcpcd.extraConfig = "noarp";
@ -8,10 +10,30 @@
# low latency audio stuff
security.pam.loginLimits = [
{ domain = "@audio"; item = "memlock"; type = "-"; value = "unlimited"; }
{ domain = "@audio"; item = "rtprio"; type = "-"; value = "99"; }
{ domain = "@audio"; item = "nofile"; type = "soft"; value = "99999"; }
{ domain = "@audio"; item = "nofile"; type = "hard"; value = "99999"; }
{
domain = "@audio";
item = "memlock";
type = "-";
value = "unlimited";
}
{
domain = "@audio";
item = "rtprio";
type = "-";
value = "99";
}
{
domain = "@audio";
item = "nofile";
type = "soft";
value = "99999";
}
{
domain = "@audio";
item = "nofile";
type = "hard";
value = "99999";
}
];
environment = {
etc = {
@ -38,8 +60,8 @@
};
};
boot = {
kernelModules = [ "snd-usb-audio" "snd-aloop" "snd-seq" "snd-rawmidi" ];
kernelParams = [ "threadirq" ];
kernelModules = ["snd-usb-audio" "snd-aloop" "snd-seq" "snd-rawmidi"];
kernelParams = ["threadirq"];
extraModprobeConfig = ''
options snd-usb-audio nrpacks=1
'';

View file

@ -1,32 +1,35 @@
{ nixpkgs, config, pkgs, ... }:
let
{
nixpkgs,
config,
pkgs,
...
}: let
cfg = config.machine;
in {
imports = [ "${nixpkgs}/nixos/modules/installer/scan/not-detected.nix" ];
imports = ["${nixpkgs}/nixos/modules/installer/scan/not-detected.nix"];
boot = {
loader.systemd-boot = {
enable = true;
# signed = true;
# signing-key = "${cfg.secretPath}/secureboot/db.key";
# signing-certificate = "${cfg.secretPath}/secureboot/db.crt";
# signed = true;
# signing-key = "${cfg.secretPath}/secureboot/db.key";
# signing-certificate = "${cfg.secretPath}/secureboot/db.crt";
};
loader.efi.canTouchEfiVariables = true;
tmp = {
useTmpfs = true;
cleanOnBoot= true;
cleanOnBoot = true;
};
kernelPackages = pkgs.linuxPackages_latest;
initrd.availableKernelModules = [ "xhci_pci" "ahci" "sd_mod" "rtsx_pci_sdmmc" ];
kernelModules = [ "acpi_call" "i915" "kvm-intel" "uinput" ];
initrd.availableKernelModules = ["xhci_pci" "ahci" "sd_mod" "rtsx_pci_sdmmc"];
kernelModules = ["acpi_call" "i915" "kvm-intel" "uinput"];
# 5_10 breaks my touchpad/mouse buttons
# https://bbs.archlinux.org/viewtopic.php?id=254885
# maybe modprobe hid_rmi or i2c_i801
# blacklistedKernelModules = [ "i2c_i801" ];
extraModulePackages = with config.boot.kernelPackages; [ acpi_call ]; #pkgs.gitpkgs.linuxPackages_latest.hid-nintendo ];
kernelParams = [ "intel_iommu=on" ];
extraModulePackages = with config.boot.kernelPackages; [acpi_call]; #pkgs.gitpkgs.linuxPackages_latest.hid-nintendo ];
kernelParams = ["intel_iommu=on"];
extraModprobeConfig = ''
options i915 enable_fbc=1 enable_guc=3
'';
@ -37,26 +40,26 @@ in {
};
};
fileSystems."/" =
{ device = "/dev/disk/by-uuid/b37b48a8-5dcb-4f4d-ad71-1b26500b3e5f";
fileSystems."/" = {
device = "/dev/disk/by-uuid/b37b48a8-5dcb-4f4d-ad71-1b26500b3e5f";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/546A-A3D1";
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/546A-A3D1";
fsType = "vfat";
};
hardware = {
firmware = with pkgs; [ firmwareLinuxNonfree ];
firmware = with pkgs; [firmwareLinuxNonfree];
cpu.intel.updateMicrocode = true;
enableAllFirmware = false;
ksm.enable = true;
opengl = {
driSupport = true;
extraPackages = with pkgs; [ intel-media-driver libvdpau-va-gl libva (vaapiIntel.override {enableHybridCodec = true;}) vaapiVdpau intel-media-driver ];
extraPackages = with pkgs; [intel-media-driver libvdpau-va-gl libva (vaapiIntel.override {enableHybridCodec = true;}) vaapiVdpau intel-media-driver];
driSupport32Bit = true;
extraPackages32 = with pkgs.pkgsi686Linux; [ libvdpau-va-gl libva (vaapiIntel.override {enableHybridCodec = true;}) vaapiVdpau ];
extraPackages32 = with pkgs.pkgsi686Linux; [libvdpau-va-gl libva (vaapiIntel.override {enableHybridCodec = true;}) vaapiVdpau];
};
pulseaudio = {
@ -81,7 +84,7 @@ in {
};
services = {
upower.enable = true;
xserver.videoDrivers = [ "intel" ];
xserver.videoDrivers = ["intel"];
};
time.timeZone = "Europe/Berlin";

View file

@ -1,8 +1,9 @@
{ pkgs, lib, ... }:
with lib;
{
pkgs,
lib,
...
}:
with lib; {
imports = [
../../options/copySysConf.nix
];
@ -13,7 +14,12 @@ with lib;
enable = true;
waitOnline = false;
};
administrators = [ { name = "derped"; id = 1337; } ];
administrators = [
{
name = "derped";
id = 1337;
}
];
conffiles = [
"etcfiles"
"etcvars"
@ -59,15 +65,26 @@ with lib;
"cups"
"mullvad"
"mariaDB"
"docker" "podman"
"docker"
"podman"
];
firewall = {
enable = true;
allowPing = true;
allowedUDPPorts = [ 24642 ];
allowedTCPPorts = [ 24642 ];
allowedUDPPortRanges = [ { from = 1714; to = 1764; } ];
allowedTCPPortRanges = [ { from = 1714; to = 1764; } ];
allowedUDPPorts = [24642];
allowedTCPPorts = [24642];
allowedUDPPortRanges = [
{
from = 1714;
to = 1764;
}
];
allowedTCPPortRanges = [
{
from = 1714;
to = 1764;
}
];
};
};

View file

@ -1,6 +1,8 @@
{ config, lib, ... }:
{
config,
lib,
...
}: {
sops = {
defaultSopsFile = ./secrets.yaml;
age = {

View file

@ -1,6 +1,4 @@
{ pkgs, ... }:
{
{pkgs, ...}: {
services.cron.enable = false;
security.pki.certificateFiles = [
./certs/proxy

View file

@ -1,9 +1,12 @@
{ config, pkgs, modulesPath, ... }:
let
{
config,
pkgs,
modulesPath,
...
}: let
cfg = config.machine;
in {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
imports = [(modulesPath + "/installer/scan/not-detected.nix")];
boot = {
loader.systemd-boot = {
@ -12,12 +15,12 @@ in {
loader.efi.canTouchEfiVariables = true;
tmp = {
useTmpfs = true;
cleanOnBoot= true;
cleanOnBoot = true;
};
kernelPackages = pkgs.linuxPackages_latest;
initrd.availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
kernelModules = [ "kvm-amd" ];
initrd.availableKernelModules = ["nvme" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"];
kernelModules = ["kvm-amd"];
kernelParams = [
# get backlight service to work part one (fixes systemd backlight service)
"acpi_backlight=native"
@ -29,18 +32,18 @@ in {
};
};
fileSystems."/" =
{ device = "/dev/disk/by-uuid/cf8db7d5-5da7-4fb9-818d-ed5dd2815f0d";
fileSystems."/" = {
device = "/dev/disk/by-uuid/cf8db7d5-5da7-4fb9-818d-ed5dd2815f0d";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/96E4-9DF3";
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/96E4-9DF3";
fsType = "vfat";
};
hardware = {
firmware = with pkgs; [ firmwareLinuxNonfree ];
firmware = with pkgs; [firmwareLinuxNonfree];
enableAllFirmware = true;
ksm.enable = true;
opengl = {

View file

@ -1,15 +1,21 @@
{ pkgs, lib, ... }:
with lib;
{
pkgs,
lib,
...
}:
with lib; {
imports = [
../../options/copySysConf.nix
];
config.machine = {
allowUnfree = true;
hostName = "Marid";
administrators = [ { name = "derped"; id = 1337; } ];
administrators = [
{
name = "derped";
id = 1337;
}
];
conffiles = [
"etcfiles"
"etcvars"
@ -53,10 +59,10 @@ with lib;
firewall = {
enable = true;
allowPing = true;
allowedUDPPorts = [ ];
allowedTCPPorts = [ ];
allowedUDPPortRanges = [ ];
allowedTCPPortRanges = [ ];
allowedUDPPorts = [];
allowedTCPPorts = [];
allowedUDPPortRanges = [];
allowedTCPPortRanges = [];
};
};

View file

@ -1,6 +1,8 @@
{ config, lib, ... }:
{
config,
lib,
...
}: {
sops = {
defaultSopsFile = ./secrets.yaml;
age = {

View file

@ -1,17 +1,16 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{
system.autoUpgrade.enable = false;
# services.vsftp = {
# enable = true;
# ssl_sslv3 = true;
# forceLocalDataSSL = true;
# writeEnable = false;
# userlist = [];
# };
# services.vsftp = {
# enable = true;
# ssl_sslv3 = true;
# forceLocalDataSSL = true;
# writeEnable = false;
# userlist = [];
# };
services.haveged.enable = true;
programs.zsh.promptInit = ''PROMPT="%(!.%B%F{magenta}.%B%F{cyan}%n@)%m %F{blue}%(!.%1~.%~) ''${vcs_info_msg_0_}%F{blue}%(!.#.$)%k%b%f "'';

View file

@ -1,15 +1,17 @@
{ nixpkgs, pkgs, ... }:
{
imports =
[ "${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
nixpkgs,
pkgs,
...
}: {
imports = [
"${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
];
boot = {
initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sd_mod" "sr_mod" ];
initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "sd_mod" "sr_mod"];
kernelPackages = pkgs.linuxPackages_latest;
kernelModules = [ ];
extraModulePackages = [ ];
kernelModules = [];
extraModulePackages = [];
loader.grub = {
enable = true;
device = "/dev/sda"; # or "nodev" for efi only
@ -18,10 +20,10 @@
time.timeZone = "Europe/Berlin";
fileSystems."/" =
{ device = "/dev/disk/by-uuid/fa0c2ff3-59f9-4c00-8153-c2c2ef0f0e84";
fileSystems."/" = {
device = "/dev/disk/by-uuid/fa0c2ff3-59f9-4c00-8153-c2c2ef0f0e84";
fsType = "ext4";
};
swapDevices = [ ];
swapDevices = [];
}

View file

@ -1,15 +1,26 @@
{ config, lib, ... }:
with lib;
let
{
config,
lib,
...
}:
with lib; let
cfg = config.machine;
in {
config.machine = rec {
hostName = "Ophanim";
domain = "ophanim.de";
administrators = [ { name = "derped"; id = 1337; } ];
mailAccounts = [ { name = "derped"; aliases = [ "postmaster" "baensch" ]; } ];
administrators = [
{
name = "derped";
id = 1337;
}
];
mailAccounts = [
{
name = "derped";
aliases = ["postmaster" "baensch"];
}
];
allowUnfree = true;
conffiles = [
"etcvars"
@ -23,26 +34,40 @@ in {
services = [
"acme"
"gitea"
# "hydra"
# "hydra"
"mailserver"
"mariaDB"
"nextcloud"
"nginx"
"openssh"
];
vHosts = (let base = domain; in [
{ domain = base; service = "simple"; }
# { domain = "builder.${base}"; service = "hydra"; }
# { domain = "cache.${base}"; service = "cache"; }
{ domain = "storage.${base}"; service = "nextcloud"; }
{ domain = "mail.${base}"; service = "mail"; }
{ domain = "git.${base}"; service = "gitea"; }
]);
vHosts = let
base = domain;
in [
{
domain = base;
service = "simple";
}
# { domain = "builder.${base}"; service = "hydra"; }
# { domain = "cache.${base}"; service = "cache"; }
{
domain = "storage.${base}";
service = "nextcloud";
}
{
domain = "mail.${base}";
service = "mail";
}
{
domain = "git.${base}";
service = "gitea";
}
];
firewall = {
enable = true;
allowPing = false;
allowedUDPPorts = [ 22 80 443 7776 ];
allowedTCPPorts = [ 80 443 7776 ];
allowedUDPPorts = [22 80 443 7776];
allowedTCPPorts = [80 443 7776];
};
};
}

View file

@ -1,6 +1,8 @@
{ config, lib, ... }:
{
config,
lib,
...
}: {
sops = {
defaultSopsFile = ./secrets.yaml;
age = {

View file

@ -1,11 +1,16 @@
{ config, pkgs, lib, ... }:
with lib;
let
{
config,
pkgs,
lib,
...
}:
with lib; let
cfg = config.system.copySysConf;
cfgPath = ../.;
copySysConf = if !(isStorePath cfgPath) then pkgs.stdenv.mkDerivation rec {
copySysConf =
if !(isStorePath cfgPath)
then
pkgs.stdenv.mkDerivation rec {
name = "NixOS_Configuration-${version}";
version = commitIdFromGitRepo (cfgPath + "/.git");
@ -14,8 +19,8 @@ let
installPhase = ''
cp -R ./. $out
'';
} else (builtins.toPath ../.);
}
else (builtins.toPath ../.);
in {
options.system.copySysConf = {
enable = mkOption {

View file

@ -1,20 +1,15 @@
# Original Source:
# https://gitlab.com/rycee/nur-expressions/raw/master/hm-modules/emacs-init-defaults.nix (49ff2d63e867c09e658c959c0d8a73d641061c30)
# MIT License
# Copyright (c) 2019 Robert Helgesson
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -22,11 +17,7 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
{ pkgs, ... }:
{
{pkgs, ...}: {
programs.emacs.init.usePackage = {
deadgrep = {
config = ''

View file

@ -1,20 +1,15 @@
# Original Source:
# https://gitlab.com/rycee/nur-expressions/raw/master/hm-modules/emacs-init.nix (d27525db3358b9463fab1b4a7739cb77e27b768c)
# MIT License
# Copyright (c) 2019 Robert Helgesson
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -22,14 +17,13 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
{ config, lib, pkgs, ... }:
with lib;
let
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.programs.emacs.init;
packageFunctionType = mkOptionType {
@ -39,14 +33,18 @@ let
merge = mergeOneOption;
};
usePackageType = types.submodule ({ name, config, ... }: {
usePackageType = types.submodule ({
name,
config,
...
}: {
options = {
enable = mkEnableOption "Emacs package ${name}";
package = mkOption {
type =
types.either
(types.str // { description = "name of package"; })
(types.str // {description = "name of package";})
packageFunctionType;
default = name;
description = ''
@ -83,7 +81,10 @@ let
chords = mkOption {
type = types.attrsOf types.str;
default = {};
example = { "jj" = "ace-jump-char-mode"; "jk" = "ace-jump-word-mode"; };
example = {
"jj" = "ace-jump-char-mode";
"jk" = "ace-jump-word-mode";
};
description = ''
The entries to use for <option>:chords</option>.
'';
@ -108,7 +109,10 @@ let
bind = mkOption {
type = types.attrsOf types.str;
default = {};
example = { "M-<up>" = "drag-stuff-up"; "M-<down>" = "drag-stuff-down"; };
example = {
"M-<up>" = "drag-stuff-up";
"M-<down>" = "drag-stuff-down";
};
description = ''
The entries to use for <option>:bind</option>.
'';
@ -117,7 +121,7 @@ let
bindLocal = mkOption {
type = types.attrsOf (types.attrsOf types.str);
default = {};
example = { helm-command-map = { "C-c h" = "helm-execute-persistent-action"; }; };
example = {helm-command-map = {"C-c h" = "helm-execute-persistent-action";};};
description = ''
The entries to use for local keymaps in <option>:bind</option>.
'';
@ -126,7 +130,7 @@ let
bindKeyMap = mkOption {
type = types.attrsOf types.str;
default = {};
example = { "C-c p" = "projectile-command-map"; };
example = {"C-c p" = "projectile-command-map";};
description = ''
The entries to use for <option>:bind-keymap</option>.
'';
@ -181,14 +185,13 @@ let
};
config = mkIf config.enable {
assembly =
let
assembly = let
quoted = v: ''"${escape ["\""] v}"'';
mkBindHelper = cmd: prefix: bs:
optionals (bs != {}) (
[ ":${cmd} (${prefix}" ]
[":${cmd} (${prefix}"]
++ mapAttrsToList (n: v: " (${quoted n} . ${v})") bs
++ [ ")" ]
++ [")"]
);
mkAfter = vs: optional (vs != []) ":after (${toString vs})";
@ -196,8 +199,7 @@ let
mkDiminish = vs: optional (vs != []) ":diminish (${toString vs})";
mkMode = map (v: ":mode ${v}");
mkBind = mkBindHelper "bind" "";
mkBindLocal = bs:
let
mkBindLocal = bs: let
mkMap = n: v: mkBindHelper "bind" ":map ${n}" v;
in
flatten (mapAttrsToList mkMap bs);
@ -205,12 +207,13 @@ let
mkChords = mkBindHelper "chords" "";
mkHook = map (v: ":hook ${v}");
mkDefer = v:
if isBool v then optional v ":defer t"
else [ ":defer ${toString v}" ];
if isBool v
then optional v ":defer t"
else [":defer ${toString v}"];
mkDemand = v: optional v ":demand t";
in
concatStringsSep "\n " (
[ "(use-package ${name}" ]
["(use-package ${name}"]
++ mkAfter config.after
++ mkBind config.bind
++ mkBindKeyMap config.bindKeyMap
@ -222,10 +225,11 @@ let
++ mkDiminish config.diminish
++ mkHook config.hook
++ mkMode config.mode
++ optionals (config.init != "") [ ":init" config.init ]
++ optionals (config.config != "") [ ":config" config.config ]
++ optionals (config.init != "") [":init" config.init]
++ optionals (config.config != "") [":config" config.config]
++ optional (config.extraConfig != "") config.extraConfig
) + ")";
)
+ ")";
};
});
@ -234,13 +238,16 @@ let
${pkgConfStr})
'';
mkRecommendedOption = type: extraDescription: mkOption {
mkRecommendedOption = type: extraDescription:
mkOption {
type = types.bool;
default = false;
example = true;
description = ''
description =
''
Whether to enable recommended ${type} settings.
'' + optionalString (extraDescription != "") ''
''
+ optionalString (extraDescription != "") ''
</para><para>
${extraDescription}
'';
@ -285,7 +292,7 @@ let
hasBind = any (p: p.bind != {}) (attrValues cfg.usePackage);
# Whether the configuration makes use of `:chords`.
hasChords = any ( p: p.chords != {}) (attrValues cfg.usePackage);
hasChords = any (p: p.chords != {}) (attrValues cfg.usePackage);
usePackageSetup =
''
@ -300,7 +307,9 @@ let
;; To help fixing issues during startup.
(setq use-package-verbose ${
if cfg.usePackageVerbose then "t" else "nil"
if cfg.usePackageVerbose
then "t"
else "nil"
}))
''
+ optionalString hasDiminish ''
@ -317,7 +326,8 @@ let
:config (key-chord-mode 1))
'';
initFile = ''
initFile =
''
;;; hm-init.el --- Emacs configuration à la Home Manager.
;;
;; -*- lexical-binding: t; -*-
@ -359,11 +369,8 @@ let
(provide 'hm-init)
;; hm-init.el ends here
'';
in
{
imports = [ ./emacs-init-defaults.nix ];
in {
imports = [./emacs-init-defaults.nix];
options.programs.emacs.init = {
enable = mkEnableOption "Emacs configuration";
@ -412,13 +419,13 @@ in
};
config = mkIf cfg.enable {
machine.pkgsets.emacs.pkgs = epkgs:
let
machine.pkgsets.emacs.pkgs = epkgs: let
getPkg = v:
if isFunction v then [ (v epkgs) ]
if isFunction v
then [(v epkgs)]
else optional (isString v && hasAttr v epkgs) epkgs.${v};
in
[ epkgs.use-package ]
[epkgs.use-package]
++ optional hasBind epkgs.bind-key
++ optional hasDiminish epkgs.diminish
++ optional hasChords epkgs.use-package-chords
@ -430,11 +437,13 @@ in
# use lucid as toolkit; emacs will otherwise crash quite frequently when run in daemon mode
# https://gitlab.gnome.org/GNOME/gtk/issues/221
machine.pkgsets.emacs.pkgwrap = let
emacsWithPackages = (pkgs.emacsPackagesFor
emacsWithPackages =
(pkgs.emacsPackagesFor
(pkgs.emacs.override {
withGTK2 = false;
withGTK3 = false;
})).emacsWithPackages;
}))
.emacsWithPackages;
in (emacsWithPackages config.machine.pkgsets.emacs.pkgs);
environment.systemPackages = [

View file

@ -1,9 +1,11 @@
{ config, lib, fn, ... }:
{
config,
lib,
fn,
...
}:
with builtins;
with lib;
let
with lib; let
cfg = config.machine;
pkgsetList = fn.makeOptionTypeList (toString ../pkgsets);
serviceList = fn.makeOptionTypeList (toString ../services);
@ -11,8 +13,8 @@ let
name = pname;
value = rec {
pkgwrap = mkOption {
type = with types; oneOf [ package (listOf package) ];
default = (fn.pkgFilter cfg.pkgsets."${pname}".pkgs);
type = with types; oneOf [package (listOf package)];
default = fn.pkgFilter cfg.pkgsets."${pname}".pkgs;
description = ''
Package Wrapper for packages using a wrapper function (like python, emacs, haskell, ...)
'';
@ -29,8 +31,8 @@ let
in {
options.machine = {
pkgs = mkOption {
type = (types.listOf (types.enum pkgsetList));
default = [ "base" ];
type = types.listOf (types.enum pkgsetList);
default = ["base"];
description = ''
The list of metapackages to be installed.
'';
@ -38,7 +40,7 @@ in {
# Package names containing '::' are sub packages and should not have their own pkgset.
pkgsets = listToAttrs (map pkgOption (lists.filter (v: !(strings.hasInfix "::" v)) pkgsetList));
services = mkOption {
type = (types.listOf (types.enum serviceList));
type = types.listOf (types.enum serviceList);
default = [];
description = ''
List of services to be enabled.
@ -46,7 +48,7 @@ in {
};
conffiles = mkOption {
type = types.listOf types.str;
default = [ "zsh" ];
default = ["zsh"];
description = ''
List of configuration files to be enabled.
'';
@ -116,7 +118,7 @@ in {
};
};
imports = [
(mkAliasOptionModule [ "machine" "firewall" ] [ "networking" "firewall" ])
(mkAliasOptionModule [ "machine" "allowUnfree" ] [ "nixpkgs" "config" "allowUnfree" ])
(mkAliasOptionModule ["machine" "firewall"] ["networking" "firewall"])
(mkAliasOptionModule ["machine" "allowUnfree"] ["nixpkgs" "config" "allowUnfree"])
];
}

View file

@ -1,10 +1,29 @@
{ stdenv, buildPythonPackage, fetchgit
, aiosmtpd, alembic, atpublic, click, dnspython, falcon, flufl_bounce, flufl_i18n, flufl_lock
, importlib-resources, lazr_config, passlib, requests, sqlalchemy
, zope_component, zope_configuration, zope_event, zope_interface
# optional database dependencies
, pymysql, psycopg2 }:
{
stdenv,
buildPythonPackage,
fetchgit,
aiosmtpd,
alembic,
atpublic,
click,
dnspython,
falcon,
flufl_bounce,
flufl_i18n,
flufl_lock,
importlib-resources,
lazr_config,
passlib,
requests,
sqlalchemy,
zope_component,
zope_configuration,
zope_event,
zope_interface,
# optional database dependencies
pymysql,
psycopg2,
}:
buildPythonPackage rec {
name = "mailman3_core-${version}";
version = "3.2.2";
@ -33,7 +52,8 @@ buildPythonPackage rec {
zope_configuration
zope_event
zope_interface
pymysql psycopg2
pymysql
psycopg2
];
doCheck = false;
@ -48,7 +68,7 @@ buildPythonPackage rec {
meta = with stdenv.lib; {
description = "GNU Mailman, a mailing list management system";
license = licenses.gpl3;
maintainers = with maintainers; [ ];
maintainers = with maintainers; [];
homepage = http://list.org/;
};
}

View file

@ -1,6 +1,10 @@
{ stdenv, lib, fetchPypi, buildPythonPackage
, atpublic }:
{
stdenv,
lib,
fetchPypi,
buildPythonPackage,
atpublic,
}:
buildPythonPackage rec {
pname = "aiosmtpd";
version = "1.2";
@ -10,5 +14,5 @@ buildPythonPackage rec {
sha256 = "1xdfk741pjmz1cm8dsi4n5vq4517i175rm94696m3f7kcgk7xsmp";
};
doCheck = false;
propagatedBuildInputs = [ atpublic ];
propagatedBuildInputs = [atpublic];
}

View file

@ -1,5 +1,9 @@
{ stdenv, lib, fetchPypi, buildPythonPackage }:
{
stdenv,
lib,
fetchPypi,
buildPythonPackage,
}:
buildPythonPackage rec {
pname = "atpublic";
version = "1.0";
@ -9,5 +13,5 @@ buildPythonPackage rec {
sha256 = "0i3sbxkdlbb4560rrlmwwd5y4ps7k73lp4d8wnmd7ag9k426gjkx";
};
doCheck = false;
# propagatedBuildInputs = [];
# propagatedBuildInputs = [];
}

View file

@ -1,6 +1,11 @@
{ stdenv, lib, fetchPypi, buildPythonPackage
, atpublic, zope_interface }:
{
stdenv,
lib,
fetchPypi,
buildPythonPackage,
atpublic,
zope_interface,
}:
buildPythonPackage rec {
name = "${pname}-${version}";
pname = "flufl.bounce";
@ -11,7 +16,7 @@ buildPythonPackage rec {
sha256 = "0k5kjqa3x6gvwwxyzb2vwi1g1i6asm1zw5fivylxz3d583y4kid2";
};
propagatedBuildInputs = [ atpublic zope_interface ];
propagatedBuildInputs = [atpublic zope_interface];
doCheck = false;
}

View file

@ -1,6 +1,10 @@
{ stdenv, lib, fetchPypi, buildPythonPackage
, atpublic }:
{
stdenv,
lib,
fetchPypi,
buildPythonPackage,
atpublic,
}:
buildPythonPackage rec {
name = "${pname}-${version}";
pname = "flufl.i18n";
@ -11,7 +15,7 @@ buildPythonPackage rec {
sha256 = "1csgds59nx0ann9v2alqr69lakp1cnc1ikmbgn96l6n23js7c2ah";
};
propagatedBuildInputs = [ atpublic ];
propagatedBuildInputs = [atpublic];
doCheck = false;
}

View file

@ -1,6 +1,10 @@
{ stdenv, lib, fetchPypi, buildPythonPackage
, atpublic }:
{
stdenv,
lib,
fetchPypi,
buildPythonPackage,
atpublic,
}:
buildPythonPackage rec {
name = "${pname}-${version}";
pname = "flufl.lock";
@ -11,7 +15,7 @@ buildPythonPackage rec {
sha256 = "0nzzd6l30ff6cwsrlrb94xzfja4wkyrqv3ydc6cz0hdbr766mmm8";
};
propagatedBuildInputs = [ atpublic ];
propagatedBuildInputs = [atpublic];
doCheck = false;
}

View file

@ -1,6 +1,10 @@
{ stdenv, lib, fetchPypi, buildPythonPackage
, lazr_delegates }:
{
stdenv,
lib,
fetchPypi,
buildPythonPackage,
lazr_delegates,
}:
buildPythonPackage rec {
name = "${pname}-${version}";
pname = "lazr.config";
@ -11,7 +15,7 @@ buildPythonPackage rec {
sha256 = "1s7pyvlq06qjrkaw9r6nc290lb095n25ybzgavvy51ygpxkgqxwn";
};
propagatedBuildInputs = [ lazr_delegates ];
propagatedBuildInputs = [lazr_delegates];
doCheck = false;
}

View file

@ -1,6 +1,11 @@
{ stdenv, lib, fetchPypi, buildPythonPackage
, nose, zope_interface }:
{
stdenv,
lib,
fetchPypi,
buildPythonPackage,
nose,
zope_interface,
}:
buildPythonPackage rec {
name = "${pname}-${version}";
pname = "lazr.delegates";
@ -11,7 +16,7 @@ buildPythonPackage rec {
sha256 = "1rdnl85j9ayp8n85l0ciip621j9dcziz5qnmv2m7krgwgcn31vfx";
};
propagatedBuildInputs = [ nose zope_interface ];
propagatedBuildInputs = [nose zope_interface];
doCheck = false;
}

View file

@ -1,9 +1,11 @@
{ pkgs, lib, config, ... }:
with lib;
let
mailman3 = import ./release.nix { };
{
pkgs,
lib,
config,
...
}:
with lib; let
mailman3 = import ./release.nix {};
cfg = config.services.mailman3;
usePostgresql = cfg.database.type == "postgresql";
useSqlite = cfg.database.type == "sqlite3";
@ -102,7 +104,7 @@ in {
database = {
type = mkOption {
type = types.enum [ "sqlite3" "mysql" "postgres" ];
type = types.enum ["sqlite3" "mysql" "postgres"];
default = "sqlite3";
example = "mysql";
description = ''
@ -271,7 +273,7 @@ in {
mta = {
# TODO: add Sentmail and qmail
type = mkOption {
type = types.enum [ "postfix" "exim4" ];
type = types.enum ["postfix" "exim4"];
default = "postfix";
example = "exim4";
description = ''
@ -357,7 +359,6 @@ in {
};
};
config = mkIf cfg.enable {
users = mkIf (cfg.user == "mailman3") {
users.mailman3 = {
@ -365,7 +366,7 @@ in {
home = cfg.paths.var_dir;
createHome = true;
useDefaultShell = true;
packages = [ mailman3.core ];
packages = [mailman3.core];
};
};
@ -374,25 +375,25 @@ in {
services.postfix.mapFiles."local_recipient_maps" = mkIf usePostfix (mkDefault "${cfg.paths.data_dir}/postfix_lmtp");
services.postfix.mapFiles."relay_domains" = mkIf usePostfix (mkDefault "${cfg.paths.data_dir}/postfix_domains");
warnings = optional (cfg.database.password != "")
''config.services.mailman3.database.password will be stored as plaintext
warnings =
optional (cfg.database.password != "")
'' config.services.mailman3.database.password will be stored as plaintext
in the Nix store. Use database.passwordFile instead.'';
# Create database passwordFile default when password is configured.
services.mailman3.database.passwordFile =
(mkDefault (toString (pkgs.writeTextFile {
services.mailman3.database.passwordFile = mkDefault (toString (pkgs.writeTextFile {
name = "mailman3-database-password";
text = cfg.database.password;
})));
}));
systemd.services.mailman3 = {
description = "GNU Mailing List Manager";
after = [ "network.target" ] ++ lib.optional usePostgresql "postgresql.service" ++ lib.optional useMysql "mysql.service";
wantedBy = [ "multi-user.target" ];
after = ["network.target"] ++ lib.optional usePostgresql "postgresql.service" ++ lib.optional useMysql "mysql.service";
wantedBy = ["multi-user.target"];
preStart = let
dbpass = (fileContents cfg.database.passwordFile);
smtppass = (fileContents cfg.mta.smtp_passFile);
dbpass = fileContents cfg.database.passwordFile;
smtppass = fileContents cfg.mta.smtp_passFile;
in ''
mkdir -p ${cfg.paths.etc_dir}
cp ${configFile} ${cfg.paths.etc_dir}/mailman.cfg

View file

@ -1,8 +1,9 @@
{ pkgs ? import <nixpkgs> {}, python3Packages ? pkgs.python3Packages }:
let
{
pkgs ? import <nixpkgs> {},
python3Packages ? pkgs.python3Packages,
}: let
mailman3 = {
core = python3Packages.callPackage ./core.nix ( with deps; {
core = python3Packages.callPackage ./core.nix (with deps; {
inherit aiosmtpd atpublic flufl_bounce flufl_i18n flufl_lock lazr_config;
});
};
@ -10,7 +11,7 @@ let
aiosmtpd = python3Packages.callPackage ./extraPackages/aiosmtpd.nix {
inherit atpublic;
};
atpublic = python3Packages.callPackage ./extraPackages/atpublic.nix { };
atpublic = python3Packages.callPackage ./extraPackages/atpublic.nix {};
flufl_bounce = python3Packages.callPackage ./extraPackages/flufl_bounce.nix {
inherit atpublic;
};
@ -23,6 +24,7 @@ let
lazr_config = python3Packages.callPackage ./extraPackages/lazr_config.nix {
inherit lazr_delegates;
};
lazr_delegates = python3Packages.callPackage ./extraPackages/lazr_delegates.nix { };
lazr_delegates = python3Packages.callPackage ./extraPackages/lazr_delegates.nix {};
};
in mailman3
in
mailman3

View file

@ -1,5 +1,8 @@
{ stdenv, fetchFromGitHub, gtk-engine-murrine }:
{
stdenv,
fetchFromGitHub,
gtk-engine-murrine,
}:
stdenv.mkDerivation {
version = "1.0";
name = "Flat-Remix-GTK";
@ -10,6 +13,6 @@ stdenv.mkDerivation {
sha256 = "0rfv75w9yr8drc3x9g4iz2cb88ixy1lqbflvmb7farw4dz74fk5f";
fetchSubmodules = true;
};
makeFlags = [ "PREFIX=$(out)" ];
propagatedUserEnvPkgs = [ gtk-engine-murrine ];
makeFlags = ["PREFIX=$(out)"];
propagatedUserEnvPkgs = [gtk-engine-murrine];
}

View file

@ -1,20 +1,24 @@
{ config, lib, pkgs,
nixpkgs-unstable, nixpkgs-stable, nixpkgs-git,
... }:
let
{
config,
lib,
pkgs,
nixpkgs-unstable,
nixpkgs-stable,
nixpkgs-git,
...
}: let
callPackage = pkgs.callPackage;
in {
nixpkgs = {
config = {
allowUnfree = true;
mpv.vaapiSupport = (lib.elem "xserver" config.machine.services);
mpv.vaapiSupport = lib.elem "xserver" config.machine.services;
packageOverrides = {
pyluxafor = pkgs.python3Packages.callPackage ./pyluxafor {};
theme_flat-remix = callPackage ./flat-remix { };
theme_sddm_midnight = callPackage ./sddm_midnight { };
xdiskusage = callPackage ./xdiskusage { };
theme_flat-remix = callPackage ./flat-remix {};
theme_sddm_midnight = callPackage ./sddm_midnight {};
xdiskusage = callPackage ./xdiskusage {};
};
};
overlays = [

View file

@ -1,5 +1,9 @@
{ fetchFromGitHub, buildPythonApplication, click, pyusb }:
{
fetchFromGitHub,
buildPythonApplication,
click,
pyusb,
}:
buildPythonApplication rec {
pname = "pyluxafor";
version = "0.1.0";
@ -14,5 +18,5 @@ buildPythonApplication rec {
substituteInPlace setup.py --replace '"click>=6.0,<=6.7.99",' ""
substituteInPlace setup.py --replace '"pyusb==1.0.0",' ""
'';
propagatedBuildInputs = [ click pyusb ];
propagatedBuildInputs = [click pyusb];
}

View file

@ -1,5 +1,8 @@
{ stdenv, fetchFromGitHub, qtstyleplugin-kvantum-qt4 }:
{
stdenv,
fetchFromGitHub,
qtstyleplugin-kvantum-qt4,
}:
stdenv.mkDerivation {
name = "sddm_midnight";
version = 1.0;
@ -11,7 +14,7 @@ stdenv.mkDerivation {
sha256 = "10br96pf4dppk9nk7yvf7h9zja40k4c6rhwmqcaxxcjlhpvjmhkj";
};
buildInputs = [ qtstyleplugin-kvantum-qt4 ];
buildInputs = [qtstyleplugin-kvantum-qt4];
patchPhase = ''
substituteInPlace sddm/themes/Midnight/Main.qml --replace /usr $out

View file

@ -1,18 +1,26 @@
{ config, lib, fn, pkgs, ... }:
with lib;
let
{
config,
lib,
fn,
pkgs,
...
}:
with lib; let
cfg = config.machine;
pkgsets = fn.lst { p = (toString ../pkgsets); b = true;};
pkgsets = fn.lst {
p = toString ../pkgsets;
b = true;
};
in {
imports = pkgsets;
environment.systemPackages = flatten
environment.systemPackages =
flatten
(lists.forEach
(attrVals
(filter
(v: !(strings.hasInfix "::" v)) cfg.pkgs)
(v: !(strings.hasInfix "::" v))
cfg.pkgs)
cfg.pkgsets)
(v: v.pkgwrap));

View file

@ -1,10 +1,13 @@
{ stdenv, fetchurl, fltk }:
{
stdenv,
fetchurl,
fltk,
}:
stdenv.mkDerivation rec {
name = "xdiskusage";
version = "1.51";
buildInputs = [ fltk ];
buildInputs = [fltk];
src = fetchurl {
url = "http://xdiskusage.sourceforge.net/${name}-${version}.tgz";

View file

@ -1,9 +1,12 @@
# Programms I'm likely to want on every machine and/or may execute as root
{ config, pkgs, ... }:
{
config,
pkgs,
...
}: {
config.machine.pkgsets.base.pkgs = with pkgs; [
age sops
age
sops
bat
ccze
cryptsetup
@ -54,7 +57,8 @@
whois
wirelesstools
wpa_supplicant
zip unzipNLS
zip
unzipNLS
zlib
zsh
];

View file

@ -1,6 +1,8 @@
{ config, pkgs, ... }:
{
config,
pkgs,
...
}: {
config.machine.pkgsets.cpp.pkgs = with pkgs; [
clang
cmake

View file

@ -1,9 +1,11 @@
{ config, pkgs, ... }:
{
config,
pkgs,
...
}: {
config.machine.pkgsets.dict.pkgs = with pkgs; [
translate-shell
( hunspellWithDicts (with pkgs.hunspellDicts; [ de-de en-us ] ))
( aspellWithDicts (d: with d; [ de en en-computers en-science ] ))
(hunspellWithDicts (with pkgs.hunspellDicts; [de-de en-us]))
(aspellWithDicts (d: with d; [de en en-computers en-science]))
];
}

View file

@ -1,16 +1,24 @@
{ config, lib, fn, pkgs, ... }:
with lib;
let
modefiles = fn.lst { p = (toString ./emacs); b = true; };
{
config,
lib,
fn,
pkgs,
...
}:
with lib; let
modefiles = fn.lst {
p = toString ./emacs;
b = true;
};
in rec {
imports = [
imports =
[
../options/emacs-init.nix
] ++ modefiles;
]
++ modefiles;
programs.emacs.init = {
enable = (elem "emacs" config.machine.pkgs);
enable = elem "emacs" config.machine.pkgs;
recommendedGcSettings = true;
prelude = ''

View file

@ -1,8 +1,10 @@
{ config, lib, pkgs, ... }:
with lib;
let
{
config,
lib,
pkgs,
...
}:
with lib; let
# Source: https://github.com/Henry/dot-emacs/blob/master/my-lisp/company-pcomplete.el
company-pcomplete = pkgs.writeText "company-pcomplete.el" ''
;;; company-pcomplete.el --- company-mode pcomplete backend -*- lexical-binding: t -*-
@ -95,26 +97,29 @@ let
(provide 'company-pcomplete)
'';
in mkIf (elem "emacs::company" config.machine.pkgs) {
in
mkIf (elem "emacs::company" config.machine.pkgs) {
programs.emacs.init.usePackage = {
company = {
enable = true;
package = epkgs: [ epkgs.company epkgs.company-web ];
diminish = [ "company-mode" ];
hook = [ "(after-init . global-company-mode)" ]
package = epkgs: [epkgs.company epkgs.company-web];
diminish = ["company-mode"];
hook =
["(after-init . global-company-mode)"]
++ optional (elem "emacs::rust" config.machine.pkgs)
''(rust-mode . (lambda () (setq company-backends '((company-capf :with company-yasnippet)))))''
++ optional (elem "emacs::web-mode" config.machine.pkgs)
''(web-mode . (lambda () (set (make-local-variable 'company-backends) '(company-web-html company-css))
'' (web-mode . (lambda () (set (make-local-variable 'company-backends) '(company-web-html company-css))
(company-mode t)))'';
bind = { "\t" = "'company-complete-common"; };
bind = {"\t" = "'company-complete-common";};
init = ''(require 'ffap)'';
config = ''
;; (setq company-tooltip-align-annotations t)
(setq company-idle-delay 0.3
company-show-numbers t)
${optionalString
${
optionalString
(elem "emacs::org" config.machine.pkgs) ''
(load-file "${company-pcomplete}")''
}
@ -128,7 +133,7 @@ in mkIf (elem "emacs::company" config.machine.pkgs) {
company-box = {
enable = true;
hook = [ "(company-mode . (lambda () (company-box-mode)))" ];
hook = ["(company-mode . (lambda () (company-box-mode)))"];
config = ''
(setq company-box-icons-alist 'company-box-icons-all-the-icons)
@ -162,10 +167,10 @@ in mkIf (elem "emacs::company" config.machine.pkgs) {
))
'';
};
all-the-icons = { enable = true; };
all-the-icons = {enable = true;};
company-jedi = {
enable = (elem "emacs::elpy" config.machine.pkgs);
enable = elem "emacs::elpy" config.machine.pkgs;
};
};
fonts.packages = pkgs.emacs-all-the-icons-fonts.all;
}
}

View file

@ -1,12 +1,15 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
with lib;
mkIf (elem "emacs::direnv" config.machine.pkgs) {
mkIf (elem "emacs::direnv" config.machine.pkgs) {
programs.emacs.init.usePackage.direnv = {
enable = true;
config = ''(direnv-mode)'';
};
services.lorri.enable = true;
environment.systemPackages = with pkgs; [ lorri direnv ];
}
environment.systemPackages = with pkgs; [lorri direnv];
}

View file

@ -1,8 +1,10 @@
{ config, lib, ... }:
{
config,
lib,
...
}:
with lib;
mkIf (elem "emacs::docker" config.machine.pkgs) {
mkIf (elem "emacs::docker" config.machine.pkgs) {
programs.emacs.init.usePackage = {
dockerfile-mode = {
enable = true;
@ -17,4 +19,4 @@ mkIf (elem "emacs::docker" config.machine.pkgs) {
enable = true;
};
};
}
}

View file

@ -1,9 +1,11 @@
{ config, lib, ... }:
{
config,
lib,
...
}:
with lib;
mkIf (elem "emacs::dockerfile" config.machine.pkgs) {
mkIf (elem "emacs::dockerfile" config.machine.pkgs) {
programs.emacs.init.usePackage.dockerfile-mode = {
enable = true;
};
}
}

View file

@ -1,11 +1,14 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
with lib;
mkIf (elem "emacs::doom-modeline" config.machine.pkgs) {
mkIf (elem "emacs::doom-modeline" config.machine.pkgs) {
programs.emacs.init.usePackage.doom-modeline = {
enable = true;
hook = [ "(after-init . doom-modeline-mode)" ];
hook = ["(after-init . doom-modeline-mode)"];
config = ''
(setq doom-modeline-icon t)
(setq doom-modeline-height 25)
@ -16,6 +19,6 @@ mkIf (elem "emacs::doom-modeline" config.machine.pkgs) {
(setq doom-modeline-unicode-fallback nil)
(setq doom-modeline--battery-status t)
'';
'';
};
}
}

View file

@ -1,8 +1,11 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
with lib;
mkIf (elem "emacs::doom-themes" config.machine.pkgs) {
mkIf (elem "emacs::doom-themes" config.machine.pkgs) {
programs.emacs.init.usePackage.doom-themes = {
enable = true;
config = ''
@ -13,4 +16,4 @@ mkIf (elem "emacs::doom-themes" config.machine.pkgs) {
;; ${optionalString (elem "emacs::org" config.machine.pkgs) "(doom-themes-org-config)"}
'';
};
}
}

View file

@ -1,11 +1,14 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
with lib;
mkIf (elem "emacs::elfeed" config.machine.pkgs) {
mkIf (elem "emacs::elfeed" config.machine.pkgs) {
programs.emacs.init.usePackage = {
elfeed = let
pyEnv = pkgs.python3.withPackages (ps: with ps; [ beautifulsoup4 lxml requests ]);
pyEnv = pkgs.python3.withPackages (ps: with ps; [beautifulsoup4 lxml requests]);
pyScript = pkgs.writeScript "elfeedFetcher.py" ''
#!${pyEnv}/bin/python3
import sys
@ -26,7 +29,7 @@ mkIf (elem "emacs::elfeed" config.machine.pkgs) {
'';
in {
enable = true;
hook = [ ''(elfeed-new-entry . elfeed-content-fetcher)'' ];
hook = [''(elfeed-new-entry . elfeed-content-fetcher)''];
config = ''
(load-file "~/.emacs.d/elfeed.el")
@ -145,4 +148,4 @@ mkIf (elem "emacs::elfeed" config.machine.pkgs) {
'';
};
};
}
}

View file

@ -1,23 +1,30 @@
{ config, lib, ... }:
{
config,
lib,
...
}:
with lib;
mkIf (elem "emacs::elpy" config.machine.pkgs) {
mkIf (elem "emacs::elpy" config.machine.pkgs) {
programs.emacs.init.usePackage.elpy = {
enable = true;
after = [ "python" ];
command = [ "elpy-enable" ];
hook = [ ''
after = ["python"];
command = ["elpy-enable"];
hook =
[
''
(elpy-mode
. (lambda ()
(set (make-local-variable 'company-backends)
'((company-dabbrev-code company-yasnippet elpy-company-backend)))))
'' ]
''
]
++ (optional (elem "emacs::flyspell" config.machine.pkgs) "(elpy-mode . (lambda () (flyspell-prog-mode)))")
++ (optional (elem "emacs::flycheck" config.machine.pkgs) "(elpy-mode . (lambda () (flycheck-mode)))");
bindLocal = { elpy-mode-map = {
bindLocal = {
elpy-mode-map = {
"<tab>" = "company-indent-or-complete-common";
};};
};
};
init = ''(with-eval-after-load 'python (elpy-enable))'';
config = ''
(setq elpy-project-root-finder-functions '(elpy-project-find-git-root elpy-project-find-python-root elpy-project-find-hg-root elpy-project-find-svn-root))
@ -33,4 +40,4 @@ mkIf (elem "emacs::elpy" config.machine.pkgs) {
;; (flycheck-add-next-checker 'python-mypy 'python-flake8 t)''}
'';
};
}
}

View file

@ -1,8 +1,10 @@
{ config, lib, ... }:
{
config,
lib,
...
}:
with lib;
mkIf (elem "emacs::fcitx" config.machine.pkgs) {
mkIf (elem "emacs::fcitx" config.machine.pkgs) {
programs.emacs.init.usePackage = {
fcitx = {
enable = true;
@ -13,4 +15,4 @@ mkIf (elem "emacs::fcitx" config.machine.pkgs) {
'';
};
};
}
}

View file

@ -1,11 +1,13 @@
{ config, lib, ... }:
{
config,
lib,
...
}:
with lib;
mkIf (elem "emacs::flycheck" config.machine.pkgs) {
mkIf (elem "emacs::flycheck" config.machine.pkgs) {
programs.emacs.init.usePackage.flycheck = {
enable = true;
command = [ "global-flycheck-mode" ];
command = ["global-flycheck-mode"];
defer = 1;
bind = {};
config = ''
@ -14,22 +16,22 @@ mkIf (elem "emacs::flycheck" config.machine.pkgs) {
};
programs.emacs.init.usePackage.flycheck-haskell = {
enable = (elem "emacs::haskell" config.machine.pkgs);
enable = elem "emacs::haskell" config.machine.pkgs;
};
programs.emacs.init.usePackage.flycheck-irony = {
enable = (elem "emacs::irony" config.machine.pkgs);
enable = elem "emacs::irony" config.machine.pkgs;
};
programs.emacs.init.usePackage.flycheck-mypy = {
enable = (elem "emacs::elpy" config.machine.pkgs);
enable = elem "emacs::elpy" config.machine.pkgs;
};
programs.emacs.init.usePackage.pylint = {
enable = (elem "emacs::elpy" config.machine.pkgs);
enable = elem "emacs::elpy" config.machine.pkgs;
};
programs.emacs.init.usePackage.flycheck-rust = {
enable = (elem "emacs::rust" config.machine.pkgs);
enable = elem "emacs::rust" config.machine.pkgs;
};
}
}

View file

@ -1,13 +1,15 @@
{ config, lib, ... }:
{
config,
lib,
...
}:
with lib;
mkIf (elem "emacs::flyspell" config.machine.pkgs) {
mkIf (elem "emacs::flyspell" config.machine.pkgs) {
programs.emacs.init.usePackage.flyspell = {
enable = true;
package = epkgs: null;
diminish = [ "flyspell-mode" ];
command = [ "flyspell-mode" "flyspell-prog-mode" ];
diminish = ["flyspell-mode"];
command = ["flyspell-mode" "flyspell-prog-mode"];
hook = [];
bind = {
"C-M-<tab>" = "flyspell-switch-dictionary";
@ -28,4 +30,4 @@ mkIf (elem "emacs::flyspell" config.machine.pkgs) {
))
'';
};
}
}

View file

@ -1,8 +1,11 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
with lib;
mkIf (elem "emacs::latex" config.machine.pkgs) {
mkIf (elem "emacs::latex" config.machine.pkgs) {
programs.emacs.init.usePackage = {
latex-mode = {
enable = true;
@ -15,7 +18,7 @@ mkIf (elem "emacs::latex" config.machine.pkgs) {
defer = true;
package = epkgs: epkgs.auctex;
hook = [];
mode = [ ''("\\.tex\\'" . TeX-latex-mode)'' ];
mode = [''("\\.tex\\'" . TeX-latex-mode)''];
};
preview = {
@ -24,4 +27,4 @@ mkIf (elem "emacs::latex" config.machine.pkgs) {
package = epkgs: epkgs.auctex;
};
};
}
}

View file

@ -1,12 +1,15 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
with lib;
mkIf (elem "emacs::lsp" config.machine.pkgs) {
mkIf (elem "emacs::lsp" config.machine.pkgs) {
programs.emacs.init.usePackage = {
lsp-mode = {
enable = true;
command = [ "lsp-mode" ];
command = ["lsp-mode"];
config = ''
(setq lsp-keymap-prefix "C-c")
(setq lsp-eldoc-render-all nil)
@ -32,7 +35,7 @@ mkIf (elem "emacs::lsp" config.machine.pkgs) {
lsp-ui = {
enable = true;
after = [ "lsp-mode" ];
after = ["lsp-mode"];
config = ''
(setq lsp-ui-sideline-enable 't)
(setq lsp-ui-sideline-show-symbol nil)
@ -48,9 +51,10 @@ mkIf (elem "emacs::lsp" config.machine.pkgs) {
lsp-ui-flycheck = {
enable = true;
package = epkgs: [ epkgs.lsp-ui ];
after = [ "lsp-ui" ]
package = epkgs: [epkgs.lsp-ui];
after =
["lsp-ui"]
++ optional (elem "emacs::flycheck" config.machine.pkgs) "flycheck";
};
};
}
}

View file

@ -1,12 +1,14 @@
{ config, lib, ... }:
{
config,
lib,
...
}:
with lib;
mkIf (elem "emacs::magit" config.machine.pkgs) {
mkIf (elem "emacs::magit" config.machine.pkgs) {
programs.emacs.init.usePackage.magit = {
enable = true;
bind = {
"C-c m" = "magit-status";
};
};
}
}

View file

@ -1,8 +1,10 @@
{ config, lib, pkgs, ... }:
with lib;
let
{
config,
lib,
pkgs,
...
}:
with lib; let
defaultEncrypt = pkgs.emacsPackages.trivialBuild rec {
pname = "defaultencrypt";
version = "ba07acc8e9fd692534c39c7cdad0a19dc0d897d9";
@ -14,26 +16,27 @@ let
sha256 = "1ln7h1syx7yi7bqvirv90mk4rvwxg4zm1wvfcvhfh64s3hqrbfgl";
};
};
in mkIf (elem "emacs::mu4e" config.machine.pkgs) {
in
mkIf (elem "emacs::mu4e" config.machine.pkgs) {
programs.emacs.init.usePackage.pinentry = {
enable = true;
command = [ "pinentry-start" ];
hook = [ "(after-init . pinentry-start)" ];
command = ["pinentry-start"];
hook = ["(after-init . pinentry-start)"];
};
programs.emacs.init.usePackage.mu4e = {
enable = true;
package = epkgs: null;
command = [ "mu4e" ];
diminish = [ "mu4e-mode" ];
command = ["mu4e"];
diminish = ["mu4e-mode"];
hook = [
"(mu4e-view-mode . visual-line-mode)"
"(mu4e-compose-mode . flyspell-mode)"
''(message-send . (lambda ()
'' (message-send . (lambda ()
(unless (yes-or-no-p "Send this message?")
(signal 'quit nil))))''
];
bind = { "\t" = "'company-complete-common"; };
bind = {"\t" = "'company-complete-common";};
bindLocal = rec {
mu4e-headers-mode-map = {
"C-+" = "nil";
@ -105,15 +108,15 @@ in mkIf (elem "emacs::mu4e" config.machine.pkgs) {
programs.emacs.init.usePackage.mu4e-alert = {
enable = true;
# hook = [ "after-init . mu4e-alert-enable-mode-line-display" ];
# hook = [ "after-init . mu4e-alert-enable-mode-line-display" ];
};
# programs.emacs.init.usePackage.org-mu4e = {
# enable = (elem "emacs::org" config.machine.pkgs);
# };
# programs.emacs.init.usePackage.org-mu4e = {
# enable = (elem "emacs::org" config.machine.pkgs);
# };
environment.systemPackages = with pkgs; [
mu
isync
];
}
}

View file

@ -1,11 +1,13 @@
{ config, lib, ... }:
{
config,
lib,
...
}:
with lib;
mkIf (elem "emacs::nix-mode" config.machine.pkgs) {
mkIf (elem "emacs::nix-mode" config.machine.pkgs) {
programs.emacs.init.usePackage.nix-mode = {
enable = true;
mode = [ ''"\\.nix\\'"'' ];
mode = [''"\\.nix\\'"''];
config = ''(setq nix-nixfmt-bin "nixfmt -w 150")'';
};
}
}

View file

@ -1,14 +1,20 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
with lib;
mkIf (elem "emacs::org" config.machine.pkgs) {
mkIf (elem "emacs::org" config.machine.pkgs) {
programs.emacs.init.usePackage.org = {
enable = true;
package = epkgs: [ epkgs.org ];
mode = [ ''("\\.org\\'" . org-mode)'' ];
command = [ "org-mode" ];
hook = [ "(org-mode . (lambda () (org-indent-mode)))" ''
package = epkgs: [epkgs.org];
mode = [''("\\.org\\'" . org-mode)''];
command = ["org-mode"];
hook =
[
"(org-mode . (lambda () (org-indent-mode)))"
''
(org-mode
. (lambda ()
;; Automatic line-wrapping in org-mode
@ -17,7 +23,8 @@ mkIf (elem "emacs::org" config.machine.pkgs) {
(setq completion-at-point-functions
'(org-completion-symbols
ora-cap-filesystem))))
'' ''
''
''
(org-mode
. (lambda ()
"Beautify Org Checkbox Symbol"
@ -26,11 +33,14 @@ mkIf (elem "emacs::org" config.machine.pkgs) {
(push '("[-]" . "" ) prettify-symbols-alist)
(prettify-symbols-mode)))
''
] ++ optional (elem "emacs::flyspell" config.machine.pkgs) "(org-mode . (lambda () (flyspell-mode)))";
]
++ optional (elem "emacs::flyspell" config.machine.pkgs) "(org-mode . (lambda () (flyspell-mode)))";
bind = {
"C-c a" = "org-agenda";
};
bindLocal = { org-mode-map = {
bindLocal = {
org-mode-map =
{
"M-<up>" = "org-metaup";
"M-<down>" = "org-metadown";
"M-." = "org-open-at-point";
@ -39,9 +49,11 @@ mkIf (elem "emacs::org" config.machine.pkgs) {
"M-<return>" = "org-meta-return";
"M-p" = "org-previous-visible-heading";
"M-n" = "org-next-visible-heading";
} // (optionalAttrs (elem "emacs::company" config.machine.pkgs) {
}
// (optionalAttrs (elem "emacs::company" config.machine.pkgs) {
"<M-tab>" = "company-pcomplete";
}); };
});
};
config = ''
;; Insead of "..." show "" when there's hidden folded content
@ -162,7 +174,7 @@ mkIf (elem "emacs::org" config.machine.pkgs) {
(when cands
(list (match-beginning 0) (match-end 0) cands)))))
(defun ora-cap-filesystem ()
(defun ora-cap-filesystem ()
(let (path)
(when (setq path (ffap-string-at-point))
(when (string-match "\\`file:\\(.*\\)\\'" path)
@ -185,7 +197,7 @@ mkIf (elem "emacs::org" config.machine.pkgs) {
programs.emacs.init.usePackage.ob = {
enable = true;
package = epkgs: [ epkgs.ob-ipython epkgs.ob-rust epkgs.ob-diagrams ];
package = epkgs: [epkgs.ob-ipython epkgs.ob-rust epkgs.ob-diagrams];
defer = true;
init = ''
(add-hook 'org-babel-after-execute-hook 'org-display-inline-images 'append)
@ -381,35 +393,37 @@ mkIf (elem "emacs::org" config.machine.pkgs) {
programs.emacs.init.usePackage.ox-gfm = {
enable = true;
after = [ "ox" ];
after = ["ox"];
};
programs.emacs.init.usePackage.ox-rst = {
enable = true;
after = [ "ox" ];
after = ["ox"];
};
programs.emacs.init.usePackage.ox-md = {
enable = true;
package = epkgs: null;
after = [ "ox" ];
after = ["ox"];
};
programs.emacs.init.usePackage.org-bullets = {
enable = true;
hook = [ "(org-mode . org-bullets-mode)" ];
hook = ["(org-mode . org-bullets-mode)"];
};
programs.emacs.init.usePackage.org-crypt = {
enable = true;
package = epkgs: null;
after = [ "org" ];
hook = [ "(org-mode . (lambda () (add-hook 'before-save-hook 'org-encrypt-entries nil t)))" ];
command = [ "org-decrypt-entry" "org-encrypt-entry" ];
bindLocal = { org-mode-map = {
after = ["org"];
hook = ["(org-mode . (lambda () (add-hook 'before-save-hook 'org-encrypt-entries nil t)))"];
command = ["org-decrypt-entry" "org-encrypt-entry"];
bindLocal = {
org-mode-map = {
"C-c d" = "org-decrypt-entry";
"C-c e" = "org-encrypt-entry";
};};
};
};
config = ''
(setq org-tags-exclude-from-inheritance (quote ("crypt")))
;; GPG key to use for encryption
@ -423,4 +437,4 @@ mkIf (elem "emacs::org" config.machine.pkgs) {
programs.emacs.init.usePackage.org-drill = {
enable = true;
};
}
}

View file

@ -1,13 +1,16 @@
{ config, lib, ... }:
{
config,
lib,
...
}:
with lib;
mkIf (elem "emacs::php-mode" config.machine.pkgs) {
mkIf (elem "emacs::php-mode" config.machine.pkgs) {
programs.emacs.init.usePackage = {
php-mode = {
enable = true;
hook = lib.optional (elem "emacs::lsp" config.machine.pkgs)
hook =
lib.optional (elem "emacs::lsp" config.machine.pkgs)
''(typescript-mode . (lambda () (lsp)))'';
};
};
}
}

View file

@ -1,8 +1,10 @@
{ config, lib, ... }:
{
config,
lib,
...
}:
with lib;
mkIf (elem "emacs::powerline" config.machine.pkgs) {
mkIf (elem "emacs::powerline" config.machine.pkgs) {
programs.emacs.init.usePackage.powerline = {
enable = true;
config = ''
@ -13,4 +15,4 @@ mkIf (elem "emacs::powerline" config.machine.pkgs) {
(powerline-default-theme)
'';
};
}
}

View file

@ -1,24 +1,32 @@
{ config, lib, pkgs, ... }:
with lib;
let
{
config,
lib,
pkgs,
...
}:
with lib; let
rustEnv = pkgs.symlinkJoin {
name = "rustEnv";
paths = config.machine.pkgsets.rustpkgs.pkgwrap;
};
in mkIf (elem "emacs::rust" config.machine.pkgs) {
in
mkIf (elem "emacs::rust" config.machine.pkgs) {
programs.emacs.init.usePackage.rust-mode = {
enable = true;
hook = [ ''(rust-mode . (lambda () (cargo-minor-mode)))'' ]
++ (if (elem "emacs::lsp" config.machine.pkgs)
hook =
[''(rust-mode . (lambda () (cargo-minor-mode)))'']
++ (
if (elem "emacs::lsp" config.machine.pkgs)
then [''(rust-mode . (lambda () (lsp)))'']
else [''(rust-mode . (lambda () (racer-mode)))'']);
mode = [ ''("\\.rs\\'" . rust-mode)'' ];
command = [ "rust-mode" ];
bindLocal = optionalAttrs (elem "emacs::company" config.machine.pkgs) { rust-mode-map = {
else [''(rust-mode . (lambda () (racer-mode)))'']
);
mode = [''("\\.rs\\'" . rust-mode)''];
command = ["rust-mode"];
bindLocal = optionalAttrs (elem "emacs::company" config.machine.pkgs) {
rust-mode-map = {
"<tab>" = "company-indent-or-complete-common";
};};
};
};
config = ''
(setq rust-rustfmt-bin "${rustEnv}/bin/rustfmt")
(setq rust-format-on-save t)
@ -33,13 +41,15 @@ in mkIf (elem "emacs::rust" config.machine.pkgs) {
programs.emacs.init.usePackage.racer = {
enable = true;
defer = true;
hook = [
hook =
[
''(racer-mode . (lambda () (eldoc-mode)))''
] ++ optional (elem "emacs::company" config.machine.pkgs) ''(racer-mode . (lambda () (company-mode)))'';
]
++ optional (elem "emacs::company" config.machine.pkgs) ''(racer-mode . (lambda () (company-mode)))'';
config = ''
(setq racer-rust-src-path "${rustEnv}/lib/rustlib/src/rust/src")
(setq racer-cmd "${rustEnv}/bin/racer")
'';
};
}
}

View file

@ -1,10 +1,12 @@
{ config, lib, ... }:
{
config,
lib,
...
}:
with lib;
mkIf (elem "emacs::solarized-theme" config.machine.pkgs) {
mkIf (elem "emacs::solarized-theme" config.machine.pkgs) {
programs.emacs.init.usePackage.solarized-theme = {
enable = true;
config = "(load-theme 'solarized-dark t)";
};
}
}

View file

@ -1,15 +1,17 @@
{ config, lib, ... }:
{
config,
lib,
...
}:
with lib;
mkIf (elem "emacs::telega" config.machine.pkgs) {
mkIf (elem "emacs::telega" config.machine.pkgs) {
programs.emacs.init.usePackage.telegram = {
enable = true;
defer = true;
package = epkgs: [ epkgs.telega epkgs.visual-fill-column ];
command = [ "telega" ];
package = epkgs: [epkgs.telega epkgs.visual-fill-column];
command = ["telega"];
config = ''
(telega-alert-mode 1)
'';
};
}
}

View file

@ -1,16 +1,19 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
with lib;
mkIf (elem "emacs::transmission" config.machine.pkgs) {
mkIf (elem "emacs::transmission" config.machine.pkgs) {
programs.emacs.init.usePackage = {
transmission = {
enable = true;
defer = true;
command = [ "transmission" ];
command = ["transmission"];
bindLocal = {
transmission-mode-map = {
"A" = ''(lambda ()
"A" = '' (lambda ()
(interactive)
(transmission-add (read-string "Magnet URI: ")))'';
};
@ -44,4 +47,4 @@ mkIf (elem "emacs::transmission" config.machine.pkgs) {
'';
};
};
}
}

View file

@ -1,11 +1,13 @@
{ config, lib, ... }:
{
config,
lib,
...
}:
with lib;
mkIf (elem "emacs::undo-tree" config.machine.pkgs) {
mkIf (elem "emacs::undo-tree" config.machine.pkgs) {
programs.emacs.init.usePackage.undo-tree = {
enable = true;
hook = [ "(after-init . global-undo-tree-mode)" ];
hook = ["(after-init . global-undo-tree-mode)"];
config = ''
(setq undo-tree-visualizer-diff 't)
(setq undo-tree-auto-save-history 't)
@ -13,4 +15,4 @@ mkIf (elem "emacs::undo-tree" config.machine.pkgs) {
(setq undo-tree-history-directory-alist '(("." . "~/.emacs_undo")))
'';
};
}
}

View file

@ -1,8 +1,10 @@
{ config, lib, ... }:
{
config,
lib,
...
}:
with lib;
mkIf (elem "emacs::web-mode" config.machine.pkgs) {
mkIf (elem "emacs::web-mode" config.machine.pkgs) {
programs.emacs.init.usePackage = {
web-mode = {
enable = true;
@ -60,7 +62,8 @@ mkIf (elem "emacs::web-mode" config.machine.pkgs) {
};
typescript-mode = {
enable = true;
hook = [ "(typescript-mode . (lambda () (subword-mode)))" ]
hook =
["(typescript-mode . (lambda () (subword-mode)))"]
++ lib.optional (elem "emacs::lsp" config.machine.pkgs)
''(typescript-mode . (lambda () (lsp)))'';
mode = [
@ -77,7 +80,7 @@ mkIf (elem "emacs::web-mode" config.machine.pkgs) {
# https://github.com/NixOS/nixpkgs/pull/150239
tree-sitter = {
enable = true;
package = (epkgs: [ epkgs.tree-sitter (epkgs.tree-sitter-langs.withPlugins(p: epkgs.tree-sitter-langs.plugins ++ [ p.tree-sitter-markdown p.tree-sitter-tsx ]))]);
package = epkgs: [epkgs.tree-sitter (epkgs.tree-sitter-langs.withPlugins (p: epkgs.tree-sitter-langs.plugins ++ [p.tree-sitter-markdown p.tree-sitter-tsx]))];
hook = [
"(typescript-mode . tree-sitter-hl-mode)"
"(typescript-tsx-mode . tree-sitter-hl-mode)"
@ -86,7 +89,6 @@ mkIf (elem "emacs::web-mode" config.machine.pkgs) {
(tree-sitter-require 'tsx)
(add-to-list 'tree-sitter-major-mode-language-alist '(typescript-tsx-mode . tsx))
'';
};
impatient-mode = {
enable = true;
@ -95,4 +97,4 @@ mkIf (elem "emacs::web-mode" config.machine.pkgs) {
enable = true;
};
};
}
}

View file

@ -1,11 +1,14 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
with lib;
mkIf (elem "emacs::yaml-mode" config.machine.pkgs) {
mkIf (elem "emacs::yaml-mode" config.machine.pkgs) {
programs.emacs.init.usePackage = {
yaml-mode = {
enable = true;
};
};
}
}

View file

@ -1,12 +1,15 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
with lib;
mkIf (elem "emacs::yasnippet" config.machine.pkgs) {
mkIf (elem "emacs::yasnippet" config.machine.pkgs) {
programs.emacs.init.usePackage = {
yasnippet = {
enable = true;
hook = [ "(after-init . yas-global-mode)" ];
hook = ["(after-init . yas-global-mode)"];
# config = ''
# '';
@ -15,4 +18,4 @@ mkIf (elem "emacs::yasnippet" config.machine.pkgs) {
enable = true;
};
};
}
}

View file

@ -1,6 +1,8 @@
{ config, pkgs, ... }:
{
config,
pkgs,
...
}: {
config.machine.pkgsets.extra.pkgs = with pkgs; [
alsaUtils
binutils-unwrapped

View file

@ -1,5 +1,7 @@
{ config, pkgs, ... }:
{
config.machine.pkgsets.haskell-tools.pkgs = with pkgs; [ cabal-install hlint ]; # ghcid
config,
pkgs,
...
}: {
config.machine.pkgsets.haskell-tools.pkgs = with pkgs; [cabal-install hlint]; # ghcid
}

View file

@ -1,7 +1,11 @@
{ config, lib, fn, pkgs, ... }:
{
config.machine.pkgsets.haskell.pkgwrap = (pkgs.haskellPackages.ghcWithPackages (pkgs: (fn.pkgFilter config.machine.pkgsets.haskell.pkgs)));
config,
lib,
fn,
pkgs,
...
}: {
config.machine.pkgsets.haskell.pkgwrap = pkgs.haskellPackages.ghcWithPackages (pkgs: (fn.pkgFilter config.machine.pkgsets.haskell.pkgs));
config.machine.pkgsets.haskell.pkgs = with pkgs.haskellPackages; [
hindent
mtl

View file

@ -1,8 +1,10 @@
{ config, lib, pkgs, ... }:
with lib;
{
config,
lib,
pkgs,
...
}:
with lib; {
config.machine.pkgsets.latex.pkgs = with pkgs; [
texlive.combined.scheme-full
texlab

View file

@ -1,6 +1,8 @@
{ config, pkgs, ... }:
{
config,
pkgs,
...
}: {
config.machine.pkgsets.mail_utils.pkgs = with pkgs; [
fetchmail
isync

View file

@ -1,8 +1,11 @@
{ config, pkgs, ... }:
{
config.machine.pkgsets.nodejs.pkgs = (with pkgs; [ nodejs yarn deno esbuild ]) ++
(with pkgs.nodePackages; [
config,
pkgs,
...
}: {
config.machine.pkgsets.nodejs.pkgs =
(with pkgs; [nodejs yarn deno esbuild])
++ (with pkgs.nodePackages; [
autoprefixer
browserify
create-react-app

View file

@ -1,8 +1,14 @@
{ config, lib, fn, pkgs, ... }:
{
config.machine.pkgsets.php.pkgwrap = (fn.pkgFilter config.machine.pkgsets.php.pkgs);
config.machine.pkgsets.php.pkgs = (with pkgs.php82Packages; [
config,
lib,
fn,
pkgs,
...
}: {
config.machine.pkgsets.php.pkgwrap = fn.pkgFilter config.machine.pkgsets.php.pkgs;
config.machine.pkgsets.php.pkgs =
(with pkgs.php82Packages; [
composer
]) ++ (with pkgs; [ php82 ]);
])
++ (with pkgs; [php82]);
}

View file

@ -1,9 +1,12 @@
{ config, lib, fn, pkgs, ... }:
with lib;
{
config.machine.pkgsets.python3.pkgwrap = (pkgs.python310.withPackages (ps: (fn.pkgFilter config.machine.pkgsets.python3.pkgs)));
config,
lib,
fn,
pkgs,
...
}:
with lib; {
config.machine.pkgsets.python3.pkgwrap = pkgs.python310.withPackages (ps: (fn.pkgFilter config.machine.pkgsets.python3.pkgs));
config.machine.pkgsets.python3.pkgs = with pkgs.python310Packages; [
GitPython
bpython
@ -13,7 +16,8 @@ with lib;
epc
flake8
genanki
matplotlib ipywidgets
matplotlib
ipywidgets
python-docx
mypy
numpy
@ -29,7 +33,8 @@ with lib;
pypdf2
# pygame pygame_sdl2
pylama
pylint toml
pylint
toml
pyopengl
pyproj
pytest

View file

@ -1,14 +1,15 @@
{ config, ... }:
let
mozRust = with builtins; (map (p: import ((fetchTarball {
{config, ...}: let
mozRust = with builtins;
(map (p:
import ((fetchTarball {
url = "https://github.com/mozilla/nixpkgs-mozilla/archive/e912ed4.tar.gz";
sha256 = "08fvzb8w80bkkabc1iyhzd15f4sm7ra10jn32kfch5klgl0gj3j3";
}) + p))) [
})
+ p))) [
(toPath "/lib-overlay.nix")
(toPath "/rust-overlay.nix")
];
stablepkgs = import <nixos-stable> { overlays = mozRust;};
stablepkgs = import <nixos-stable> {overlays = mozRust;};
# https://rust-lang.github.io/rustup-components-history
nightly = stablepkgs.rustChannelOf {
@ -16,24 +17,28 @@ let
channel = "nightly";
};
rustNightly = {
rustc = nightly.rust.override {
rustc =
nightly.rust.override {
extensions = [
"clippy-preview"
"rls-preview"
"rust-analysis"
"rust-src"
"rustfmt-preview"
]; } // { src = nightly.rust-src; };
];
}
// {src = nightly.rust-src;};
cargo = nightly.cargo;
};
rustPNightly = stablepkgs.recurseIntoAttrs (stablepkgs.makeRustPlatform {
inherit (rustNightly) rustc cargo;
});
in {
config.machine.pkgsets.rustpkgs.pkgs = (with stablepkgs; [
config.machine.pkgsets.rustpkgs.pkgs =
(with stablepkgs; [
diesel-cli
carnix
rustracer
]) ++ (with rustNightly; [ rustc cargo]);
])
++ (with rustNightly; [rustc cargo]);
}

View file

@ -1,6 +1,8 @@
{ config, pkgs, ... }:
{
config,
pkgs,
...
}: {
config.machine.pkgsets.server.pkgs = with pkgs; [
audit
certbot

View file

@ -1,8 +1,10 @@
{ config, lib, pkgs, ... }:
with lib;
{
config,
lib,
pkgs,
...
}:
with lib; {
config.machine.pkgsets.tracking.pkgs = with pkgs; [
aw-qt
aw-server-rust

View file

@ -1,5 +1,7 @@
{ config, pkgs, ... }:
{
config.machine.pkgsets.uniProgs.pkgs = with pkgs; [ qucs ];
config,
pkgs,
...
}: {
config.machine.pkgsets.uniProgs.pkgs = with pkgs; [qucs];
}

View file

@ -1,6 +1,8 @@
{ config, pkgs, ... }:
let
{
config,
pkgs,
...
}: let
cfg = config.machine;
in {
config.machine.pkgsets.xpkgs.pkgs = with pkgs; [
@ -13,7 +15,9 @@ in {
gnome3.gvfs
gvfs
oneko
pcmanfm lxmenu-data shared-mime-info
pcmanfm
lxmenu-data
shared-mime-info
pavucontrol
xclip
xorg.xkill

View file

@ -1,14 +1,19 @@
{ options, config, lib, fn, pkgs, ... }:
{
options,
config,
lib,
fn,
pkgs,
...
}:
with builtins;
with lib;
let
with lib; let
cfg = config.machine;
in mkIf (elem "acme" cfg.services) {
in
mkIf (elem "acme" cfg.services) {
security.acme = {
# see https://letsencrypt.org/repository/
acceptTerms = true;
defaults.email = "${(elemAt cfg.mailAccounts 0).name}@${cfg.domain}";
};
}
}

View file

@ -1,20 +1,28 @@
# This Configuration is meant for local DNS setups only!
{ options, config, lib, fn, pkgs, ... }:
{
options,
config,
lib,
fn,
pkgs,
...
}:
with builtins;
with lib;
let
with lib; let
cfg = config.machine;
in mkIf (elem "bind" cfg.services) {
in
mkIf (elem "bind" cfg.services) {
services.bind = {
enable = true;
listenOn = [ "127.0.0.1" ];
listenOn = ["127.0.0.1"];
forwarders = [
# Cloudflare CDN
"1.1.1.1" "1.0.0.1"
"1.1.1.1"
"1.0.0.1"
#CCC DNS
"204.152.184.76" "159.203.38.175" "207.148.83.241"
"204.152.184.76"
"159.203.38.175"
"207.148.83.241"
];
# TODO: add DNSSEC
extraOptions = ''
@ -25,4 +33,4 @@ in mkIf (elem "bind" cfg.services) {
version none;
'';
};
}
}

View file

@ -1,14 +1,15 @@
{ config, lib, ... }:
{
config,
lib,
...
}:
with lib;
mkIf (elem "containers" config.machine.services) {
mkIf (elem "containers" config.machine.services) {
containers.CDServer = {
privateNetwork = true;
hostAddress = "192.168.100.10";
localAddress = "192.168.100.11";
config =
{
config = {
imports = [
../machines/CDServer/options.nix
./default.nix
@ -20,4 +21,4 @@ mkIf (elem "containers" config.machine.services) {
services.ntp.enable = false;
};
};
}
}

View file

@ -1,11 +1,14 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
with lib;
mkIf (elem "cups" config.machine.services) {
mkIf (elem "cups" config.machine.services) {
services.printing = {
enable = true;
startWhenNeeded = true;
drivers = with pkgs; [ gutenprint hplip splix samsung-unified-linux-driver ];
drivers = with pkgs; [gutenprint hplip splix samsung-unified-linux-driver];
};
}
}

View file

@ -1,13 +1,21 @@
{ config, lib, fn, pkgs, ... }:
with lib;
let
{
config,
lib,
fn,
pkgs,
...
}:
with lib; let
cfg = config.machine;
desktopFiles = fn.lst { p = (toString ./desktop); b = true; };
in {
desktopFiles = fn.lst {
p = toString ./desktop;
b = true;
};
in
{
imports = desktopFiles;
} // mkIf (elem "desktop" cfg.services) {
}
// mkIf (elem "desktop" cfg.services) {
services.gvfs.enable = true;
services.xserver = {
layout = "de";
@ -25,4 +33,4 @@ in {
ACTION=="add", SUBSYSTEM=="backlight", RUN+="${pkgs.coreutils}/bin/chgrp video /sys/class/backlight/%k/brightness"
ACTION=="add", SUBSYSTEM=="backlight", RUN+="${pkgs.coreutils}/bin/chmod 664 /sys/class/backlight/%k/brightness"
'';
}
}

View file

@ -1,13 +1,16 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
with lib;
mkIf (elem "desktop::i3" config.machine.services) {
mkIf (elem "desktop::i3" config.machine.services) {
services.xserver = {
enable = true;
windowManager.i3 = {
enable = true;
configFile = (import ../../config/etc/i3/config.nix { inherit pkgs; });
configFile = import ../../config/etc/i3/config.nix {inherit pkgs;};
extraPackages = with pkgs; [
dmenu
file
@ -17,5 +20,5 @@ mkIf (elem "desktop::i3" config.machine.services) {
];
};
};
machine.pkgsets.python3.pkgs = with pkgs.python310Packages; [ py3status pytz tzlocal ];
}
machine.pkgsets.python3.pkgs = with pkgs.python310Packages; [py3status pytz tzlocal];
}

View file

@ -1,15 +1,21 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
with lib;
mkIf (elem "desktop::sway" config.machine.services) {
mkIf (elem "desktop::sway" config.machine.services) {
programs.sway = {
enable = true;
extraPackages = with pkgs; [
xwayland
file i3status dmenu
file
i3status
dmenu
qt5.qtwayland
grim slurp
grim
slurp
swaylock
swayidle
light
@ -30,4 +36,4 @@ mkIf (elem "desktop::sway" config.machine.services) {
export _JAVA_AWT_WM_NONREPARENTING=1
'';
};
}
}

View file

@ -1,13 +1,16 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
# Note: add privileged users to docker group for access
with lib;
mkIf ((elem "docker" config.machine.services) && !(elem "podman" config.machine.services)) {
virtualisation.docker= {
mkIf ((elem "docker" config.machine.services) && !(elem "podman" config.machine.services)) {
virtualisation.docker = {
enable = true;
# Disable live restore as it tends to delay/block system shutdown
liveRestore = false;
};
environment.systemPackages = with pkgs; [ docker-compose docker-machine cntr ];
}
environment.systemPackages = with pkgs; [docker-compose docker-machine cntr];
}

View file

@ -1,11 +1,13 @@
{ config, lib, ... }:
with lib;
let
{
config,
lib,
...
}:
with lib; let
cfg = config.machine;
active = name: (elem name cfg.services);
in mkIf (elem "fail2ban" cfg.services) {
in
mkIf (elem "fail2ban" cfg.services) {
services.fail2ban = {
enable = true;
jails = {
@ -61,7 +63,7 @@ in mkIf (elem "fail2ban" cfg.services) {
};
environment.etc."fail2ban/filter.d/sshd-ddos.conf" = {
enable = (active "openssh");
enable = active "openssh";
text = ''
[Definition]
failregex = sshd(?:\[\d+\])?: Did not receive identification string from <HOST>$
@ -70,7 +72,7 @@ in mkIf (elem "fail2ban" cfg.services) {
};
environment.etc."fail2ban/filter.d/postfix-sasl.conf" = {
enable = (active "mailserver");
enable = active "mailserver";
text = ''
# Fail2Ban filter for postfix authentication failures
[INCLUDES]
@ -82,7 +84,7 @@ in mkIf (elem "fail2ban" cfg.services) {
};
environment.etc."fail2ban/filter.d/postfix-ddos.conf" = {
enable = (active "mailserver");
enable = active "mailserver";
text = ''
[Definition]
failregex = lost connection after EHLO from \S+\[<HOST>\]
@ -90,7 +92,7 @@ in mkIf (elem "fail2ban" cfg.services) {
};
environment.etc."fail2ban/filter.d/nginx-req-limit.conf" = {
enable = (active "nginx");
enable = active "nginx";
text = ''
[Definition]
failregex = limiting requests, excess:.* by zone.*client: <HOST>
@ -99,4 +101,4 @@ in mkIf (elem "fail2ban" cfg.services) {
# Limit stack size to reduce memory usage
systemd.services.fail2ban.serviceConfig.LimitSTACK = 256 * 1024;
}
}

View file

@ -1,8 +1,10 @@
{ config, lib, ... }:
{
config,
lib,
...
}:
with lib;
mkIf (elem "fprintd" config.machine.services) {
mkIf (elem "fprintd" config.machine.services) {
security.pam.services = let
unlock = [
"sudo"
@ -10,9 +12,13 @@ mkIf (elem "fprintd" config.machine.services) {
"login"
"lightdm"
];
in listToAttrs (forEach unlock (n: {name = n; value = { fprintAuth = true; }; }));
in
listToAttrs (forEach unlock (n: {
name = n;
value = {fprintAuth = true;};
}));
services.fprintd = {
enable = true;
};
}
}

View file

@ -1,8 +1,10 @@
{ config, lib, ... }:
{
config,
lib,
...
}:
with lib;
mkIf (elem "gitea" config.machine.services) {
mkIf (elem "gitea" config.machine.services) {
services = {
gitea = let
cfg = config.machine;
@ -34,7 +36,7 @@ mkIf (elem "gitea" config.machine.services) {
};
service = {
DISABLE_REGISTRATION = (lib.mkForce true);
DISABLE_REGISTRATION = lib.mkForce true;
};
session = {
@ -51,4 +53,4 @@ mkIf (elem "gitea" config.machine.services) {
createHome = true;
useDefaultShell = true;
};
}
}

Some files were not shown because too many files have changed in this diff Show more