mass reformat

This commit is contained in:
notgne2 2022-10-03 17:08:32 -07:00
parent ed1c53e94c
commit 9cb456ad60
Signed by: notgne2
GPG Key ID: 5CE0A245A2DAC84A
25 changed files with 1216 additions and 1043 deletions

View File

@ -1,6 +1,10 @@
{ config, pkgs, lib, options, ... }:
{
config,
pkgs,
lib,
options,
...
}: {
imports = [./modules];
config = {

View File

@ -59,7 +59,11 @@
};
};
outputs = { self, nixpkgs, ... }@inputs: {
outputs = {
self,
nixpkgs,
...
} @ inputs: {
nixosModules = {
ezpassthru = import ./modules/ezpassthru.nix;
ezwg = import ./modules/ezwg.nix;

View File

@ -1,7 +1,9 @@
inputs:
{ config, lib, pkgs, ... }:
{
inputs: {
config,
lib,
pkgs,
...
}: {
imports = [(import ./modules inputs)];
programs.direnv = {

View File

@ -1,24 +1,43 @@
inputs:
{ config, lib, pkgs, ... }:
with lib;
let
inputs: {
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.ezcolors;
pow = n: i: if i == 1 then n else if i == 0 then 1 else n * pow n (i - 1);
pow = n: i:
if i == 1
then n
else if i == 0
then 1
else n * pow n (i - 1);
alf = ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "a" "b" "c" "d" "e" "f"];
fil = c: lib.imap0 (n: x: if (lib.toLower x) == (lib.toLower c) then n else null) alf;
fil = c:
lib.imap0 (n: x:
if (lib.toLower x) == (lib.toLower c)
then n
else null)
alf;
fin = c: builtins.elemAt (builtins.filter (x: x != null) (fil c)) 0;
add = l: lib.foldr ({ n, x }: c: (x * (pow 16 n)) + c) 0 (lib.imap0 (n: x: { inherit n x; }) l);
add = l:
lib.foldr ({
n,
x,
}: c: (x * (pow 16 n)) + c)
0 (lib.imap0 (n: x: {inherit n x;}) l);
calc = s: add (builtins.map fin (builtins.filter (x: builtins.isString x && builtins.stringLength x == 1) (builtins.split "" s)));
splitHex = c:
let
splitHex = c: let
s' = builtins.match "(..)(..)(..)|(.)(.)(.)" c;
ss = builtins.elemAt s';
o = if ss 0 == null then 3 else 0;
in
{
o =
if ss 0 == null
then 3
else 0;
in {
r = ss (0 + o);
g = ss (1 + o);
b = ss (2 + o);
@ -28,35 +47,35 @@ let
hexToAlphaCss = c: a: with hexToRgb c; "rgba(${r}, ${g}, ${b}, ${a})";
makeScheme = base16: lib.mapAttrs' (k: v: lib.nameValuePair "${k}-hex" v) base16 //
lib.mapAttrs' (k: v: lib.nameValuePair "${k}-hex-r" (splitHex v).r) base16 //
lib.mapAttrs' (k: v: lib.nameValuePair "${k}-hex-g" (splitHex v).g) base16 //
lib.mapAttrs' (k: v: lib.nameValuePair "${k}-hex-b" (splitHex v).b) base16 //
lib.mapAttrs' (k: v: lib.nameValuePair "${k}-rgb-r" (hexToRgb v).r) base16 //
lib.mapAttrs' (k: v: lib.nameValuePair "${k}-rgb-g" (hexToRgb v).g) base16 //
lib.mapAttrs' (k: v: lib.nameValuePair "${k}-rgb-b" (hexToRgb v).b) base16 //
lib.mapAttrs' (k: v: lib.nameValuePair "${k}-dec-r" ((hexToRgb v).r / 255.0)) base16 //
lib.mapAttrs' (k: v: lib.nameValuePair "${k}-dec-g" ((hexToRgb v).g / 255.0)) base16 //
lib.mapAttrs' (k: v: lib.nameValuePair "${k}-dec-b" ((hexToRgb v).b / 255.0)) base16;
makeScheme = base16:
lib.mapAttrs' (k: v: lib.nameValuePair "${k}-hex" v) base16
// lib.mapAttrs' (k: v: lib.nameValuePair "${k}-hex-r" (splitHex v).r) base16
// lib.mapAttrs' (k: v: lib.nameValuePair "${k}-hex-g" (splitHex v).g) base16
// lib.mapAttrs' (k: v: lib.nameValuePair "${k}-hex-b" (splitHex v).b) base16
// lib.mapAttrs' (k: v: lib.nameValuePair "${k}-rgb-r" (hexToRgb v).r) base16
// lib.mapAttrs' (k: v: lib.nameValuePair "${k}-rgb-g" (hexToRgb v).g) base16
// lib.mapAttrs' (k: v: lib.nameValuePair "${k}-rgb-b" (hexToRgb v).b) base16
// lib.mapAttrs' (k: v: lib.nameValuePair "${k}-dec-r" ((hexToRgb v).r / 255.0)) base16
// lib.mapAttrs' (k: v: lib.nameValuePair "${k}-dec-g" ((hexToRgb v).g / 255.0)) base16
// lib.mapAttrs' (k: v: lib.nameValuePair "${k}-dec-b" ((hexToRgb v).b / 255.0)) base16;
mustache = scheme: src:
pkgs.stdenv.mkDerivation (
{
pkgs.stdenv.mkDerivation {
# TODO add template name
name = "base16-generated";
inherit src;
data = pkgs.writeText "base16-generated-data" (builtins.toJSON scheme);
phases = ["buildPhase"];
buildPhase = "${pkgs.mustache-go}/bin/mustache $data $src > $out";
}
);
};
scheme = (makeScheme cfg.base16 // {
scheme =
makeScheme cfg.base16
// {
scheme-name = "base16 generated";
scheme-slug = "idk";
scheme-author = "nixos";
});
};
genTheme = repo: mustache scheme "${repo}/templates/default.mustache";
@ -75,8 +94,7 @@ let
homepage = "https://github.com/thefryscorer/schemer2";
};
};
in
{
in {
options.ezcolors = {
enable = mkEnableOption "Enable automatic colors";
@ -125,8 +143,7 @@ in
};
};
config =
let
config = let
colorsJson = builtins.toFile "colors.json" (builtins.toJSON cfg.base16);
themeHashOut = pkgs.runCommand "theme-hash" {} ''
cat ${colorsJson} | ${pkgs.coreutils}/bin/sha256sum | ${pkgs.coreutils}/bin/head -c 8 > $out
@ -246,9 +263,13 @@ in
base16FromImage = lib.filterAttrs (k: v: k != "scheme" && k != "author") (builtins.fromJSON (builtins.readFile base16FromImageSrc));
in
mkMerge [(mkIf cfg.enable {
mkMerge [
(mkIf cfg.enable {
# Read only utility attributes
ezcolors.base16 = if builtins.typeOf cfg.baseColors == "set" then cfg.baseColors else base16FromImage;
ezcolors.base16 =
if builtins.typeOf cfg.baseColors == "set"
then cfg.baseColors
else base16FromImage;
ezcolors.base16Rgb = builtins.mapAttrs (n: c: hexToRgb c) cfg.base16;
ezcolors.base16Split = builtins.mapAttrs (n: c: splitHex c) cfg.base16;
@ -317,8 +338,7 @@ in
# GTK
gtk = {
enable = true;
theme =
let
theme = let
generated-gtk-theme = pkgs.callPackage "${inputs.rycee}/pkgs/materia-theme" {
configBase16 = {
name = "Generated";
@ -326,8 +346,7 @@ in
colors = builtins.mapAttrs (k: v: {hex.rgb = v;}) cfg.base16;
};
};
in
{
in {
name = "Generated";
package = generated-gtk-theme;
};
@ -348,7 +367,8 @@ in
"workbench.colorTheme" = "nix colors";
};
home.file = lib.mkMerge
home.file =
lib.mkMerge
[
(
mkIf config.programs.vscode.enable {
@ -375,7 +395,8 @@ in
}
)
];
}) (mkIf (cfg.enable && cfg.plasma) {
})
(mkIf (cfg.enable && cfg.plasma) {
programs.plasma.files.kdeglobals = with (lib.mapAttrs (n: c: "#${c}") cfg.base16); {
# programs.plasma.files.kdeglobals = with (lib.mapAttrs (n: c: "${toString c.r},${toString c.g},${toString c.b}") cfg.base16Rgb); {
General = {
@ -483,5 +504,6 @@ in
ForegroundVisited = base0E;
};
};
})];
})
];
}

View File

@ -1,10 +1,12 @@
inputs:
{ config, lib, pkgs, ... }:
with lib;
let
inputs: {
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.de2u;
in
{
in {
options.de2u = {
enable = mkEnableOption "Enable de2 user stuff";
@ -40,7 +42,12 @@ in
programs.firefox = {
enable = lib.mkDefault true;
package = lib.mkDefault ((if pkgs ? librewolf then pkgs.librewolf else pkgs.firefox).override {
package = lib.mkDefault ((
if pkgs ? librewolf
then pkgs.librewolf
else pkgs.firefox
)
.override {
cfg = {
enableGnomeExtensions = true;
pipewireSupport = true;
@ -138,12 +145,20 @@ in
xdg.configFile."gtk-4.0/gtk.css".text = ''
/* UNITE windowDecorations */
@import url('${config.home.homeDirectory}/.nix-profile/share/gnome-shell/extensions/unite@hardpixel.eu/styles/gtk4/buttons-right/${if (cfg.tiling && !cfg.touch) then "always" else "both"}.css');
@import url('${config.home.homeDirectory}/.nix-profile/share/gnome-shell/extensions/unite@hardpixel.eu/styles/gtk4/buttons-right/${
if (cfg.tiling && !cfg.touch)
then "always"
else "both"
}.css');
/* windowDecorations UNITE */
'';
gtk.gtk3.extraCss = ''
/* UNITE windowDecorations */
@import url('${config.home.homeDirectory}/.nix-profile/share/gnome-shell/extensions/unite@hardpixel.eu/styles/gtk3/buttons-right/${if (cfg.tiling && !cfg.touch) then "always" else "both"}.css');
@import url('${config.home.homeDirectory}/.nix-profile/share/gnome-shell/extensions/unite@hardpixel.eu/styles/gtk3/buttons-right/${
if (cfg.tiling && !cfg.touch)
then "always"
else "both"
}.css');
/* windowDecorations UNITE */
'';
home.activation.gtk3css-over-unite = {
@ -158,15 +173,14 @@ in
xdg.configFile."mimeapps.list".force = true;
xdg.mimeApps = let
browser =
if config.programs.firefox.enable then
if config.programs.firefox.enable
then
(
if config.programs.firefox.package.pname == "firefox" then
"firefox.desktop"
else
"librewolf.desktop"
if config.programs.firefox.package.pname == "firefox"
then "firefox.desktop"
else "librewolf.desktop"
)
else
"chromium-browser.desktop";
else "chromium-browser.desktop";
apps = {
"text/plain" = "org.gnome.TextEditor.desktop";
@ -244,7 +258,10 @@ in
tray-pos = "center";
};
"org/gnome/shell/extensions/user-theme" = {
name = if config.ezcolors.enable then "Generated" else "Default";
name =
if config.ezcolors.enable
then "Generated"
else "Default";
};
"org/gnome/shell/extensions/just-perfection" = {
# activities-button = !cfg.tiling; # conflicts with unite?
@ -289,9 +306,18 @@ in
only-on-primary = cfg.tiling;
};
"org/gnome/shell/extensions/unite" = {
hide-window-titlebars = if (cfg.tiling && !cfg.touch) then "always" else "both";
hide-activities-button = if (cfg.tiling || cfg.touch) then "never" else "always";
show-window-buttons = if cfg.tiling then "never" else "both";
hide-window-titlebars =
if (cfg.tiling && !cfg.touch)
then "always"
else "both";
hide-activities-button =
if (cfg.tiling || cfg.touch)
then "never"
else "always";
show-window-buttons =
if cfg.tiling
then "never"
else "both";
notifications-position = "center";
restrict-to-primary-screen = false;
show-legacy-tray = false;
@ -315,7 +341,10 @@ in
snap-color = "rgba(0,0,0,0)";
};
"org/gnome/desktop/wm/preferences" = {
focus-mode = if cfg.tiling then "sloppy" else "click";
focus-mode =
if cfg.tiling
then "sloppy"
else "click";
resize-with-right-button = true;
num-workspaces = 9;
};
@ -327,8 +356,7 @@ in
enabled = true;
};
"org/gnome/desktop/wm/keybindings" =
let
"org/gnome/desktop/wm/keybindings" = let
workspaceAttrsList = lib.flatten (map
(n: [
(lib.nameValuePair "move-to-workspace-${n}" ["<Shift><Super>${n}"])
@ -336,7 +364,8 @@ in
])
(map (n: toString n) (lib.range 1 9)));
in
lib.listToAttrs workspaceAttrsList // {
lib.listToAttrs workspaceAttrsList
// {
minimize = ["<Super>comma"];
maximize = [""];
unmaximize = [""];
@ -380,7 +409,9 @@ in
"org/gnome/mutter/wayland/keybindings" = {
restore-shortcuts = [""];
};
"org/gnome/shell/keybindings" = lib.listToAttrs (map (n: lib.nameValuePair "switch-to-application-${toString n}" [ "" ]) (lib.range 1 9)) // {
"org/gnome/shell/keybindings" =
lib.listToAttrs (map (n: lib.nameValuePair "switch-to-application-${toString n}" [""]) (lib.range 1 9))
// {
open-application-menu = [""];
toggle-message-tray = ["<Super>v"];
toggle-overview = [""];

View File

@ -1,11 +1,12 @@
inputs:
{ config, lib, pkgs, ... }:
with lib;
let
inputs: {
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.de3u;
in
{
in {
imports = [
inputs.plasma-manager.homeManagerModules.plasma-manager
];
@ -106,15 +107,14 @@ in
};
General = {
BrowserApplication =
if config.programs.firefox.enable then
if config.programs.firefox.enable
then
(
if config.programs.firefox.package.pname == "firefox" then
"firefox.desktop"
else
"librewolf.desktop"
if config.programs.firefox.package.pname == "firefox"
then "firefox.desktop"
else "librewolf.desktop"
)
else
"chromium-browser.desktop";
else "chromium-browser.desktop";
TerminalApplication = "kermit";
TerminalService = "kermit.desktop";
};
@ -332,15 +332,14 @@ in
xdg.configFile."mimeapps.list".force = true;
xdg.mimeApps = let
browser =
if config.programs.firefox.enable then
if config.programs.firefox.enable
then
(
if config.programs.firefox.package.pname == "firefox" then
"firefox.desktop"
else
"librewolf.desktop"
if config.programs.firefox.package.pname == "firefox"
then "firefox.desktop"
else "librewolf.desktop"
)
else
"chromium-browser.desktop";
else "chromium-browser.desktop";
apps = {
"text/plain" = "org.kde.kate.desktop";

View File

@ -1,7 +1,9 @@
inputs:
{ config, lib, pkgs, ... }:
{
inputs: {
config,
lib,
pkgs,
...
}: {
imports = [
(lib.mkAliasOptionModule ["ezpcusr" "gaming"] ["gaming" "enable"])
(lib.mkAliasOptionModule ["ezpcusr" "newWine"] ["gaming" "newWine"])

View File

@ -1,7 +1,10 @@
inputs:
{ config, lib, pkgs, ... }:
with lib;
let
inputs: {
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.ezpcusr;
lockCommand = "${pkgs.swaylock-effects}/bin/swaylock --clock --indicator --screenshots --effect-scale 0.8 --effect-blur 8x3 --effect-vignette 0.2:0.5 --fade-in 0.5 --text-color ${config.ezcolors.base16.base08} --inside-color ${config.ezcolors.base16.base00} --ring-color ${config.ezcolors.base16.base01} --datestr \"%Y-%m-%e\" --timestr \"%I:%M %p\"";
@ -30,7 +33,8 @@ let
'';
scrsaveup =
if cfg.uploadScript != null then
if cfg.uploadScript != null
then
pkgs.writeScript "scr-save-up.sh" ''
#!${pkgs.zsh}/bin/zsh
LOC=$(${getscrloc})
@ -38,8 +42,7 @@ let
${cfg.uploadScript} $LOC | xargs echo -n | ${pkgs.wl-clipboard}/bin/wl-copy
notify-send "Screenshot Uploaded!"
''
else
null;
else null;
scrvidsaveclip = pkgs.writeScript "scr-vid-save-clip.sh" ''
#!${pkgs.zsh}/bin/zsh
@ -49,7 +52,8 @@ let
'';
scrvidsaveup =
if cfg.uploadScript != null then
if cfg.uploadScript != null
then
pkgs.writeScript "scr-vid-save-up.sh" ''
#!${pkgs.zsh}/bin/zsh
LOC=$(${getscrloc} mp4)
@ -57,15 +61,15 @@ let
${cfg.uploadScript} $LOC | ${pkgs.findutils}/bin/xargs echo -n | ${pkgs.wl-clipboard}/bin/wl-copy
notify-send "Screen Recording Uploaded!"
''
else
null;
else null;
scrvidstop = pkgs.writeScript "scr-vid-stop.sh" ''
#!${pkgs.zsh}/bin/zsh
${pkgs.procps}/bin/pkill -2 wf-recorder
'';
ezDrv = pkgs.runCommand "ez-commands" { } (''
ezDrv = pkgs.runCommand "ez-commands" {} (
''
mkdir -p $out/bin
ln -s ${selshot} $out/bin/selshot
ln -s ${selvid} $out/bin/selvid
@ -73,25 +77,26 @@ let
ln -s ${scrsaveclip} $out/bin/scrsaveclip
ln -s ${scrvidsaveclip} $out/bin/scrvidsaveclip
ln -s ${scrvidstop} $out/bin/scrvidstop
'' + (
if cfg.uploadScript != null then ''
''
+ (
if cfg.uploadScript != null
then ''
ln -s ${cfg.uploadScript} $out/bin/upload_file
ln -s ${scrsaveup} $out/bin/scrsaveup
ln -s ${scrvidsaveup} $out/bin/scrvidsaveup
'' else ""
''
else ""
)
);
in
{
in {
options.ezpcusr = {
enable = mkEnableOption "Enable simple PC user config";
uploadScript = mkOption {
type = types.nullOr types.package;
default = null;
description =
"A path to a script that takes a path to a file and returns a URL";
description = "A path to a script that takes a path to a file and returns a URL";
};
screenshotsPath = mkOption {
@ -194,8 +199,7 @@ in
modifier = lib.mkDefault "Mod4";
keybindings =
let
keybindings = let
# ugly stupid way of doing things but im lazy
bwRofi = pkgs.writeScript "bw-rofi" ''
#!${pkgs.bash}/bin/bash
@ -232,26 +236,39 @@ in
modifier = config.wayland.windowManager.sway.config.modifier;
alphabet = ["Ctrl" "Alt" "Ctrl+Alt"];
genKeyAttrs = move: lib.listToAttrs (
genKeyAttrs = move:
lib.listToAttrs (
map
(
n: {
name = "${modifier}${if move then "+Shift" else ""}+${builtins.elemAt alphabet ((n - 11) / 10)}+${toString (lib.mod n 10)}";
value = "${if move then "move container to " else ""}workspace ${toString n}";
name = "${modifier}${
if move
then "+Shift"
else ""
}+${builtins.elemAt alphabet ((n - 11) / 10)}+${toString (lib.mod n 10)}";
value = "${
if move
then "move container to "
else ""
}workspace ${toString n}";
}
)
(lib.lists.range 11 (10 * (builtins.length alphabet) + 10))
);
in
lib.mkOptionDefault (
genKeyAttrs true // genKeyAttrs false // (
genKeyAttrs true
// genKeyAttrs false
// (
let
volumeUp = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%";
volumeDown = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%";
in
{
in {
"Print" = "exec ${scrsaveclip}";
"Shift+Print" = if cfg.uploadScript != null then "exec ${scrsaveup}" else "nop";
"Shift+Print" =
if cfg.uploadScript != null
then "exec ${scrsaveup}"
else "nop";
"Ctrl+Print" = "exec ${scrvidsaveclip}";
"Ctrl+Alt+Print" = "exec ${scrvidstop}";
@ -261,10 +278,8 @@ in
"XF86AudioRaiseVolume" = volumeUp;
"XF86AudioLowerVolume" = volumeDown;
"XF86AudioMute" =
"exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
"XF86AudioMicMute" =
"exec ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle";
"XF86AudioMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
"XF86AudioMicMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle";
"XF86MonBrightnessDown" = "exec ${pkgs.light}/bin/light -U 10";
"XF86MonBrightnessUp" = "exec ${pkgs.light}/bin/light -A 10";
@ -272,12 +287,9 @@ in
"${modifier}+apostrophe" = "exec ${pkgs.light}/bin/light -A 10";
# Previous/next but change the shuffle/random state before action (and change back afterwards)
"${modifier}+Shift+bracketright" =
"exec ${pkgs.playerctl}/bin/playerctl shuffle Toggle && ${pkgs.playerctl}/bin/playerctl next && ${pkgs.playerctl}/bin/playerctl shuffle Toggle";
"${modifier}+Shift+bracketleft" =
"exec ${pkgs.playerctl}/bin/playerctl shuffle Toggle && ${pkgs.playerctl}/bin/playerctl previous && ${pkgs.playerctl}/bin/playerctl shuffle Toggle";
"Shift+XF86AudioNext" =
"exec ${pkgs.playerctl}/bin/playerctl shuffle Toggle && ${pkgs.playerctl}/bin/playerctl next && ${pkgs.playerctl}/bin/playerctl shuffle Toggle";
"${modifier}+Shift+bracketright" = "exec ${pkgs.playerctl}/bin/playerctl shuffle Toggle && ${pkgs.playerctl}/bin/playerctl next && ${pkgs.playerctl}/bin/playerctl shuffle Toggle";
"${modifier}+Shift+bracketleft" = "exec ${pkgs.playerctl}/bin/playerctl shuffle Toggle && ${pkgs.playerctl}/bin/playerctl previous && ${pkgs.playerctl}/bin/playerctl shuffle Toggle";
"Shift+XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl shuffle Toggle && ${pkgs.playerctl}/bin/playerctl next && ${pkgs.playerctl}/bin/playerctl shuffle Toggle";
# Previous/next
"${modifier}+bracketright" = "exec ${pkgs.playerctl}/bin/playerctl next";
@ -296,18 +308,15 @@ in
"XF86AudioPause" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
"${modifier}+backslash" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
"${modifier}+Ctrl+Shift+m" =
let
"${modifier}+Ctrl+Shift+m" = let
ripMusicAdvanced = pkgs.writeShellScript "rip-music-advanced.sh" ''
CURRENT=$(${pkgs.mpc_cli}/bin/mpc -f '%file%' current)
URLIFIED=$(${pkgs.gnused}/bin/sed 's/youtube:video:/https:\/\/youtube.com\/watch?v=/'<<<$CURRENT)
PARAMS=$(${pkgs.rofi}/bin/rofi -dmenu)
echo y | ${inputs.mudl.defaultPackage.${pkgs.system}}/bin/mudl "$URLIFIED" "$PARAMS"
'';
in
"exec ${ripMusicAdvanced}";
"${modifier}+Ctrl+m" =
let
in "exec ${ripMusicAdvanced}";
"${modifier}+Ctrl+m" = let
ripMusic = pkgs.writeShellScript "rip-music.sh" ''
CURRENT=$(${pkgs.mpc_cli}/bin/mpc -f '%file%' current)
URLIFIED=$(${pkgs.gnused}/bin/sed 's/youtube:video:/https:\/\/youtube.com\/watch?v=/'<<<$CURRENT)
@ -320,21 +329,17 @@ in
echo y | ${inputs.mudl.defaultPackage.${pkgs.system}}/bin/mudl "$URLIFIED" "$ALBUM"
fi
'';
in
"exec ${ripMusic}";
in "exec ${ripMusic}";
"${modifier}+m" =
let
"${modifier}+m" = let
musicRofi = pkgs.writeShellScript "music-rofi" ''
SONGN=$(${pkgs.mpc_cli}/bin/mpc -f "%position% - %artist% - %album% - %title%" playlist | ${pkgs.rofi}/bin/rofi -dmenu -i | ${pkgs.coreutils}/bin/cut -d " " -f 1)
[ ! -z "$SONGN" ] && ${pkgs.mpc_cli}/bin/mpc play "$SONGN"
'';
in
"exec ${musicRofi}";
in "exec ${musicRofi}";
"${modifier}+k" = "exec ${pkgs.mpc_cli}/bin/mpc clear";
"${config.wayland.windowManager.sway.config.modifier}+Shift+k" = lib.mkForce "exec ${pkgs.mpc_cli}/bin/mpc ls \"Local media/Tracks\" | ${pkgs.mpc_cli}/bin/mpc add";
"${config.wayland.windowManager.sway.config.modifier}+Shift+m" =
let
"${config.wayland.windowManager.sway.config.modifier}+Shift+m" = let
mopidySearch = pkgs.writeShellScript "mopidy-search.sh" ''
QUERY=$(${pkgs.rofi}/bin/rofi -dmenu)
[ -z "$QUERY" ] && exit
@ -354,8 +359,7 @@ in
PLAYLIST_ENTRY_POSITION=$(echo "$PLAYLIST_ENTRY" | ${pkgs.gawk}/bin/awk -F' / ' '{print $1}')
${pkgs.mpc_cli}/bin/mpc play "$PLAYLIST_ENTRY_POSITION"
'';
in
"exec ${mopidySearch}";
in "exec ${mopidySearch}";
"${modifier}+p" = "exec ${bwRofi}";
"${modifier}+t" = "exec ${bwRofiOtp}";
@ -497,8 +501,8 @@ in
spacing = 5;
};
};
} // cfg.waybarConfig)
}
// cfg.waybarConfig)
];
style = ''
@ -663,14 +667,12 @@ in
};
};
xdg.configFile."neofetch/config.conf".text =
let
xdg.configFile."neofetch/config.conf".text = let
image = builtins.path {
name = "nixos_circlejerk.png";
path = ../data/nixos_circlejerk.png;
};
in
''
in ''
image_source="${image}"
image_backend="kitty"
'';

View File

@ -1,10 +1,12 @@
inputs:
{ config, lib, pkgs, ... }:
with lib;
let
inputs: {
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.gaming;
in
{
in {
options.gaming = {
enable = mkEnableOption "Enable gaming stuff";
@ -33,9 +35,11 @@ in
STAGING_RT_PRIORITY_SERVER = 90;
};
home.packages =
let
newwine = (pkgs.winePackages.full.override { wineBuild = "wineWow"; wineRelease = "staging"; });
home.packages = let
newwine = pkgs.winePackages.full.override {
wineBuild = "wineWow";
wineRelease = "staging";
};
newwinetricks = pkgs.winetricks.overrideAttrs (old: rec {
pathAdd = "${newwine}/bin:" + old.pathAdd;
postInstall = ''
@ -55,7 +59,8 @@ in
'';
});
in
with pkgs; [
with pkgs;
[
oldwine
oldwinetricks
@ -63,7 +68,8 @@ in
tuxpaint
extremetuxracer
] ++ lib.optionals cfg.newWine [
]
++ lib.optionals cfg.newWine [
(
pkgs.runCommand "new-wine-stuff"
{} ''
@ -73,7 +79,8 @@ in
ln -s ${newwinetricks}/bin/winetricks $out/bin/new-winetricks
''
)
] ++ lib.optional cfg.steamService (pkgs.writeShellScriptBin "steam" "${pkgs.systemd}/bin/systemctl --user start steam");
]
++ lib.optional cfg.steamService (pkgs.writeShellScriptBin "steam" "${pkgs.systemd}/bin/systemctl --user start steam");
systemd.user.services.scc = mkIf cfg.scService {
Unit = {
@ -101,8 +108,7 @@ in
Service = {
Type = "simple";
ExecStart =
let
ExecStart = let
steamStart = pkgs.writeShellScript "steam-start" ''
${pkgs.systemd}/bin/systemctl --user stop scc
# no sleep is needed here because steam is slow as fuck lol
@ -110,8 +116,7 @@ in
'';
in
lib.mkIf cfg.scService "${steamStart}";
ExecStop =
let
ExecStop = let
steamStop = pkgs.writeShellScript "steam-stop" ''
${pkgs.coreutils}/bin/sleep 5 # give time for controller to reset
${pkgs.systemd}/bin/systemctl --user start scc

View File

@ -1,9 +1,11 @@
{ config, lib, pkgs, ... }:
let
cfg = config.programs.kermit;
in
{
config,
lib,
pkgs,
...
}: let
cfg = config.programs.kermit;
in {
options.programs.kermit = {
enable = lib.mkEnableOption "A VTE-based, simple and froggy terminal emulator 🐸";
@ -25,16 +27,20 @@ in
};
config = lib.mkIf cfg.enable {
xdg.configFile."kermit.conf".text = (lib.generators.toKeyValue
xdg.configFile."kermit.conf".text =
(lib.generators.toKeyValue
{
mkKeyValue = lib.generators.mkKeyValueDefault {} " ";
}
cfg.settings) + cfg.extraConfig;
cfg.settings)
+ cfg.extraConfig;
home.packages = [ (pkgs.kermit-terminal.overrideAttrs (super: {
home.packages = [
(pkgs.kermit-terminal.overrideAttrs (super: {
postInstall = ''
sed -i 's/\/usr\/bin\///' $out/share/applications/kermit.desktop
'';
})) ];
}))
];
};
}

View File

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }: {
{
config,
pkgs,
lib,
...
}: {
programs.home-manager.enable = true;
home.packages = with pkgs; [zsh-powerlevel9k];

View File

@ -1,6 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}: {
programs.home-manager.enable = true;
home.packages = with pkgs; [zsh-powerlevel9k];

View File

@ -1,11 +1,12 @@
inputs:
{ config, pkgs, lib, ... }:
let
inputs: {
config,
pkgs,
lib,
...
}: let
# TODO: find a better source
mimeTypes = pkgs.fetchurl {
url =
"https://raw.githubusercontent.com/eprints/eprints3.4/master/lib/mime.types";
url = "https://raw.githubusercontent.com/eprints/eprints3.4/master/lib/mime.types";
sha256 = "0cdhq71wk5h3zcfrz8dyqc3vrjyikwjqsla855v036r54lch0kn2";
};
@ -13,8 +14,7 @@ let
#!${pkgs.zsh}/bin/zsh
git commit -am "$*"
'';
in
{
in {
programs.home-manager.enable = true;
home.packages = with pkgs; [
@ -79,7 +79,8 @@ in
"rust-analyzer.diagnostics.disabled" = ["unresolved-proc-macro"];
};
extensions = with pkgs.vscode-extensions; [
extensions = with pkgs.vscode-extensions;
[
vscodevim.vim
jnoortheen.nix-ide
haskell.haskell
@ -94,7 +95,8 @@ in
exec rust-analyzer "$@"
'';
})
] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
]
++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
{
name = "vscode-autohide";
publisher = "sirmspencer";
@ -181,7 +183,8 @@ in
version = builtins.readFile (pkgs.runCommand "firenvim-version" {} ''
${pkgs.jq}/bin/jq -j .version < ${inputs.firenvim}/package.json > $out
'');
})
}
)
vim-gitgutter
];
extraConfig = ''

View File

@ -1,6 +1,11 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.de2;
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.de2;
in {
options.de2.enable = mkEnableOption "Enable de2 system stuff";
@ -26,13 +31,17 @@ in {
services.power-profiles-daemon.enable = lib.mkDefault false;
# for KDE connect
networking.firewall.allowedTCPPortRanges = [{
networking.firewall.allowedTCPPortRanges = [
{
from = 1714;
to = 1764;
}];
networking.firewall.allowedUDPPortRanges = [{
}
];
networking.firewall.allowedUDPPortRanges = [
{
from = 1714;
to = 1764;
}];
}
];
};
}

View File

@ -1,6 +1,11 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.de3;
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.de3;
in {
options.de3.enable = mkEnableOption "Enable de3 system stuff";
@ -27,13 +32,17 @@ in {
services.power-profiles-daemon.enable = lib.mkDefault false;
# for KDE connect
networking.firewall.allowedTCPPortRanges = [{
networking.firewall.allowedTCPPortRanges = [
{
from = 1714;
to = 1764;
}];
networking.firewall.allowedUDPPortRanges = [{
}
];
networking.firewall.allowedUDPPortRanges = [
{
from = 1714;
to = 1764;
}];
}
];
};
}

View File

@ -1,6 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}: {
imports = [
./ezwg.nix
./kiosk.nix

View File

@ -1,9 +1,15 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.services.ezpassthru;
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.services.ezpassthru;
in {
options.services.ezpassthru = {
enable = mkEnableOption
enable =
mkEnableOption
"Enable simple VM PCI passthrough config (NOTE: this is only for ppl with a primary AMD/Intel, and a non-primary NVidia)";
PCIs = mkOption {

View File

@ -1,6 +1,11 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.services.ezpw;
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.services.ezpw;
in {
options.services.ezpw = {
enable = mkEnableOption "Enable pipewire";
@ -13,8 +18,7 @@ in {
usbSoundcard = mkOption {
type = types.bool;
description =
"Doubles the audio rate for alsa outputs in low latency mode";
description = "Doubles the audio rate for alsa outputs in low latency mode";
default = false;
};
@ -38,9 +42,10 @@ in {
};
};
config =
let qr = "${toString cfg.quantum}/${toString cfg.rate}";
in mkIf cfg.enable {
config = let
qr = "${toString cfg.quantum}/${toString cfg.rate}";
in
mkIf cfg.enable {
hardware.pulseaudio.enable = lib.mkDefault false;
sound.enable = lib.mkDefault false;
@ -129,16 +134,24 @@ in {
};
media-session.config.alsa-monitor = mkIf cfg.lowLatency {
rules = [{
rules = [
{
matches = [{node.name = "alsa_output.*";}];
actions = {
update-props = {
"audio.format" = "S32LE";
"audio.rate" = cfg.rate * (if cfg.usbSoundcard then 2 else 1);
"audio.rate" =
cfg.rate
* (
if cfg.usbSoundcard
then 2
else 1
);
"api.alsa.period-size" = cfg.periodSize;
};
};
}];
}
];
};
media-session.config.bluez-monitor = {
@ -151,8 +164,7 @@ in {
actions = {
update-props = {
"bluez5.auto-connect" = ["hsp_hs" "hfp_hf" "a2dp_sink"];
"bluez5.hw-volume" =
[ "hsp_ag" "hfp_ag" "a2dp_source" "a2dp_sink" ];
"bluez5.hw-volume" = ["hsp_ag" "hfp_ag" "a2dp_source" "a2dp_sink"];
"bluez5.autoswitch-profile" = true;
};
};
@ -169,18 +181,21 @@ in {
};
};
environment.systemPackages = with pkgs;
[
environment.systemPackages = with pkgs; [
# pactl is required for pipewire-pulse
pulseaudio
];
environment.etc."wireplumber/main.lua.d/51-alsa-config.lua" =
mkIf cfg.lowLatency {
environment.etc."wireplumber/main.lua.d/51-alsa-config.lua" = mkIf cfg.lowLatency {
text = ''
alsa_monitor.properties = {
["audio.rate"] = ${
toString (cfg.rate * (if cfg.usbSoundcard then 2 else 1))
toString (cfg.rate
* (
if cfg.usbSoundcard
then 2
else 1
))
},
["audio.format"] = "S32LE",
["api.alsa.headroom"] = 512,

View File

@ -1,6 +1,10 @@
{ config, lib, pkgs, ... }:
with lib;
let
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.services.ezwg;
peerNameReplacement = lib.replaceChars ["/" "-" " " "+" "="] [
@ -11,10 +15,8 @@ let
"\\x3d"
];
ranges = serverIPs:
let
generateRangesScript =
builtins.toFile "exclusionary-wildcard-ranges-generator.py" ''
ranges = serverIPs: let
generateRangesScript = builtins.toFile "exclusionary-wildcard-ranges-generator.py" ''
import ipaddress
serverNetworks = [${map (ip: "ip_network('${ip}/32')") serverIPs}]
ranges = [ipaddress.ip_network('0.0.0.0/0')]
@ -28,10 +30,8 @@ let
in
lib.splitString ":" (builtins.readFile "${rangesOutput}");
subnet = vlanIP: vlanSize:
let
generateSubnetScript =
builtins.toFile "subnet-without-host-bits-generator.py" ''
subnet = vlanIP: vlanSize: let
generateSubnetScript = builtins.toFile "subnet-without-host-bits-generator.py" ''
import ipaddress
n1 = ipaddress.ip_network('${vlanIP}/${toString vlanSize}', False)
print(n1, end="")
@ -88,8 +88,7 @@ let
description = "The IP to use on the wg VLAN";
};
};
in
{
in {
options.services.ezwg = {
enable = mkEnableOption "Enable simple Wireguard connection";
instances = mkOption {
@ -102,40 +101,51 @@ in
config = mkIf cfg.enable {
networking.firewall.checkReversePath = false;
systemd.paths = mapAttrs'
systemd.paths =
mapAttrs'
(instName: inst: {
name = "wireguard-${instName}";
value = if inst.autoStart then { } else { wantedBy = mkForce [ ]; };
value =
if inst.autoStart
then {}
else {wantedBy = mkForce [];};
})
cfg.instances;
systemd.services = lib.listToAttrs (flatten (mapAttrsToList
(instName: inst:
[{
[
{
name = "wireguard-${instName}";
value = if inst.autoStart then { } else { wantedBy = mkForce [ ]; };
}] ++ map
value =
if inst.autoStart
then {}
else {wantedBy = mkForce [];};
}
]
++ map
(server: {
name =
"wireguard-${instName}-peer${peerNameReplacement server.publicKey}";
value = if inst.autoStart then { } else { wantedBy = mkForce [ ]; };
name = "wireguard-${instName}-peer${peerNameReplacement server.publicKey}";
value =
if inst.autoStart
then {}
else {wantedBy = mkForce [];};
})
inst.servers)
cfg.instances));
networking.wireguard.interfaces = mapAttrs
(instName: inst:
let
networking.wireguard.interfaces =
mapAttrs
(instName: inst: let
allowedIPs =
if inst.proxy then
ranges (map (s: s.ip) inst.servers)
else
[ (subnet inst.vlanIP inst.vlanSize) ];
in
{
if inst.proxy
then ranges (map (s: s.ip) inst.servers)
else [(subnet inst.vlanIP inst.vlanSize)];
in {
ips = ["${inst.vlanIP}/${toString inst.vlanSize}"];
privateKeyFile = inst.privateKeyFile;
peers = map
peers =
map
(server: {
inherit allowedIPs;
publicKey = server.publicKey;
@ -145,6 +155,5 @@ in
inst.servers;
})
cfg.instances;
};
}

View File

@ -1,17 +1,23 @@
{ config, lib, pkgs, ... }:
with lib;
let
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.fuckingprint;
fixPlatforms = p:
p.overrideAttrs (super:
super // {
meta = super.meta // {
super
// {
meta =
super.meta
// {
platforms = super.meta.platforms ++ ["x86_64-linux"];
};
});
in
{
in {
options.fuckingprint.enable = mkEnableOption "Make my fucking printer work";
config = mkIf cfg.enable {

View File

@ -1,6 +1,11 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.services.kiosk;
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.services.kiosk;
in {
options.services.kiosk = {
enable = mkEnableOption "Enable simple kiosk display";
@ -60,10 +65,14 @@ in {
};
};
displayManager.xserverArgs = if cfg.cursor then [ ] else [ "-nocursor" ];
displayManager.xserverArgs =
if cfg.cursor
then []
else ["-nocursor"];
displayManager.defaultSession = "kiosk+ratpoison";
desktopManager.session = [{
desktopManager.session = [
{
name = "kiosk";
start = ''
# dont blank the screen after 5min
@ -74,7 +83,8 @@ in {
${cfg.session}
'';
}];
}
];
};
};
}

View File

@ -1,6 +1,11 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.workstation;
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.workstation;
in {
options.workstation = {
enable = mkEnableOption "make my computer work";
@ -175,14 +180,18 @@ in {
"lp"
];
subUidRanges = [{
subUidRanges = [
{
startUid = 100000;
count = 65536;
}];
subGidRanges = [{
}
];
subGidRanges = [
{
startGid = 100000;
count = 65536;
}];
}
];
};
# brightness

View File

@ -1,6 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}: {
users.users.chekkie = {
isNormalUser = true;
useDefaultShell = true;

View File

@ -1,6 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}: {
# config for me
users.users.glooder = {
isNormalUser = true;

View File

@ -1,6 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}: {
nix.trustedUsers = ["notgne2"];
users.users.notgne2 = {