mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 20:39:18 -08:00
feat: clean up the repo
This commit is contained in:
parent
bc9c310c77
commit
f6ec9f37eb
249 changed files with 804 additions and 13048 deletions
|
|
@ -1,234 +0,0 @@
|
|||
{ config, pkgs, lib, ... }: let
|
||||
inherit (lib.types) bool enum str int submodule oneOf attrsOf listOf package;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.strings) optionalString concatStringsSep toUpper hasInfix;
|
||||
inherit (lib.attrsets) mapAttrsToList mapAttrs attrValues;
|
||||
inherit (pkgs.stdenv) mkDerivation;
|
||||
inherit (lib.modules) mkIf mkDefault;
|
||||
cfg = config.base16.gtk.settings;
|
||||
bcfg = config.base16.gtk;
|
||||
in {
|
||||
options = {
|
||||
base16.gtk = {
|
||||
enable = mkEnableOption "Enable GTK theme generation";
|
||||
packages = {
|
||||
icons = mkOption {
|
||||
type = attrsOf package;
|
||||
};
|
||||
themes = mkOption {
|
||||
type = attrsOf package;
|
||||
};
|
||||
};
|
||||
settings = mkOption {
|
||||
type = attrsOf (submodule {
|
||||
freeformType = attrsOf (oneOf [bool str int]);
|
||||
options = {
|
||||
name = mkOption {
|
||||
description = "Name of the theme";
|
||||
type = str;
|
||||
default = ''"${config.base16.defaultSchemeName}"'';
|
||||
};
|
||||
theme_style = mkOption {
|
||||
description = "What GTK theme do we use as the base for generating the resulting base16 GTK theme";
|
||||
type = enum ["materia" "oomox"];
|
||||
default = "oomox";
|
||||
};
|
||||
roundness = mkOption {
|
||||
description = "GTK theme roundness";
|
||||
type = int;
|
||||
default = 2;
|
||||
};
|
||||
spacing = mkOption {
|
||||
description = "GTK theme spacing";
|
||||
type = int;
|
||||
default = 3;
|
||||
};
|
||||
outline_width = mkOption {
|
||||
description = "GTK outline width";
|
||||
type = int;
|
||||
default = 1;
|
||||
};
|
||||
button_outline_offset = mkOption {
|
||||
description = "GTK theme button outline offset";
|
||||
type = int;
|
||||
default = -3;
|
||||
};
|
||||
button_outline_width = mkOption {
|
||||
description = "GTK theme button outline width";
|
||||
type = int;
|
||||
default = 1;
|
||||
};
|
||||
icon_style = mkOption {
|
||||
description = "What icon theme do we use as the base for generating the resulting base16 color templated icon theme";
|
||||
type = enum ["numix" "archdroid" "gnomecolors" "papirus" "suruplus" "suruplus_aspromauros"];
|
||||
default = "archdroid";
|
||||
};
|
||||
numix_style = mkOption {
|
||||
description = "If you chose numix for base16.gtk.icons, this chooses the Numix icon theme sub-style";
|
||||
type = enum [ 0 1 2 3 4 5 ];
|
||||
default = 0;
|
||||
};
|
||||
suruplus_gradient_enabled = mkOption {
|
||||
description = "If you chose suruplus for base16.gtk.icons, this chooses to enable the gradient on it";
|
||||
type = bool;
|
||||
default = false;
|
||||
};
|
||||
base16_generate_dark = mkOption {
|
||||
description = "Choose whether to invert the GUI colours";
|
||||
type = bool;
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
};
|
||||
};
|
||||
config = mkIf bcfg.enable (let
|
||||
oomoxPath = "${pkgs.oomox}/lib/share/oomox/plugins";
|
||||
iconPathSelector = icon_style: {
|
||||
archdroid = "icons_archdroid/archdroid-icon-theme/change_color.sh";
|
||||
gnomecolors = "icons_gnomecolors/gnome-colors-icon-theme/change_color.sh";
|
||||
}.${icon_style} or "icons_${icon_style}/change_color.sh";
|
||||
themePathSelector = theme_style: {
|
||||
materia = "theme_materia/materia-theme/change_color.sh";
|
||||
}.${theme_style} or "theme_${theme_style}/change_color.sh";
|
||||
iconsTheme = icon_style: {
|
||||
numix = "numix_icons";
|
||||
suruplus = "icons_suru";
|
||||
suruplus_aspromauros = "icons_suruplus_aspromauros";
|
||||
archdroid = "archdroid";
|
||||
gnomecolors = "gnome_colors";
|
||||
papirus = "papirus_icons";
|
||||
}.${icon_style};
|
||||
configForScheme = schemeName: scheme: let
|
||||
schemeSettings = cfg.${schemeName} or cfg.default;
|
||||
keyValues = mapAttrsToList (k: v: let
|
||||
typeHandler = {
|
||||
"string" = if hasInfix "base" v then scheme.${v}.hex else v;
|
||||
"bool" = if v == true then "True" else "False";
|
||||
"int" = toString v;
|
||||
}.${builtins.typeOf v};
|
||||
keyHandler = {
|
||||
"icon_style" = iconsTheme v;
|
||||
}.${k} or typeHandler;
|
||||
in "${toUpper k}=${keyHandler}") schemeSettings;
|
||||
in ''
|
||||
${concatStringsSep "\n" keyValues}
|
||||
'';
|
||||
configForSchemes = mapAttrs configForScheme config.base16.schemes;
|
||||
configFilesForSchemes = mapAttrs (k: v: pkgs.writeText "oomox-config-${k}" v) configForSchemes;
|
||||
iconPackageForScheme = schemeName: schemeConfigFile: let
|
||||
schemeConfig = cfg.${schemeName} or cfg.default;
|
||||
in with pkgs; mkDerivation rec {
|
||||
name = "icons-${cfg.${schemeName}.icon_style or cfg.default.icon_style}-${schemeName}";
|
||||
src = fetchFromGitHub {
|
||||
owner = "themix-project";
|
||||
repo = "oomox";
|
||||
rev = "1.14";
|
||||
sha256 = "0zk2q0z0n64kl6my60vkq11gp4mc442jxqcwbi4kl108242izpjv";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
nativeBuildInputs = [ glib libxml2 bc ];
|
||||
buildInputs = [ gnome.gnome-themes-extra gdk-pixbuf librsvg pkgs.sassc pkgs.inkscape pkgs.optipng ];
|
||||
propagatedUserEnvPkgs = [ gtk-engine-murrine ];
|
||||
installPhase = ''
|
||||
export HOME=./
|
||||
mkdir -p ./.icons
|
||||
patchShebangs plugins/${iconPathSelector schemeConfig.icon_style}
|
||||
plugins/${iconPathSelector schemeConfig.icon_style} ${schemeConfigFile} \
|
||||
-o ${schemeConfig.icon_style}-$name
|
||||
mkdir -p $out/share/icons/${schemeConfig.icon_style}-$name
|
||||
mv ./.icons/* $out/share/icons
|
||||
'';
|
||||
};
|
||||
themePackageForScheme = schemeName: schemeConfigFile: let
|
||||
schemeConfig = cfg.${schemeName} or cfg.default;
|
||||
in with pkgs; mkDerivation rec {
|
||||
name = "theme-${cfg.${schemeName}.theme_style or cfg.default.theme_style}-${schemeName}";
|
||||
src = fetchFromGitHub {
|
||||
owner = "themix-project";
|
||||
repo = "oomox";
|
||||
rev = "1.14";
|
||||
sha256 = "0zk2q0z0n64kl6my60vkq11gp4mc442jxqcwbi4kl108242izpjv";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
nativeBuildInputs = [ glib libxml2 bc ];
|
||||
buildInputs = [ gnome.gnome-themes-extra gdk-pixbuf librsvg pkgs.sassc pkgs.inkscape pkgs.optipng ];
|
||||
propagatedUserEnvPkgs = [ gtk-engine-murrine ];
|
||||
installPhase = ''
|
||||
export HOME=./
|
||||
mkdir -p $out/share/themes/${schemeConfig.theme_style}-$name
|
||||
patchShebangs plugins/theme_${schemeConfig.theme_style}
|
||||
plugins/${themePathSelector schemeConfig.theme_style} \
|
||||
--hidpi False -t $out/share/themes -m all --output ${schemeConfig.theme_style}-$name ${schemeConfigFile}
|
||||
'';
|
||||
};
|
||||
themePackagesForSchemes = mapAttrs (k: v: themePackageForScheme k v) configFilesForSchemes;
|
||||
iconPackagesForSchemes = mapAttrs (k: v: iconPackageForScheme k v) configFilesForSchemes;
|
||||
in {
|
||||
base16.gtk = {
|
||||
packages = {
|
||||
themes = themePackagesForSchemes;
|
||||
icons = iconPackagesForSchemes;
|
||||
};
|
||||
settings.default = mapAttrs (_: mkDefault) {
|
||||
base16_invert_terminal = false;
|
||||
base16_mild_terminal = false;
|
||||
terminal_theme_accuracy = 128;
|
||||
terminal_theme_auto_bgfg = true;
|
||||
terminal_theme_extend_palette = false;
|
||||
terminal_theme_mode = "manual";
|
||||
unity_default_launcher_style = false;
|
||||
suruplus_gradient1 = "3623c";
|
||||
suruplus_gradient2 = "base0E";
|
||||
caret1_fg = "base07";
|
||||
caret2_fg = "base07";
|
||||
terminal_background = "base00";
|
||||
terminal_foreground = "base05";
|
||||
terminal_cursor = "base05";
|
||||
terminal_color0 = "base01";
|
||||
terminal_color1 = "base08";
|
||||
terminal_color2 = "base0B";
|
||||
terminal_color3 = "base09";
|
||||
terminal_color4 = "base0D";
|
||||
terminal_color5 = "base0E";
|
||||
terminal_color6 = "base0C";
|
||||
terminal_color7 = "base06";
|
||||
terminal_color8 = "base02";
|
||||
terminal_color9 = "base08";
|
||||
terminal_color10 = "base0B";
|
||||
terminal_color11 = "base0A";
|
||||
terminal_color12 = "base0D";
|
||||
terminal_color13 = "base0E";
|
||||
terminal_color14 = "base0C";
|
||||
terminal_color15 = "base07";
|
||||
bg = "base01";
|
||||
fg = "base06";
|
||||
hdr_bg = "base00";
|
||||
hdr_fg = "base05";
|
||||
sel_bg = "base0E";
|
||||
sel_fg = "base00";
|
||||
accent_bg = "base0E";
|
||||
txt_bg = "base02";
|
||||
txt_fg = "base07";
|
||||
btn_bg = "base00";
|
||||
btn_fg = "base05";
|
||||
hdr_btn_bg = "base01";
|
||||
hdr_btn_fg = "base05";
|
||||
wm_border_focus = "base0E";
|
||||
wm_border_unfocus = "base00";
|
||||
spotify_proto_bg = "base00";
|
||||
spotify_proto_fg = "base05";
|
||||
spotify_proto_sel = "base0E";
|
||||
icons_light_folder = "base0D";
|
||||
icons_light = "base0D";
|
||||
icons_medium = "base0E";
|
||||
icons_dark = "base00";
|
||||
icons_symbolic_panel = "base06";
|
||||
icons_symbolic_action = "3623c";
|
||||
icons_archdroid = "base0E";
|
||||
};
|
||||
};
|
||||
home.packages = (attrValues iconPackagesForSchemes) ++ (attrValues themePackagesForSchemes);
|
||||
});
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
/*
|
||||
This module:
|
||||
* Provides in-scope TF config for home-manager.
|
||||
*/
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.deploy.tf;
|
||||
unmergedValues = types.mkOptionType {
|
||||
name = "unmergedValues";
|
||||
merge = loc: defs: map (def: def.value) defs;
|
||||
};
|
||||
in
|
||||
{
|
||||
|
||||
options.deploy.tf = mkOption {
|
||||
type = types.submodule {
|
||||
freeformType = types.attrsOf unmergedValues;
|
||||
|
||||
options = {
|
||||
attrs = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
};
|
||||
out.set = mkOption { type = types.unspecified; };
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
config = {
|
||||
deploy.tf = {
|
||||
attrs = [ "out" "attrs" ];
|
||||
out.set = removeAttrs cfg cfg.attrs;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
{ config, lib, nixos, ... }: with lib; {
|
||||
options.hardware.displays = mkOption {
|
||||
type = with types; attrsOf (submodule ({ config, ... }: {
|
||||
options = {
|
||||
pos = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
res = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
}));
|
||||
};
|
||||
config = mkMerge [
|
||||
{
|
||||
hardware.displays = nixos.hardware.displays;
|
||||
}
|
||||
(mkIf config.wayland.windowManager.sway.enable {
|
||||
wayland.windowManager.sway.config.output = config.hardware.displays;
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let cfg = config.network.firewall;
|
||||
in
|
||||
{
|
||||
options.network.firewall = {
|
||||
public.tcp.ports = mkOption {
|
||||
type = types.listOf types.port;
|
||||
default = [ ];
|
||||
};
|
||||
public.udp.ports = mkOption {
|
||||
type = types.listOf types.port;
|
||||
default = [ ];
|
||||
};
|
||||
private.tcp.ports = mkOption {
|
||||
type = types.listOf types.port;
|
||||
default = [ ];
|
||||
};
|
||||
private.udp.ports = mkOption {
|
||||
type = types.listOf types.port;
|
||||
default = [ ];
|
||||
};
|
||||
|
||||
public.tcp.ranges = mkOption {
|
||||
type = types.listOf (types.attrsOf types.port);
|
||||
default = [ ];
|
||||
};
|
||||
public.udp.ranges = mkOption {
|
||||
type = types.listOf (types.attrsOf types.port);
|
||||
default = [ ];
|
||||
};
|
||||
private.tcp.ranges = mkOption {
|
||||
type = types.listOf (types.attrsOf types.port);
|
||||
default = [ ];
|
||||
};
|
||||
private.udp.ranges = mkOption {
|
||||
type = types.listOf (types.attrsOf types.port);
|
||||
default = [ ];
|
||||
};
|
||||
|
||||
public.interfaces = mkOption {
|
||||
type = types.listOf types.str;
|
||||
description = "Public firewall interfaces";
|
||||
default = [ ];
|
||||
};
|
||||
private.interfaces = mkOption {
|
||||
type = types.listOf types.str;
|
||||
description = "Private firewall interfaces";
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
{ config, nixos, ... }: {
|
||||
secrets.repo = nixos.secrets.repo;
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
{ config, lib, pkgs, ... }: with lib;
|
||||
|
||||
let cfg = config.programs.swaylock; in
|
||||
{
|
||||
options.programs.swaylock = {
|
||||
colors = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = { };
|
||||
};
|
||||
};
|
||||
config.programs.swaylock.settings = mapAttrs' (arg: color: nameValuePair ("${arg}-color") (removePrefix "#" color)) cfg.colors;
|
||||
}
|
||||
|
|
@ -1,161 +0,0 @@
|
|||
{ meta, config, pkgs, lib, ... }:
|
||||
|
||||
/*
|
||||
This module:
|
||||
* provides a central way to change the font my system uses.
|
||||
*/
|
||||
|
||||
with lib;
|
||||
|
||||
let cfg = config.nixfiles.theme; in
|
||||
{
|
||||
imports = with meta; [
|
||||
modules.home.swaylock
|
||||
];
|
||||
options.nixfiles.theme = {
|
||||
enable = mkEnableOption "kat's theme module";
|
||||
sass = {
|
||||
variables = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = (cfg.base16 // cfg.base16t // {
|
||||
term_font = cfg.font.termName;
|
||||
font = cfg.font.name;
|
||||
font_size = cfg.font.size_css;
|
||||
});
|
||||
};
|
||||
css_style = mkOption {
|
||||
type = types.enum [ "nested" "compressed" "compact" "expanded" ];
|
||||
default = "expanded";
|
||||
};
|
||||
};
|
||||
swaylock = mkEnableOption "use swaylock module";
|
||||
base16 = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
};
|
||||
base16t = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
};
|
||||
alpha = mkOption {
|
||||
type = types.float;
|
||||
};
|
||||
font = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
default = "Iosevka Nerd Font";
|
||||
};
|
||||
termName = mkOption {
|
||||
type = types.str;
|
||||
default = "Iosevka Nerd Font";
|
||||
};
|
||||
size = mkOption {
|
||||
type = types.float;
|
||||
default = 10.0;
|
||||
};
|
||||
size_css = mkOption {
|
||||
type = types.str;
|
||||
default = "${toString (cfg.font.size + 3)}px";
|
||||
};
|
||||
};
|
||||
};
|
||||
config = mkIf (cfg.enable) {
|
||||
nixfiles.theme = {
|
||||
base16 = lib.mapAttrs' (k: v: lib.nameValuePair k "#${v.hex}")
|
||||
(lib.filterAttrs (n: _: lib.hasInfix "base" n) config.base16.defaultScheme);
|
||||
base16t = lib.mapAttrs' (k: v: lib.nameValuePair "${k}t" "rgba(${toString v.red.byte}, ${toString v.green.byte}, ${toString v.blue.byte}, ${toString cfg.alpha})")
|
||||
(lib.filterAttrs (n: _: lib.hasInfix "base" n) config.base16.defaultScheme);
|
||||
alpha = 0.7;
|
||||
};
|
||||
|
||||
programs.swaylock = mkIf (cfg.swaylock) {
|
||||
enable = true;
|
||||
package = pkgs.swaylock-effects-develop;
|
||||
settings = {
|
||||
screenshots = true;
|
||||
daemonize = true;
|
||||
show-failed-attempts = true;
|
||||
indicator = true;
|
||||
indicator-radius = 110;
|
||||
indicator-thickness = 8;
|
||||
font = cfg.font.name;
|
||||
font-size = cfg.font.size_css;
|
||||
clock = true;
|
||||
datestr = "%F";
|
||||
timestr = "%T";
|
||||
effect-blur = "5x2";
|
||||
fade-in = 0.2;
|
||||
};
|
||||
colors = with cfg.base16; {
|
||||
key-hl = base0C;
|
||||
separator = base01;
|
||||
line = base01;
|
||||
line-clear = base01;
|
||||
line-caps-lock = base01;
|
||||
line-ver = base01;
|
||||
line-wrong = base01;
|
||||
ring = base00;
|
||||
ring-clear = base0B;
|
||||
ring-caps-lock = base09;
|
||||
ring-ver = base0D;
|
||||
ring-wrong = base08;
|
||||
inside = base00;
|
||||
inside-clear = base00;
|
||||
inside-caps-lock = base00;
|
||||
inside-ver = base00;
|
||||
inside-wrong = base00;
|
||||
text = base05;
|
||||
text-clear = base05;
|
||||
text-caps-lock = base05;
|
||||
text-ver = base05;
|
||||
text-wrong = base05;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.swayidle = mkIf (cfg.swaylock) {
|
||||
Unit = {
|
||||
Description = "swayidle";
|
||||
Documentation = [ "man:swayidle(1)" ];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
};
|
||||
Service = {
|
||||
Type = "simple";
|
||||
ExecStart =
|
||||
let
|
||||
lockCommand = config.programs.swaylock.script;
|
||||
in
|
||||
''
|
||||
${pkgs.swayidle}/bin/swayidle -w \
|
||||
timeout 300 '${lockCommand}' \
|
||||
timeout 600 'swaymsg "output * dpms off"' \
|
||||
resume 'swaymsg "output * dpms on"' \
|
||||
before-sleep '${lockCommand}'
|
||||
'';
|
||||
RestartSec = 3;
|
||||
Restart = "always";
|
||||
};
|
||||
Install = { WantedBy = [ "sway-session.target" ]; };
|
||||
};
|
||||
|
||||
lib.nixfiles.sassTemplate = { name, src }:
|
||||
let
|
||||
variables = pkgs.writeText "base-variables.sass" ''
|
||||
${(concatStringsSep "\n" (mapAttrsToList(var: con: "\$${var}: ${con}") cfg.sass.variables))}
|
||||
'';
|
||||
source = pkgs.callPackage
|
||||
({ sass, stdenv }: stdenv.mkDerivation {
|
||||
inherit name src variables;
|
||||
nativeBuildInputs = lib.singleton sass;
|
||||
phases = [ "buildPhase" ];
|
||||
buildPhase = ''
|
||||
cat $variables $src > src-mut.sass
|
||||
sass src-mut.sass $out --sourcemap=none --trace --style=${cfg.sass.css_style}
|
||||
'';
|
||||
})
|
||||
{ };
|
||||
in
|
||||
{
|
||||
inherit source;
|
||||
text = builtins.readFile source;
|
||||
};
|
||||
_module.args = { inherit (config.lib) nixfiles; };
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue