This commit is contained in:
Grimmauld 2024-05-07 23:31:41 +02:00
parent 280cc4f686
commit 2e8ca0ee0d
Signed by: Grimmauld
GPG Key ID: C2946668769F91FB
42 changed files with 1811 additions and 1405 deletions

View File

View File

@ -1,7 +1,16 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
cfg = config.grimmShared;
sync_mod = with lib; types.submodule ({ config, ... }: {
sync_mod =
with lib;
types.submodule (
{ config, ... }:
{
options = {
remote = mkOption {
type = types.nonEmptyStr;
@ -14,10 +23,13 @@ let
description = "local path to sync";
};
};
});
}
);
in
{
config = with cfg; lib.mkIf (enable && cloudSync.enable) (
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}";
@ -28,17 +40,20 @@ in
nextcloud-client
];
systemd.services = lib.mkMerge (lib.mapAttrsToList
(local_user: user_conf:
systemd.services = lib.mkMerge (
lib.mapAttrsToList (
local_user: user_conf:
let
paths = user_conf.syncPaths;
sync_script = lib.strings.concatLines (map
({ local, remote }:
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);
"${cloud_cmd} /${remote_clean} ${local} ${sync_server}"
) paths
);
in
{
# user-specific sync jobs
@ -56,11 +71,13 @@ in
wantedBy = [ "multi-user.target" ];
enable = true;
};
})
config.users.users);
}
) config.users.users
);
systemd.timers = lib.mkMerge (lib.mapAttrsToList
(local_user: user_conf:
systemd.timers = lib.mkMerge (
lib.mapAttrsToList (
local_user: user_conf:
let
paths = user_conf.syncPaths;
in
@ -70,16 +87,23 @@ in
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" ];
wantedBy = [
"multi-user.target"
"timers.target"
];
enable = true;
};
})
config.users.users);
}
) config.users.users
);
}
);
options.users.users = with lib; mkOption {
type = types.attrsOf (types.submodule {
options.users.users =
with lib;
mkOption {
type = types.attrsOf (
types.submodule {
options = {
syncPaths = mkOption {
type = types.listOf sync_mod;
@ -87,10 +111,10 @@ in
description = "paths to sync via nextcloud";
};
};
});
}
);
};
options.grimmShared.cloudSync = with lib; {
enable = mkEnableOption "cloud_sync";

View File

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

View File

@ -1,30 +1,38 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
cfg = config.grimmShared;
in
{
config = with cfg; lib.mkIf (enable && firefox.enable) {
environment.systemPackages = [ ]
config =
with cfg;
lib.mkIf (enable && firefox.enable) {
environment.systemPackages =
[ ]
++ lib.optionals config.services.desktopManager.plasma6.enable [ pkgs.plasma-browser-integration ];
programs.firefox = {
package = pkgs.firefox-beta;
enable = true;
nativeMessagingHosts.packages = [ ]
nativeMessagingHosts.packages =
[ ]
++ lib.optionals (cfg.tooling.enable && cfg.tooling.pass) [ pkgs.passff-host ];
languagePacks = lib.optionals cfg.locale [ "de" "en-US" ];
languagePacks = lib.optionals cfg.locale [
"de"
"en-US"
];
policies = {
ExtensionSettings = lib.mkMerge [
(lib.mkIf cfg.firefox.disableUserPlugins {
"*".installation_mode = "blocked";
})
(lib.mapAttrs
(guid: shortId: {
(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";
installation_mode = "force_installed";
})
cfg.firefox.plugins)
}) cfg.firefox.plugins)
(lib.mkIf (cfg.tooling.enable && cfg.tooling.pass) {
# password-store support
"passff@invicem.pro" = {

View File

@ -1,18 +1,23 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
cfg = config.grimmShared;
in
{
config = with cfg; lib.mkIf (enable && gaming) {
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
];
extraCompatPackages = with pkgs; [ proton-ge-bin ];
# extest.enable = true;
};
@ -44,7 +49,8 @@ in
(pkgs.symlinkJoin {
name = "osu";
paths = [
(pkgs.writeShellScriptBin "osu!" ''exec gamemoderun ${lib.getExe pkgs.osu-lazer-bin}
(pkgs.writeShellScriptBin "osu!" ''
exec gamemoderun ${lib.getExe pkgs.osu-lazer-bin}
'')
pkgs.osu-lazer-bin
];

View File

@ -1,6 +1,13 @@
{ lib, pkgs, config, ... }:
{
config = with config.grimmShared; lib.mkIf (enable && graphical) {
lib,
pkgs,
config,
...
}:
{
config =
with config.grimmShared;
lib.mkIf (enable && graphical) {
fonts = {
packages = with pkgs; [
noto-fonts

View File

@ -1,7 +1,14 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
cfg = config.grimmShared;
screen = with lib; types.submodule {
screen =
with lib;
types.submodule {
options = {
fps = mkOption {
type = types.either types.int (types.nonEmptyListOf types.int);
@ -30,7 +37,9 @@ let
};
in
{
config = with cfg; lib.mkIf (enable && graphical) {
config =
with cfg;
lib.mkIf (enable && graphical) {
# Enable OpenGL
hardware.opengl = {
enable = true;
@ -60,7 +69,6 @@ in
];
};
options.grimmShared = with lib; {
graphical = mkOption {
type = types.bool;

View File

@ -1,16 +1,26 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
let
cfg = config.grimmShared;
in
{
config = with cfg; lib.mkIf (enable && graphical) {
config =
with cfg;
lib.mkIf (enable && graphical) {
qt = {
enable = true;
style = "kvantum";
platformTheme = "qt5ct";
};
environment.systemPackages = with pkgs; with kdePackages; [
environment.systemPackages =
with pkgs;
with kdePackages;
[
qtstyleplugin-kvantum
catppuccin-sddm-corners
libsForQt5.qtgraphicaleffects
@ -24,9 +34,7 @@ in
qtwayland
];
environment.pathsToLink = [
"/share/Kvantum"
];
environment.pathsToLink = [ "/share/Kvantum" ];
services.displayManager = {
sddm = {
@ -39,9 +47,7 @@ in
};
boot.plymouth = {
themePackages = with pkgs; [
catppuccin-plymouth
];
themePackages = with pkgs; [ catppuccin-plymouth ];
theme = "catppuccin-macchiato";
enable = true;
};

View File

@ -1,7 +1,16 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
cfg = config.grimmShared;
sway_conf = with lib; types.submodule ({ config, ... }: rec {
sway_conf =
with lib;
types.submodule (
{ config, ... }:
rec {
options = {
keybinds = mkOption {
type = types.attrsOf types.str;
@ -39,15 +48,18 @@ let
description = "possible modes to switch to, e.g. resize";
};
};
});
}
);
build_screen_def = fps_func: with lib; let
output_def = mapAttrsToList
(name: value:
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;
) cfg.screens;
in
''
for pid in $(${pkgs.procps}/bin/pgrep sway -x)
@ -64,16 +76,22 @@ let
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_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}";
in
{
config =
let
bar_conf_file = if (lib.isPath cfg.sway.bar.config) then cfg.sway.bar.config else pkgs.writers.writeJSON "config.json" cfg.sway.bar.config;
bar_conf_file =
if (lib.isPath cfg.sway.bar.config) then
cfg.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}")
@ -92,16 +110,21 @@ in
systemctl --user start xdg-desktop-portal xdg-desktop-portal-wlr
'';
build_conf = with lib; sway_conf:
build_conf =
with lib;
sway_conf:
let
build_definition_lines = mapAttrsToList (name: value: "set \$${name} ${value}");
build_keybind_lines = mapAttrsToList (key: value: "bindsym ${key} ${value}");
build_exec_lines = e: map (item: "${e} " + (if isString item then item else (getExe item)));
build_mode_lines = mapAttrsToList (name: value: ''
build_mode_lines = mapAttrsToList (
name: value: ''
mode "${name}" {
${concatLines (map (item: " " + item ) (build_conf value))}}'');
${concatLines (map (item: " " + item) (build_conf value))}}''
);
in
([ ]
(
[ ]
++ (build_definition_lines sway_conf.definitions)
++ (build_keybind_lines sway_conf.keybinds)
++ (build_exec_lines "exec" sway_conf.autolaunch)
@ -113,17 +136,17 @@ in
sway_conf = lib.concatLines (
(build_conf cfg.sway.config)
++ lib.optional cfg.sway.bar.enable bar_config
++ (lib.mapAttrsToList
(name: value:
++ (lib.mapAttrsToList (
name: value:
"output ${value.id} mode ${value.mode}"
+ (lib.optionalString (value.pos != null) " position ${value.pos}")
)
cfg.screens)
) cfg.screens)
);
conf_path = "sway.conf";
in
with cfg; lib.mkIf (enable && sway.enable) {
with cfg;
lib.mkIf (enable && sway.enable) {
environment.etc."${conf_path}".text = sway_conf;
grimmShared.sway.config.execAlways = [
@ -131,13 +154,15 @@ in
init_screens_auto
];
environment.systemPackages = [
environment.systemPackages =
[
waybar_full
dbus-sway-environment
init_screens_min_fps
init_screens_max_fps
init_screens_auto
] ++ (with pkgs; [
]
++ (with pkgs; [
procps
slurp
libnotify

View File

@ -1,10 +1,19 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
cfg = config.grimmShared;
in
{
config = with cfg; lib.mkIf (enable && laptop_hardware.enable) {
environment.systemPackages = with pkgs; [
config =
with cfg;
lib.mkIf (enable && laptop_hardware.enable) {
environment.systemPackages =
with pkgs;
[
lm_sensors
lshw
pciutils
@ -13,7 +22,8 @@ in
ddcutil
python312Packages.py-cpuinfo
(writeShellScriptBin "lsiommu" ./lsiommu)
] ++ lib.optionals graphical [
]
++ lib.optionals graphical [
ddcui
wootility
];
@ -66,8 +76,7 @@ in
];
loader.systemd-boot.enable = true;
extraModulePackages = [
(config.boot.kernelPackages.ddcci-driver.overrideAttrs
(old: {
(config.boot.kernelPackages.ddcci-driver.overrideAttrs (old: {
patches = [
(pkgs.fetchpatch {
url = "https://gitlab.com/Sweenu/ddcci-driver-linux/-/commit/7f851f5fb8fbcd7b3a93aaedff90b27124e17a7e.patch";
@ -93,4 +102,3 @@ in
enable = lib.mkEnableOption "grimm-laptop";
};
}

View File

@ -1,33 +1,67 @@
{ pkgs, config, lib, system, ... }:
{
pkgs,
config,
lib,
system,
...
}:
let
cfg = config.grimmShared;
inherit (lib) optionals optional optionalString concatLines getExe;
inherit (lib)
optionals
optional
optionalString
concatLines
getExe
;
inherit (config.boot.kernelPackages) x86_energy_perf_policy cpupower;
enable_perf_policy = (lib.elem system x86_energy_perf_policy.meta.platforms);
powersave = with pkgs; writeShellScriptBin "powersave-mode" (concatLines ([
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 [
]
++ 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"));
]
++ optional cfg.sway.enable "init-screens-min"
)
);
performance = pkgs.writeShellScriptBin "performance-mode" (concatLines ([
performance = pkgs.writeShellScriptBin "performance-mode" (
concatLines (
[
"${getExe cpupower} frequency-set frequency-set -g performance -u 5000000" # clock speed
"${getExe pkgs.brightnessctl} s 100%" # display brightness
] ++ optionals enable_perf_policy [
]
++ optionals enable_perf_policy [
"${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"));
auto = let inherit (pkgs) tlp; in pkgs.writeShellScriptBin "auto-mode" ''
]
++ optional cfg.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}
'';
in
{
config = with cfg; lib.mkIf (enable && laptop_hardware.enable) {
environment.systemPackages = with pkgs; [
config =
with cfg;
lib.mkIf (enable && laptop_hardware.enable) {
environment.systemPackages =
with pkgs;
[
acpi
powertop
brightnessctl
@ -35,9 +69,9 @@ in
powersave
performance
auto
] ++ optionals graphical [
tlpui
] ++ optional enable_perf_policy x86_energy_perf_policy;
]
++ optionals graphical [ tlpui ]
++ optional enable_perf_policy x86_energy_perf_policy;
services.acpid = {
enable = true;
@ -74,4 +108,3 @@ in
};
};
}

View File

@ -3,7 +3,9 @@ let
cfg = config.grimmShared;
in
{
config = with cfg; lib.mkIf (enable && locale) {
config =
with cfg;
lib.mkIf (enable && locale) {
time.timeZone = "Europe/Berlin";
# Select internationalisation properties.

View File

@ -1,18 +1,26 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
cfg = config.grimmShared;
in
{
config = with cfg; lib.mkIf (enable && network && config.hardware.bluetooth.enable) {
config =
with cfg;
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 = with 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" ];
after = [
"network.target"
"sound.target"
];
wantedBy = [ "default.target" ];
serviceConfig.ExecStart = "${pkgs.bluez}/bin/mpris-proxy";
};

View File

@ -1,9 +1,16 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
cfg = config.grimmShared;
in
{
config = with cfg; lib.mkIf (enable && network) {
config =
with cfg;
lib.mkIf (enable && network) {
networking.networkmanager.enable = true;
networking.useDHCP = lib.mkDefault true;

View File

@ -1,12 +1,22 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
cfg = config.grimmShared;
in
{
config = with cfg; lib.mkIf (enable && printing) {
config =
with cfg;
lib.mkIf (enable && printing) {
# Enable CUPS to print documents.
services.printing.enable = true;
services.printing.drivers = with pkgs; [ brgenml1lpr brgenml1cupswrapper ];
services.printing.drivers = with pkgs; [
brgenml1lpr
brgenml1cupswrapper
];
services.avahi = {
enable = true;
nssmdns4 = true;
@ -15,7 +25,9 @@ in
services.printing.cups-pdf.enable = true;
hardware.sane.brscan4.enable = true; # enables support for SANE scanners
environment.systemPackages = with pkgs; (lib.optionals cfg.graphical [
environment.systemPackages =
with pkgs;
(lib.optionals cfg.graphical [
kdePackages.skanpage
# libsForQt5.skanpage
]);

View File

@ -1,9 +1,16 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
cfg = config.grimmShared;
in
{
config = with cfg; lib.mkIf (enable && sound.enable) {
config =
with cfg;
lib.mkIf (enable && sound.enable) {
sound.enable = true;
hardware.pulseaudio.enable = false;

View File

@ -1,10 +1,17 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.grimmShared;
sound_font = pkgs.soundfont-fluid;
in
{
config = with cfg; lib.mkIf (enable && sound.midi) {
config =
with cfg;
lib.mkIf (enable && sound.midi) {
environment.systemPackages = with pkgs; [
mpv
timidity
@ -12,9 +19,7 @@ in
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";
};

View File

@ -1,8 +1,9 @@
# source: https://github.com/fufexan/nix-gaming/raw/master/modules/pipewireLowLatency.nix
{ config
, pkgs
, lib
, ...
{
config,
pkgs,
lib,
...
}:
let
inherit (lib.modules) mkIf;
@ -55,7 +56,10 @@ in
modules = [
{
name = "libpipewire-module-rtkit";
flags = [ "ifexists" "nofail" ];
flags = [
"ifexists"
"nofail"
];
args = {
nice.level = -15;
rt = {
@ -93,11 +97,21 @@ in
configPackages =
let
# generate "matches" section of the rules
matches = toLua
matches =
toLua
{
multiline = false; # looks better while inline
indent = false;
} [ [ [ "node.name" "matches" "alsa_output.*" ] ] ]; # nested lists are to produce `{{{ }}}` in the output
}
[
[
[
"node.name"
"matches"
"alsa_output.*"
]
]
]; # nested lists are to produce `{{{ }}}` in the output
# generate "apply_properties" section of the rules
apply_properties = toLua { } {

View File

@ -1,12 +1,17 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.grimmShared;
in
{
config = with cfg; lib.mkIf (enable && spotify.enable) {
environment.systemPackages = [
pkgs.ncspot
] ++ lib.optional graphical pkgs.spotify;
config =
with cfg;
lib.mkIf (enable && spotify.enable) {
environment.systemPackages = [ pkgs.ncspot ] ++ lib.optional graphical pkgs.spotify;
grimmShared = {
sound.enable = true;
@ -18,7 +23,5 @@ in
enable = lib.mkEnableOption "grimm-spotify";
};
imports = [
./spotifyd.nix
];
imports = [ ./spotifyd.nix ];
}

View File

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
spotifyd_cache_dir = "/tmp/spotifyd";
cfg = config.grimmShared;
@ -22,7 +27,9 @@ let
'';
in
{
config = with cfg; lib.mkIf (enable && spotify.spotifyd.enable) {
config =
with cfg;
lib.mkIf (enable && spotify.spotifyd.enable) {
environment.systemPackages = with pkgs; [
spotifyd
spotifyd-dbus
@ -53,7 +60,15 @@ in
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);
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";
@ -67,16 +82,16 @@ in
};
};
services.dbus.packages = with pkgs; [
spotifyd-dbus
];
services.dbus.packages = with pkgs; [ spotifyd-dbus ];
# spotifyd has access to global pipewire
users.users.spotifyd = {
isSystemUser = true;
group = "spotifyd";
extraGroups = [ "audio" "pipewire" ];
extraGroups = [
"audio"
"pipewire"
];
};
# spotifyd is also a group
@ -91,7 +106,6 @@ in
description = "spotify username";
};
pass = mkOption {
type = types.either types.nonEmptyStr (types.either types.package types.path);
description = "command to execute to obtain login information or readable path to a file containing them";

View File

@ -1,4 +1,9 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
cfg = config.grimmShared;
in
@ -10,14 +15,19 @@ in
./python.nix
];
config = with cfg; lib.mkIf (enable && tooling.enable) {
environment.systemPackages = with pkgs; [
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 &'')
urlencode
pstree
dos2unix
treefmt
gcc
jdk17
@ -45,7 +55,8 @@ in
glibc
expect
neovim-remote
] ++ lib.optionals cfg.graphical [
]
++ lib.optionals cfg.graphical [
wev
qdirstat
libva-utils
@ -88,7 +99,6 @@ in
services.dbus.implementation = "broker";
grimmShared.tooling.nvim.plugins = with pkgs.vimPlugins; [
vim-scala
fugitive

View File

@ -1,14 +1,21 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
let
cfg = config.grimmShared;
viewer_pkg = pkgs.zathura;
viewer_def = lib.optionalString cfg.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;
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)'";
};
@ -39,11 +46,8 @@ in
'';
};
grimmShared.tooling.nvim.plugins = with pkgs.vimPlugins; [
nvim-lilypond-suite
];
grimmShared.tooling.nvim.plugins = with pkgs.vimPlugins; [ nvim-lilypond-suite ];
};
options.grimmShared.tooling.lilypond = lib.mkEnableOption "enable lilypond tooling";
}

View File

@ -1,4 +1,10 @@
{ pkgs, config, lib, inputs, ... }:
{
pkgs,
config,
lib,
inputs,
...
}:
let
cfg = config.grimmShared;
in
@ -7,7 +13,6 @@ in
(writeShellScriptBin "silent-add" "git add --intent-to-add $@ ; git update-index --assume-unchanged $@")
(writeShellScriptBin "nix-referrers" "nix-store --query --referrers $@")
(writeShellScriptBin "nixpkgs-review-head" "nixpkgs-review rev HEAD")
(writeShellScriptBin "fmt-all" ''find ./ -readable -writable -type f | grep "\.nix" | xargs nixpkgs-fmt'')
(writeShellScriptBin "rebuild" "bash -c \"nixos-rebuild switch |& nom\"")
nixpkgs-review
@ -20,16 +25,15 @@ in
niv
];
environment.sessionVariables = lib.mkIf pkgs.config.allowUnfree {
NIXPKGS_ALLOW_UNFREE = "1";
};
environment.sessionVariables = lib.mkIf pkgs.config.allowUnfree { NIXPKGS_ALLOW_UNFREE = "1"; };
grimmShared.tooling.nvim.plugins = with pkgs.vimPlugins; [
vim-nix
];
grimmShared.tooling.nvim.plugins = with pkgs.vimPlugins; [ vim-nix ];
nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
experimental-features = [
"nix-command"
"flakes"
];
warn-dirty = false;
};
nix.gc = {

View File

@ -1,14 +1,19 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
cfg = config.grimmShared;
in
{
config = with cfg; lib.mkIf (enable && tooling.enable) {
environment.systemPackages = with pkgs; [
python3
] ++ lib.optionals cfg.graphical [
jetbrains.pycharm-community
];
config =
with cfg;
lib.mkIf (enable && tooling.enable) {
environment.systemPackages =
with pkgs;
[ python3 ] ++ lib.optionals cfg.graphical [ jetbrains.pycharm-community ];
programs.xonsh = {
enable = true;
@ -17,7 +22,8 @@ in
aliases["ls"] = "eza"
'';
package = pkgs.xonsh.override {
extraPackages = ps: with ps; [
extraPackages =
ps: with ps; [
requests
matplotlib
numpy

View File

@ -1,32 +1,45 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
cfg = config.grimmShared;
in
{
config = with cfg; lib.mkIf enable {
config =
with cfg;
lib.mkIf enable {
security.polkit.enable = true;
networking.firewall.enable = lib.mkIf network true;
security.rtkit.enable = true;
security.doas.enable = true;
security.sudo.enable = false;
security.doas.extraRules = [{
security.doas.extraRules = [
{
users = lib.attrNames (lib.filterAttrs (n: v: v.isNormalUser) config.users.users);
keepEnv = true;
persist = true;
}];
}
];
environment.systemPackages = with pkgs; [
environment.systemPackages =
with pkgs;
[
mkpasswd
gnupg
libsecret
vulnix
doas-sudo-shim # muscle memory
agenix
] ++ lib.optionals (tooling.enable && tooling.pass) [
]
++ lib.optionals (tooling.enable && tooling.pass) [
pass
(writeShellScriptBin "passw" "pass $@")
] ++ lib.optional graphical lxqt.lxqt-policykit;
]
++ lib.optional graphical lxqt.lxqt-policykit;
services.passSecretService.enable = lib.mkIf (tooling.enable && tooling.pass) true;
programs.gnupg.agent = {

View File

@ -1,4 +1,9 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
cfg = config.grimmShared;
browsers = [
@ -15,12 +20,8 @@ let
"org.kde.krita.desktop"
"draw.desktop"
];
audio_players = [
"vlc.desktop"
];
video_viewers = [
"vlc.desktop"
];
audio_players = [ "vlc.desktop" ];
video_viewers = [ "vlc.desktop" ];
document_viewers = [
"org.pwmt.zathura-pdf-mupdf.desktop"
"com.github.jeromerobert.pdfarranger.desktop"
@ -34,7 +35,9 @@ let
tex_editors = [ ] ++ text_editors;
in
{
config = with cfg; lib.mkIf (enable && portals && graphical) {
config =
with cfg;
lib.mkIf (enable && portals && graphical) {
environment.systemPackages = with pkgs; [
deskwhich
@ -63,7 +66,10 @@ in
xdg.terminal-exec = {
enable = true;
settings = {
default = [ "Alacritty.desktop" "kitty.desktop" ];
default = [
"Alacritty.desktop"
"kitty.desktop"
];
};
};
@ -73,9 +79,7 @@ in
"idea-community.desktop"
"imhex.desktop"
];
"application/json" = text_editors ++ [
"firefox-beta.desktop"
];
"application/json" = text_editors ++ [ "firefox-beta.desktop" ];
"application/mp4" = video_viewers;
"application/ogg" = audio_players;
"application/octet-stream" = "imhex.desktop";

View File

@ -1,9 +1,16 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
cfg = config.grimmShared;
in
{
config = with cfg; lib.mkIf (enable && portals) {
config =
with cfg;
lib.mkIf (enable && portals) {
xdg.icons.enable = true;
xdg.sounds.enable = lib.mkIf sound.enable true;
@ -17,23 +24,24 @@ in
];
wlr.enable = true;
wlr.settings = with lib; mapAttrs'
(name: value: nameValuePair ("screencast_" + name) {
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;
}
) cfg.screens;
};
environment.sessionVariables = {
XDG_CONFIG_HOME = "$HOME/.config";
};
environment.systemPackages = with pkgs; [
xwaylandvideobridge
];
environment.systemPackages = with pkgs; [ xwaylandvideobridge ];
};
options.grimmShared.portals = lib.mkEnableOption "Enables portals for wlr, gtk and kde as well as fixes fonts";

View File

@ -1,7 +1,6 @@
{ config, pkgs, ... }:
{
imports =
[
imports = [
./overlays
./common
./fake_flake.nix

View File

@ -1,6 +1,7 @@
{ fetchFromGitea
, lib
, rustPlatform
{
fetchFromGitea,
lib,
rustPlatform,
}:
rustPlatform.buildRustPackage rec {
pname = "deskwhich";

View File

@ -1,4 +1,10 @@
{ pkgs, lib, config, system, ... }:
{
pkgs,
lib,
config,
system,
...
}:
let
nivSources = import ./nix/sources.nix;
asGithubRef = src: "github:${src.owner}/${src.repo}/${src.rev}";
@ -32,12 +38,13 @@ in
nixpkgs.pkgs =
let
src = nivSources.nixpkgs;
config = { allowUnfree = true; };
config = {
allowUnfree = true;
};
unpatched = import src { inherit config system; };
inherit (unpatched) applyPatches fetchpatch;
in
import
(applyPatches {
import (applyPatches {
name = "nixpkgs-patched";
inherit src;
patches = map fetchpatch nixpkgs_patches;

View File

@ -48,10 +48,12 @@ let
done <<< "$(find -L "$HOOKPATH" -maxdepth 1 -type f -executable -print;)"
fi
'';
in
{
environment.systemPackages = [ loadnvidia loadvfio ];
environment.systemPackages = [
loadnvidia
loadvfio
];
security.sudo.extraConfig = "grimmauld ALL=(ALL) NOPASSWD:/run/current-system/sw/bin/loadnvidia, /run/current-system/sw/bin/loadvfio";
virtualisation.libvirtd = {
enable = true;
@ -69,8 +71,6 @@ in
onShutdown = "shutdown";
};
programs.virt-manager.enable = true;
virtualisation.spiceUSBRedirection.enable = true;
}

View File

@ -1,4 +1,10 @@
{ lib, config, pkgs, ... }: {
{
lib,
config,
pkgs,
...
}:
{
users.users.grimmauld = {
isNormalUser = true;
# shell = pkgs.xonsh;

View File

@ -6,30 +6,48 @@ let
# The fetchers. fetch_<type> fetches specs of type <type>.
#
fetch_file = pkgs: name: spec:
fetch_file =
pkgs: name: spec:
let
name' = sanitizeName name + "-src";
in
if spec.builtin or true then
builtins_fetchurl { inherit (spec) url sha256; name = name'; }
builtins_fetchurl {
inherit (spec) url sha256;
name = name';
}
else
pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
pkgs.fetchurl {
inherit (spec) url sha256;
name = name';
};
fetch_tarball = pkgs: name: spec:
fetch_tarball =
pkgs: name: spec:
let
name' = sanitizeName name + "-src";
in
if spec.builtin or true then
builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
builtins_fetchTarball {
name = name';
inherit (spec) url sha256;
}
else
pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
pkgs.fetchzip {
name = name';
inherit (spec) url sha256;
};
fetch_git = name: spec:
fetch_git =
name: spec:
let
ref =
spec.ref or (
if spec ? branch then "refs/heads/${spec.branch}" else
if spec ? tag then "refs/tags/${spec.tag}" else
if spec ? branch then
"refs/heads/${spec.branch}"
else if spec ? tag then
"refs/tags/${spec.tag}"
else
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!"
);
submodules = spec.submodules or false;
@ -37,32 +55,38 @@ let
let
nixSupportsSubmodules = builtins.compareVersions builtins.nixVersion "2.4" >= 0;
emptyArgWithWarning =
if submodules
then
builtins.trace
(
if submodules then
builtins.trace (
"The niv input \"${name}\" uses submodules "
+ "but your nix's (${builtins.nixVersion}) builtins.fetchGit "
+ "does not support them"
)
{ }
else { };
) { }
else
{ };
in
if nixSupportsSubmodules
then { inherit submodules; }
else emptyArgWithWarning;
if nixSupportsSubmodules then { inherit submodules; } else emptyArgWithWarning;
in
builtins.fetchGit
({ url = spec.repo; inherit (spec) rev; inherit ref; } // submoduleArg);
builtins.fetchGit (
{
url = spec.repo;
inherit (spec) rev;
inherit ref;
}
// submoduleArg
);
fetch_local = spec: spec.path;
fetch_builtin-tarball = name: throw
''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`.
fetch_builtin-tarball =
name:
throw ''
[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`.
$ niv modify ${name} -a type=tarball -a builtin=true'';
fetch_builtin-url = name: throw
''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`.
fetch_builtin-url =
name:
throw ''
[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`.
$ niv modify ${name} -a type=file -a builtin=true'';
#
@ -70,70 +94,89 @@ let
#
# https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695
sanitizeName = name:
(
concatMapStrings (s: if builtins.isList s then "-" else s)
(
builtins.split "[^[:alnum:]+._?=-]+"
((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name)
)
);
sanitizeName =
name:
(concatMapStrings (s: if builtins.isList s then "-" else s) (
builtins.split "[^[:alnum:]+._?=-]+" ((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name)
));
# The set of packages used when specs are fetched using non-builtins.
mkPkgs = sources: system:
mkPkgs =
sources: system:
let
sourcesNixpkgs =
import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; };
sourcesNixpkgs = import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) {
inherit system;
};
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
in
if builtins.hasAttr "nixpkgs" sources
then sourcesNixpkgs
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
if builtins.hasAttr "nixpkgs" sources then
sourcesNixpkgs
else if hasNixpkgsPath && !hasThisAsNixpkgsPath then
import <nixpkgs> { }
else
abort
''
abort ''
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
add a package called "nixpkgs" to your sources.json.
'';
# The actual fetching function.
fetch = pkgs: name: spec:
fetch =
pkgs: name: spec:
if ! builtins.hasAttr "type" spec then
if !builtins.hasAttr "type" spec then
abort "ERROR: niv spec ${name} does not have a 'type' attribute"
else if spec.type == "file" then fetch_file pkgs name spec
else if spec.type == "tarball" then fetch_tarball pkgs name spec
else if spec.type == "git" then fetch_git name spec
else if spec.type == "local" then fetch_local spec
else if spec.type == "builtin-tarball" then fetch_builtin-tarball name
else if spec.type == "builtin-url" then fetch_builtin-url name
else if spec.type == "file" then
fetch_file pkgs name spec
else if spec.type == "tarball" then
fetch_tarball pkgs name spec
else if spec.type == "git" then
fetch_git name spec
else if spec.type == "local" then
fetch_local spec
else if spec.type == "builtin-tarball" then
fetch_builtin-tarball name
else if spec.type == "builtin-url" then
fetch_builtin-url name
else
abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
# If the environment variable NIV_OVERRIDE_${name} is set, then use
# the path directly as opposed to the fetched source.
replace = name: drv:
replace =
name: drv:
let
saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name;
ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
in
if ersatz == "" then drv else
if ersatz == "" then
drv
else
# this turns the string into an actual Nix path (for both absolute and
# relative paths)
if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}";
if builtins.substring 0 1 ersatz == "/" then
/. + ersatz
else
/. + builtins.getEnv "PWD" + "/${ersatz}";
# Ports of functions for older nix versions
# a Nix version of mapAttrs if the built-in doesn't exist
mapAttrs = builtins.mapAttrs or (
f: set: with builtins;
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
mapAttrs =
builtins.mapAttrs or (
f: set:
with builtins;
listToAttrs (
map (attr: {
name = attr;
value = f attr set.${attr};
}) (attrNames set)
)
);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
range = first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1);
range =
first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1);
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
@ -147,7 +190,12 @@ let
optionalAttrs = cond: as: if cond then as else { };
# fetchTarball version that is compatible between all the versions of Nix
builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
builtins_fetchTarball =
{
url,
name ? null,
sha256,
}@attrs:
let
inherit (builtins) lessThan nixVersion fetchTarball;
in
@ -157,7 +205,12 @@ let
fetchTarball attrs;
# fetchurl version that is compatible between all the versions of Nix
builtins_fetchurl = { url, name ? null, sha256 }@attrs:
builtins_fetchurl =
{
url,
name ? null,
sha256,
}@attrs:
let
inherit (builtins) lessThan nixVersion fetchurl;
in
@ -167,32 +220,30 @@ let
fetchurl attrs;
# Create the final "sources" from the config
mkSources = config:
mapAttrs
(
mkSources =
config:
mapAttrs (
name: spec:
if builtins.hasAttr "outPath" spec
then
abort
"The values in sources.json should not have an 'outPath' attribute"
if builtins.hasAttr "outPath" spec then
abort "The values in sources.json should not have an 'outPath' attribute"
else
spec // { outPath = replace name (fetch config.pkgs name spec); }
)
config.sources;
) config.sources;
# The "config" used by the fetchers
mkConfig =
{ sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
, sources ? if sourcesFile == null then { } else builtins.fromJSON (builtins.readFile sourcesFile)
, system ? builtins.currentSystem
, pkgs ? mkPkgs sources system
}: rec {
{
sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null,
sources ? if sourcesFile == null then { } else builtins.fromJSON (builtins.readFile sourcesFile),
system ? builtins.currentSystem,
pkgs ? mkPkgs sources system,
}:
rec {
# The sources, i.e. the attribute set of spec name to spec
inherit sources;
# The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
inherit pkgs;
};
in
mkSources (mkConfig { }) // { __functor = _: settings: mkSources (mkConfig settings); }

View File

@ -1,5 +1,22 @@
{ config, lib, ... }: {
nixpkgs.overlays = map (f: (final: prev: (import f { inherit final prev lib config; }))) [
{ config, lib, ... }:
{
nixpkgs.overlays =
map
(
f:
(
final: prev:
(import f {
inherit
final
prev
lib
config
;
})
)
)
[
./deskwhich.nix
./mcontrolcenter.nix
./the-powder-toy.nix

View File

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

View File

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

View File

@ -1,8 +1,7 @@
{ final, prev, ... }: {
the-powder-toy = prev.callPackage
(prev.fetchurl {
{ final, prev, ... }:
{
the-powder-toy = prev.callPackage (prev.fetchurl {
url = "https://raw.githubusercontent.com/NixOS/nixpkgs/9863d8c74a959d73df0c495a55097f804f7b379d/pkgs/by-name/th/the-powder-toy/package.nix";
hash = "sha256-po6jhmdV+HNZBq4/vy6uQsDuW6PyvKcvysWNPZn4K7I=";
})
{ };
}) { };
}

View File

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

View File

@ -1,13 +1,18 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
config,
lib,
pkgs,
modulesPath,
...
}:
let
cpus = "12";
in
{
imports =
[
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
# ./modules/nvidia.nix
];
@ -16,32 +21,33 @@ in
boot.extraModulePackages = [ ];
boot.kernelParams = [ "possible_cpus=${cpus}" ];
fileSystems."/" =
{
fileSystems."/" = {
device = "/dev/disk/by-uuid/3a4a7076-98e7-4ecd-bb07-7e182a04ceac";
fsType = "ext4";
options = [ "relatime" ];
};
fileSystems."/boot" =
{
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/D20D-B5B0";
fsType = "vfat";
options = [ "umask=077" "relatime" ];
options = [
"umask=077"
"relatime"
];
};
swapDevices = [{
swapDevices = [
{
device = "/var/lib/swapfile";
size = 48 * 1024;
}];
}
];
environment.sessionVariables = {
OMP_NUM_THREADS = cpus;
};
environment.systemPackages = with pkgs; [
mcontrolcenter
];
environment.systemPackages = with pkgs; [ mcontrolcenter ];
grimmShared = {
screens = {
@ -52,12 +58,14 @@ in
internal = {
id = "eDP-1";
fps = [ 144 60 ];
fps = [
144
60
];
};
};
laptop_hardware.enable = true;
};
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
inherit (lib) getExe;
in
@ -8,16 +13,35 @@ in
config = with pkgs; {
backlight = {
format = "{percent}%";
format-icons = [ "" "" "" "" "" "" "" "" "" ];
format-icons = [
""
""
""
""
""
""
""
""
""
];
};
battery = {
format = "{capacity}% {icon}";
format-alt = "{time} {icon}";
format-charging = "{capacity}% ";
format-icons = [ "" "" "" "" "" ];
format-icons = [
""
""
""
""
""
];
format-plugged = "{capacity}% ";
on-click = "${getExe rmenu} -r powermenu --single-click true";
states = { critical = 15; warning = 30; };
states = {
critical = 15;
warning = 30;
};
};
clock = {
format-alt = "{:%d.%m.%Y}";
@ -41,19 +65,31 @@ in
height = 30;
idle_inhibitor = {
format = "{icon}";
format-icons = { activated = ""; deactivated = ""; };
format-icons = {
activated = "";
deactivated = "";
};
};
keyboard-state = {
capslock = true;
format = "{name} {icon}";
format-icons = { locked = ""; unlocked = ""; };
format-icons = {
locked = "";
unlocked = "";
};
numlock = true;
};
memory = { format = "{}% "; };
memory = {
format = "{}% ";
};
modules-center = [
# "wlr/taskbar"
];
modules-left = [ "sway/workspaces" "sway/mode" "sway/scratchpad" ];
modules-left = [
"sway/workspaces"
"sway/mode"
"sway/scratchpad"
];
modules-right = [
"custom/media"
"idle_inhibitor"
@ -84,7 +120,11 @@ in
format-bluetooth-muted = "{icon} {format_source}";
format-icons = {
car = "";
default = [ "" "" "" ];
default = [
""
""
""
];
hands-free = "";
headphone = "";
headset = "";
@ -98,10 +138,15 @@ in
on-click = "${getExe pwvucontrol}";
};
spacing = 4;
"sway/mode" = { format = "<span style=\"italic\">{}</span>"; };
"sway/mode" = {
format = "<span style=\"italic\">{}</span>";
};
"sway/scratchpad" = {
format = "{icon} {count}";
format-icons = [ "" "" ];
format-icons = [
""
""
];
show-empty = false;
tooltip = true;
tooltip-format = "{app}: {title}";
@ -109,16 +154,24 @@ in
temperature = {
critical-threshold = 80;
format = "{temperatureC}°C {icon}";
format-icons = [ "" "" "" ];
format-icons = [
""
""
""
];
};
tray = {
spacing = 10;
};
tray = { spacing = 10; };
"wlr/taskbar" = {
format = "{icon}";
icon-size = 14;
ignore-list = [ ];
on-click = "activate";
on-click-middle = "close";
rewrite = { "Firefox Web Browser" = "Firefox"; };
rewrite = {
"Firefox Web Browser" = "Firefox";
};
tooltip-format = "{title}";
};
};

View File

@ -1,6 +1,16 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
searchclip = let inherit (lib) getExe; in with pkgs; writeShellScriptBin "searchclip" ''
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
@ -8,9 +18,7 @@ let
'';
in
{
imports = [
./bar
];
imports = [ ./bar ];
environment.systemPackages = with pkgs; [
rmenu
@ -28,7 +36,9 @@ in
grimmShared.sway = {
enable = true;
config = with pkgs; let
config =
with pkgs;
let
inherit (lib) getExe;
in
{
@ -237,4 +247,3 @@ in
};
};
}

4
treefmt.toml Normal file
View File

@ -0,0 +1,4 @@
[formatter.nix]
command = "nixfmt"
includes = ["*.nix"]
excludes = ["tests/**"]