Compare commits

...

2 Commits

Author SHA1 Message Date
fad8e51f94
clean up some scopes 2024-05-11 22:55:59 +02:00
95d2252b1e
update tooling 2024-05-11 11:37:59 +02:00
54 changed files with 1293 additions and 1290 deletions

View File

@ -5,117 +5,120 @@
...
}:
let
cfg = config.grimmShared;
sync_mod =
with lib;
types.submodule (
{ config, ... }:
{
options = {
remote = mkOption {
type = types.nonEmptyStr;
description = "path on the cloud server";
};
inherit (lib)
types
mkOption
concatStrings
mkIf
mkEnableOption
;
inherit (config.grimmShared) enable cloudSync;
inherit (pkgs) nextcloud-client writeShellScriptBin;
local = mkOption {
type = types.nonEmptyStr;
default = "$HOME/" + (concatStrings (builtins.match "/*(.+)" config.remote));
description = "local path to sync";
sync_mod = types.submodule (
{ config, ... }:
{
options = {
remote = mkOption {
type = types.nonEmptyStr;
description = "path on the cloud server";
};
local = mkOption {
type = types.nonEmptyStr;
default = "$HOME/" + (concatStrings (builtins.match "/*(.+)" config.remote));
description = "local path to sync";
};
};
}
);
in
{
config = mkIf (enable && cloudSync.enable) (
let
cloud_cmd = ''${nextcloud-client}/bin/nextcloudcmd -u ${cloudSync.username} -p "$(cat ${cloudSync.passwordFile})" -h -n --path'';
sync_server = "https://${cloudSync.server}";
in
{
environment.systemPackages = [
(writeShellScriptBin "cloudsync-cmd" (cloud_cmd + " $@ " + sync_server))
nextcloud-client
];
systemd.services = lib.mkMerge (
lib.mapAttrsToList (
local_user: user_conf:
let
paths = user_conf.syncPaths;
sync_script = lib.strings.concatLines (
map (
{ local, remote }:
let
remote_clean = lib.strings.concatStrings (builtins.match "/*(.+)" remote);
in
"${cloud_cmd} /${remote_clean} ${local} ${sync_server}"
) paths
);
in
{
# user-specific sync jobs
"nextcloud-autosync-${local_user}" = lib.mkIf (paths != [ ]) {
description = "Auto sync Nextcloud";
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
serviceConfig.Type = "simple";
serviceConfig.User = local_user;
serviceConfig.Group = "users";
script = sync_script;
# TimeoutStopSec = "180";
# KillMode = "process";
# KillSignal = "SIGINT";
wantedBy = [ "multi-user.target" ];
enable = true;
};
}
) config.users.users
);
systemd.timers = lib.mkMerge (
lib.mapAttrsToList (
local_user: user_conf:
let
paths = user_conf.syncPaths;
in
{
# user-specific sync jobs
"nextcloud-autosync-${local_user}" = lib.mkIf (paths != [ ]) {
description = "Automatic sync files with Nextcloud when booted up after 5 minutes then rerun every 60 minutes";
timerConfig.OnBootSec = "5min";
timerConfig.OnUnitActiveSec = "60min";
wantedBy = [
"multi-user.target"
"timers.target"
];
enable = true;
};
}
) config.users.users
);
}
);
options.users.users = mkOption {
type = types.attrsOf (
types.submodule {
options = {
syncPaths = mkOption {
type = types.listOf sync_mod;
default = [ ];
description = "paths to sync via nextcloud";
};
};
}
);
in
{
config =
with cfg;
lib.mkIf (enable && cloudSync.enable) (
let
cloud_cmd = ''${pkgs.nextcloud-client}/bin/nextcloudcmd -u ${config.grimmShared.cloudSync.username} -p "$(cat ${config.grimmShared.cloudSync.passwordFile})" -h -n --path'';
sync_server = "https://${config.grimmShared.cloudSync.server}";
in
{
environment.systemPackages = with pkgs; [
(writeShellScriptBin "cloudsync-cmd" (cloud_cmd + " $@ " + sync_server))
nextcloud-client
];
};
systemd.services = lib.mkMerge (
lib.mapAttrsToList (
local_user: user_conf:
let
paths = user_conf.syncPaths;
sync_script = lib.strings.concatLines (
map (
{ local, remote }:
let
remote_clean = lib.strings.concatStrings (builtins.match "/*(.+)" remote);
in
"${cloud_cmd} /${remote_clean} ${local} ${sync_server}"
) paths
);
in
{
# user-specific sync jobs
"nextcloud-autosync-${local_user}" = lib.mkIf (paths != [ ]) {
description = "Auto sync Nextcloud";
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
serviceConfig.Type = "simple";
serviceConfig.User = local_user;
serviceConfig.Group = "users";
script = sync_script;
# TimeoutStopSec = "180";
# KillMode = "process";
# KillSignal = "SIGINT";
wantedBy = [ "multi-user.target" ];
enable = true;
};
}
) config.users.users
);
systemd.timers = lib.mkMerge (
lib.mapAttrsToList (
local_user: user_conf:
let
paths = user_conf.syncPaths;
in
{
# user-specific sync jobs
"nextcloud-autosync-${local_user}" = lib.mkIf (paths != [ ]) {
description = "Automatic sync files with Nextcloud when booted up after 5 minutes then rerun every 60 minutes";
timerConfig.OnBootSec = "5min";
timerConfig.OnUnitActiveSec = "60min";
wantedBy = [
"multi-user.target"
"timers.target"
];
enable = true;
};
}
) config.users.users
);
}
);
options.users.users =
with lib;
mkOption {
type = types.attrsOf (
types.submodule {
options = {
syncPaths = mkOption {
type = types.listOf sync_mod;
default = [ ];
description = "paths to sync via nextcloud";
};
};
}
);
};
options.grimmShared.cloudSync = with lib; {
options.grimmShared.cloudSync = {
enable = mkEnableOption "cloud_sync";
username = mkOption {

View File

@ -1,9 +1,4 @@
{
config,
lib,
pkgs,
...
}:
{ lib, ... }:
with lib;
{
options.grimmShared = {

View File

@ -5,68 +5,77 @@
...
}:
let
cfg = config.grimmShared;
inherit (config.grimmShared)
enable
firefox
tooling
locale
sway
;
inherit (lib)
mkIf
optionals
mapAttrs
optionalAttrs
;
in
{
config =
with cfg;
lib.mkIf (enable && firefox.enable) {
environment.systemPackages =
config = mkIf (enable && firefox.enable) {
environment.systemPackages =
[ ]
++ optionals config.services.desktopManager.plasma6.enable [ pkgs.plasma-browser-integration ];
programs.firefox = {
package = pkgs.firefox-beta;
enable = true;
nativeMessagingHosts.packages =
[ ]
++ lib.optionals config.services.desktopManager.plasma6.enable [ pkgs.plasma-browser-integration ];
programs.firefox = {
package = pkgs.firefox-beta;
enable = true;
nativeMessagingHosts.packages =
[ ]
++ lib.optionals (cfg.tooling.enable && cfg.tooling.pass) [ pkgs.passff-host ];
languagePacks = lib.optionals cfg.locale [
"de"
"en-US"
];
policies = {
ExtensionSettings = lib.mkMerge [
(lib.mkIf cfg.firefox.disableUserPlugins { "*".installation_mode = "blocked"; })
(lib.mapAttrs (guid: shortId: {
# explicit plugins by config
install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi";
++ lib.optionals (tooling.enable && tooling.pass) [ pkgs.passff-host ];
languagePacks = optionals locale [
"de"
"en-US"
];
policies = {
ExtensionSettings =
(mkIf firefox.disableUserPlugins { "*".installation_mode = "blocked"; })
// (mapAttrs (guid: shortId: {
# explicit plugins by config
install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi";
installation_mode = "force_installed";
}) firefox.plugins)
// (mkIf (tooling.enable && tooling.pass) {
# password-store support
"passff@invicem.pro" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/passff/latest.xpi";
installation_mode = "force_installed";
}) cfg.firefox.plugins)
(lib.mkIf (cfg.tooling.enable && cfg.tooling.pass) {
# password-store support
"passff@invicem.pro" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/passff/latest.xpi";
installation_mode = "force_installed";
};
})
];
DisableTelemetry = true;
DisableFirefoxStudies = true;
EnableTrackingProtection = {
Value = true;
Locked = true;
Cryptomining = true;
Fingerprinting = true;
};
DisablePocket = true;
DisableFirefoxAccounts = true;
DisableAccounts = true;
DisableFirefoxScreenshots = true;
OverrideFirstRunPage = "";
OverridePostUpdatePage = "";
DontCheckDefaultBrowser = true;
Preferences = {
"pdfjs.enableScripting" = false;
"media.hardware-video-decoding.enabled" = true;
"media.ffmpeg.vaapi.enabled" = true;
"media.rdd-ffmpeg.enabled" = true;
"media.navigator.mediadatadecoder_vpx_enabled" = true;
} // lib.optionalAttrs cfg.sway.enable { "browser.tabs.inTitlebar" = 0; };
};
});
DisableTelemetry = true;
DisableFirefoxStudies = true;
EnableTrackingProtection = {
Value = true;
Locked = true;
Cryptomining = true;
Fingerprinting = true;
};
DisablePocket = true;
DisableFirefoxAccounts = true;
DisableAccounts = true;
DisableFirefoxScreenshots = true;
OverrideFirstRunPage = "";
OverridePostUpdatePage = "";
DontCheckDefaultBrowser = true;
Preferences = {
"pdfjs.enableScripting" = false;
"media.hardware-video-decoding.enabled" = true;
"media.ffmpeg.vaapi.enabled" = true;
"media.rdd-ffmpeg.enabled" = true;
"media.navigator.mediadatadecoder_vpx_enabled" = true;
} // optionalAttrs sway.enable { "browser.tabs.inTitlebar" = 0; };
};
};
};
options.grimmShared.firefox = with lib; {
enable = mkEnableOption "grimm-firefox";
@ -77,6 +86,6 @@ in
description = "set of plugins to install. Format: guid = short-id";
};
disableUserPlugins = lib.mkEnableOption "disables user controlled plugins";
disableUserPlugins = mkEnableOption "disables user controlled plugins";
};
}

View File

@ -5,58 +5,57 @@
...
}:
let
cfg = config.grimmShared;
inherit (config.grimmShared) enable gaming;
inherit (lib) mkIf getExe mkEnableOption;
in
{
config =
with cfg;
lib.mkIf (enable && gaming) {
programs.steam = {
enable = true;
gamescopeSession.enable = true;
gamescopeSession.env = {
DRI_PRIME = "1";
};
extraCompatPackages = with pkgs; [ proton-ge-bin ];
# extest.enable = true;
config = mkIf (enable && gaming) {
programs.steam = {
enable = true;
gamescopeSession.enable = true;
gamescopeSession.env = {
DRI_PRIME = "1";
};
programs.gamemode = {
enable = true;
settings = {
general = {
inhibit_screensaver = 0;
renice = 10;
};
custom = {
start = "${lib.getExe pkgs.libnotify} 'GameMode started'";
end = "${lib.getExe pkgs.libnotify} 'GameMode ended'";
};
};
};
services.udev.packages = [ pkgs.wooting-udev-rules ];
environment.sessionVariables = {
GAMEMODERUNEXEC = "env DRI_PRIME=1";
};
environment.systemPackages = with pkgs; [
heroic
prismlauncher
mangohud
the-powder-toy
(pkgs.symlinkJoin {
name = "osu";
paths = [
(pkgs.writeShellScriptBin "osu!" ''
exec gamemoderun ${lib.getExe pkgs.osu-lazer-bin}
'')
pkgs.osu-lazer-bin
];
})
];
extraCompatPackages = with pkgs; [ proton-ge-bin ];
# extest.enable = true;
};
options.grimmShared.gaming = lib.mkEnableOption "enables steam, heroic, prism and gamemoded";
programs.gamemode = {
enable = true;
settings = {
general = {
inhibit_screensaver = 0;
renice = 10;
};
custom = {
start = "${lib.getExe pkgs.libnotify} 'GameMode started'";
end = "${lib.getExe pkgs.libnotify} 'GameMode ended'";
};
};
};
services.udev.packages = [ pkgs.wooting-udev-rules ];
environment.sessionVariables = {
GAMEMODERUNEXEC = "env DRI_PRIME=1";
};
environment.systemPackages = with pkgs; [
heroic
prismlauncher
mangohud
the-powder-toy
(symlinkJoin {
name = "osu";
paths = [
(writeShellScriptBin "osu!" ''
exec gamemoderun ${getExe osu-lazer-bin}
'')
osu-lazer-bin
];
})
];
};
options.grimmShared.gaming = mkEnableOption "enables steam, heroic, prism and gamemoded";
}

View File

@ -4,24 +4,25 @@
config,
...
}:
let
inherit (config.grimmShared) enable graphical;
in
{
config =
with config.grimmShared;
lib.mkIf (enable && graphical) {
fonts = {
packages = with pkgs; [
noto-fonts
noto-fonts-cjk
font-awesome
noto-fonts-emoji
roboto
liberation_ttf
];
config = lib.mkIf (enable && graphical) {
fonts = {
packages = with pkgs; [
noto-fonts
noto-fonts-cjk
font-awesome
noto-fonts-emoji
roboto
liberation_ttf
];
fontDir.enable = true;
};
environment.sessionVariables = {
FREETYPE_PROPERTIES = "cff:no-stem-darkening=0 autofitter:no-stem-darkening=0";
};
fontDir.enable = true;
};
environment.sessionVariables = {
FREETYPE_PROPERTIES = "cff:no-stem-darkening=0 autofitter:no-stem-darkening=0";
};
};
}

View File

@ -5,74 +5,72 @@
...
}:
let
cfg = config.grimmShared;
screen =
with lib;
types.submodule {
options = {
fps = mkOption {
type = types.either types.int (types.nonEmptyListOf types.int);
default = 60;
description = "max framerate of screen";
};
inherit (config.grimmShared) enable graphical screens;
inherit (lib) types mkOption mkIf;
mode = mkOption {
type = types.nonEmptyStr;
default = "1920x1080";
description = "pixel format of the screen";
};
screen = types.submodule {
options = {
fps = mkOption {
type = types.either types.int (types.nonEmptyListOf types.int);
default = 60;
description = "max framerate of screen";
};
id = mkOption {
type = types.nonEmptyStr;
description = "ID of the screen";
};
mode = mkOption {
type = types.nonEmptyStr;
default = "1920x1080";
description = "pixel format of the screen";
};
pos = mkOption {
type = types.nullOr types.nonEmptyStr;
default = null;
example = "0,0";
description = "position where to place the screen";
};
id = mkOption {
type = types.nonEmptyStr;
description = "ID of the screen";
};
pos = mkOption {
type = types.nullOr types.nonEmptyStr;
default = null;
example = "0,0";
description = "position where to place the screen";
};
};
};
in
{
config =
with cfg;
lib.mkIf (enable && graphical) {
# Enable OpenGL
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages = with pkgs; [ ];
};
chaotic.mesa-git.enable = true;
boot.kernelParams = [ "nouveau.config=NvGspRm=1" ];
environment.sessionVariables = {
__GL_LOG_MAX_ANISO = "0";
__GL_SHADER_DISK_CACHE = "1";
__GL_SYNC_TO_VBLANK = "0";
__GL_THREADED_OPTIMIZATIONS = "1";
__GL_VRR_ALLOWED = "1";
# MESA_LOADER_DRIVER_OVERRIDE="zink";
# FLATPAK_GL_DRIVERS="mesa-git";
};
environment.systemPackages = with pkgs; [
glfw
glxinfo
vulkan-tools
mangohud
];
config = mkIf (enable && graphical) {
# Enable OpenGL
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages = [ ];
};
options.grimmShared = with lib; {
chaotic.mesa-git.enable = true;
boot.kernelParams = [ "nouveau.config=NvGspRm=1" ];
environment.sessionVariables = {
__GL_LOG_MAX_ANISO = "0";
__GL_SHADER_DISK_CACHE = "1";
__GL_SYNC_TO_VBLANK = "0";
__GL_THREADED_OPTIMIZATIONS = "1";
__GL_VRR_ALLOWED = "1";
# MESA_LOADER_DRIVER_OVERRIDE="zink";
# FLATPAK_GL_DRIVERS="mesa-git";
};
environment.systemPackages = with pkgs; [
glfw
glxinfo
vulkan-tools
mangohud
];
};
options.grimmShared = {
graphical = mkOption {
type = types.bool;
default = cfg.screens != { };
default = screens != { };
description = "whether to force enable graphical components";
};

View File

@ -5,51 +5,49 @@
...
}:
let
cfg = config.grimmShared;
inherit (config.grimmShared) enable graphical sway;
in
{
config =
with cfg;
lib.mkIf (enable && graphical) {
qt = {
enable = true;
style = "kvantum";
platformTheme = "qt5ct";
};
environment.systemPackages =
with pkgs;
with kdePackages;
[
qtstyleplugin-kvantum
catppuccin-sddm-corners
libsForQt5.qtgraphicaleffects
catppuccin-kvantum
kdePackages.audiocd-kio
kdePackages.kio-extras
kdePackages.kio
xcb-util-cursor
qt6ct
kdePackages.dolphin
qtwayland
];
environment.pathsToLink = [ "/share/Kvantum" ];
services.displayManager = {
sddm = {
enable = true;
theme = "catppuccin-sddm-corners";
wayland.enable = true;
wayland.compositor = "weston";
};
defaultSession = lib.optionalString cfg.sway.enable "sway";
};
boot.plymouth = {
themePackages = with pkgs; [ catppuccin-plymouth ];
theme = "catppuccin-macchiato";
enable = true;
};
config = lib.mkIf (enable && graphical) {
qt = {
enable = true;
style = "kvantum";
platformTheme = "qt5ct";
};
environment.systemPackages =
with pkgs;
with kdePackages;
[
qtstyleplugin-kvantum
catppuccin-sddm-corners
libsForQt5.qtgraphicaleffects
catppuccin-kvantum
kdePackages.audiocd-kio
kdePackages.kio-extras
kdePackages.kio
xcb-util-cursor
qt6ct
kdePackages.dolphin
qtwayland
];
environment.pathsToLink = [ "/share/Kvantum" ];
services.displayManager = {
sddm = {
enable = true;
theme = "catppuccin-sddm-corners";
wayland.enable = true;
wayland.compositor = "weston";
};
defaultSession = lib.optionalString sway.enable "sway";
};
boot.plymouth = {
themePackages = with pkgs; [ catppuccin-plymouth ];
theme = "catppuccin-macchiato";
enable = true;
};
};
}

View File

@ -5,61 +5,78 @@
...
}:
let
cfg = config.grimmShared;
sway_conf =
with lib;
types.submodule (
{ config, ... }:
rec {
options = {
keybinds = mkOption {
type = types.attrsOf types.str;
default = { };
description = "set of keybinds assigning key combo to action";
};
inherit (config.grimmShared) enable sway screens;
inherit (lib)
types
mkOption
mkEnableOption
mapAttrsToList
optionalString
concatMapStrings
isInt
min
max
foldl'
getExe
isPath
isDerivation
concatLines
optional
mkIf
;
inherit (pkgs) writeShellScriptBin;
autolaunch = mkOption {
type = types.listOf (types.either types.nonEmptyStr types.package);
default = [ ];
description = "set of commands to be run at sway startup";
};
execAlways = mkOption {
type = types.listOf (types.either types.nonEmptyStr types.package);
default = [ ];
description = "set of commands to be run at sway reload";
};
extraConfig = mkOption {
type = types.str;
default = "";
description = "additional sway config to be included";
};
definitions = mkOption {
type = types.attrsOf types.str;
default = { };
description = "set of definitions assigning variable to value";
};
modes = mkOption {
type = types.attrsOf sway_conf;
default = { };
description = "possible modes to switch to, e.g. resize";
};
sway_conf = types.submodule (
{ ... }:
{
options = {
keybinds = mkOption {
type = types.attrsOf types.str;
default = { };
description = "set of keybinds assigning key combo to action";
};
}
);
autolaunch = mkOption {
type = types.listOf (types.either types.nonEmptyStr types.package);
default = [ ];
description = "set of commands to be run at sway startup";
};
execAlways = mkOption {
type = types.listOf (types.either types.nonEmptyStr types.package);
default = [ ];
description = "set of commands to be run at sway reload";
};
extraConfig = mkOption {
type = types.str;
default = "";
description = "additional sway config to be included";
};
definitions = mkOption {
type = types.attrsOf types.str;
default = { };
description = "set of definitions assigning variable to value";
};
modes = mkOption {
type = types.attrsOf sway_conf;
default = { };
description = "possible modes to switch to, e.g. resize";
};
};
}
);
build_screen_def =
fps_func:
with lib;
let
output_def = mapAttrsToList (
name: value:
"output ${value.id} mode ${value.mode}@${toString (fps_func value.fps)}Hz"
+ (optionalString (value.pos != null) " position ${value.pos}")
) cfg.screens;
) screens;
in
''
for pid in $(${pkgs.procps}/bin/pgrep sway -x)
@ -72,30 +89,25 @@ let
fi
done
'';
inherit (lib) getExe;
fps_min = fps: with lib; if isInt fps then fps else (foldl' min 2147483647 fps);
fps_max = fps: with lib; if isInt fps then fps else (foldl' max 0 fps);
init_screens_min_fps =
with lib;
pkgs.writeShellScriptBin "init-screens-min" (build_screen_def fps_min);
init_screens_max_fps =
with lib;
pkgs.writeShellScriptBin "init-screens-max" (build_screen_def fps_max);
init_screens_auto = pkgs.writeShellScriptBin "init-screens-auto" "which run-on-ac && which run-on-bat && run-on-ac ${getExe init_screens_max_fps} && run-on-bat ${getExe init_screens_min_fps} || ${getExe init_screens_max_fps}";
fps_min = fps: if isInt fps then fps else (foldl' min 2147483647 fps);
fps_max = fps: if isInt fps then fps else (foldl' max 0 fps);
init_screens_min_fps = writeShellScriptBin "init-screens-min" (build_screen_def fps_min);
init_screens_max_fps = writeShellScriptBin "init-screens-max" (build_screen_def fps_max);
init_screens_auto = writeShellScriptBin "init-screens-auto" "which run-on-ac && which run-on-bat && run-on-ac ${getExe init_screens_max_fps} && run-on-bat ${getExe init_screens_min_fps} || ${getExe init_screens_max_fps}";
in
{
config =
let
bar_conf_file =
if (lib.isPath cfg.sway.bar.config) then
cfg.sway.bar.config
if (isPath sway.bar.config) then
sway.bar.config
else
pkgs.writers.writeJSON "config.json" cfg.sway.bar.config;
waybar_full = pkgs.writeShellScriptBin "waybar-full" (
(lib.getExe config.programs.waybar.package)
+ (lib.optionalString (!isNull cfg.sway.bar.config) " -c ${bar_conf_file}")
+ (lib.optionalString (!isNull cfg.sway.bar.style) " -s ${cfg.sway.bar.style}")
pkgs.writers.writeJSON "config.json" sway.bar.config;
waybar_full = writeShellScriptBin "waybar-full" (
(getExe config.programs.waybar.package)
+ (optionalString (!isNull sway.bar.config) " -c ${bar_conf_file}")
+ (optionalString (!isNull sway.bar.style) " -s ${sway.bar.style}")
);
bar_config = ''
@ -111,7 +123,6 @@ in
'';
build_conf =
with lib;
sway_conf:
let
build_definition_lines = mapAttrsToList (name: value: "set \$${name} ${value}");
@ -133,20 +144,19 @@ in
++ optional (sway_conf.extraConfig != "") sway_conf.extraConfig
);
sway_conf = lib.concatLines (
(build_conf cfg.sway.config)
++ lib.optional cfg.sway.bar.enable bar_config
++ (lib.mapAttrsToList (
sway_conf = concatLines (
(build_conf sway.config)
++ optional sway.bar.enable bar_config
++ (mapAttrsToList (
name: value:
"output ${value.id} mode ${value.mode}"
+ (lib.optionalString (value.pos != null) " position ${value.pos}")
) cfg.screens)
+ (optionalString (value.pos != null) " position ${value.pos}")
) screens)
);
conf_path = "sway.conf";
in
with cfg;
lib.mkIf (enable && sway.enable) {
mkIf (enable && sway.enable) {
environment.etc."${conf_path}".text = sway_conf;
grimmShared.sway.config.execAlways = [
@ -232,7 +242,7 @@ in
};
};
options.grimmShared.sway = with lib; {
options.grimmShared.sway = {
enable = mkEnableOption "grimm-sway";
bar = {

View File

@ -5,79 +5,75 @@
...
}:
let
cfg = config.grimmShared;
inherit (config.grimmShared) enable laptop_hardware graphical;
in
{
config =
with cfg;
lib.mkIf (enable && laptop_hardware.enable) {
environment.systemPackages =
with pkgs;
[
lm_sensors
lshw
pciutils
usbutils
ddcutil
python312Packages.py-cpuinfo
(writeShellScriptBin "lsiommu" ./lsiommu)
]
++ lib.optionals graphical [
opentabletdriver
ddcui
wootility
];
config = lib.mkIf (enable && laptop_hardware.enable) {
environment.systemPackages =
with pkgs;
[
lm_sensors
lshw
pciutils
usbutils
ddcutil
python312Packages.py-cpuinfo
(writeShellScriptBin "lsiommu" ./lsiommu)
]
++ lib.optionals graphical [
opentabletdriver
ddcui
wootility
];
hardware.i2c.enable = true;
services.libinput.enable = true;
hardware.opentabletdriver.enable = true;
services.udisks2.enable = true;
hardware.i2c.enable = true;
services.libinput.enable = true;
hardware.opentabletdriver.enable = true;
services.udisks2.enable = true;
services.udev.extraRules = ''
SUBSYSTEM=="i2c-dev", ACTION=="add",\
ATTR{name}=="NVIDIA i2c adapter*",\
TAG+="ddcci",\
TAG+="systemd",\
ENV{SYSTEMD_WANTS}+="ddcci@$kernel.service"
services.udev.extraRules = ''
SUBSYSTEM=="i2c-dev", ACTION=="add",\
ATTR{name}=="NVIDIA i2c adapter*",\
TAG+="ddcci",\
TAG+="systemd",\
ENV{SYSTEMD_WANTS}+="ddcci@$kernel.service"
'';
systemd.services."ddcci@" = {
scriptArgs = "%i";
script = ''
sleep 20
echo Trying to attach ddcci to $1
i=0
id=$(echo $1 | cut -d "-" -f 2)
if ${pkgs.ddcutil}/bin/ddcutil getvcp 10 -b $id; then
echo ddcci 0x37 > /sys/bus/i2c/devices/$1/new_device
fi
'';
systemd.services."ddcci@" = {
scriptArgs = "%i";
script = ''
sleep 20
echo Trying to attach ddcci to $1
i=0
id=$(echo $1 | cut -d "-" -f 2)
if ${pkgs.ddcutil}/bin/ddcutil getvcp 10 -b $id; then
echo ddcci 0x37 > /sys/bus/i2c/devices/$1/new_device
fi
'';
serviceConfig.Type = "oneshot";
};
boot = {
kernelParams = [ "quiet" ];
loader.efi.canTouchEfiVariables = true;
initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"nvme"
"usbhid"
"usb_storage"
"sd_mod"
];
loader.systemd-boot.enable = true;
extraModulePackages = [
config.boot.kernelPackages.ddcci-driver
];
kernelModules = [
"ddcci_backlight"
"i2c-dev"
"ec_sys"
];
};
serviceConfig.Type = "oneshot";
};
boot = {
kernelParams = [ "quiet" ];
loader.efi.canTouchEfiVariables = true;
initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"nvme"
"usbhid"
"usb_storage"
"sd_mod"
];
loader.systemd-boot.enable = true;
extraModulePackages = [ config.boot.kernelPackages.ddcci-driver ];
kernelModules = [
"ddcci_backlight"
"i2c-dev"
"ec_sys"
];
};
};
options.grimmShared.laptop_hardware = {
enable = lib.mkEnableOption "grimm-laptop";
};

View File

@ -6,34 +6,39 @@
...
}:
let
cfg = config.grimmShared;
inherit (lib)
optionals
optional
optionalString
concatLines
getExe
elem
mkIf
;
inherit (pkgs) writeShellScriptBin tlp tlpui;
inherit (config.grimmShared)
enable
laptop_hardware
graphical
sway
;
inherit (config.boot.kernelPackages) x86_energy_perf_policy cpupower;
enable_perf_policy = (lib.elem system x86_energy_perf_policy.meta.platforms);
enable_perf_policy = (elem system x86_energy_perf_policy.meta.platforms);
powersave =
with pkgs;
writeShellScriptBin "powersave-mode" (
concatLines (
[
"${getExe cpupower} frequency-set -g powersave -u 2000000" # clock speed
"${getExe pkgs.brightnessctl} s 20%" # display brightness
]
++ optionals enable_perf_policy [
"${getExe x86_energy_perf_policy} 15" # power save preference
"${getExe x86_energy_perf_policy} --turbo-enable 0" # disable turbo
]
++ optional cfg.sway.enable "init-screens-min"
)
);
powersave = writeShellScriptBin "powersave-mode" (
concatLines (
[
"${getExe cpupower} frequency-set -g powersave -u 2000000" # clock speed
"${getExe pkgs.brightnessctl} s 20%" # display brightness
]
++ optionals enable_perf_policy [
"${getExe x86_energy_perf_policy} 15" # power save preference
"${getExe x86_energy_perf_policy} --turbo-enable 0" # disable turbo
]
++ optional sway.enable "init-screens-min"
)
);
performance = pkgs.writeShellScriptBin "performance-mode" (
performance = writeShellScriptBin "performance-mode" (
concatLines (
[
"${getExe cpupower} frequency-set frequency-set -g performance -u 5000000" # clock speed
@ -43,66 +48,61 @@ let
"${getExe x86_energy_perf_policy} 0" # performance preference
"${getExe x86_energy_perf_policy} --turbo-enable 1" # enable turbo
]
++ optional cfg.sway.enable "init-screens-max"
++ optional sway.enable "init-screens-max"
)
);
auto =
let
inherit (pkgs) tlp;
in
pkgs.writeShellScriptBin "auto-mode" ''
${tlp}/bin/run-on-ac ${getExe performance}
${tlp}/bin/run-on-bat ${getExe powersave}
'';
auto = writeShellScriptBin "auto-mode" ''
${tlp}/bin/run-on-ac ${getExe performance}
${tlp}/bin/run-on-bat ${getExe powersave}
'';
in
{
config =
with cfg;
lib.mkIf (enable && laptop_hardware.enable) {
environment.systemPackages =
with pkgs;
[
acpi
powertop
brightnessctl
cpupower
powersave
performance
auto
]
++ optionals graphical [ tlpui ]
++ optional enable_perf_policy x86_energy_perf_policy;
config = mkIf (enable && laptop_hardware.enable) {
environment.systemPackages =
(with pkgs; [
acpi
powertop
brightnessctl
])
++ [
cpupower
powersave
performance
auto
]
++ optionals graphical [ tlpui ]
++ optional enable_perf_policy x86_energy_perf_policy;
services.acpid = {
enable = true;
acEventCommands = getExe auto;
};
services.acpid = {
enable = true;
acEventCommands = getExe auto;
};
powerManagement.scsiLinkPolicy = lib.mkIf (!config.services.tlp.enable) "min_power";
powerManagement.cpuFreqGovernor = lib.mkDefault "normal";
powerManagement.scsiLinkPolicy = lib.mkIf (!config.services.tlp.enable) "min_power";
powerManagement.cpuFreqGovernor = lib.mkDefault "normal";
services.power-profiles-daemon.enable = false;
services.upower.enable = true;
boot.extraModulePackages = [ cpupower ] ++ optional enable_perf_policy x86_energy_perf_policy;
services.power-profiles-daemon.enable = false;
services.upower.enable = true;
boot.extraModulePackages = [ cpupower ] ++ optional enable_perf_policy x86_energy_perf_policy;
services.tlp = {
enable = true;
settings = {
USB_AUTOSUSPEND = 1;
USB_EXCLUDE_BTUSB = 1;
USB_EXCLUDE_PHONE = 1;
SOUND_POWER_SAVE_ON_AC = 0;
SOUND_POWER_SAVE_ON_BAT = 1;
SATA_LINKPWR_ON_AC = "max_performance";
SATA_LINKPWR_ON_BAT = "min_power";
MAX_LOST_WORK_SECS_ON_BAT = 15;
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
CPU_BOOST_ON_AC = 1;
CPU_BOOST_ON_BAT = 0;
RUNTIME_PM_ON_AC = "on";
RUNTIME_PM_ON_BAT = "auto";
};
services.tlp = {
enable = true;
settings = {
USB_AUTOSUSPEND = 1;
USB_EXCLUDE_BTUSB = 1;
USB_EXCLUDE_PHONE = 1;
SOUND_POWER_SAVE_ON_AC = 0;
SOUND_POWER_SAVE_ON_BAT = 1;
SATA_LINKPWR_ON_AC = "max_performance";
SATA_LINKPWR_ON_BAT = "min_power";
MAX_LOST_WORK_SECS_ON_BAT = 15;
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
CPU_BOOST_ON_AC = 1;
CPU_BOOST_ON_BAT = 0;
RUNTIME_PM_ON_AC = "on";
RUNTIME_PM_ON_BAT = "auto";
};
};
};
}

View File

@ -1,35 +1,33 @@
{ config, lib, ... }:
let
cfg = config.grimmShared;
inherit (config.grimmShared) enable locale;
in
{
config =
with cfg;
lib.mkIf (enable && locale) {
time.timeZone = "Europe/Berlin";
config = lib.mkIf (enable && locale) {
time.timeZone = "Europe/Berlin";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "de_DE.UTF-8";
LC_IDENTIFICATION = "de_DE.UTF-8";
LC_MEASUREMENT = "de_DE.UTF-8";
LC_MONETARY = "de_DE.UTF-8";
LC_NAME = "de_DE.UTF-8";
LC_NUMERIC = "de_DE.UTF-8";
LC_PAPER = "de_DE.UTF-8";
LC_TELEPHONE = "de_DE.UTF-8";
LC_TIME = "de_DE.UTF-8";
};
console.keyMap = "de";
services.xserver.xkb = {
layout = "de";
variant = "";
};
i18n.extraLocaleSettings = {
LC_ADDRESS = "de_DE.UTF-8";
LC_IDENTIFICATION = "de_DE.UTF-8";
LC_MEASUREMENT = "de_DE.UTF-8";
LC_MONETARY = "de_DE.UTF-8";
LC_NAME = "de_DE.UTF-8";
LC_NUMERIC = "de_DE.UTF-8";
LC_PAPER = "de_DE.UTF-8";
LC_TELEPHONE = "de_DE.UTF-8";
LC_TIME = "de_DE.UTF-8";
};
console.keyMap = "de";
services.xserver.xkb = {
layout = "de";
variant = "";
};
};
options.grimmShared.locale = lib.mkEnableOption "Sets german units but english language";
}

View File

@ -5,24 +5,27 @@
...
}:
let
cfg = config.grimmShared;
inherit (config.grimmShared)
enable
network
graphical
sound
;
in
{
config =
with cfg;
lib.mkIf (enable && network && config.hardware.bluetooth.enable) {
services.blueman.enable = lib.mkIf graphical true;
config = lib.mkIf (enable && network && config.hardware.bluetooth.enable) {
services.blueman.enable = lib.mkIf graphical true;
environment.systemPackages = with pkgs; [ bluetuith ] ++ lib.optional sound.enable pkgs.bluez;
environment.systemPackages = [ pkgs.bluetuith ] ++ lib.optional sound.enable pkgs.bluez;
systemd.user.services.mpris-proxy = lib.mkIf sound.enable {
description = "Mpris proxy";
after = [
"network.target"
"sound.target"
];
wantedBy = [ "default.target" ];
serviceConfig.ExecStart = "${pkgs.bluez}/bin/mpris-proxy";
};
systemd.user.services.mpris-proxy = lib.mkIf sound.enable {
description = "Mpris proxy";
after = [
"network.target"
"sound.target"
];
wantedBy = [ "default.target" ];
serviceConfig.ExecStart = "${pkgs.bluez}/bin/mpris-proxy";
};
};
}

View File

@ -5,27 +5,25 @@
...
}:
let
cfg = config.grimmShared;
inherit (config.grimmShared) enable network laptop_hardware;
in
{
config =
with cfg;
lib.mkIf (enable && network) {
networking.networkmanager.enable = true;
networking.useDHCP = lib.mkDefault true;
config = lib.mkIf (enable && network) {
networking.networkmanager.enable = true;
networking.useDHCP = lib.mkDefault true;
hardware.bluetooth.enable = lib.mkDefault laptop_hardware.enable;
hardware.bluetooth.enable = lib.mkDefault laptop_hardware.enable;
environment.systemPackages = with pkgs; [
wireguard-tools
openconnect
];
environment.systemPackages = with pkgs; [
wireguard-tools
openconnect
];
networking.firewall = {
enable = true;
allowPing = true;
};
networking.firewall = {
enable = true;
allowPing = true;
};
};
imports = [ ./bluetooth.nix ];

View File

@ -5,33 +5,31 @@
...
}:
let
cfg = config.grimmShared;
inherit (config.grimmShared) enable printing graphical;
in
{
config =
with cfg;
lib.mkIf (enable && printing) {
# Enable CUPS to print documents.
services.printing.enable = true;
services.printing.drivers = with pkgs; [
brgenml1lpr
brgenml1cupswrapper
];
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
services.printing.cups-pdf.enable = true;
hardware.sane.brscan4.enable = true; # enables support for SANE scanners
environment.systemPackages =
with pkgs;
(lib.optionals cfg.graphical [
kdePackages.skanpage
# libsForQt5.skanpage
]);
config = lib.mkIf (enable && printing) {
# Enable CUPS to print documents.
services.printing.enable = true;
services.printing.drivers = with pkgs; [
brgenml1lpr
brgenml1cupswrapper
];
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
services.printing.cups-pdf.enable = true;
hardware.sane.brscan4.enable = true; # enables support for SANE scanners
environment.systemPackages = (
lib.optionals graphical [
pkgs.kdePackages.skanpage
# libsForQt5.skanpage
]
);
};
options.grimmShared.printing = lib.mkEnableOption "Enables print and scan related options";
}

View File

@ -5,32 +5,30 @@
...
}:
let
cfg = config.grimmShared;
inherit (config.grimmShared) enable sound;
in
{
config =
with cfg;
lib.mkIf (enable && sound.enable) {
sound.enable = true;
hardware.pulseaudio.enable = false;
config = lib.mkIf (enable && sound.enable) {
sound.enable = true;
hardware.pulseaudio.enable = false;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true; # osu uses jack
lowLatency.enable = true;
};
environment.systemPackages = with pkgs; [
pwvucontrol
playerctl
openal
pulseaudio
];
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true; # osu uses jack
lowLatency.enable = true;
};
environment.systemPackages = with pkgs; [
pwvucontrol
playerctl
openal
pulseaudio
];
};
imports = [
./spotify.nix
./midi.nix

View File

@ -5,24 +5,23 @@
...
}:
let
cfg = config.grimmShared;
sound_font = pkgs.soundfont-fluid;
inherit (config.grimmShared) enable sound;
in
{
config =
with cfg;
lib.mkIf (enable && sound.midi) {
environment.systemPackages = with pkgs; [
config = lib.mkIf (enable && sound.midi) {
environment.systemPackages =
(with pkgs; [
mpv
timidity
ffmpeg-full
sound_font
];
])
++ [ sound_font ];
environment.pathsToLink = [ "/share/soundfonts" ];
environment.pathsToLink = [ "/share/soundfonts" ];
environment.etc."timidity/timidity.cfg".text = "soundfont ${sound_font}/share/soundfonts/FluidR3_GM2-2.sf2";
};
environment.etc."timidity/timidity.cfg".text = "soundfont ${sound_font}/share/soundfonts/FluidR3_GM2-2.sf2";
};
options.grimmShared.sound.midi = lib.mkEnableOption "enable midi";
}

View File

@ -5,19 +5,17 @@
...
}:
let
cfg = config.grimmShared;
inherit (config.grimmShared) enable spotify graphical;
in
{
config =
with cfg;
lib.mkIf (enable && spotify.enable) {
environment.systemPackages = [ pkgs.ncspot ] ++ lib.optional graphical pkgs.spotify;
config = lib.mkIf (enable && spotify.enable) {
environment.systemPackages = [ pkgs.ncspot ] ++ lib.optional graphical pkgs.spotify;
grimmShared = {
sound.enable = true;
network = true;
};
grimmShared = {
sound.enable = true;
network = true;
};
};
options.grimmShared.spotify = {
enable = lib.mkEnableOption "grimm-spotify";

View File

@ -6,7 +6,7 @@
}:
let
spotifyd_cache_dir = "/tmp/spotifyd";
cfg = config.grimmShared;
inherit (config.grimmShared) enable spotify;
spotifyd-dbus = pkgs.writeTextDir "share/dbus-1/system.d/org.mpris.MediaPlayer2.spotifyd.conf" ''
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->
@ -27,77 +27,72 @@ let
'';
in
{
config =
with cfg;
lib.mkIf (enable && spotify.spotifyd.enable) {
environment.systemPackages = with pkgs; [
spotifyd
spotifyd-dbus
];
config = lib.mkIf (enable && spotify.spotifyd.enable) {
environment.systemPackages = [
pkgs.spotifyd
spotifyd-dbus
];
systemd.services.init-spotifyd-cache-dir = {
description = "Create the spotifyd cache dir";
wantedBy = [ "multi-user.target" ];
systemd.services.init-spotifyd-cache-dir = {
description = "Create the spotifyd cache dir";
wantedBy = [ "multi-user.target" ];
serviceConfig.Type = "oneshot";
script = ''
mkdir -p ${spotifyd_cache_dir}
chown spotifyd:spotifyd -R ${spotifyd_cache_dir}
'';
};
grimmShared = {
sound.enable = true;
network = true;
};
services.pipewire.systemWide = true; # required for spotifyd as spotifyd runs as the spotifyd user
# spotifyd config
services.spotifyd = {
enable = true;
settings.global = {
bitrate = 320;
username = cfg.spotify.spotifyd.username;
device_name = "grimm_laptop";
password_cmd =
let
pass = cfg.spotify.spotifyd.pass;
in
with lib;
if (lib.isPath pass || lib.isString pass) then
"${pkgs.coreutils-full}/bin/cat ${pass}"
else
(getExe pass);
device_type = "computer";
dbus_type = "system";
device = "default";
control = "default";
volume_controller = "softvol";
# no_audio_cache = true;
spotifyd_cache_dir = spotifyd_cache_dir;
max_cache_size = 10000000000;
initial_volume = "90";
backend = "alsa"; # fixme
};
};
services.dbus.packages = with pkgs; [ spotifyd-dbus ];
# spotifyd has access to global pipewire
users.users.spotifyd = {
isSystemUser = true;
group = "spotifyd";
extraGroups = [
"audio"
"pipewire"
];
};
# spotifyd is also a group
users.groups.spotifyd = { };
serviceConfig.Type = "oneshot";
script = ''
mkdir -p ${spotifyd_cache_dir}
chown spotifyd:spotifyd -R ${spotifyd_cache_dir}
'';
};
grimmShared = {
sound.enable = true;
network = true;
};
services.pipewire.systemWide = true; # required for spotifyd as spotifyd runs as the spotifyd user
# spotifyd config
services.spotifyd = {
enable = true;
settings.global = {
bitrate = 320;
username = spotify.spotifyd.username;
device_name = "grimm_laptop";
password_cmd =
let
pass = spotify.spotifyd.pass;
inherit (lib) isPath isString getExe;
in
if (isPath pass || isString pass) then "${pkgs.coreutils-full}/bin/cat ${pass}" else (getExe pass);
device_type = "computer";
dbus_type = "system";
device = "default";
control = "default";
volume_controller = "softvol";
# no_audio_cache = true;
spotifyd_cache_dir = spotifyd_cache_dir;
max_cache_size = 10000000000;
initial_volume = "90";
backend = "alsa"; # fixme
};
};
services.dbus.packages = [ spotifyd-dbus ];
# spotifyd has access to global pipewire
users.users.spotifyd = {
isSystemUser = true;
group = "spotifyd";
extraGroups = [
"audio"
"pipewire"
];
};
# spotifyd is also a group
users.groups.spotifyd = { };
};
options.grimmShared.spotify.spotifyd = with lib; {
enable = mkEnableOption "grimm-spotify-tui";

View File

@ -5,7 +5,16 @@
...
}:
let
cfg = config.grimmShared;
inherit (config.grimmShared) enable tooling graphical;
inherit (lib)
mkEnableOption
mkOption
types
getExe
optionals
mkIf
concatLines
;
in
{
imports = [
@ -15,144 +24,144 @@ in
./python.nix
];
config =
with cfg;
lib.mkIf (enable && tooling.enable) {
environment.systemPackages =
with pkgs;
[
(writeShellScriptBin "systemd-owner" "systemctl show -pUser,UID $@")
(writeShellScriptBin "tree" "${lib.getExe pkgs.eza} -T --git -lh --no-permissions --no-user --no-filesize --no-time")
(writeShellScriptBin "spawn" ''exec "$@" &> /dev/null &'')
(writeShellScriptBin "silent-add" "git add --intent-to-add $@ ; git update-index --assume-unchanged $@")
config = mkIf (enable && tooling.enable) {
environment.systemPackages =
with pkgs;
[
(writeShellScriptBin "systemd-owner" "systemctl show -pUser,UID $@")
(writeShellScriptBin "tree" "${getExe eza} -T --git -lh --no-permissions --no-user --no-filesize --no-time")
(writeShellScriptBin "spawn" ''exec "$@" &> /dev/null &'')
(writeShellScriptBin "silent-add" "git add --intent-to-add $@ ; git update-index --assume-unchanged $@")
urlencode
pstree
dos2unix
treefmt
file
wget
hyfetch
util-linux
btop
neovim-remote
linuxPackages.perf
eza
urlencode
pstree
dos2unix
treefmt
file
wget
hyfetch
util-linux
btop
neovim-remote
linuxPackages.perf
eza
gcc
jdk17
pkg-config
unzip
p7zip
gcc
jdk17
pkg-config
unzip
p7zip
tea
tea
fbcat
gomuks
ranger
fbcat
gomuks
ranger
visualvm
imagemagick
nmap
visualvm
imagemagick
nmap
parted
glib
glibc
expect
]
++ lib.optionals cfg.graphical [
wev
qdirstat
libva-utils
gparted
jetbrains.clion
jetbrains.idea-community
];
programs.git = {
enable = true;
lfs.enable = true;
config = {
init.defaultBranch = "main";
credential.username = cfg.tooling.git_user;
core.editor = lib.getExe pkgs.neovim;
user.name = cfg.tooling.git_user;
user.email = cfg.tooling.git_email;
push.autoSetupRemote = true;
core.autocrlf = "input";
commit.gpgsign = true;
pull.rebase = true;
alias = {
pfusch = "push --force-with-lease --force-if-includes";
fuck = "reset HEAD~1";
fixup = "commit --fixup";
};
};
};
environment.shellAliases = {
":q" = "exit";
"ls" = "eza";
"lix" = "nix";
};
programs.tmux = {
enable = true;
historyLimit = 42000;
#keyMode = "vi";
};
# virtualisation.docker.enable = true;
services.dbus.implementation = "broker";
grimmShared.tooling.nvim.plugins = with pkgs.vimPlugins; [
vim-scala
fugitive
parted
glib
glibc
expect
]
++ optionals graphical [
wev
qdirstat
libva-utils
gparted
jetbrains.clion
jetbrains.idea-community
];
boot.tmp.cleanOnBoot = true;
zramSwap.enable = true;
programs.neovim = {
enable = true;
viAlias = true;
defaultEditor = true;
configure = {
customRC =
let
luarc = pkgs.writeText "init.lua" (lib.concatLines tooling.nvim.extraLuaRC);
in
''
set number
set hidden
set fileencodings=utf-8
set nocompatible
set clipboard+=unnamedplus
set ff=unix
luafile ${luarc}
if filereadable($HOME . "/.vimrc")
source ~/.vimrc
endif
'';
packages.myVimPackage = {
start = tooling.nvim.plugins;
opt = [ ];
};
programs.git = {
enable = true;
lfs.enable = true;
config = {
init.defaultBranch = "main";
credential.username = tooling.git_user;
core.editor = getExe pkgs.neovim;
user.name = tooling.git_user;
user.email = tooling.git_email;
push.autoSetupRemote = true;
core.autocrlf = "input";
commit.gpgsign = true;
pull.rebase = true;
alias = {
pfusch = "push --force-with-lease --force-if-includes";
fuck = "reset HEAD~1";
fixup = "commit --fixup";
};
};
programs.ssh = {
startAgent = true;
enableAskPassword = graphical;
askPassword = lib.mkIf graphical (lib.getExe pkgs.lxqt.lxqt-openssh-askpass);
};
programs.thefuck.enable = true;
};
options.grimmShared.tooling = with lib; {
environment.shellAliases = {
":q" = "exit";
"ls" = "eza";
"lix" = "nix";
};
programs.tmux = {
enable = true;
historyLimit = 42000;
#keyMode = "vi";
};
# virtualisation.docker.enable = true;
services.dbus.implementation = "broker";
grimmShared.tooling.nvim = {
plugins = with pkgs.vimPlugins; [
fugitive
nvim-lspconfig
];
};
boot.tmp.cleanOnBoot = true;
zramSwap.enable = true;
programs.neovim = {
enable = true;
viAlias = true;
defaultEditor = true;
configure = {
customRC =
let
luarc = pkgs.writeText "init.lua" (concatLines tooling.nvim.extraLuaRC);
in
''
set number
set hidden
set fileencodings=utf-8
set nocompatible
set clipboard+=unnamedplus
set ff=unix
luafile ${luarc}
if filereadable($HOME . "/.vimrc")
source ~/.vimrc
endif
'';
packages.myVimPackage = {
start = tooling.nvim.plugins;
opt = [ ];
};
};
};
programs.ssh = {
startAgent = true;
enableAskPassword = graphical;
askPassword = mkIf graphical (getExe pkgs.lxqt.lxqt-openssh-askpass);
};
programs.thefuck.enable = true;
};
options.grimmShared.tooling = {
enable = mkEnableOption "grimm-tooling";
nvim = {

View File

@ -5,49 +5,53 @@
...
}:
let
cfg = config.grimmShared;
inherit (config.grimmShared) enable tooling graphical;
inherit (lib)
getExe
optional
mkIf
optionalString
mkEnableOption
;
viewer_pkg = pkgs.zathura;
viewer_def = lib.optionalString cfg.graphical ''pdf_viewer = "${lib.getExe pkgs.zathura}",'';
viewer_def = optionalString graphical ''pdf_viewer = "${lib.getExe pkgs.zathura}",'';
in
{
config =
with cfg;
lib.mkIf (enable && tooling.enable && tooling.lilypond) {
environment.systemPackages =
with pkgs;
[ lilypond-with-fonts ] ++ lib.optional graphical viewer_pkg;
environment.sessionVariables = {
LYEDITOR = "${lib.getExe pkgs.neovim-remote} -s +:'dr %(file)s | call cursor(%(line)s,%(char)s+1)'";
};
grimmShared.sound.midi = true;
grimmShared.tooling.nvim = {
extraLuaRC = lib.singleton ''
require('nvls').setup({
lilypond = {
options = {
${viewer_def}
},
},
latex = {
options = {
${viewer_def}
},
},
player = {
options = {
fluidsynth_flags = {
"/run/current-system/sw/share/soundfonts/FluidR3_GM2-2.sf2"
}
}
}
})
'';
};
grimmShared.tooling.nvim.plugins = with pkgs.vimPlugins; [ nvim-lilypond-suite ];
config = mkIf (enable && tooling.enable && tooling.lilypond) {
environment.systemPackages = [ pkgs.lilypond-with-fonts ] ++ optional graphical viewer_pkg;
environment.sessionVariables = {
LYEDITOR = "${getExe pkgs.neovim-remote} -s +:'dr %(file)s | call cursor(%(line)s,%(char)s+1)'";
};
options.grimmShared.tooling.lilypond = lib.mkEnableOption "enable lilypond tooling";
grimmShared.sound.midi = true;
grimmShared.tooling.nvim = {
extraLuaRC = lib.singleton ''
require('nvls').setup({
lilypond = {
options = {
${viewer_def}
},
},
latex = {
options = {
${viewer_def}
},
},
player = {
options = {
fluidsynth_flags = {
"/run/current-system/sw/share/soundfonts/FluidR3_GM2-2.sf2"
}
}
}
})
'';
};
grimmShared.tooling.nvim.plugins = with pkgs.vimPlugins; [ nvim-lilypond-suite ];
};
options.grimmShared.tooling.lilypond = mkEnableOption "enable lilypond tooling";
}

View File

@ -1,13 +1,4 @@
{
pkgs,
config,
lib,
inputs,
...
}:
let
cfg = config.grimmShared;
in
{ pkgs, lib, ... }:
{
environment.systemPackages = with pkgs; [
(writeShellScriptBin "nix-referrers" "nix-store --query --referrers $@")
@ -27,7 +18,9 @@ in
environment.sessionVariables = lib.mkIf pkgs.config.allowUnfree { NIXPKGS_ALLOW_UNFREE = "1"; };
grimmShared.tooling.nvim.plugins = with pkgs.vimPlugins; [ vim-nix ];
grimmShared.tooling.nvim.extraLuaRC = lib.singleton ''
require'lspconfig'.nixd.setup{}
'';
nix.settings = {
experimental-features = [
@ -41,6 +34,7 @@ in
dates = "weekly";
options = "--delete-older-than 30d";
};
# nix.package = pkgs.nixVersions.latest;
nix.optimise.automatic = true;
}

View File

@ -5,33 +5,30 @@
...
}:
let
cfg = config.grimmShared;
inherit (config.grimmShared) enable tooling graphical;
pyLibs =
python-pkgs: with python-pkgs; [
requests
matplotlib
numpy
scipy
pygobject3
];
in
{
config =
with cfg;
lib.mkIf (enable && tooling.enable) {
environment.systemPackages =
with pkgs;
[ python3 ] ++ lib.optionals cfg.graphical [ jetbrains.pycharm-community ];
config = lib.mkIf (enable && tooling.enable) {
environment.systemPackages = [
(pkgs.python3.withPackages pyLibs)
] ++ lib.optionals graphical (with pkgs; [ jetbrains.pycharm-community ]);
programs.xonsh = {
enable = true;
config = lib.concatLines (
lib.mapAttrsToList (
name: value: ''aliases["${name}"] = "${value}"''
) config.environment.shellAliases
);
package = pkgs.xonsh.override {
extraPackages =
ps: with ps; [
requests
matplotlib
numpy
scipy
pygobject3
];
};
};
programs.xonsh = {
enable = true;
config = lib.concatLines (
lib.mapAttrsToList (
name: value: ''aliases["${name}"] = "${value}"''
) config.environment.shellAliases
);
package = pkgs.xonsh.wrapper.override { extraPackages = pyLibs; };
};
};
}

View File

@ -5,50 +5,56 @@
...
}:
let
cfg = config.grimmShared;
inherit (config.grimmShared) enable tooling graphical;
inherit (lib)
optional
optionals
filterAttrs
mkForce
mkIf
attrNames
mkEnableOption
;
in
{
config =
with cfg;
lib.mkIf enable {
security.polkit.enable = true;
security.rtkit.enable = true;
config = mkIf enable {
security.polkit.enable = true;
security.rtkit.enable = true;
security.doas.enable = true;
security.sudo.enable = false;
security.doas.extraRules = [
{
users = lib.attrNames (lib.filterAttrs (n: v: v.isNormalUser) config.users.users);
keepEnv = true;
persist = true;
}
];
security.doas.enable = true;
security.sudo.enable = false;
security.doas.extraRules = [
{
users = attrNames (filterAttrs (n: v: v.isNormalUser) config.users.users);
keepEnv = true;
persist = true;
}
];
environment.systemPackages =
with pkgs;
[
mkpasswd
gnupg
libsecret
vulnix
doas-sudo-shim # muscle memory
agenix
]
++ lib.optionals (tooling.enable && tooling.pass) [
pass
(writeShellScriptBin "passw" "pass $@")
]
++ lib.optional graphical lxqt.lxqt-policykit;
environment.systemPackages =
(with pkgs; [
mkpasswd
gnupg
libsecret
vulnix
doas-sudo-shim # muscle memory
agenix
])
++ optionals (tooling.enable && tooling.pass) [
pkgs.pass
(pkgs.writeShellScriptBin "passw" "pass $@")
]
++ optional graphical pkgs.lxqt.lxqt-policykit;
services.passSecretService.enable = lib.mkIf (tooling.enable && tooling.pass) true;
programs.gnupg.agent = {
settings = {
# default-cache-ttl = 6000;
};
pinentryPackage = with pkgs; lib.mkForce (if graphical then pinentry-qt else pinentry-tty);
enable = true;
services.passSecretService.enable = mkIf (tooling.enable && tooling.pass) true;
programs.gnupg.agent = {
settings = {
# default-cache-ttl = 6000;
};
pinentryPackage = mkForce (if graphical then pkgs.pinentry-qt else pkgs.pinentry-tty);
enable = true;
};
};
options.grimmShared.tooling.pass = lib.mkEnableOption "Enables password-store, gnupg and such secret handling";
options.grimmShared.tooling.pass = mkEnableOption "Enables password-store, gnupg and such secret handling";
}

View File

@ -5,7 +5,7 @@
...
}:
let
cfg = config.grimmShared;
inherit (config.grimmShared) enable portals graphical;
browsers = [
"firefox-beta.desktop"
"firefox.desktop"
@ -35,111 +35,109 @@ let
tex_editors = [ ] ++ text_editors;
in
{
config =
with cfg;
lib.mkIf (enable && portals && graphical) {
environment.systemPackages = with pkgs; [
deskwhich
config = lib.mkIf (enable && portals && graphical) {
environment.systemPackages = with pkgs; [
deskwhich
zathura
alacritty
imhex
libreoffice-qt
filezilla
obsidian
nomacs
pdfarranger
geany
krita
weasis
# kicad
prusa-slicer
freecad
openscad
vlc
blender
thunderbird
xdg-terminal-exec
xdg-utils
];
zathura
alacritty
imhex
libreoffice-qt
filezilla
obsidian
nomacs
pdfarranger
geany
krita
weasis
# kicad
prusa-slicer
freecad
openscad
vlc
blender
thunderbird
xdg-terminal-exec
xdg-utils
];
xdg.terminal-exec = {
enable = true;
settings = {
default = [
"Alacritty.desktop"
"kitty.desktop"
];
};
};
xdg.mime.enable = true;
xdg.mime.addedAssociations = {
"application/java-vm" = [
"idea-community.desktop"
"imhex.desktop"
xdg.terminal-exec = {
enable = true;
settings = {
default = [
"Alacritty.desktop"
"kitty.desktop"
];
"application/json" = text_editors ++ [ "firefox-beta.desktop" ];
"application/mp4" = video_viewers;
"application/ogg" = audio_players;
"application/octet-stream" = "imhex.desktop";
"application/pdf" = document_viewers;
"application/rss+xml" = text_editors;
"application/x-chess-pgn" = [ ] ++ text_editors; # fixme
"application/x-krita" = "org.kde.krita.desktop";
"application/x-latex" = tex_editors;
"application/x-tex" = tex_editors;
"application/x-texinfo" = tex_editors;
"application/xml" = text_editors;
"image/svg+xml" = image_viewers ++ browsers ++ text_editors;
"image/*" = image_viewers;
"image/vnd.dwg" = cad;
"model/*" = cad;
"gcode" = [
"PrusaGcodeviewer.desktop"
"PrusaSlicer.desktop"
];
"audio/*" = audio_players;
"text/*" = text_editors;
"text/plain" = text_editors;
"text/markdown" = [ "obsidian.desktop" ] ++ text_editors;
"text/csv" = [ "calc.desktop" ] ++ text_editors;
"text/html" = browsers ++ text_editors;
"text/x-python" = [ "pycharm-community.desktop" ] ++ text_editors;
"text/x-c" = [ "clion.desktop" ] ++ text_editors;
"text/x-java-source" = [ "idea-community.desktop" ] ++ text_editors;
"video/*" = video_viewers;
"inode/directory" = [
"ranger.desktop"
"dolphin.desktop"
];
"x-scheme-handler/mailto" = "thunderbird.desktop";
"application/vnd.oasis.opendocument.chart" = "calc.desktop";
"application/vnd.oasis.opendocument.chart-template" = "calc.desktop";
"application/vnd.oasis.opendocument.database" = "base.desktop";
"application/vnd.oasis.opendocument.formula" = "math.desktop";
"application/vnd.oasis.opendocument.formula-template" = "math.desktop";
"application/vnd.oasis.opendocument.graphics" = "draw.desktop";
"application/vnd.oasis.opendocument.graphics-template" = "draw.desktop";
"application/vnd.oasis.opendocument.image" = "draw.desktop";
"application/vnd.oasis.opendocument.image-template" = "draw.desktop";
"application/vnd.oasis.opendocument.presentation" = "impress.desktop";
"application/vnd.oasis.opendocument.presentation-template" = "impress.desktop";
"application/vnd.oasis.opendocument.spreadsheet" = "calc.desktop";
"application/vnd.oasis.opendocument.spreadsheet-template" = "calc.desktop";
"application/vnd.oasis.opendocument.text" = "writer.desktop";
"application/vnd.oasis.opendocument.text-master" = "writer.desktop";
"application/vnd.oasis.opendocument.text-template" = "writer.desktop";
"application/vnd.oasis.opendocument.text-web" = "writer.desktop";
"application/vnd.openxmlformats-officedocument.presentationml.presentation" = "impress.desktop";
"application/vnd.openxmlformats-officedocument.presentationml.slide" = "impress.desktop";
"application/vnd.openxmlformats-officedocument.presentationml.slideshow" = "impress.desktop";
"application/vnd.openxmlformats-officedocument.presentationml.template" = "impress.desktop";
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" = "calc.desktop";
"application/vnd.openxmlformats-officedocument.spreadsheetml.template" = "calc.desktop";
"application/vnd.openxmlformats-officedocument.wordprocessingml.document" = "writer.desktop";
"application/vnd.openxmlformats-officedocument.wordprocessingml.template" = "writer.desktop";
};
};
xdg.mime.enable = true;
xdg.mime.addedAssociations = {
"application/java-vm" = [
"idea-community.desktop"
"imhex.desktop"
];
"application/json" = text_editors ++ [ "firefox-beta.desktop" ];
"application/mp4" = video_viewers;
"application/ogg" = audio_players;
"application/octet-stream" = "imhex.desktop";
"application/pdf" = document_viewers;
"application/rss+xml" = text_editors;
"application/x-chess-pgn" = [ ] ++ text_editors; # fixme
"application/x-krita" = "org.kde.krita.desktop";
"application/x-latex" = tex_editors;
"application/x-tex" = tex_editors;
"application/x-texinfo" = tex_editors;
"application/xml" = text_editors;
"image/svg+xml" = image_viewers ++ browsers ++ text_editors;
"image/*" = image_viewers;
"image/vnd.dwg" = cad;
"model/*" = cad;
"gcode" = [
"PrusaGcodeviewer.desktop"
"PrusaSlicer.desktop"
];
"audio/*" = audio_players;
"text/*" = text_editors;
"text/plain" = text_editors;
"text/markdown" = [ "obsidian.desktop" ] ++ text_editors;
"text/csv" = [ "calc.desktop" ] ++ text_editors;
"text/html" = browsers ++ text_editors;
"text/x-python" = [ "pycharm-community.desktop" ] ++ text_editors;
"text/x-c" = [ "clion.desktop" ] ++ text_editors;
"text/x-java-source" = [ "idea-community.desktop" ] ++ text_editors;
"video/*" = video_viewers;
"inode/directory" = [
"ranger.desktop"
"dolphin.desktop"
];
"x-scheme-handler/mailto" = "thunderbird.desktop";
"application/vnd.oasis.opendocument.chart" = "calc.desktop";
"application/vnd.oasis.opendocument.chart-template" = "calc.desktop";
"application/vnd.oasis.opendocument.database" = "base.desktop";
"application/vnd.oasis.opendocument.formula" = "math.desktop";
"application/vnd.oasis.opendocument.formula-template" = "math.desktop";
"application/vnd.oasis.opendocument.graphics" = "draw.desktop";
"application/vnd.oasis.opendocument.graphics-template" = "draw.desktop";
"application/vnd.oasis.opendocument.image" = "draw.desktop";
"application/vnd.oasis.opendocument.image-template" = "draw.desktop";
"application/vnd.oasis.opendocument.presentation" = "impress.desktop";
"application/vnd.oasis.opendocument.presentation-template" = "impress.desktop";
"application/vnd.oasis.opendocument.spreadsheet" = "calc.desktop";
"application/vnd.oasis.opendocument.spreadsheet-template" = "calc.desktop";
"application/vnd.oasis.opendocument.text" = "writer.desktop";
"application/vnd.oasis.opendocument.text-master" = "writer.desktop";
"application/vnd.oasis.opendocument.text-template" = "writer.desktop";
"application/vnd.oasis.opendocument.text-web" = "writer.desktop";
"application/vnd.openxmlformats-officedocument.presentationml.presentation" = "impress.desktop";
"application/vnd.openxmlformats-officedocument.presentationml.slide" = "impress.desktop";
"application/vnd.openxmlformats-officedocument.presentationml.slideshow" = "impress.desktop";
"application/vnd.openxmlformats-officedocument.presentationml.template" = "impress.desktop";
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" = "calc.desktop";
"application/vnd.openxmlformats-officedocument.spreadsheetml.template" = "calc.desktop";
"application/vnd.openxmlformats-officedocument.wordprocessingml.document" = "writer.desktop";
"application/vnd.openxmlformats-officedocument.wordprocessingml.template" = "writer.desktop";
};
};
}

View File

@ -5,44 +5,55 @@
...
}:
let
cfg = config.grimmShared;
inherit (config.grimmShared)
enable
portals
sound
screens
;
inherit (lib)
mkIf
mkEnableOption
mapAttrs'
foldl'
min
getExe
isInt
nameValuePair
;
in
{
config =
with cfg;
lib.mkIf (enable && portals) {
xdg.icons.enable = true;
xdg.sounds.enable = lib.mkIf sound.enable true;
config = mkIf (enable && portals) {
xdg.icons.enable = true;
xdg.sounds.enable = lib.mkIf sound.enable true;
xdg.portal = {
enable = true;
xdgOpenUsePortal = true;
extraPortals = with pkgs; [
xdg-desktop-portal-wlr
xdg-desktop-portal-kde
xdg-desktop-portal-gtk
];
xdg.portal = {
enable = true;
xdgOpenUsePortal = true;
extraPortals = with pkgs; [
xdg-desktop-portal-wlr
xdg-desktop-portal-kde
xdg-desktop-portal-gtk
];
wlr.enable = true;
wlr.settings =
with lib;
mapAttrs' (
name: value:
nameValuePair ("screencast_" + name) {
output_name = value.id;
max_fps = if isInt value.fps then value.fps else (foldl' min 2147483647 value.fps);
chooser_type = "simple";
chooser_cmd = "${getExe pkgs.slurp} -f %o -or";
}
) cfg.screens;
};
environment.sessionVariables = {
XDG_CONFIG_HOME = "$HOME/.config";
};
environment.systemPackages = with pkgs; [ xwaylandvideobridge ];
wlr.enable = true;
wlr.settings = mapAttrs' (
name: value:
nameValuePair ("screencast_" + name) {
output_name = value.id;
max_fps = if isInt value.fps then value.fps else (foldl' min 2147483647 value.fps);
chooser_type = "simple";
chooser_cmd = "${getExe pkgs.slurp} -f %o -or";
}
) screens;
};
options.grimmShared.portals = lib.mkEnableOption "Enables portals for wlr, gtk and kde as well as fixes fonts";
environment.sessionVariables = {
XDG_CONFIG_HOME = "$HOME/.config";
};
environment.systemPackages = with pkgs; [ xwaylandvideobridge ];
};
options.grimmShared.portals = mkEnableOption "Enables portals for wlr, gtk and kde as well as fixes fonts";
}

View File

@ -1,9 +1,4 @@
{
config,
lib,
pkgs,
...
}:
{ lib, pkgs, ... }:
{
imports = [
./overlays

View File

@ -3,7 +3,7 @@
lib,
rustPlatform,
}:
rustPlatform.buildRustPackage rec {
rustPlatform.buildRustPackage {
pname = "deskwhich";
version = "unstable-2024-04-30";

View File

@ -0,0 +1,16 @@
{
writeShellScriptBin,
lib,
urlencode,
}:
let
inherit (lib) getExe;
in
writeShellScriptBin "searchclip" ''
xdg-open https://www.google.com/search?q=$(wl-paste -p | ${getExe urlencode})
browser=$(xdg-settings get default-web-browser | sed "s/\.desktop//")
if [[ -v SWAYSOCK ]]; then
sleep .1
swaymsg [app_id="$browser" urgent="newest"] focus
fi
''

View File

@ -1,5 +1,4 @@
{
cairo,
fetchFromGitHub,
gobject-introspection,
gtk3,

View File

@ -28,11 +28,11 @@ let
};
nixpkgs_patches = [
# {
# # tlpui
# url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/305278.patch";
# hash = "sha256-vmzj7gF8jwHdqxN+dQiJ4MRxKpHvBTzbrUvFgt1DK8I=";
# }
{
# xonsh update
url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/305316.patch";
hash = "sha256-oUjCyA18RvIChTUwPqkO4+v2skTqLBYf2DMd+ADiGE8=";
}
];
# enable ccache for lix if ccache is enabled
@ -56,9 +56,13 @@ in
distroName = "LixOS";
};
environment.sessionVariables = with config.system.nixos; {
distro = "${distroName} ${version} (${codeName}) ${system}";
};
environment.sessionVariables =
let
inherit (config.system.nixos) distroName version codeName;
in
{
distro = "${distroName} ${version} (${codeName}) ${system}";
};
documentation.doc.enable = false;
@ -66,15 +70,23 @@ in
programs.ccache.enable = true;
environment.systemPackages =
with pkgs;
with lib;
let
inherit (lib)
getExe
attrNames
optionalString
elem
concatLines
;
inherit (pkgs) writeShellScriptBin nix-output-monitor;
in
[
(writeShellScriptBin "nixos-build-all" (
concatLines (
map (
n:
"NIXOS_TARGET_HOST=${n} nixos-rebuild build --show-trace --upgrade"
+ optionalString (elem nix-output-monitor config.environment.systemPackages) " |& ${lib.getExe pkgs.nix-output-monitor}"
+ optionalString (elem nix-output-monitor config.environment.systemPackages) " |& ${getExe nix-output-monitor}"
) (attrNames host_modules)
)
))

View File

@ -1,8 +1,9 @@
{config, ...}: let
inherit (config.serverConfig) ports vhosts;
{ config, ... }:
let
inherit (config.serverConfig) vhosts;
inherit (config.networking) domain;
in {
in
{
services.authentik = {
enable = true;

View File

@ -1,10 +1,4 @@
{
lib,
config,
inputs,
pkgs,
...
}:
{ lib, config, ... }:
let
inherit (config.networking) domain;
root_email = "contact@${domain}";
@ -25,69 +19,77 @@ in
./nix_cache.nix
];
options.serverConfig = with lib; {
ports = mkOption {
type = types.attrsOf (
types.submodule (
{ config, ... }:
rec {
options = {
port = mkOption {
type = types.int;
description = "port to define";
};
open = mkEnableOption "whether to open the port" // {
default = true;
};
};
}
)
);
default = { };
description = "ports associated with services";
};
vhosts = mkOption {
type = types.attrsOf (
types.submodule (
{ config, ... }:
let
type_lookup = {
proxy = { locations."/".proxyPass = "http://127.0.0.1:${builtins.toString config.port}"; };
redirect = { locations."/".return = "307 https://${domain}"; };
custom = {};
none = {};
};
in
options.serverConfig =
let
inherit (lib) mkOption types mkEnableOption;
in
{
ports = mkOption {
type = types.attrsOf (
types.submodule (
{ ... }:
{
options = {
port = mkOption {
type = types.int;
default = 80;
description = "port to redirect to this vhost";
options = {
port = mkOption {
type = types.int;
description = "port to define";
};
open = mkEnableOption "whether to open the port" // {
default = true;
};
};
host = mkOption {
type = types.nonEmptyStr;
description = "name if the vhost";
}
)
);
default = { };
description = "ports associated with services";
};
vhosts = mkOption {
type = types.attrsOf (
types.submodule (
{ config, ... }:
let
type_lookup = {
proxy = {
locations."/".proxyPass = "http://127.0.0.1:${builtins.toString config.port}";
};
redirect = {
locations."/".return = "307 https://${domain}";
};
custom = { };
none = { };
};
accessType = mkOption {
type = types.enum (lib.attrNames type_lookup);
default = "none";
description = "nginx template to use";
in
{
options = {
port = mkOption {
type = types.int;
default = 80;
description = "port to redirect to this vhost";
};
host = mkOption {
type = types.nonEmptyStr;
description = "name if the vhost";
};
accessType = mkOption {
type = types.enum (lib.attrNames type_lookup);
default = "none";
description = "nginx template to use";
};
extraNginx = mkOption {
type = types.attrs;
default = type_lookup.${config.accessType};
description = "location definition for nginx";
};
};
extraNginx = mkOption {
type = types.attrs;
default = type_lookup.${config.accessType};
description = "location definition for nginx";
};
};
}
)
);
default = { };
description = "vhosts associated with services";
}
)
);
default = { };
description = "vhosts associated with services";
};
};
};
config = {
networking.firewall.allowedTCPPorts = [

View File

@ -1,11 +1,6 @@
{
config,
lib,
pkgs,
...
}:
{ config, pkgs, ... }:
let
inherit (config.serverConfig) ports vhosts;
inherit (config.serverConfig) ports;
in
{
age.secrets.matrix_discord_bridge_token.file = ../secrets/matrix_discord_bridge_token.age;

View File

@ -1,6 +1,6 @@
{ config, ... }:
let
inherit (config.serverConfig) ports vhosts;
inherit (config.serverConfig) vhosts;
inherit (config.networking) domain;
in
{

View File

@ -1,10 +1,4 @@
{
lib,
config,
inputs,
pkgs,
...
}:
{ config, pkgs, ... }:
let
inherit (config.networking) domain;
inherit (config.serverConfig) ports vhosts;

View File

@ -1,6 +1,6 @@
{ config, ... }:
let
inherit (config.serverConfig) ports vhosts;
inherit (config.serverConfig) vhosts;
inherit (config.networking) domain;
in
{

View File

@ -1,13 +1,12 @@
{
lib,
config,
inputs,
pkgs,
...
}:
let
inherit (config.networking) domain;
inherit (config.serverConfig) ports vhosts;
inherit (config.serverConfig) vhosts;
in
{
services.postgresql = {

View File

@ -1,4 +1,4 @@
{ config, ... }:
{ ... }:
let
in
{

View File

@ -1,9 +1,4 @@
{
lib,
pkgs,
config,
...
}:
{ pkgs, config, ... }:
let
inherit (config.serverConfig) ports vhosts;
in

View File

@ -1,12 +1,6 @@
{
lib,
config,
inputs,
pkgs,
...
}:
{ config, ... }:
let
inherit (config.serverConfig) ports vhosts;
inherit (config.serverConfig) vhosts;
in
{
services.harmonia = {

View File

@ -13,7 +13,14 @@ in
static_configs = [
{
targets =
with lib;
let
inherit (lib)
toString
filter
isAttrs
attrValues
;
in
map (v: "127.0.0.1:${toString v.port}") (
filter (v: (isAttrs v) && v.enable) (attrValues config.services.prometheus.exporters)
);

View File

@ -1,10 +1,4 @@
{
lib,
config,
inputs,
pkgs,
...
}:
{ config, pkgs, ... }:
let
inherit (config.serverConfig) ports vhosts;
in
@ -15,7 +9,6 @@ in
PUFFER_WEB_HOST = ":${builtins.toString vhosts.puffer_host.port}";
PUFFER_DAEMON_SFTP_HOST = ":${builtins.toString ports.puffer_sftp_port.port}";
};
extraPackages = with pkgs; [ ];
extraGroups = [ "docker" ];
};

View File

@ -1,9 +1,4 @@
{
final,
prev,
config,
...
}:
{ prev, config, ... }:
{
ccacheWrapper = prev.ccacheWrapper.override {
extraConfig = ''

View File

@ -27,5 +27,6 @@
./tlpui.nix
./mcontrolcenter.nix
./ccache-wrapper.nix
./searchclip.nix
];
}

View File

@ -1,4 +1,4 @@
{ final, prev, ... }:
{ prev, ... }:
{
deskwhich = prev.callPackage ../custom/deskwhich/package.nix { };
}

View File

@ -1,4 +1,4 @@
{ final, prev, ... }:
{ prev, ... }:
{
matrix-appservice-discord = prev.matrix-appservice-discord.overrideAttrs (old: {
src = prev.fetchFromGitHub {

View File

@ -1,4 +1,4 @@
{ final, prev, ... }:
{ prev, ... }:
{
mcontrolcenter = prev.callPackage (prev.fetchurl {
url = "https://raw.githubusercontent.com/NixOS/nixpkgs/2efffaa70e6de4cb34fd694798af5d433250f4e8/pkgs/by-name/mc/mcontrolcenter/package.nix";

4
overlays/searchclip.nix Normal file
View File

@ -0,0 +1,4 @@
{ prev, ... }:
{
searchclip = prev.callPackage ../custom/searchclip/package.nix { };
}

View File

@ -1,4 +1,4 @@
{ final, prev, ... }:
{ prev, ... }:
{
tlpui = prev.callPackage ../custom/tlpui/package.nix { };
}

View File

@ -1,4 +1,4 @@
{ pkgs, config, ... }:
{ config, ... }:
{
imports = [
# Include the results of the hardware scan.

View File

@ -1,13 +1,4 @@
{
lib,
config,
inputs,
pkgs,
...
}:
let
inherit (config.networking) domain;
in
{ lib, ... }:
{
imports = [ ./hardware-configuration.nix ];

View File

@ -1,16 +1,18 @@
{
config,
lib,
pkgs,
...
}:
{ lib, pkgs, ... }:
let
inherit (lib) getExe;
inherit (pkgs)
rmenu
btop
xdg-terminal-exec
waybar-mpris
pwvucontrol
;
in
{
grimmShared.sway.bar = {
enable = true;
config = with pkgs; {
config = {
backlight = {
format = "{percent}%";
format-icons = [

View File

@ -1,22 +1,4 @@
{
pkgs,
config,
lib,
...
}:
let
searchclip =
let
inherit (lib) getExe;
in
with pkgs;
writeShellScriptBin "searchclip" ''
xdg-open https://www.google.com/search?q=$(wl-paste -p | ${getExe urlencode})
browser=$(xdg-settings get default-web-browser | sed "s/\.desktop//")
sleep .1
swaymsg [app_id="$browser" urgent="newest"] focus
'';
in
{ pkgs, lib, ... }:
{
imports = [ ./bar ];
@ -37,9 +19,19 @@ in
grimmShared.sway = {
enable = true;
config =
with pkgs;
let
inherit (lib) getExe;
inherit (pkgs)
rmenu
xdg-terminal-exec
slurp
swaymux
grim
brightnessctl
searchclip
ranger
deskwhich
;
in
{
definitions = {

View File

@ -35,15 +35,16 @@
{ remote = "Videos"; }
];
packages =
packages = lib.optionals config.grimmShared.graphical (
with pkgs;
lib.optionals config.grimmShared.graphical [
[
webcord
discord
obs-studio
element-desktop
ghidra
# rmview
];
]
);
};
}