mass reformat
This commit is contained in:
parent
ed1c53e94c
commit
9cb456ad60
14
common.nix
14
common.nix
@ -1,7 +1,11 @@
|
||||
{ config, pkgs, lib, options, ... }:
|
||||
|
||||
{
|
||||
imports = [ ./modules ];
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
options,
|
||||
...
|
||||
}: {
|
||||
imports = [./modules];
|
||||
|
||||
config = {
|
||||
services.haveged.enable = lib.mkDefault true;
|
||||
@ -34,7 +38,7 @@
|
||||
daemonIOSchedPriority = lib.mkDefault 7;
|
||||
daemonIOSchedClass = lib.mkDefault "idle";
|
||||
daemonCPUSchedPolicy = lib.mkDefault "idle";
|
||||
trustedUsers = [ "root" "builder" "@wheel" ];
|
||||
trustedUsers = ["root" "builder" "@wheel"];
|
||||
|
||||
extraOptions = ''
|
||||
builders-use-substitutes = true
|
||||
@ -100,7 +104,7 @@
|
||||
# Use a firewall
|
||||
networking.firewall.enable = lib.mkDefault true;
|
||||
networking.firewall.allowPing = true;
|
||||
networking.firewall.allowedTCPPorts = lib.mkDefault [ 22 ];
|
||||
networking.firewall.allowedTCPPorts = lib.mkDefault [22];
|
||||
|
||||
programs.fish.enable = lib.mkDefault true;
|
||||
users.defaultUserShell = lib.mkOverride 900 pkgs.fish;
|
||||
|
@ -59,7 +59,11 @@
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }@inputs: {
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
...
|
||||
} @ inputs: {
|
||||
nixosModules = {
|
||||
ezpassthru = import ./modules/ezpassthru.nix;
|
||||
ezwg = import ./modules/ezwg.nix;
|
||||
|
@ -1,8 +1,10 @@
|
||||
inputs:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [ (import ./modules inputs) ];
|
||||
inputs: {
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
imports = [(import ./modules inputs)];
|
||||
|
||||
programs.direnv = {
|
||||
enable = lib.mkDefault true;
|
||||
@ -52,7 +54,7 @@ inputs:
|
||||
notify-desktop
|
||||
];
|
||||
|
||||
home.sessionVariables = { TERM = "xterm-256color"; };
|
||||
home.sessionVariables = {TERM = "xterm-256color";};
|
||||
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
|
@ -1,62 +1,81 @@
|
||||
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;
|
||||
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;
|
||||
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
|
||||
s' = builtins.match "(..)(..)(..)|(.)(.)(.)" c;
|
||||
ss = builtins.elemAt s';
|
||||
o = if ss 0 == null then 3 else 0;
|
||||
in
|
||||
{
|
||||
r = ss (0 + o);
|
||||
g = ss (1 + o);
|
||||
b = ss (2 + o);
|
||||
};
|
||||
splitHex = c: let
|
||||
s' = builtins.match "(..)(..)(..)|(.)(.)(.)" c;
|
||||
ss = builtins.elemAt s';
|
||||
o =
|
||||
if ss 0 == null
|
||||
then 3
|
||||
else 0;
|
||||
in {
|
||||
r = ss (0 + o);
|
||||
g = ss (1 + o);
|
||||
b = ss (2 + o);
|
||||
};
|
||||
|
||||
hexToRgb = c: builtins.mapAttrs (_: calc) (splitHex c);
|
||||
|
||||
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 (
|
||||
{
|
||||
# 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";
|
||||
}
|
||||
);
|
||||
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-name = "base16 generated";
|
||||
scheme-slug = "idk";
|
||||
scheme-author = "nixos";
|
||||
});
|
||||
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,259 +143,262 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
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
|
||||
'';
|
||||
themeHash = builtins.readFile themeHashOut;
|
||||
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
|
||||
'';
|
||||
themeHash = builtins.readFile themeHashOut;
|
||||
|
||||
i3config = {
|
||||
config = {
|
||||
colors = {
|
||||
background = "#${cfg.base16.base07}";
|
||||
focused = {
|
||||
border = "#${cfg.base16.base05}";
|
||||
background = "#${cfg.base16.base0D}";
|
||||
text = "#${cfg.base16.base00}";
|
||||
indicator = "#${cfg.base16.base0D}";
|
||||
childBorder = "#${cfg.base16.base0D}";
|
||||
};
|
||||
focusedInactive = {
|
||||
border = "#${cfg.base16.base01}";
|
||||
background = "#${cfg.base16.base01}";
|
||||
text = "#${cfg.base16.base05}";
|
||||
indicator = "#${cfg.base16.base03}";
|
||||
childBorder = "#${cfg.base16.base01}";
|
||||
};
|
||||
unfocused = {
|
||||
border = "#${cfg.base16.base01}";
|
||||
background = "#${cfg.base16.base00}";
|
||||
text = "#${cfg.base16.base05}";
|
||||
indicator = "#${cfg.base16.base01}";
|
||||
childBorder = "#${cfg.base16.base01}";
|
||||
};
|
||||
urgent = {
|
||||
border = "#${cfg.base16.base08}";
|
||||
background = "#${cfg.base16.base08}";
|
||||
text = "#${cfg.base16.base00}";
|
||||
indicator = "#${cfg.base16.base08}";
|
||||
childBorder = "#${cfg.base16.base08}";
|
||||
};
|
||||
placeholder = {
|
||||
border = "#${cfg.base16.base00}";
|
||||
background = "#${cfg.base16.base00}";
|
||||
text = "#${cfg.base16.base05}";
|
||||
indicator = "#${cfg.base16.base00}";
|
||||
childBorder = "#${cfg.base16.base00}";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
elementTheme = {
|
||||
name = "colors-${themeHash}";
|
||||
is_dark = true;
|
||||
i3config = {
|
||||
config = {
|
||||
colors = {
|
||||
# "accent-color" = "#${cfg.base16.base02}";
|
||||
# "primary-color" = "#${cfg.base16.base08}";
|
||||
# "warning-color" = "#${cfg.base16.base0F}";
|
||||
|
||||
# "sidebar-color" = "#${cfg.base16.base01}";
|
||||
# "roomlist-background-color" = "#${cfg.base16.base00}";
|
||||
# "roomlist-text-color" = "#${cfg.base16.base05}";
|
||||
# "roomlist-text-secondary-color" = "${cfg.base16.base06}";
|
||||
# "roomlist-highlights-color" = "#${cfg.base16.base02}";
|
||||
# "roomlist-separator-color" = "#${cfg.base16.base05}";
|
||||
|
||||
# "timeline-background-color" = "#${cfg.base16.base00}";
|
||||
# "timeline-text-color" = "#${cfg.base16.base07}";
|
||||
# "timeline-text-secondary-color" = "#${cfg.base16.base05}";
|
||||
# "timeline-highlights-color" = "#${cfg.base16.base02}";
|
||||
# "reaction-row-button-selected-bg-color" = "#${cfg.base16.base0B}";
|
||||
|
||||
"accent-color" = "#${cfg.base16.base02}";
|
||||
"accent" = "#${cfg.base16.base02}";
|
||||
"primary-color" = "#${cfg.base16.base0B}";
|
||||
"warning-color" = "#${cfg.base16.base08}";
|
||||
"alert" = "#${cfg.base16.base08}";
|
||||
|
||||
"sidebar-color" = "#${cfg.base16.base00}";
|
||||
"roomlist-background-color" = "#${cfg.base16.base01}";
|
||||
"roomlist-text-color" = "#${cfg.base16.base05}";
|
||||
"roomlist-text-secondary-color" = "${cfg.base16.base09}";
|
||||
"roomlist-highlights-color" = "#${cfg.base16.base08}";
|
||||
"roomlist-separator-color" = "#${cfg.base16.base05}";
|
||||
|
||||
"timeline-background-color" = "#${cfg.base16.base00}";
|
||||
"timeline-text-color" = "#${cfg.base16.base05}";
|
||||
"secondary-content" = "#${cfg.base16.base05}";
|
||||
"tertiary-content" = "#${cfg.base16.base05}";
|
||||
"timeline-text-secondary-color" = "#${cfg.base16.base06}";
|
||||
"timeline-highlights-color" = "#${cfg.base16.base03}";
|
||||
|
||||
"reaction-row-button-selected-bg-color" = "#${cfg.base16.base04}";
|
||||
"menu-selected-color" = "#${cfg.base16.base04}";
|
||||
"focus-bg-color" = "#${cfg.base16.base04}";
|
||||
"room-highlight-color" = "#${cfg.base16.base04}";
|
||||
"other-user-pill-bg-color" = "#${cfg.base16.base04}";
|
||||
"togglesw-off-color" = "#${cfg.base16.base04}";
|
||||
|
||||
"username-colors" = [ "#${cfg.base16.base08}" "#${cfg.base16.base09}" "#${cfg.base16.base0A}" "#${cfg.base16.base0B}" "#${cfg.base16.base0C}" "#${cfg.base16.base0D}" "#${cfg.base16.base0E}" "#${cfg.base16.base0F}" ];
|
||||
# "avatar-background-colors" = [ "#${cfg.base16.base03}" "#${cfg.base16.base04}" "#${cfg.base16.base05}" ];
|
||||
};
|
||||
};
|
||||
|
||||
elementConfig = {
|
||||
settingDefaults.custom_themes = [ elementTheme ];
|
||||
|
||||
settingDefaults.theme = "${elementTheme.name}";
|
||||
default_theme = "${elementTheme.name}";
|
||||
|
||||
showLabsSettings = true;
|
||||
show_labs_settings = true;
|
||||
};
|
||||
|
||||
base16FromImageSrc = pkgs.runCommand "auto-image-base16" { } ''
|
||||
${schemer2}/bin/schemer2 -format img::colors -in ${cfg.baseColors} -out colors.txt && ${pkgs.python3}/bin/python3 ${inputs.auto-base16-theme}/AutoBase16Theme.py ${inputs.auto-base16-theme}/templates/base16-template.yaml auto-image-base16.yaml
|
||||
${pkgs.yaml2json}/bin/yaml2json < auto-image-base16.yaml > $out
|
||||
'';
|
||||
|
||||
base16FromImage = lib.filterAttrs (k: v: k != "scheme" && k != "author") (builtins.fromJSON (builtins.readFile base16FromImageSrc));
|
||||
in
|
||||
mkMerge [(mkIf cfg.enable {
|
||||
# Read only utility attributes
|
||||
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;
|
||||
|
||||
# Element
|
||||
xdg.configFile."Riot/config.json".text = builtins.toJSON elementConfig;
|
||||
xdg.configFile."Element/config.json".text = builtins.toJSON elementConfig;
|
||||
# And in case you want to do something with the generated theme yourself
|
||||
xdg.configFile."Riot/theme.json".text = builtins.toJSON elementTheme;
|
||||
xdg.configFile."Element/theme.json".text = builtins.toJSON elementTheme;
|
||||
|
||||
# Mako
|
||||
programs.mako = {
|
||||
backgroundColor = "#${cfg.base16.base00}";
|
||||
textColor = "#${cfg.base16.base07}";
|
||||
borderColor = "#${cfg.base16.base08}";
|
||||
progressColor = "over #${cfg.base16.base0D}";
|
||||
};
|
||||
|
||||
# I3/sway
|
||||
wayland.windowManager.sway = i3config;
|
||||
xsession.windowManager.i3 = i3config;
|
||||
|
||||
# Dunst
|
||||
services.dunst = {
|
||||
settings = {
|
||||
global = {
|
||||
frame_color = "#${cfg.base16.base09}";
|
||||
separator_color = "#${cfg.base16.base05}";
|
||||
background = "#${cfg.base16.base07}";
|
||||
focused = {
|
||||
border = "#${cfg.base16.base05}";
|
||||
background = "#${cfg.base16.base0D}";
|
||||
text = "#${cfg.base16.base00}";
|
||||
indicator = "#${cfg.base16.base0D}";
|
||||
childBorder = "#${cfg.base16.base0D}";
|
||||
};
|
||||
|
||||
urgency_low = {
|
||||
focusedInactive = {
|
||||
border = "#${cfg.base16.base01}";
|
||||
background = "#${cfg.base16.base01}";
|
||||
foreground = "#${cfg.base16.base03}";
|
||||
text = "#${cfg.base16.base05}";
|
||||
indicator = "#${cfg.base16.base03}";
|
||||
childBorder = "#${cfg.base16.base01}";
|
||||
};
|
||||
|
||||
urgency_normal = {
|
||||
background = "#${cfg.base16.base02}";
|
||||
foreground = "#${cfg.base16.base05}";
|
||||
unfocused = {
|
||||
border = "#${cfg.base16.base01}";
|
||||
background = "#${cfg.base16.base00}";
|
||||
text = "#${cfg.base16.base05}";
|
||||
indicator = "#${cfg.base16.base01}";
|
||||
childBorder = "#${cfg.base16.base01}";
|
||||
};
|
||||
|
||||
urgency_critical = {
|
||||
urgent = {
|
||||
border = "#${cfg.base16.base08}";
|
||||
background = "#${cfg.base16.base08}";
|
||||
foreground = "#${cfg.base16.base06}";
|
||||
text = "#${cfg.base16.base00}";
|
||||
indicator = "#${cfg.base16.base08}";
|
||||
childBorder = "#${cfg.base16.base08}";
|
||||
};
|
||||
placeholder = {
|
||||
border = "#${cfg.base16.base00}";
|
||||
background = "#${cfg.base16.base00}";
|
||||
text = "#${cfg.base16.base05}";
|
||||
indicator = "#${cfg.base16.base00}";
|
||||
childBorder = "#${cfg.base16.base00}";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Rofi
|
||||
programs.rofi.theme = "${genTheme inputs.base16-rofi}";
|
||||
elementTheme = {
|
||||
name = "colors-${themeHash}";
|
||||
is_dark = true;
|
||||
colors = {
|
||||
# "accent-color" = "#${cfg.base16.base02}";
|
||||
# "primary-color" = "#${cfg.base16.base08}";
|
||||
# "warning-color" = "#${cfg.base16.base0F}";
|
||||
|
||||
# Kitty
|
||||
programs.kitty.extraConfig = ''
|
||||
include ${genTheme inputs.base16-kitty}
|
||||
'';
|
||||
# "sidebar-color" = "#${cfg.base16.base01}";
|
||||
# "roomlist-background-color" = "#${cfg.base16.base00}";
|
||||
# "roomlist-text-color" = "#${cfg.base16.base05}";
|
||||
# "roomlist-text-secondary-color" = "${cfg.base16.base06}";
|
||||
# "roomlist-highlights-color" = "#${cfg.base16.base02}";
|
||||
# "roomlist-separator-color" = "#${cfg.base16.base05}";
|
||||
|
||||
# Kermit
|
||||
programs.kermit.extraConfig = builtins.readFile (genTheme inputs.base16-kermit);
|
||||
# "timeline-background-color" = "#${cfg.base16.base00}";
|
||||
# "timeline-text-color" = "#${cfg.base16.base07}";
|
||||
# "timeline-text-secondary-color" = "#${cfg.base16.base05}";
|
||||
# "timeline-highlights-color" = "#${cfg.base16.base02}";
|
||||
# "reaction-row-button-selected-bg-color" = "#${cfg.base16.base0B}";
|
||||
|
||||
# neovim
|
||||
xdg.configFile."nvim/colors/base16.vim".source = "${genTheme inputs.base16-vim}";
|
||||
programs.neovim.extraConfig = ''
|
||||
colorscheme base16
|
||||
set termguicolors
|
||||
'';
|
||||
"accent-color" = "#${cfg.base16.base02}";
|
||||
"accent" = "#${cfg.base16.base02}";
|
||||
"primary-color" = "#${cfg.base16.base0B}";
|
||||
"warning-color" = "#${cfg.base16.base08}";
|
||||
"alert" = "#${cfg.base16.base08}";
|
||||
|
||||
# GTK
|
||||
gtk = {
|
||||
enable = true;
|
||||
theme =
|
||||
let
|
||||
"sidebar-color" = "#${cfg.base16.base00}";
|
||||
"roomlist-background-color" = "#${cfg.base16.base01}";
|
||||
"roomlist-text-color" = "#${cfg.base16.base05}";
|
||||
"roomlist-text-secondary-color" = "${cfg.base16.base09}";
|
||||
"roomlist-highlights-color" = "#${cfg.base16.base08}";
|
||||
"roomlist-separator-color" = "#${cfg.base16.base05}";
|
||||
|
||||
"timeline-background-color" = "#${cfg.base16.base00}";
|
||||
"timeline-text-color" = "#${cfg.base16.base05}";
|
||||
"secondary-content" = "#${cfg.base16.base05}";
|
||||
"tertiary-content" = "#${cfg.base16.base05}";
|
||||
"timeline-text-secondary-color" = "#${cfg.base16.base06}";
|
||||
"timeline-highlights-color" = "#${cfg.base16.base03}";
|
||||
|
||||
"reaction-row-button-selected-bg-color" = "#${cfg.base16.base04}";
|
||||
"menu-selected-color" = "#${cfg.base16.base04}";
|
||||
"focus-bg-color" = "#${cfg.base16.base04}";
|
||||
"room-highlight-color" = "#${cfg.base16.base04}";
|
||||
"other-user-pill-bg-color" = "#${cfg.base16.base04}";
|
||||
"togglesw-off-color" = "#${cfg.base16.base04}";
|
||||
|
||||
"username-colors" = ["#${cfg.base16.base08}" "#${cfg.base16.base09}" "#${cfg.base16.base0A}" "#${cfg.base16.base0B}" "#${cfg.base16.base0C}" "#${cfg.base16.base0D}" "#${cfg.base16.base0E}" "#${cfg.base16.base0F}"];
|
||||
# "avatar-background-colors" = [ "#${cfg.base16.base03}" "#${cfg.base16.base04}" "#${cfg.base16.base05}" ];
|
||||
};
|
||||
};
|
||||
|
||||
elementConfig = {
|
||||
settingDefaults.custom_themes = [elementTheme];
|
||||
|
||||
settingDefaults.theme = "${elementTheme.name}";
|
||||
default_theme = "${elementTheme.name}";
|
||||
|
||||
showLabsSettings = true;
|
||||
show_labs_settings = true;
|
||||
};
|
||||
|
||||
base16FromImageSrc = pkgs.runCommand "auto-image-base16" {} ''
|
||||
${schemer2}/bin/schemer2 -format img::colors -in ${cfg.baseColors} -out colors.txt && ${pkgs.python3}/bin/python3 ${inputs.auto-base16-theme}/AutoBase16Theme.py ${inputs.auto-base16-theme}/templates/base16-template.yaml auto-image-base16.yaml
|
||||
${pkgs.yaml2json}/bin/yaml2json < auto-image-base16.yaml > $out
|
||||
'';
|
||||
|
||||
base16FromImage = lib.filterAttrs (k: v: k != "scheme" && k != "author") (builtins.fromJSON (builtins.readFile base16FromImageSrc));
|
||||
in
|
||||
mkMerge [
|
||||
(mkIf cfg.enable {
|
||||
# Read only utility attributes
|
||||
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;
|
||||
|
||||
# Element
|
||||
xdg.configFile."Riot/config.json".text = builtins.toJSON elementConfig;
|
||||
xdg.configFile."Element/config.json".text = builtins.toJSON elementConfig;
|
||||
# And in case you want to do something with the generated theme yourself
|
||||
xdg.configFile."Riot/theme.json".text = builtins.toJSON elementTheme;
|
||||
xdg.configFile."Element/theme.json".text = builtins.toJSON elementTheme;
|
||||
|
||||
# Mako
|
||||
programs.mako = {
|
||||
backgroundColor = "#${cfg.base16.base00}";
|
||||
textColor = "#${cfg.base16.base07}";
|
||||
borderColor = "#${cfg.base16.base08}";
|
||||
progressColor = "over #${cfg.base16.base0D}";
|
||||
};
|
||||
|
||||
# I3/sway
|
||||
wayland.windowManager.sway = i3config;
|
||||
xsession.windowManager.i3 = i3config;
|
||||
|
||||
# Dunst
|
||||
services.dunst = {
|
||||
settings = {
|
||||
global = {
|
||||
frame_color = "#${cfg.base16.base09}";
|
||||
separator_color = "#${cfg.base16.base05}";
|
||||
};
|
||||
|
||||
urgency_low = {
|
||||
background = "#${cfg.base16.base01}";
|
||||
foreground = "#${cfg.base16.base03}";
|
||||
};
|
||||
|
||||
urgency_normal = {
|
||||
background = "#${cfg.base16.base02}";
|
||||
foreground = "#${cfg.base16.base05}";
|
||||
};
|
||||
|
||||
urgency_critical = {
|
||||
background = "#${cfg.base16.base08}";
|
||||
foreground = "#${cfg.base16.base06}";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Rofi
|
||||
programs.rofi.theme = "${genTheme inputs.base16-rofi}";
|
||||
|
||||
# Kitty
|
||||
programs.kitty.extraConfig = ''
|
||||
include ${genTheme inputs.base16-kitty}
|
||||
'';
|
||||
|
||||
# Kermit
|
||||
programs.kermit.extraConfig = builtins.readFile (genTheme inputs.base16-kermit);
|
||||
|
||||
# neovim
|
||||
xdg.configFile."nvim/colors/base16.vim".source = "${genTheme inputs.base16-vim}";
|
||||
programs.neovim.extraConfig = ''
|
||||
colorscheme base16
|
||||
set termguicolors
|
||||
'';
|
||||
|
||||
# GTK
|
||||
gtk = {
|
||||
enable = true;
|
||||
theme = let
|
||||
generated-gtk-theme = pkgs.callPackage "${inputs.rycee}/pkgs/materia-theme" {
|
||||
configBase16 = {
|
||||
name = "Generated";
|
||||
kind = "dark";
|
||||
colors = builtins.mapAttrs (k: v: { hex.rgb = v; }) cfg.base16;
|
||||
colors = builtins.mapAttrs (k: v: {hex.rgb = v;}) cfg.base16;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
name = "Generated";
|
||||
package = generated-gtk-theme;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
xdg.configFile."geary/user-style.css".text = ''
|
||||
:root, *:not(a) {
|
||||
background-color: #${cfg.base16.base00} !important;
|
||||
color: #${cfg.base16.base05} !important;
|
||||
}
|
||||
'';
|
||||
xdg.configFile."geary/user-style.css".text = ''
|
||||
:root, *:not(a) {
|
||||
background-color: #${cfg.base16.base00} !important;
|
||||
color: #${cfg.base16.base05} !important;
|
||||
}
|
||||
'';
|
||||
|
||||
systemd.user.sessionVariables.GTK_THEME = "Generated";
|
||||
home.sessionVariables.GTK_THEME = "Generated";
|
||||
systemd.user.sessionVariables.GTK_THEME = "Generated";
|
||||
home.sessionVariables.GTK_THEME = "Generated";
|
||||
|
||||
# Codium/VSCODE
|
||||
programs.vscode.userSettings = {
|
||||
"workbench.colorTheme" = "nix colors";
|
||||
};
|
||||
# Codium/VSCODE
|
||||
programs.vscode.userSettings = {
|
||||
"workbench.colorTheme" = "nix colors";
|
||||
};
|
||||
|
||||
home.file = lib.mkMerge
|
||||
[
|
||||
(
|
||||
mkIf config.programs.vscode.enable {
|
||||
".vscode-oss/extensions/base16-1.0.0/themes/nix-colors.json".source = genTheme inputs.base16-vscode;
|
||||
".vscode-oss/extensions/base16-1.0.0/package.json".text = builtins.toJSON {
|
||||
name = "nix colors";
|
||||
displayName = "Automatic Nix-generated base16 colors";
|
||||
version = "1.0.0";
|
||||
publisher = "colors";
|
||||
author = {
|
||||
name = "ezpc usr";
|
||||
email = "usr@ezpc";
|
||||
home.file =
|
||||
lib.mkMerge
|
||||
[
|
||||
(
|
||||
mkIf config.programs.vscode.enable {
|
||||
".vscode-oss/extensions/base16-1.0.0/themes/nix-colors.json".source = genTheme inputs.base16-vscode;
|
||||
".vscode-oss/extensions/base16-1.0.0/package.json".text = builtins.toJSON {
|
||||
name = "nix colors";
|
||||
displayName = "Automatic Nix-generated base16 colors";
|
||||
version = "1.0.0";
|
||||
publisher = "colors";
|
||||
author = {
|
||||
name = "ezpc usr";
|
||||
email = "usr@ezpc";
|
||||
};
|
||||
engines.vscode = "^1.11.1";
|
||||
categories = "Themes";
|
||||
contributes.themes = [
|
||||
{
|
||||
label = "nix colors";
|
||||
uiTheme = "vs-dark";
|
||||
path = "./themes/nix-colors.json";
|
||||
}
|
||||
];
|
||||
};
|
||||
engines.vscode = "^1.11.1";
|
||||
categories = "Themes";
|
||||
contributes.themes = [
|
||||
{
|
||||
label = "nix colors";
|
||||
uiTheme = "vs-dark";
|
||||
path = "./themes/nix-colors.json";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
}) (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); {
|
||||
# programs.plasma.files.kdeglobals = with (lib.mapAttrs (n: c: "${toString c.r},${toString c.g},${toString c.b}") cfg.base16Rgb); {
|
||||
General = {
|
||||
ColorScheme = "Generated";
|
||||
Name = "Generated";
|
||||
@ -483,5 +504,6 @@ in
|
||||
ForegroundVisited = base0E;
|
||||
};
|
||||
};
|
||||
})];
|
||||
})
|
||||
];
|
||||
}
|
||||
|
@ -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";
|
||||
|
||||
@ -33,19 +35,24 @@ in
|
||||
'');
|
||||
};
|
||||
Install = rec {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
WantedBy = ["graphical-session.target"];
|
||||
};
|
||||
};
|
||||
|
||||
programs.firefox = {
|
||||
enable = lib.mkDefault true;
|
||||
|
||||
package = lib.mkDefault ((if pkgs ? librewolf then pkgs.librewolf else pkgs.firefox).override {
|
||||
cfg = {
|
||||
enableGnomeExtensions = true;
|
||||
pipewireSupport = true;
|
||||
};
|
||||
});
|
||||
package = lib.mkDefault ((
|
||||
if pkgs ? librewolf
|
||||
then pkgs.librewolf
|
||||
else pkgs.firefox
|
||||
)
|
||||
.override {
|
||||
cfg = {
|
||||
enableGnomeExtensions = true;
|
||||
pipewireSupport = true;
|
||||
};
|
||||
});
|
||||
|
||||
extensions = lib.optionals (pkgs ? nur.repos.rycee.firefox-addons) (with pkgs.nur.repos.rycee.firefox-addons; [
|
||||
darkreader
|
||||
@ -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 = {
|
||||
@ -151,22 +166,21 @@ in
|
||||
$DRY_RUN_CMD rm -f ~/.config/gtk-3.0/gtk.css
|
||||
$DRY_RUN_CMD rm -f ~/.config/gtk-4.0/gtk.css
|
||||
'';
|
||||
before = [ "checkLinkTargets" ];
|
||||
after = [ ];
|
||||
before = ["checkLinkTargets"];
|
||||
after = [];
|
||||
};
|
||||
|
||||
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?
|
||||
@ -257,7 +274,7 @@ in
|
||||
};
|
||||
"org/gnome/shell" = {
|
||||
disable-user-extensions = false;
|
||||
disabled-extensions = [ "" ];
|
||||
disabled-extensions = [""];
|
||||
enabled-extensions = [
|
||||
"pop-shell@system76.com"
|
||||
"rrc@ogarcia.me"
|
||||
@ -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,80 +356,82 @@ in
|
||||
enabled = true;
|
||||
};
|
||||
|
||||
"org/gnome/desktop/wm/keybindings" =
|
||||
let
|
||||
workspaceAttrsList = lib.flatten (map
|
||||
(n: [
|
||||
(lib.nameValuePair "move-to-workspace-${n}" [ "<Shift><Super>${n}" ])
|
||||
(lib.nameValuePair "switch-to-workspace-${n}" [ "<Super>${n}" ])
|
||||
])
|
||||
(map (n: toString n) (lib.range 1 9)));
|
||||
in
|
||||
lib.listToAttrs workspaceAttrsList // {
|
||||
minimize = [ "<Super>comma" ];
|
||||
maximize = [ "" ];
|
||||
unmaximize = [ "" ];
|
||||
move-to-monitor-up = [ "" ];
|
||||
move-to-monitor-down = [ "" ];
|
||||
move-to-monitor-left = [ "" ];
|
||||
move-to-monitor-right = [ "" ];
|
||||
move-to-workspace-down = [ "" ];
|
||||
move-to-workspace-up = [ "" ];
|
||||
switch-to-workspace-down = [ "<Primary><Super>Down" "<Primary><Super>j" ];
|
||||
switch-to-workspace-up = [ "<Primary><Super>Up" "<Primary><Super>k" ];
|
||||
toggle-maximized = [ "<Super>m" ];
|
||||
close = [ "<Super>q" ];
|
||||
cycle-windows = [ "" ];
|
||||
panel-run-dialog = [ "<Super>d" ];
|
||||
move-to-workspace-right = [ "" ];
|
||||
move-to-workspace-left = [ "" ];
|
||||
switch-to-workspace-right = [ "" ];
|
||||
switch-to-workspace-left = [ "" ];
|
||||
"org/gnome/desktop/wm/keybindings" = let
|
||||
workspaceAttrsList = lib.flatten (map
|
||||
(n: [
|
||||
(lib.nameValuePair "move-to-workspace-${n}" ["<Shift><Super>${n}"])
|
||||
(lib.nameValuePair "switch-to-workspace-${n}" ["<Super>${n}"])
|
||||
])
|
||||
(map (n: toString n) (lib.range 1 9)));
|
||||
in
|
||||
lib.listToAttrs workspaceAttrsList
|
||||
// {
|
||||
minimize = ["<Super>comma"];
|
||||
maximize = [""];
|
||||
unmaximize = [""];
|
||||
move-to-monitor-up = [""];
|
||||
move-to-monitor-down = [""];
|
||||
move-to-monitor-left = [""];
|
||||
move-to-monitor-right = [""];
|
||||
move-to-workspace-down = [""];
|
||||
move-to-workspace-up = [""];
|
||||
switch-to-workspace-down = ["<Primary><Super>Down" "<Primary><Super>j"];
|
||||
switch-to-workspace-up = ["<Primary><Super>Up" "<Primary><Super>k"];
|
||||
toggle-maximized = ["<Super>m"];
|
||||
close = ["<Super>q"];
|
||||
cycle-windows = [""];
|
||||
panel-run-dialog = ["<Super>d"];
|
||||
move-to-workspace-right = [""];
|
||||
move-to-workspace-left = [""];
|
||||
switch-to-workspace-right = [""];
|
||||
switch-to-workspace-left = [""];
|
||||
|
||||
# And deal with the remaining alt keys, screw alt keys
|
||||
cycle-windows-backward = [ "" ];
|
||||
activate-window-menu = [ "" ];
|
||||
cycle-panels = [ "" ];
|
||||
cycle-panels-backward = [ "" ];
|
||||
switch-panels = [ "" ];
|
||||
switch-panels-backward = [ "" ];
|
||||
switch-applications = [ "<Super>Tab" ];
|
||||
switch-applications-backward = [ "<Shift><Super>Tab" ];
|
||||
cycle-group = [ "" ];
|
||||
cycle-group-backward = [ "" ];
|
||||
switch-group = [ "" ];
|
||||
switch-group-backward = [ "" ];
|
||||
begin-resize = [ "" ];
|
||||
begin-move = [ "" ];
|
||||
cycle-windows-backward = [""];
|
||||
activate-window-menu = [""];
|
||||
cycle-panels = [""];
|
||||
cycle-panels-backward = [""];
|
||||
switch-panels = [""];
|
||||
switch-panels-backward = [""];
|
||||
switch-applications = ["<Super>Tab"];
|
||||
switch-applications-backward = ["<Shift><Super>Tab"];
|
||||
cycle-group = [""];
|
||||
cycle-group-backward = [""];
|
||||
switch-group = [""];
|
||||
switch-group-backward = [""];
|
||||
begin-resize = [""];
|
||||
begin-move = [""];
|
||||
};
|
||||
"org/gnome/mutter/keybindings" = {
|
||||
toggle-tiled-left = [ "" ];
|
||||
toggle-tiled-right = [ "" ];
|
||||
toggle-tiled-left = [""];
|
||||
toggle-tiled-right = [""];
|
||||
};
|
||||
"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)) // {
|
||||
open-application-menu = [ "" ];
|
||||
toggle-message-tray = [ "<Super>v" ];
|
||||
toggle-overview = [ "" ];
|
||||
restore-shortcuts = [""];
|
||||
};
|
||||
"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 = [""];
|
||||
};
|
||||
"org/gnome/settings-daemon/plugins/media-keys" = {
|
||||
play = [ "<Super>backslash" ];
|
||||
next = [ "<Super>bracketright" ];
|
||||
previous = [ "<Super>bracketleft" ];
|
||||
play = ["<Super>backslash"];
|
||||
next = ["<Super>bracketright"];
|
||||
previous = ["<Super>bracketleft"];
|
||||
|
||||
volume-down = [ "<Super>minus" ];
|
||||
volume-up = [ "<Super>equal" ];
|
||||
volume-down = ["<Super>minus"];
|
||||
volume-up = ["<Super>equal"];
|
||||
|
||||
screensaver = [ "<Super>Escape" ];
|
||||
home = [ "<Super>f" ];
|
||||
email = [ "<Super>e" ];
|
||||
www = [ "<Super>b" ];
|
||||
screensaver = ["<Super>Escape"];
|
||||
home = ["<Super>f"];
|
||||
email = ["<Super>e"];
|
||||
www = ["<Super>b"];
|
||||
|
||||
rotate-video-lock-static = [ "" ];
|
||||
rotate-video-lock-static = [""];
|
||||
|
||||
screenshot-clip = [ "Print" ];
|
||||
screenshot-clip = ["Print"];
|
||||
};
|
||||
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
|
||||
binding = "<Super>t";
|
||||
|
@ -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";
|
||||
};
|
||||
@ -133,21 +133,21 @@ in
|
||||
|
||||
shortcuts = {
|
||||
"org.kde.krunner.desktop"."_launch" = ["Meta+D" "Search" "Alt+Space"];
|
||||
"org.kde.plasma.emojier.desktop"."_launch" = [ ];
|
||||
"org.kde.plasma.emojier.desktop"."_launch" = [];
|
||||
|
||||
plasmashell = {
|
||||
"activate task manager entry 1" = [ ];
|
||||
"activate task manager entry 2" = [ ];
|
||||
"activate task manager entry 3" = [ ];
|
||||
"activate task manager entry 4" = [ ];
|
||||
"activate task manager entry 5" = [ ];
|
||||
"activate task manager entry 6" = [ ];
|
||||
"activate task manager entry 7" = [ ];
|
||||
"activate task manager entry 8" = [ ];
|
||||
"activate task manager entry 9" = [ ];
|
||||
"activate task manager entry 10" = [ ];
|
||||
"next activity" = [ ];
|
||||
"manage activities" = [ ];
|
||||
"activate task manager entry 1" = [];
|
||||
"activate task manager entry 2" = [];
|
||||
"activate task manager entry 3" = [];
|
||||
"activate task manager entry 4" = [];
|
||||
"activate task manager entry 5" = [];
|
||||
"activate task manager entry 6" = [];
|
||||
"activate task manager entry 7" = [];
|
||||
"activate task manager entry 8" = [];
|
||||
"activate task manager entry 9" = [];
|
||||
"activate task manager entry 10" = [];
|
||||
"next activity" = [];
|
||||
"manage activities" = [];
|
||||
};
|
||||
|
||||
kwin = {
|
||||
@ -183,11 +183,11 @@ in
|
||||
view_zoom_out = "Meta+_";
|
||||
|
||||
"Window to Next Screen" = "Meta+>";
|
||||
"Window to Previous Screen" ="Meta+<";
|
||||
"Window to Previous Screen" = "Meta+<";
|
||||
"Switch to Next Screen" = "Meta+.";
|
||||
"Switch to Previous Screen" ="Meta+,";
|
||||
"Switch to Previous Screen" = "Meta+,";
|
||||
|
||||
"Show Desktop" = [ ];
|
||||
"Show Desktop" = [];
|
||||
|
||||
"Window On All Desktops" = "Meta+A";
|
||||
};
|
||||
@ -220,21 +220,21 @@ in
|
||||
|
||||
push_window_to_master = "Meta+M";
|
||||
|
||||
move_window_to_next_pos = [ ];
|
||||
move_window_to_prev_pos = [ ];
|
||||
decrease_master_win_count = [ ];
|
||||
increase_master_win_count = [ ];
|
||||
rotate = [ ];
|
||||
rotate_part = [ ];
|
||||
rotate_reverse = [ ];
|
||||
toggle_float_layout = [ ];
|
||||
toggle_monocle_layout = [ ];
|
||||
toggle_quarter_layout = [ ];
|
||||
toggle_spiral_layout = [ ];
|
||||
toggle_spread_layout = [ ];
|
||||
toggle_stair_layout = [ ];
|
||||
toggle_three_column_layout = [ ];
|
||||
toggle_tile_layout = [ ];
|
||||
move_window_to_next_pos = [];
|
||||
move_window_to_prev_pos = [];
|
||||
decrease_master_win_count = [];
|
||||
increase_master_win_count = [];
|
||||
rotate = [];
|
||||
rotate_part = [];
|
||||
rotate_reverse = [];
|
||||
toggle_float_layout = [];
|
||||
toggle_monocle_layout = [];
|
||||
toggle_quarter_layout = [];
|
||||
toggle_spiral_layout = [];
|
||||
toggle_spread_layout = [];
|
||||
toggle_stair_layout = [];
|
||||
toggle_three_column_layout = [];
|
||||
toggle_tile_layout = [];
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -247,7 +247,7 @@ in
|
||||
'');
|
||||
};
|
||||
Install = rec {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
WantedBy = ["graphical-session.target"];
|
||||
};
|
||||
};
|
||||
|
||||
@ -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";
|
||||
|
@ -1,10 +1,12 @@
|
||||
inputs:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
inputs: {
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
(lib.mkAliasOptionModule [ "ezpcusr" "gaming" ] [ "gaming" "enable" ])
|
||||
(lib.mkAliasOptionModule [ "ezpcusr" "newWine" ] [ "gaming" "newWine" ])
|
||||
(lib.mkAliasOptionModule ["ezpcusr" "gaming"] ["gaming" "enable"])
|
||||
(lib.mkAliasOptionModule ["ezpcusr" "newWine"] ["gaming" "newWine"])
|
||||
|
||||
(import ./ezpcusr.nix inputs)
|
||||
(import ./colors.nix inputs)
|
||||
|
@ -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,41 +61,42 @@ 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" { } (''
|
||||
mkdir -p $out/bin
|
||||
ln -s ${selshot} $out/bin/selshot
|
||||
ln -s ${selvid} $out/bin/selvid
|
||||
ln -s ${getscrloc} $out/bin/getscrloc
|
||||
ln -s ${scrsaveclip} $out/bin/scrsaveclip
|
||||
ln -s ${scrvidsaveclip} $out/bin/scrvidsaveclip
|
||||
ln -s ${scrvidstop} $out/bin/scrvidstop
|
||||
'' + (
|
||||
if cfg.uploadScript != null then ''
|
||||
ln -s ${cfg.uploadScript} $out/bin/upload_file
|
||||
ezDrv = pkgs.runCommand "ez-commands" {} (
|
||||
''
|
||||
mkdir -p $out/bin
|
||||
ln -s ${selshot} $out/bin/selshot
|
||||
ln -s ${selvid} $out/bin/selvid
|
||||
ln -s ${getscrloc} $out/bin/getscrloc
|
||||
ln -s ${scrsaveclip} $out/bin/scrsaveclip
|
||||
ln -s ${scrvidsaveclip} $out/bin/scrvidsaveclip
|
||||
ln -s ${scrvidstop} $out/bin/scrvidstop
|
||||
''
|
||||
+ (
|
||||
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 ""
|
||||
)
|
||||
ln -s ${scrsaveup} $out/bin/scrsaveup
|
||||
ln -s ${scrvidsaveup} $out/bin/scrvidsaveup
|
||||
''
|
||||
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 {
|
||||
@ -102,18 +107,18 @@ in
|
||||
|
||||
outputOptions = mkOption {
|
||||
description = "Additional output options";
|
||||
default = { };
|
||||
default = {};
|
||||
type = types.attrsOf (types.attrsOf types.str);
|
||||
};
|
||||
|
||||
waybarConfig = mkOption {
|
||||
description = "Waybar config";
|
||||
default = { };
|
||||
default = {};
|
||||
};
|
||||
|
||||
screensaver = mkOption {
|
||||
description = "ezpcusr screensaver";
|
||||
default = { };
|
||||
default = {};
|
||||
type = types.submodule {
|
||||
options = {
|
||||
enable = mkOption {
|
||||
@ -137,7 +142,7 @@ in
|
||||
|
||||
favIcons = mkOption {
|
||||
description = "Your favourite icons pack";
|
||||
default = { };
|
||||
default = {};
|
||||
type = types.submodule {
|
||||
options = {
|
||||
name = mkOption {
|
||||
@ -194,64 +199,76 @@ in
|
||||
|
||||
modifier = lib.mkDefault "Mod4";
|
||||
|
||||
keybindings =
|
||||
let
|
||||
# ugly stupid way of doing things but im lazy
|
||||
bwRofi = pkgs.writeScript "bw-rofi" ''
|
||||
#!${pkgs.bash}/bin/bash
|
||||
LIST=$(${pkgs.bitwarden-cli}/bin/bw list items)
|
||||
USERLIST=$(echo "$LIST" | ${pkgs.jq}/bin/jq -r '.[] | "\(.name) - \(.login.username)"')
|
||||
keybindings = let
|
||||
# ugly stupid way of doing things but im lazy
|
||||
bwRofi = pkgs.writeScript "bw-rofi" ''
|
||||
#!${pkgs.bash}/bin/bash
|
||||
LIST=$(${pkgs.bitwarden-cli}/bin/bw list items)
|
||||
USERLIST=$(echo "$LIST" | ${pkgs.jq}/bin/jq -r '.[] | "\(.name) - \(.login.username)"')
|
||||
|
||||
CHOSEN=$(echo "$USERLIST" | ${pkgs.rofi}/bin/rofi -dmenu -i)
|
||||
NUMBER=$(echo "$USERLIST" | grep -n "^$CHOSEN$" | cut -d':' -f1)
|
||||
NTH=$(expr $NUMBER - 1)
|
||||
CHOSEN=$(echo "$USERLIST" | ${pkgs.rofi}/bin/rofi -dmenu -i)
|
||||
NUMBER=$(echo "$USERLIST" | grep -n "^$CHOSEN$" | cut -d':' -f1)
|
||||
NTH=$(expr $NUMBER - 1)
|
||||
|
||||
echo "$LIST" | ${pkgs.jq}/bin/jq -j -r ".[$NTH].login.password" | ${pkgs.wl-clipboard}/bin/wl-copy
|
||||
'';
|
||||
echo "$LIST" | ${pkgs.jq}/bin/jq -j -r ".[$NTH].login.password" | ${pkgs.wl-clipboard}/bin/wl-copy
|
||||
'';
|
||||
|
||||
# very ugly stupid way of doing things but im still lazy
|
||||
bwRofiOtp = pkgs.writeScript "bw-rofi-otp" ''
|
||||
#!${pkgs.bash}/bin/bash
|
||||
LIST=$(${pkgs.bitwarden-cli}/bin/bw list items)
|
||||
USERLIST=$(echo "$LIST" | ${pkgs.jq}/bin/jq -r '.[] | "\(.name) - \(.login.username)"')
|
||||
# very ugly stupid way of doing things but im still lazy
|
||||
bwRofiOtp = pkgs.writeScript "bw-rofi-otp" ''
|
||||
#!${pkgs.bash}/bin/bash
|
||||
LIST=$(${pkgs.bitwarden-cli}/bin/bw list items)
|
||||
USERLIST=$(echo "$LIST" | ${pkgs.jq}/bin/jq -r '.[] | "\(.name) - \(.login.username)"')
|
||||
|
||||
CHOSEN=$(echo "$USERLIST" | ${pkgs.rofi}/bin/rofi -dmenu -i)
|
||||
NUMBER=$(echo "$USERLIST" | grep -n "^$CHOSEN$" | cut -d':' -f1)
|
||||
NTH=$(expr $NUMBER - 1)
|
||||
CHOSEN=$(echo "$USERLIST" | ${pkgs.rofi}/bin/rofi -dmenu -i)
|
||||
NUMBER=$(echo "$USERLIST" | grep -n "^$CHOSEN$" | cut -d':' -f1)
|
||||
NTH=$(expr $NUMBER - 1)
|
||||
|
||||
ID=$(echo "$LIST" | ${pkgs.jq}/bin/jq -j -r ".[$NTH].id")
|
||||
ID=$(echo "$LIST" | ${pkgs.jq}/bin/jq -j -r ".[$NTH].id")
|
||||
|
||||
${pkgs.bitwarden-cli}/bin/bw get totp $ID | ${pkgs.wl-clipboard}/bin/wl-copy
|
||||
'';
|
||||
${pkgs.bitwarden-cli}/bin/bw get totp $ID | ${pkgs.wl-clipboard}/bin/wl-copy
|
||||
'';
|
||||
|
||||
emojiRofi = pkgs.writeScript "rofi-emoji" ''
|
||||
line=$(${pkgs.coreutils}/bin/cat ${toString ../data/emojis.txt} | ${pkgs.rofi}/bin/rofi -dmenu -i)
|
||||
${pkgs.coreutils}/bin/echo ''${line::1} | ${pkgs.wl-clipboard}/bin/wl-copy
|
||||
'';
|
||||
emojiRofi = pkgs.writeScript "rofi-emoji" ''
|
||||
line=$(${pkgs.coreutils}/bin/cat ${toString ../data/emojis.txt} | ${pkgs.rofi}/bin/rofi -dmenu -i)
|
||||
${pkgs.coreutils}/bin/echo ''${line::1} | ${pkgs.wl-clipboard}/bin/wl-copy
|
||||
'';
|
||||
|
||||
modifier = config.wayland.windowManager.sway.config.modifier;
|
||||
modifier = config.wayland.windowManager.sway.config.modifier;
|
||||
|
||||
alphabet = [ "Ctrl" "Alt" "Ctrl+Alt" ];
|
||||
genKeyAttrs = move: lib.listToAttrs (
|
||||
alphabet = ["Ctrl" "Alt" "Ctrl+Alt"];
|
||||
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}";
|
||||
}
|
||||
)
|
||||
(lib.lists.range 11 (10 * (builtins.length alphabet) + 10))
|
||||
(
|
||||
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
|
||||
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,66 +308,58 @@ in
|
||||
"XF86AudioPause" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
|
||||
"${modifier}+backslash" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
|
||||
|
||||
"${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
|
||||
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)
|
||||
"${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
|
||||
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)
|
||||
|
||||
DL_OUT=$(echo y | ${inputs.mudl.defaultPackage.${pkgs.system}}/bin/mudl "$URLIFIED")
|
||||
DL_OUT=$(echo y | ${inputs.mudl.defaultPackage.${pkgs.system}}/bin/mudl "$URLIFIED")
|
||||
|
||||
if echo "$DL_OUT" | ${pkgs.gnugrep}/bin/grep -qE 'Album: $'; then
|
||||
${pkgs.libnotify}/bin/notify-send mudl 'Album name required'
|
||||
ALBUM=$(${pkgs.rofi}/bin/rofi -dmenu)
|
||||
echo y | ${inputs.mudl.defaultPackage.${pkgs.system}}/bin/mudl "$URLIFIED" "$ALBUM"
|
||||
fi
|
||||
'';
|
||||
in
|
||||
"exec ${ripMusic}";
|
||||
if echo "$DL_OUT" | ${pkgs.gnugrep}/bin/grep -qE 'Album: $'; then
|
||||
${pkgs.libnotify}/bin/notify-send mudl 'Album name required'
|
||||
ALBUM=$(${pkgs.rofi}/bin/rofi -dmenu)
|
||||
echo y | ${inputs.mudl.defaultPackage.${pkgs.system}}/bin/mudl "$URLIFIED" "$ALBUM"
|
||||
fi
|
||||
'';
|
||||
in "exec ${ripMusic}";
|
||||
|
||||
"${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}";
|
||||
"${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}";
|
||||
"${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
|
||||
mopidySearch = pkgs.writeShellScript "mopidy-search.sh" ''
|
||||
QUERY=$(${pkgs.rofi}/bin/rofi -dmenu)
|
||||
[ -z "$QUERY" ] && exit
|
||||
RESULTS=$(${pkgs.mpc_cli}/bin/mpc search -f '%file% / %artist% - %title%' any "$QUERY")
|
||||
USERLIST=$(echo "$RESULTS" | ${pkgs.gawk}/bin/awk -F' / ' '{print $2}')
|
||||
"${config.wayland.windowManager.sway.config.modifier}+Shift+m" = let
|
||||
mopidySearch = pkgs.writeShellScript "mopidy-search.sh" ''
|
||||
QUERY=$(${pkgs.rofi}/bin/rofi -dmenu)
|
||||
[ -z "$QUERY" ] && exit
|
||||
RESULTS=$(${pkgs.mpc_cli}/bin/mpc search -f '%file% / %artist% - %title%' any "$QUERY")
|
||||
USERLIST=$(echo "$RESULTS" | ${pkgs.gawk}/bin/awk -F' / ' '{print $2}')
|
||||
|
||||
CHOSEN=$(echo "$USERLIST" | ${pkgs.rofi}/bin/rofi -dmenu -i)
|
||||
[ -z "$CHOSEN" ] && exit
|
||||
NTH=$(echo "$USERLIST" | ${pkgs.gnugrep}/bin/grep -n "^$CHOSEN$" | cut -d':' -f1)
|
||||
CHOSEN=$(echo "$USERLIST" | ${pkgs.rofi}/bin/rofi -dmenu -i)
|
||||
[ -z "$CHOSEN" ] && exit
|
||||
NTH=$(echo "$USERLIST" | ${pkgs.gnugrep}/bin/grep -n "^$CHOSEN$" | cut -d':' -f1)
|
||||
|
||||
LINE=$(echo "$RESULTS" | ${pkgs.coreutils}/bin/tail "-n+$NTH" | ${pkgs.coreutils}/bin/head -1)
|
||||
NAME=$(echo "$LINE" | ${pkgs.gawk}/bin/awk -F' / ' '{print $1}')
|
||||
LINE=$(echo "$RESULTS" | ${pkgs.coreutils}/bin/tail "-n+$NTH" | ${pkgs.coreutils}/bin/head -1)
|
||||
NAME=$(echo "$LINE" | ${pkgs.gawk}/bin/awk -F' / ' '{print $1}')
|
||||
|
||||
${pkgs.mpc_cli}/bin/mpc add "$NAME"
|
||||
PLAYLIST=$(${pkgs.mpc_cli}/bin/mpc -f "%position% / %file%" playlist)
|
||||
PLAYLIST_ENTRY=$(echo "$PLAYLIST" | ${pkgs.gnugrep}/bin/grep -E "^.* / $NAME$" | head -1)
|
||||
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}";
|
||||
${pkgs.mpc_cli}/bin/mpc add "$NAME"
|
||||
PLAYLIST=$(${pkgs.mpc_cli}/bin/mpc -f "%position% / %file%" playlist)
|
||||
PLAYLIST_ENTRY=$(echo "$PLAYLIST" | ${pkgs.gnugrep}/bin/grep -E "^.* / $NAME$" | head -1)
|
||||
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}";
|
||||
|
||||
"${modifier}+p" = "exec ${bwRofi}";
|
||||
"${modifier}+t" = "exec ${bwRofiOtp}";
|
||||
@ -372,7 +376,7 @@ in
|
||||
|
||||
menu = "${pkgs.rofi}/bin/rofi -show drun -show-icons -run-command '${pkgs.sway}/bin/swaymsg exec -- {cmd}'";
|
||||
|
||||
bars = [ ];
|
||||
bars = [];
|
||||
|
||||
gaps = {
|
||||
smartGaps = lib.mkDefault true;
|
||||
@ -398,107 +402,107 @@ in
|
||||
|
||||
settings = [
|
||||
({
|
||||
position = "left";
|
||||
height = null;
|
||||
position = "left";
|
||||
height = null;
|
||||
|
||||
modules-left = [ "sway/workspaces" "custom/spacer" "custom/weather-temp" "custom/weather-precip" "custom/weather-wind" ];
|
||||
modules-center = [ "clock#1" "clock#2" "custom/spacer" "custom/media" "custom/spacer" "clock#3" "custom/spacer" "clock#4" ];
|
||||
modules-right = [ "pulseaudio" "custom/spacer" "memory" "custom/spacer" "cpu" ] ++ lib.optionals cfg.battery [ "custom/spacer" "battery" ] ++ [ "custom/spacer" "tray" ];
|
||||
modules-left = ["sway/workspaces" "custom/spacer" "custom/weather-temp" "custom/weather-precip" "custom/weather-wind"];
|
||||
modules-center = ["clock#1" "clock#2" "custom/spacer" "custom/media" "custom/spacer" "clock#3" "custom/spacer" "clock#4"];
|
||||
modules-right = ["pulseaudio" "custom/spacer" "memory" "custom/spacer" "cpu"] ++ lib.optionals cfg.battery ["custom/spacer" "battery"] ++ ["custom/spacer" "tray"];
|
||||
|
||||
modules = {
|
||||
"custom/spacer" = {
|
||||
format = "〰";
|
||||
rotate = 90;
|
||||
tooltip = false;
|
||||
};
|
||||
|
||||
"custom/weather-temp" = {
|
||||
exec = "${pkgs.curl}/bin/curl 'wttr.in/${cfg.location}?format=%c+%t' || echo ERR";
|
||||
on-click = "${pkgs.xdg-utils}/bin/xdg-open 'https://weather.com/weather/today/l/85625'";
|
||||
on-click-right = "${pkgs.xdg-utils}/bin/xdg-open 'https://wttr.in/${cfg.location}'";
|
||||
interval = 900;
|
||||
};
|
||||
"custom/weather-precip" = {
|
||||
exec = "${pkgs.curl}/bin/curl 'wttr.in/${cfg.location}?format=🌧️+%p'";
|
||||
on-click = "${pkgs.xdg-utils}/bin/xdg-open 'https://www.lightningmaps.org/'";
|
||||
on-click-right = "${pkgs.xdg-utils}/bin/xdg-open 'https://wttr.in/${cfg.location}'";
|
||||
interval = 900;
|
||||
};
|
||||
"custom/weather-wind" = {
|
||||
exec = "${pkgs.curl}/bin/curl 'wttr.in/${cfg.location}?format=🌬️+%w'";
|
||||
on-click = "${pkgs.xdg-utils}/bin/xdg-open 'https://www.ventusky.com/";
|
||||
on-click-right = "${pkgs.xdg-utils}/bin/xdg-open 'https://wttr.in/${cfg.location}'";
|
||||
interval = 900;
|
||||
};
|
||||
|
||||
"custom/media" = {
|
||||
rotate = 90;
|
||||
max-length = 60;
|
||||
on-click = "${pkgs.playerctl}/bin/playerctl play-pause";
|
||||
exec = "${pkgs.playerctl}/bin/playerctl metadata --format '{{ emoji(status) }} {{ artist }} - {{ title }}' --follow";
|
||||
};
|
||||
|
||||
"sway/workspaces" = {
|
||||
disable-scroll = true;
|
||||
};
|
||||
|
||||
"clock#1" = {
|
||||
tooltip = false;
|
||||
format = "{:%a}";
|
||||
};
|
||||
"clock#2" = {
|
||||
tooltip = false;
|
||||
format = "{:%m-%d}";
|
||||
};
|
||||
"clock#3" = {
|
||||
tooltip = false;
|
||||
format = "{:%I:%M %p}";
|
||||
};
|
||||
"clock#4" = {
|
||||
tooltip = false;
|
||||
timezone = "Etc/UTC";
|
||||
format = "{:%H:%M} UTC";
|
||||
};
|
||||
|
||||
pulseaudio = {
|
||||
format = "{icon} {volume}%";
|
||||
format-bluetooth = "{icon} {volume}%";
|
||||
format-muted = "MUTE";
|
||||
format-icons = {
|
||||
headphone = "";
|
||||
default = "";
|
||||
modules = {
|
||||
"custom/spacer" = {
|
||||
format = "〰";
|
||||
rotate = 90;
|
||||
tooltip = false;
|
||||
};
|
||||
on-click = "${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle";
|
||||
on-click-right = "${pkgs.pavucontrol}/bin/pavucontrol";
|
||||
};
|
||||
|
||||
memory = {
|
||||
interval = 20;
|
||||
format = " {}%";
|
||||
};
|
||||
|
||||
cpu = {
|
||||
interval = 20;
|
||||
format = " {usage}%";
|
||||
};
|
||||
|
||||
battery = {
|
||||
states = {
|
||||
good = 90;
|
||||
warning = 25;
|
||||
critical = 10;
|
||||
"custom/weather-temp" = {
|
||||
exec = "${pkgs.curl}/bin/curl 'wttr.in/${cfg.location}?format=%c+%t' || echo ERR";
|
||||
on-click = "${pkgs.xdg-utils}/bin/xdg-open 'https://weather.com/weather/today/l/85625'";
|
||||
on-click-right = "${pkgs.xdg-utils}/bin/xdg-open 'https://wttr.in/${cfg.location}'";
|
||||
interval = 900;
|
||||
};
|
||||
"custom/weather-precip" = {
|
||||
exec = "${pkgs.curl}/bin/curl 'wttr.in/${cfg.location}?format=🌧️+%p'";
|
||||
on-click = "${pkgs.xdg-utils}/bin/xdg-open 'https://www.lightningmaps.org/'";
|
||||
on-click-right = "${pkgs.xdg-utils}/bin/xdg-open 'https://wttr.in/${cfg.location}'";
|
||||
interval = 900;
|
||||
};
|
||||
"custom/weather-wind" = {
|
||||
exec = "${pkgs.curl}/bin/curl 'wttr.in/${cfg.location}?format=🌬️+%w'";
|
||||
on-click = "${pkgs.xdg-utils}/bin/xdg-open 'https://www.ventusky.com/";
|
||||
on-click-right = "${pkgs.xdg-utils}/bin/xdg-open 'https://wttr.in/${cfg.location}'";
|
||||
interval = 900;
|
||||
};
|
||||
format = "{icon} {capacity}%";
|
||||
format-icons = [ "" "" "" "" "" ];
|
||||
};
|
||||
|
||||
tray = {
|
||||
icon-size = 18;
|
||||
spacing = 5;
|
||||
};
|
||||
};
|
||||
"custom/media" = {
|
||||
rotate = 90;
|
||||
max-length = 60;
|
||||
on-click = "${pkgs.playerctl}/bin/playerctl play-pause";
|
||||
exec = "${pkgs.playerctl}/bin/playerctl metadata --format '{{ emoji(status) }} {{ artist }} - {{ title }}' --follow";
|
||||
};
|
||||
|
||||
} // cfg.waybarConfig)
|
||||
"sway/workspaces" = {
|
||||
disable-scroll = true;
|
||||
};
|
||||
|
||||
"clock#1" = {
|
||||
tooltip = false;
|
||||
format = "{:%a}";
|
||||
};
|
||||
"clock#2" = {
|
||||
tooltip = false;
|
||||
format = "{:%m-%d}";
|
||||
};
|
||||
"clock#3" = {
|
||||
tooltip = false;
|
||||
format = "{:%I:%M %p}";
|
||||
};
|
||||
"clock#4" = {
|
||||
tooltip = false;
|
||||
timezone = "Etc/UTC";
|
||||
format = "{:%H:%M} UTC";
|
||||
};
|
||||
|
||||
pulseaudio = {
|
||||
format = "{icon} {volume}%";
|
||||
format-bluetooth = "{icon} {volume}%";
|
||||
format-muted = "MUTE";
|
||||
format-icons = {
|
||||
headphone = "";
|
||||
default = "";
|
||||
};
|
||||
on-click = "${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle";
|
||||
on-click-right = "${pkgs.pavucontrol}/bin/pavucontrol";
|
||||
};
|
||||
|
||||
memory = {
|
||||
interval = 20;
|
||||
format = " {}%";
|
||||
};
|
||||
|
||||
cpu = {
|
||||
interval = 20;
|
||||
format = " {usage}%";
|
||||
};
|
||||
|
||||
battery = {
|
||||
states = {
|
||||
good = 90;
|
||||
warning = 25;
|
||||
critical = 10;
|
||||
};
|
||||
format = "{icon} {capacity}%";
|
||||
format-icons = ["" "" "" "" ""];
|
||||
};
|
||||
|
||||
tray = {
|
||||
icon-size = 18;
|
||||
spacing = 5;
|
||||
};
|
||||
};
|
||||
}
|
||||
// cfg.waybarConfig)
|
||||
];
|
||||
|
||||
style = ''
|
||||
@ -581,7 +585,7 @@ in
|
||||
programs.mako = {
|
||||
enable = lib.mkDefault true;
|
||||
maxVisible = lib.mkDefault 6;
|
||||
extraConfig = lib.generators.toKeyValue { } {
|
||||
extraConfig = lib.generators.toKeyValue {} {
|
||||
on-button-middle = "dismiss-all";
|
||||
};
|
||||
};
|
||||
@ -591,8 +595,8 @@ in
|
||||
ExecStart = "${pkgs.mako}/bin/mako";
|
||||
};
|
||||
Install = {
|
||||
After = [ "sway-session.target" ];
|
||||
WantedBy = [ "sway-session.target" ];
|
||||
After = ["sway-session.target"];
|
||||
WantedBy = ["sway-session.target"];
|
||||
};
|
||||
};
|
||||
|
||||
@ -663,17 +667,15 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
xdg.configFile."neofetch/config.conf".text =
|
||||
let
|
||||
image = builtins.path {
|
||||
name = "nixos_circlejerk.png";
|
||||
path = ../data/nixos_circlejerk.png;
|
||||
};
|
||||
in
|
||||
''
|
||||
image_source="${image}"
|
||||
image_backend="kitty"
|
||||
'';
|
||||
xdg.configFile."neofetch/config.conf".text = let
|
||||
image = builtins.path {
|
||||
name = "nixos_circlejerk.png";
|
||||
path = ../data/nixos_circlejerk.png;
|
||||
};
|
||||
in ''
|
||||
image_source="${image}"
|
||||
image_backend="kitty"
|
||||
'';
|
||||
|
||||
xdg.enable = true;
|
||||
xdg.userDirs.enable = true;
|
||||
|
@ -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,53 +35,58 @@ in
|
||||
STAGING_RT_PRIORITY_SERVER = 90;
|
||||
};
|
||||
|
||||
home.packages =
|
||||
let
|
||||
newwine = (pkgs.winePackages.full.override { wineBuild = "wineWow"; wineRelease = "staging"; });
|
||||
newwinetricks = pkgs.winetricks.overrideAttrs (old: rec {
|
||||
pathAdd = "${newwine}/bin:" + old.pathAdd;
|
||||
postInstall = ''
|
||||
sed -i \
|
||||
-e '2i PATH="${pathAdd}"' \
|
||||
"$out/bin/winetricks"
|
||||
'';
|
||||
});
|
||||
home.packages = let
|
||||
newwine = pkgs.winePackages.full.override {
|
||||
wineBuild = "wineWow";
|
||||
wineRelease = "staging";
|
||||
};
|
||||
newwinetricks = pkgs.winetricks.overrideAttrs (old: rec {
|
||||
pathAdd = "${newwine}/bin:" + old.pathAdd;
|
||||
postInstall = ''
|
||||
sed -i \
|
||||
-e '2i PATH="${pathAdd}"' \
|
||||
"$out/bin/winetricks"
|
||||
'';
|
||||
});
|
||||
|
||||
oldwine = pkgs.wineWowPackages.full;
|
||||
oldwinetricks = pkgs.winetricks.overrideAttrs (old: rec {
|
||||
pathAdd = "${oldwine}/bin:" + old.pathAdd;
|
||||
postInstall = ''
|
||||
sed -i \
|
||||
-e '2i PATH="${pathAdd}"' \
|
||||
"$out/bin/winetricks"
|
||||
'';
|
||||
});
|
||||
in
|
||||
with pkgs; [
|
||||
oldwine
|
||||
oldwinetricks
|
||||
oldwine = pkgs.wineWowPackages.full;
|
||||
oldwinetricks = pkgs.winetricks.overrideAttrs (old: rec {
|
||||
pathAdd = "${oldwine}/bin:" + old.pathAdd;
|
||||
postInstall = ''
|
||||
sed -i \
|
||||
-e '2i PATH="${pathAdd}"' \
|
||||
"$out/bin/winetricks"
|
||||
'';
|
||||
});
|
||||
in
|
||||
with pkgs;
|
||||
[
|
||||
oldwine
|
||||
oldwinetricks
|
||||
|
||||
sc-controller
|
||||
sc-controller
|
||||
|
||||
tuxpaint
|
||||
extremetuxracer
|
||||
] ++ lib.optionals cfg.newWine [
|
||||
(
|
||||
pkgs.runCommand "new-wine-stuff"
|
||||
{ } ''
|
||||
mkdir -p $out/bin
|
||||
ln -s ${newwine}/bin/wine $out/bin/new-wine
|
||||
ln -s ${newwine}/bin/winecfg $out/bin/new-winecfg
|
||||
ln -s ${newwinetricks}/bin/winetricks $out/bin/new-winetricks
|
||||
''
|
||||
)
|
||||
] ++ lib.optional cfg.steamService (pkgs.writeShellScriptBin "steam" "${pkgs.systemd}/bin/systemctl --user start steam");
|
||||
tuxpaint
|
||||
extremetuxracer
|
||||
]
|
||||
++ lib.optionals cfg.newWine [
|
||||
(
|
||||
pkgs.runCommand "new-wine-stuff"
|
||||
{} ''
|
||||
mkdir -p $out/bin
|
||||
ln -s ${newwine}/bin/wine $out/bin/new-wine
|
||||
ln -s ${newwine}/bin/winecfg $out/bin/new-winecfg
|
||||
ln -s ${newwinetricks}/bin/winetricks $out/bin/new-winetricks
|
||||
''
|
||||
)
|
||||
]
|
||||
++ lib.optional cfg.steamService (pkgs.writeShellScriptBin "steam" "${pkgs.systemd}/bin/systemctl --user start steam");
|
||||
|
||||
systemd.user.services.scc = mkIf cfg.scService {
|
||||
Unit = {
|
||||
Description = "User-mode driver and GTK3 based GUI for Steam Controller";
|
||||
After = [ "graphical-session-pre.target" ];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
After = ["graphical-session-pre.target"];
|
||||
PartOf = ["graphical-session.target"];
|
||||
};
|
||||
|
||||
Service = {
|
||||
@ -89,38 +96,36 @@ in
|
||||
RestartSec = 5;
|
||||
};
|
||||
|
||||
Install = { WantedBy = [ "graphical-session.target" ]; };
|
||||
Install = {WantedBy = ["graphical-session.target"];};
|
||||
};
|
||||
|
||||
systemd.user.services.steam = mkIf cfg.steamService {
|
||||
Unit = {
|
||||
Description = "Start Steam gaming platform";
|
||||
After = [ "graphical-session-pre.target" ];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
After = ["graphical-session-pre.target"];
|
||||
PartOf = ["graphical-session.target"];
|
||||
};
|
||||
|
||||
Service = {
|
||||
Type = "simple";
|
||||
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
|
||||
/run/current-system/sw/bin/steam -fulldesktopres
|
||||
'';
|
||||
in
|
||||
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
|
||||
/run/current-system/sw/bin/steam -fulldesktopres
|
||||
'';
|
||||
in
|
||||
lib.mkIf cfg.scService "${steamStart}";
|
||||
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
|
||||
'';
|
||||
in
|
||||
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
|
||||
'';
|
||||
in
|
||||
lib.mkIf cfg.scService "${steamStop}";
|
||||
};
|
||||
|
||||
Install = { WantedBy = [ "graphical-session.target" ]; };
|
||||
Install = {WantedBy = ["graphical-session.target"];};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -1,14 +1,16 @@
|
||||
{ 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 🐸";
|
||||
|
||||
settings = lib.mkOption {
|
||||
default = { };
|
||||
default = {};
|
||||
type = with lib.types; attrsOf str;
|
||||
description = ''
|
||||
The settings that Kermit should use.
|
||||
@ -25,16 +27,20 @@ in
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
xdg.configFile."kermit.conf".text = (lib.generators.toKeyValue
|
||||
{
|
||||
mkKeyValue = lib.generators.mkKeyValueDefault { } " ";
|
||||
}
|
||||
cfg.settings) + cfg.extraConfig;
|
||||
xdg.configFile."kermit.conf".text =
|
||||
(lib.generators.toKeyValue
|
||||
{
|
||||
mkKeyValue = lib.generators.mkKeyValueDefault {} " ";
|
||||
}
|
||||
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
|
||||
'';
|
||||
})) ];
|
||||
}))
|
||||
];
|
||||
};
|
||||
}
|
||||
|
@ -1,7 +1,12 @@
|
||||
{ config, pkgs, lib, ... }: {
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
home.packages = with pkgs; [ zsh-powerlevel9k ];
|
||||
home.packages = with pkgs; [zsh-powerlevel9k];
|
||||
|
||||
programs.htop = {
|
||||
enable = true;
|
||||
@ -24,7 +29,7 @@
|
||||
"Memory"
|
||||
"Uptime"
|
||||
];
|
||||
right_meters = [ "RightCPUs" "Blank" "CPU" ];
|
||||
right_meters = ["RightCPUs" "Blank" "CPU"];
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,10 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
home.packages = with pkgs; [ zsh-powerlevel9k ];
|
||||
home.packages = with pkgs; [zsh-powerlevel9k];
|
||||
}
|
||||
|
@ -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; [
|
||||
@ -56,12 +56,12 @@ in
|
||||
"vim.ignorecase" = true;
|
||||
"vim.normalModeKeyBindings" = [
|
||||
{
|
||||
before = [ "<Tab>" ];
|
||||
commands = [ "workbench.action.nextEditorInGroup" ];
|
||||
before = ["<Tab>"];
|
||||
commands = ["workbench.action.nextEditorInGroup"];
|
||||
}
|
||||
{
|
||||
before = [ "<S-Tab>" ];
|
||||
commands = [ "workbench.action.previousEditorInGroup" ];
|
||||
before = ["<S-Tab>"];
|
||||
commands = ["workbench.action.previousEditorInGroup"];
|
||||
}
|
||||
];
|
||||
|
||||
@ -77,61 +77,63 @@ in
|
||||
"elmLS.elmReviewPath" = "${pkgs.elmPackages.elm-review}/bin/elm-review";
|
||||
"elmLS.elmFormatPath" = "${pkgs.elmPackages.elm-format}/bin/elm-format";
|
||||
|
||||
"rust-analyzer.diagnostics.disabled" = [ "unresolved-proc-macro" ];
|
||||
"rust-analyzer.diagnostics.disabled" = ["unresolved-proc-macro"];
|
||||
};
|
||||
extensions = with pkgs.vscode-extensions; [
|
||||
vscodevim.vim
|
||||
jnoortheen.nix-ide
|
||||
haskell.haskell
|
||||
justusadam.language-haskell
|
||||
dhall.dhall-lang
|
||||
dhall.vscode-dhall-lsp-server
|
||||
elmtooling.elm-ls-vscode
|
||||
kamadorueda.alejandra
|
||||
hashicorp.terraform
|
||||
(rust-lang.rust-analyzer.override {
|
||||
rust-analyzer = pkgs.writeShellScriptBin "rust-analyzer" ''
|
||||
exec rust-analyzer "$@"
|
||||
'';
|
||||
})
|
||||
] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
|
||||
{
|
||||
name = "vscode-autohide";
|
||||
publisher = "sirmspencer";
|
||||
version = "1.0.7";
|
||||
sha256 = "sha256-VaG/eTE2BGbHAYgFdS31c47rgLZVjHGK+/U8MSYKDt8=";
|
||||
}
|
||||
{
|
||||
name = "ide-purescript";
|
||||
publisher = "nwolverson";
|
||||
version = "0.25.11";
|
||||
sha256 = "sha256-9MgPAVfIdA7frR4EUDqVJB0N/LZY4NQSXtsKhEueNeg=";
|
||||
}
|
||||
{
|
||||
name = "language-purescript";
|
||||
publisher = "nwolverson";
|
||||
version = "0.2.8";
|
||||
sha256 = "sha256-2uOwCHvnlQQM8s8n7dtvIaMgpW8ROeoUraM02rncH9o=";
|
||||
}
|
||||
{
|
||||
name = "direnv";
|
||||
publisher = "mkhl";
|
||||
version = "0.6.1";
|
||||
sha256 = "sha256-5/Tqpn/7byl+z2ATflgKV1+rhdqj+XMEZNbGwDmGwLQ=";
|
||||
}
|
||||
{
|
||||
name = "vscode-test-explorer";
|
||||
publisher = "hbenl";
|
||||
version = "2.21.1";
|
||||
sha256 = "sha256-fHyePd8fYPt7zPHBGiVmd8fRx+IM3/cSBCyiI/C0VAg=";
|
||||
}
|
||||
{
|
||||
name = "test-adapter-converter";
|
||||
publisher = "ms-vscode";
|
||||
version = "0.1.6";
|
||||
sha256 = "sha256-UC8tUe+JJ3r8nb9SsPlvVXw74W75JWjMifk39JClRF4=";
|
||||
}
|
||||
];
|
||||
extensions = with pkgs.vscode-extensions;
|
||||
[
|
||||
vscodevim.vim
|
||||
jnoortheen.nix-ide
|
||||
haskell.haskell
|
||||
justusadam.language-haskell
|
||||
dhall.dhall-lang
|
||||
dhall.vscode-dhall-lsp-server
|
||||
elmtooling.elm-ls-vscode
|
||||
kamadorueda.alejandra
|
||||
hashicorp.terraform
|
||||
(rust-lang.rust-analyzer.override {
|
||||
rust-analyzer = pkgs.writeShellScriptBin "rust-analyzer" ''
|
||||
exec rust-analyzer "$@"
|
||||
'';
|
||||
})
|
||||
]
|
||||
++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
|
||||
{
|
||||
name = "vscode-autohide";
|
||||
publisher = "sirmspencer";
|
||||
version = "1.0.7";
|
||||
sha256 = "sha256-VaG/eTE2BGbHAYgFdS31c47rgLZVjHGK+/U8MSYKDt8=";
|
||||
}
|
||||
{
|
||||
name = "ide-purescript";
|
||||
publisher = "nwolverson";
|
||||
version = "0.25.11";
|
||||
sha256 = "sha256-9MgPAVfIdA7frR4EUDqVJB0N/LZY4NQSXtsKhEueNeg=";
|
||||
}
|
||||
{
|
||||
name = "language-purescript";
|
||||
publisher = "nwolverson";
|
||||
version = "0.2.8";
|
||||
sha256 = "sha256-2uOwCHvnlQQM8s8n7dtvIaMgpW8ROeoUraM02rncH9o=";
|
||||
}
|
||||
{
|
||||
name = "direnv";
|
||||
publisher = "mkhl";
|
||||
version = "0.6.1";
|
||||
sha256 = "sha256-5/Tqpn/7byl+z2ATflgKV1+rhdqj+XMEZNbGwDmGwLQ=";
|
||||
}
|
||||
{
|
||||
name = "vscode-test-explorer";
|
||||
publisher = "hbenl";
|
||||
version = "2.21.1";
|
||||
sha256 = "sha256-fHyePd8fYPt7zPHBGiVmd8fRx+IM3/cSBCyiI/C0VAg=";
|
||||
}
|
||||
{
|
||||
name = "test-adapter-converter";
|
||||
publisher = "ms-vscode";
|
||||
version = "0.1.6";
|
||||
sha256 = "sha256-UC8tUe+JJ3r8nb9SsPlvVXw74W75JWjMifk39JClRF4=";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
programs.neovim = {
|
||||
@ -178,10 +180,11 @@ in
|
||||
pname = "firenvim";
|
||||
src = inputs.firenvim;
|
||||
# yes im stupid
|
||||
version = builtins.readFile (pkgs.runCommand "firenvim-version" { } ''
|
||||
version = builtins.readFile (pkgs.runCommand "firenvim-version" {} ''
|
||||
${pkgs.jq}/bin/jq -j .version < ${inputs.firenvim}/package.json > $out
|
||||
'');
|
||||
})
|
||||
}
|
||||
)
|
||||
vim-gitgutter
|
||||
];
|
||||
extraConfig = ''
|
||||
@ -219,7 +222,7 @@ in
|
||||
|
||||
ezfonts.font = {
|
||||
name = "Anonymice Nerd Font";
|
||||
package = pkgs.nerdfonts.override { fonts = [ "AnonymousPro" ]; };
|
||||
package = pkgs.nerdfonts.override {fonts = ["AnonymousPro"];};
|
||||
size = 11;
|
||||
};
|
||||
|
||||
@ -268,6 +271,6 @@ in
|
||||
lfs.enable = true;
|
||||
userName = "notgne2";
|
||||
userEmail = "gen2@gen2.space";
|
||||
ignores = [ ".envrc" ];
|
||||
ignores = [".envrc"];
|
||||
};
|
||||
}
|
||||
|
@ -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";
|
||||
|
||||
@ -13,7 +18,7 @@ in {
|
||||
|
||||
i18n.inputMethod = {
|
||||
enabled = "ibus";
|
||||
ibus.engines = with pkgs.ibus-engines; [ typing-booster uniemoji ];
|
||||
ibus.engines = with pkgs.ibus-engines; [typing-booster uniemoji];
|
||||
};
|
||||
|
||||
services.xserver = {
|
||||
@ -26,13 +31,17 @@ in {
|
||||
services.power-profiles-daemon.enable = lib.mkDefault false;
|
||||
|
||||
# for KDE connect
|
||||
networking.firewall.allowedTCPPortRanges = [{
|
||||
from = 1714;
|
||||
to = 1764;
|
||||
}];
|
||||
networking.firewall.allowedUDPPortRanges = [{
|
||||
from = 1714;
|
||||
to = 1764;
|
||||
}];
|
||||
networking.firewall.allowedTCPPortRanges = [
|
||||
{
|
||||
from = 1714;
|
||||
to = 1764;
|
||||
}
|
||||
];
|
||||
networking.firewall.allowedUDPPortRanges = [
|
||||
{
|
||||
from = 1714;
|
||||
to = 1764;
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
@ -1,13 +1,18 @@
|
||||
{ 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";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
i18n.inputMethod = {
|
||||
enabled = "ibus";
|
||||
ibus.engines = with pkgs.ibus-engines; [ typing-booster uniemoji ];
|
||||
ibus.engines = with pkgs.ibus-engines; [typing-booster uniemoji];
|
||||
};
|
||||
|
||||
xdg.portal.enable = lib.mkDefault true;
|
||||
@ -27,13 +32,17 @@ in {
|
||||
services.power-profiles-daemon.enable = lib.mkDefault false;
|
||||
|
||||
# for KDE connect
|
||||
networking.firewall.allowedTCPPortRanges = [{
|
||||
from = 1714;
|
||||
to = 1764;
|
||||
}];
|
||||
networking.firewall.allowedUDPPortRanges = [{
|
||||
from = 1714;
|
||||
to = 1764;
|
||||
}];
|
||||
networking.firewall.allowedTCPPortRanges = [
|
||||
{
|
||||
from = 1714;
|
||||
to = 1764;
|
||||
}
|
||||
];
|
||||
networking.firewall.allowedUDPPortRanges = [
|
||||
{
|
||||
from = 1714;
|
||||
to = 1764;
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
./ezwg.nix
|
||||
./kiosk.nix
|
||||
|
@ -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 {
|
||||
@ -26,11 +32,11 @@ in {
|
||||
"vfio"
|
||||
];
|
||||
|
||||
boot.kernelParams = [ "intel_iommu=on" "amd_iommu=on" "pcie_aspm=off" ];
|
||||
boot.kernelParams = ["intel_iommu=on" "amd_iommu=on" "pcie_aspm=off"];
|
||||
|
||||
boot.extraModprobeConfig = "options vfio-pci ids=${
|
||||
builtins.concatStringsSep "," (builtins.attrNames cfg.PCIs)
|
||||
}";
|
||||
builtins.concatStringsSep "," (builtins.attrNames cfg.PCIs)
|
||||
}";
|
||||
|
||||
boot.postBootCommands = ''
|
||||
DEVS="${builtins.concatStringsSep " " (builtins.attrValues cfg.PCIs)}"
|
||||
|
139
modules/ezpw.nix
139
modules/ezpw.nix
@ -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;
|
||||
|
||||
@ -71,26 +76,26 @@ in {
|
||||
"rt.time.soft" = 200000;
|
||||
"rt.time.hard" = 200000;
|
||||
};
|
||||
flags = [ "ifexists" "nofail" ];
|
||||
flags = ["ifexists" "nofail"];
|
||||
}
|
||||
{ name = "libpipewire-module-protocol-native"; }
|
||||
{ name = "libpipewire-module-profiler"; }
|
||||
{ name = "libpipewire-module-metadata"; }
|
||||
{ name = "libpipewire-module-spa-device-factory"; }
|
||||
{ name = "libpipewire-module-spa-node-factory"; }
|
||||
{ name = "libpipewire-module-client-node"; }
|
||||
{ name = "libpipewire-module-client-device"; }
|
||||
{name = "libpipewire-module-protocol-native";}
|
||||
{name = "libpipewire-module-profiler";}
|
||||
{name = "libpipewire-module-metadata";}
|
||||
{name = "libpipewire-module-spa-device-factory";}
|
||||
{name = "libpipewire-module-spa-node-factory";}
|
||||
{name = "libpipewire-module-client-node";}
|
||||
{name = "libpipewire-module-client-device";}
|
||||
{
|
||||
name = "libpipewire-module-portal";
|
||||
flags = [ "ifexists" "nofail" ];
|
||||
flags = ["ifexists" "nofail"];
|
||||
}
|
||||
{
|
||||
name = "libpipewire-module-access";
|
||||
args = { };
|
||||
args = {};
|
||||
}
|
||||
{ name = "libpipewire-module-adapter"; }
|
||||
{ name = "libpipewire-module-link-factory"; }
|
||||
{ name = "libpipewire-module-session-manager"; }
|
||||
{name = "libpipewire-module-adapter";}
|
||||
{name = "libpipewire-module-link-factory";}
|
||||
{name = "libpipewire-module-session-manager";}
|
||||
];
|
||||
};
|
||||
|
||||
@ -104,19 +109,19 @@ in {
|
||||
"rt.time.soft" = 200000;
|
||||
"rt.time.hard" = 200000;
|
||||
};
|
||||
flags = [ "ifexists" "nofail" ];
|
||||
flags = ["ifexists" "nofail"];
|
||||
}
|
||||
{ name = "libpipewire-module-protocol-native"; }
|
||||
{ name = "libpipewire-module-client-node"; }
|
||||
{ name = "libpipewire-module-adapter"; }
|
||||
{ name = "libpipewire-module-metadata"; }
|
||||
{name = "libpipewire-module-protocol-native";}
|
||||
{name = "libpipewire-module-client-node";}
|
||||
{name = "libpipewire-module-adapter";}
|
||||
{name = "libpipewire-module-metadata";}
|
||||
{
|
||||
name = "libpipewire-module-protocol-pulse";
|
||||
args = {
|
||||
"pulse.min.req" = qr;
|
||||
"pulse.default.req" = qr;
|
||||
"pulse.min.quantum" = qr;
|
||||
"server.address" = [ "unix:native" ];
|
||||
"server.address" = ["unix:native"];
|
||||
};
|
||||
}
|
||||
];
|
||||
@ -129,65 +134,75 @@ in {
|
||||
};
|
||||
|
||||
media-session.config.alsa-monitor = mkIf cfg.lowLatency {
|
||||
rules = [{
|
||||
matches = [{ node.name = "alsa_output.*"; }];
|
||||
actions = {
|
||||
update-props = {
|
||||
"audio.format" = "S32LE";
|
||||
"audio.rate" = cfg.rate * (if cfg.usbSoundcard then 2 else 1);
|
||||
"api.alsa.period-size" = cfg.periodSize;
|
||||
rules = [
|
||||
{
|
||||
matches = [{node.name = "alsa_output.*";}];
|
||||
actions = {
|
||||
update-props = {
|
||||
"audio.format" = "S32LE";
|
||||
"audio.rate" =
|
||||
cfg.rate
|
||||
* (
|
||||
if cfg.usbSoundcard
|
||||
then 2
|
||||
else 1
|
||||
);
|
||||
"api.alsa.period-size" = cfg.periodSize;
|
||||
};
|
||||
};
|
||||
};
|
||||
}];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
media-session.config.bluez-monitor = {
|
||||
properties = {
|
||||
"bluez5.codecs" = [ "sbc" "aac" "ldac" "aptx" "aptx_hd" ];
|
||||
"bluez5.codecs" = ["sbc" "aac" "ldac" "aptx" "aptx_hd"];
|
||||
"bluez5.mdbc-support" = true;
|
||||
};
|
||||
rules = [
|
||||
{
|
||||
actions = {
|
||||
update-props = {
|
||||
"bluez5.auto-connect" = [ "hsp_hs" "hfp_hf" "a2dp_sink" ];
|
||||
"bluez5.hw-volume" =
|
||||
[ "hsp_ag" "hfp_ag" "a2dp_source" "a2dp_sink" ];
|
||||
"bluez5.auto-connect" = ["hsp_hs" "hfp_hf" "a2dp_sink"];
|
||||
"bluez5.hw-volume" = ["hsp_ag" "hfp_ag" "a2dp_source" "a2dp_sink"];
|
||||
"bluez5.autoswitch-profile" = true;
|
||||
};
|
||||
};
|
||||
matches = [{ "device.name" = "~bluez_card.*"; }];
|
||||
matches = [{"device.name" = "~bluez_card.*";}];
|
||||
}
|
||||
{
|
||||
actions = { update-props = { "node.pause-on-idle" = false; }; };
|
||||
actions = {update-props = {"node.pause-on-idle" = false;};};
|
||||
matches = [
|
||||
{ "node.name" = "~bluez_input.*"; }
|
||||
{ "node.name" = "~bluez_output.*"; }
|
||||
{"node.name" = "~bluez_input.*";}
|
||||
{"node.name" = "~bluez_output.*";}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs;
|
||||
[
|
||||
# pactl is required for pipewire-pulse
|
||||
pulseaudio
|
||||
];
|
||||
environment.systemPackages = with pkgs; [
|
||||
# pactl is required for pipewire-pulse
|
||||
pulseaudio
|
||||
];
|
||||
|
||||
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))
|
||||
},
|
||||
["audio.format"] = "S32LE",
|
||||
["api.alsa.headroom"] = 512,
|
||||
["api.alsa.period-size"] = ${toString cfg.periodSize}
|
||||
}
|
||||
'';
|
||||
};
|
||||
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
|
||||
))
|
||||
},
|
||||
["audio.format"] = "S32LE",
|
||||
["api.alsa.headroom"] = 512,
|
||||
["api.alsa.period-size"] = ${toString cfg.periodSize}
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
environment.etc."wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = ''
|
||||
bluez_monitor.properties = {
|
||||
|
147
modules/ezwg.nix
147
modules/ezwg.nix
@ -1,9 +1,13 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.services.ezwg;
|
||||
|
||||
peerNameReplacement = lib.replaceChars [ "/" "-" " " "+" "=" ] [
|
||||
peerNameReplacement = lib.replaceChars ["/" "-" " " "+" "="] [
|
||||
"-"
|
||||
"\\x2d"
|
||||
"\\x20"
|
||||
@ -11,35 +15,31 @@ let
|
||||
"\\x3d"
|
||||
];
|
||||
|
||||
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')]
|
||||
for serverNetwork in serverNetworks:
|
||||
ranges = map(lambda r: list(r.address_exclude(serverNetwork)), ranges)
|
||||
print(':'.join(ranges))
|
||||
'';
|
||||
rangesOutput = pkgs.runCommand "exclusionary-wildcard-ranges" { } ''
|
||||
${pkgs.python3}/bin/python3 ${generateRangesScript} > $out
|
||||
'';
|
||||
in
|
||||
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')]
|
||||
for serverNetwork in serverNetworks:
|
||||
ranges = map(lambda r: list(r.address_exclude(serverNetwork)), ranges)
|
||||
print(':'.join(ranges))
|
||||
'';
|
||||
rangesOutput = pkgs.runCommand "exclusionary-wildcard-ranges" {} ''
|
||||
${pkgs.python3}/bin/python3 ${generateRangesScript} > $out
|
||||
'';
|
||||
in
|
||||
lib.splitString ":" (builtins.readFile "${rangesOutput}");
|
||||
|
||||
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="")
|
||||
'';
|
||||
subnetOutput = pkgs.runCommand "subnet-without-host-bits" { } ''
|
||||
${pkgs.python3}/bin/python3 ${generateSubnetScript} > $out
|
||||
'';
|
||||
in
|
||||
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="")
|
||||
'';
|
||||
subnetOutput = pkgs.runCommand "subnet-without-host-bits" {} ''
|
||||
${pkgs.python3}/bin/python3 ${generateSubnetScript} > $out
|
||||
'';
|
||||
in
|
||||
builtins.readFile "${subnetOutput}";
|
||||
|
||||
serverOpts.options = {
|
||||
@ -61,7 +61,7 @@ let
|
||||
instanceOpts.options = {
|
||||
servers = mkOption {
|
||||
description = "Configuration of servers to connect to";
|
||||
default = { };
|
||||
default = {};
|
||||
type = with types; listOf (submodule serverOpts);
|
||||
};
|
||||
autoStart = mkOption {
|
||||
@ -88,13 +88,12 @@ let
|
||||
description = "The IP to use on the wg VLAN";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.services.ezwg = {
|
||||
enable = mkEnableOption "Enable simple Wireguard connection";
|
||||
instances = mkOption {
|
||||
description = "Configuration of instances of Wireguard";
|
||||
default = { };
|
||||
default = {};
|
||||
type = with types; attrsOf (submodule instanceOpts);
|
||||
};
|
||||
};
|
||||
@ -102,49 +101,59 @@ 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
|
||||
(server: {
|
||||
name =
|
||||
"wireguard-${instName}-peer${peerNameReplacement server.publicKey}";
|
||||
value = if inst.autoStart then { } else { wantedBy = mkForce [ ]; };
|
||||
})
|
||||
inst.servers)
|
||||
[
|
||||
{
|
||||
name = "wireguard-${instName}";
|
||||
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 [];};
|
||||
})
|
||||
inst.servers)
|
||||
cfg.instances));
|
||||
|
||||
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
|
||||
{
|
||||
ips = [ "${inst.vlanIP}/${toString inst.vlanSize}" ];
|
||||
privateKeyFile = inst.privateKeyFile;
|
||||
peers = map
|
||||
(server: {
|
||||
inherit allowedIPs;
|
||||
publicKey = server.publicKey;
|
||||
endpoint = "${server.ip}:${toString server.port}";
|
||||
persistentKeepalive = 25;
|
||||
})
|
||||
inst.servers;
|
||||
})
|
||||
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 {
|
||||
ips = ["${inst.vlanIP}/${toString inst.vlanSize}"];
|
||||
privateKeyFile = inst.privateKeyFile;
|
||||
peers =
|
||||
map
|
||||
(server: {
|
||||
inherit allowedIPs;
|
||||
publicKey = server.publicKey;
|
||||
endpoint = "${server.ip}:${toString server.port}";
|
||||
persistentKeepalive = 25;
|
||||
})
|
||||
inst.servers;
|
||||
})
|
||||
cfg.instances;
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -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 // {
|
||||
platforms = super.meta.platforms ++ [ "x86_64-linux" ];
|
||||
};
|
||||
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 {
|
||||
@ -101,6 +107,6 @@ in
|
||||
hplipWithPlugin
|
||||
];
|
||||
};
|
||||
services.udev.packages = [ pkgs.utsushi ];
|
||||
services.udev.packages = [pkgs.utsushi];
|
||||
};
|
||||
}
|
||||
|
@ -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,21 +65,26 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
displayManager.xserverArgs = if cfg.cursor then [ ] else [ "-nocursor" ];
|
||||
displayManager.xserverArgs =
|
||||
if cfg.cursor
|
||||
then []
|
||||
else ["-nocursor"];
|
||||
displayManager.defaultSession = "kiosk+ratpoison";
|
||||
|
||||
desktopManager.session = [{
|
||||
name = "kiosk";
|
||||
start = ''
|
||||
# dont blank the screen after 5min
|
||||
xset dpms force on
|
||||
xset -dpms
|
||||
xset s noblank
|
||||
xset s off
|
||||
desktopManager.session = [
|
||||
{
|
||||
name = "kiosk";
|
||||
start = ''
|
||||
# dont blank the screen after 5min
|
||||
xset dpms force on
|
||||
xset -dpms
|
||||
xset s noblank
|
||||
xset s off
|
||||
|
||||
${cfg.session}
|
||||
'';
|
||||
}];
|
||||
${cfg.session}
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -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";
|
||||
@ -105,7 +110,7 @@ in {
|
||||
# Optimizes running games
|
||||
programs.gamemode = {
|
||||
enable = lib.mkDefault true;
|
||||
settings = { general.renice = 10; };
|
||||
settings = {general.renice = 10;};
|
||||
};
|
||||
|
||||
# Allows realtime stuff, useful for games, audio etc
|
||||
@ -175,14 +180,18 @@ in {
|
||||
"lp"
|
||||
];
|
||||
|
||||
subUidRanges = [{
|
||||
startUid = 100000;
|
||||
count = 65536;
|
||||
}];
|
||||
subGidRanges = [{
|
||||
startGid = 100000;
|
||||
count = 65536;
|
||||
}];
|
||||
subUidRanges = [
|
||||
{
|
||||
startUid = 100000;
|
||||
count = 65536;
|
||||
}
|
||||
];
|
||||
subGidRanges = [
|
||||
{
|
||||
startGid = 100000;
|
||||
count = 65536;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# brightness
|
||||
@ -258,7 +267,7 @@ in {
|
||||
|
||||
# Shit breaks without this lol
|
||||
programs.dconf.enable = lib.mkDefault true;
|
||||
services.dbus.packages = with pkgs; [ dconf ];
|
||||
services.dbus.packages = with pkgs; [dconf];
|
||||
|
||||
boot.kernel.sysctl = {
|
||||
# better default swap
|
||||
|
@ -1,6 +1,9 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
users.users.chekkie = {
|
||||
isNormalUser = true;
|
||||
useDefaultShell = true;
|
||||
|
@ -1,6 +1,9 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
# config for me
|
||||
users.users.glooder = {
|
||||
isNormalUser = true;
|
||||
|
@ -1,7 +1,10 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
nix.trustedUsers = [ "notgne2" ];
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
nix.trustedUsers = ["notgne2"];
|
||||
|
||||
users.users.notgne2 = {
|
||||
isNormalUser = true;
|
||||
|
Loading…
Reference in New Issue
Block a user