Migrate to centralised SASS templating, remove headers

This commit is contained in:
kat witch 2021-08-26 19:41:43 +01:00
parent 68594e6282
commit a1e69ae88d
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
16 changed files with 41 additions and 198 deletions

View file

@ -35,6 +35,14 @@ let cfg = config.kw.theme; in
default = "${toString (cfg.font.size + 3)}px"; default = "${toString (cfg.font.size + 3)}px";
}; };
}; };
variables = mkOption {
type = types.attrsOf types.str;
default = (cfg.base16 // {
font = cfg.font.name;
font_size = cfg.font.size_css;
inherit (cfg) alpha;
});
};
}; };
config = mkIf (cfg.enable) { config = mkIf (cfg.enable) {
kw.theme = { kw.theme = {
@ -43,19 +51,22 @@ let cfg = config.kw.theme; in
alpha = "80"; alpha = "80";
}; };
lib.kw.sassTemplate = pkgs.callPackage ({ sass, stdenv }: { name, src }: stdenv.mkDerivation ({ lib.kw.sassTemplate = { name, src }: let
inherit name src; variables = pkgs.writeText "base-variables.sass" ''
nativeBuildInputs = lib.singleton sass; ${(concatStringsSep "\n" (mapAttrsToList(var: con: "\$${var}: ${con}") cfg.variables))}
phases = [ "buildPhase" ];
buildPhase = ''
substituteAll $src sub.sass
sass sub.sass $out --sourcemap=none --style=${cfg.css_style}
''; '';
} // cfg.base16 // { source = pkgs.callPackage ({ sass, stdenv }: stdenv.mkDerivation ({
font = cfg.font.name; inherit name src variables;
font_size = cfg.font.size_css; nativeBuildInputs = lib.singleton sass;
inherit (cfg) alpha; phases = [ "buildPhase" ];
})) {}; buildPhase = ''
cat $variables $src > src-mut.sass
sass src-mut.sass $out --sourcemap=none --style=${cfg.css_style}
'';
} // cfg.variables)) {}; in {
inherit source;
text = builtins.readFile source;
};
_module.args = { inherit (config.lib) kw; }; _module.args = { inherit (config.lib) kw; };
}; };
} }

View file

@ -1,5 +1,5 @@
{ config, ... }: { config, ... }:
{ {
imports = [ ./firefox.nix ./packages.nix ./gtk.nix ./foot.nix ./xdg.nix ./ranger.nix ./fonts.nix ./qt.nix ]; imports = [ ./firefox ./packages.nix ./gtk.nix ./foot.nix ./xdg.nix ./ranger.nix ./fonts.nix ./qt.nix ];
} }

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, nixos, ... }: { config, lib, pkgs, nixos, kw, ... }:
let let
commonSettings = { commonSettings = {
@ -13,7 +13,7 @@ let
}; };
in in
{ {
home.file.".mozilla/tst.css".source = pkgs.firefox-tst { inherit (config.kw.theme) base16; }; home.file.".mozilla/tst.css" = { inherit (kw.sassTemplate { name = "tst"; src = ./tst.sass; }) source; };
programs.zsh.shellAliases = { programs.zsh.shellAliases = {
ff-pm = "firefox --ProfileManager"; ff-pm = "firefox --ProfileManager";
@ -65,7 +65,7 @@ in
id = 0; id = 0;
isDefault = true; isDefault = true;
settings = commonSettings; settings = commonSettings;
userChrome = builtins.readFile (pkgs.firefox-uc { inherit (config.kw.theme) base16; }); userChrome = (kw.sassTemplate { name = "userChrome"; src = ./userChrome.sass; }).text;
}; };
}; };
}; };

View file

@ -1,24 +1,5 @@
$base00: @base00@
$base01: @base01@
$base02: @base02@
$base03: @base03@
$base04: @base04@
$base05: @base05@
$base06: @base06@
$base07: @base07@
$base08: @base08@
$base09: @base09@
$base0A: @base0A@
$base0B: @base0B@
$base0C: @base0C@
$base0D: @base0D@
$base0E: @base0E@
$base0F: @base0F@
$font_0: "Cozette"
$font_1: "monospace !important"
* *
font-family: $font_0, $font_1 font-family: $font !important
#tabbar #tabbar
margin-top: calc(var(--pinned-tabs-area-size) - .15em) margin-top: calc(var(--pinned-tabs-area-size) - .15em)

View file

@ -1,22 +1,3 @@
$base00: @base00@
$base01: @base01@
$base02: @base02@
$base03: @base03@
$base04: @base04@
$base05: @base05@
$base06: @base06@
$base07: @base07@
$base08: @base08@
$base09: @base09@
$base0A: @base0A@
$base0B: @base0B@
$base0C: @base0C@
$base0D: @base0D@
$base0E: @base0E@
$base0F: @base0F@
$font_0: "Cozette"
$font_1: "monospace !important"
$animations: "toolbarbutton", ".toolbarbutton-icon", ".subviewbutton", "#urlbar-background", ".urlbar-icon", "#userContext-indicator", "#userContext-label", ".urlbar-input-box", "#identity-box", "#tracking-protection-icon-container", "[anonid=urlbar-go-button]", ".urlbar-icon-wrapper", "#tracking-protection-icon", "#identity-box image", "stack", "vbox", "tab:not(:active) .tab-background", "tab:not([beforeselected-visible])::after", "tab[visuallyselected] .tab-background::before", "tab[visuallyselected] .tab-background::before", ".tab-close-button" $animations: "toolbarbutton", ".toolbarbutton-icon", ".subviewbutton", "#urlbar-background", ".urlbar-icon", "#userContext-indicator", "#userContext-label", ".urlbar-input-box", "#identity-box", "#tracking-protection-icon-container", "[anonid=urlbar-go-button]", ".urlbar-icon-wrapper", "#tracking-protection-icon", "#identity-box image", "stack", "vbox", "tab:not(:active) .tab-background", "tab:not([beforeselected-visible])::after", "tab[visuallyselected] .tab-background::before", "tab[visuallyselected] .tab-background::before", ".tab-close-button"
$base00_backgrounds: "#nav-bar", "toolbar-menubar", "#menubar-items", "#main-menubar" $base00_backgrounds: "#nav-bar", "toolbar-menubar", "#menubar-items", "#main-menubar"
$extendables: ".urlbar-icon", "#userContext-indicator", "#userContext-label" $extendables: ".urlbar-icon", "#userContext-indicator", "#userContext-label"
@ -34,7 +15,7 @@ $extendables: ".urlbar-icon", "#userContext-indicator", "#userContext-label"
--animationSpeed: 0.15s --animationSpeed: 0.15s
* *
font-family: $font_0, $font_1 font-family: $font !important
#TabsToolbar #TabsToolbar
visibility: collapse visibility: collapse
@ -62,7 +43,7 @@ $extendables: ".urlbar-icon", "#userContext-indicator", "#userContext-label"
&:not(:hover):not([breakout][breakout-extend]) > #urlbar-background &:not(:hover):not([breakout][breakout-extend]) > #urlbar-background
box-shadow: none !important box-shadow: none !important
background: @base01@ !important background: $base01 !important
&:hover .urlbar-icon &:hover .urlbar-icon
fill: var(--toolbar-color) !important fill: var(--toolbar-color) !important
@ -72,10 +53,10 @@ $extendables: ".urlbar-icon", "#userContext-indicator", "#userContext-label"
@each $selector in $base00_backgrounds @each $selector in $base00_backgrounds
#{$selector} #{$selector}
background: @base00@ !important background: $base00 !important
#urlbar-background #urlbar-background
background: @base01@ !important background: $base01 !important
#star-button #star-button
display: none display: none

View file

@ -3,8 +3,8 @@
{ {
imports = [ imports = [
./xkb.nix ./xkb.nix
./waybar.nix ./waybar
./wofi.nix ./wofi
./mako.nix ./mako.nix
./sway.nix ./sway.nix
./gammastep.nix ./gammastep.nix

View file

@ -1,7 +1,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, kw, ... }:
{ {
xdg.configFile."waybar/style.css".source = pkgs.waybar-style { inherit (config.kw.theme) base16; }; xdg.configFile."waybar/style.css" = { inherit (kw.sassTemplate { name = "waybar-style"; src = ./waybar.sass; }) source; };
programs.waybar = { programs.waybar = {
enable = true; enable = true;

View file

@ -1,23 +1,3 @@
$base00: @base00@
$base01: @base01@
$base02: @base02@
$base03: @base03@
$base04: @base04@
$base05: @base05@
$base06: @base06@
$base07: @base07@
$base08: @base08@
$base09: @base09@
$base0A: @base0A@
$base0B: @base0B@
$base0C: @base0C@
$base0D: @base0D@
$base0E: @base0E@
$base0F: @base0F@
$alpha: @alpha@
$font: "Cozette"
$font_size: 12px
%extend_1 %extend_1
padding: 0 8px padding: 0 8px
transition: none transition: none

View file

@ -1,5 +0,0 @@
{ config, pkgs, ... }:
{
xdg.configFile."wofi/wofi.css".source = pkgs.wofi-style { inherit (config.kw.theme) base16; };
}

View file

@ -0,0 +1,5 @@
{ config, kw, ... }:
{
xdg.configFile."wofi/wofi.css" = { inherit (kw.sassTemplate { name = "wofi-style"; src = ./wofi.sass; }) source; };
}

View file

@ -1,23 +1,3 @@
$base00: @base00@
$base01: @base01@
$base02: @base02@
$base03: @base03@
$base04: @base04@
$base05: @base05@
$base06: @base06@
$base07: @base07@
$base08: @base08@
$base09: @base09@
$base0A: @base0A@
$base0B: @base0B@
$base0C: @base0C@
$base0D: @base0D@
$base0E: @base0E@
$base0F: @base0F@
$alpha: @alpha@
$font: "Cozette"
$font_size: 12px
#scroll #scroll
background: $base01 background: $base01
border: 1px solid $base03 border: 1px solid $base03

View file

@ -6,10 +6,6 @@ let
(import ./nur { inherit sources; }) (import ./nur { inherit sources; })
(import sources.emacs-overlay) (import sources.emacs-overlay)
(import ./rustfmt) (import ./rustfmt)
(import ./ff-tst-style)
(import ./ff-uc-style)
(import ./waybar-style)
(import ./wofi-style)
/* # TODO: implement these /* # TODO: implement these
(import ./vimrc) (import ./vimrc)
*/ */

View file

@ -1,21 +0,0 @@
final: prev: {
firefox-tst = final.callPackage ({ stdenv, sass }: { base16 }:
stdenv.mkDerivation ({
pname = "ff-tst-style";
version = "0.0.1";
phases = [ "buildPhase" ];
src = ./tst.sass;
nativeBuildInputs = [
sass
];
buildPhase = ''
substituteAll $src tst-sub.sass
sass tst-sub.sass $out --sourcemap=none --style expanded
'';
} // base16)) {};
}

View file

@ -1,21 +0,0 @@
final: prev: {
firefox-uc = final.callPackage ({ stdenv, sass }: { base16 }:
stdenv.mkDerivation ({
pname = "ff-uc-style";
version = "0.0.1";
phases = [ "buildPhase" ];
src = ./userChrome.sass;
nativeBuildInputs = [
sass
];
buildPhase = ''
substituteAll $src userChrome-sub.sass
sass userChrome-sub.sass $out --sourcemap=none --style expanded
'';
} // base16)) {};
}

View file

@ -1,22 +0,0 @@
final: prev: {
waybar-style = final.callPackage ({ stdenv, sass }: { base16 }:
stdenv.mkDerivation ({
pname = "waybar-style";
version = "0.0.1";
phases = [ "buildPhase" ];
src = ./waybar.sass;
nativeBuildInputs = [
sass
];
buildPhase = ''
substituteAll $src waybar-sub.sass
sass waybar-sub.sass $out --sourcemap=none --style expanded
'';
alpha = "80";
} // base16)) {};
}

View file

@ -1,22 +0,0 @@
final: prev: {
wofi-style = final.callPackage ({ stdenv, sass }: { base16 }:
stdenv.mkDerivation ({
pname = "wofi-style";
version = "0.0.1";
phases = [ "buildPhase" ];
src = ./wofi.sass;
nativeBuildInputs = [
sass
];
buildPhase = ''
substituteAll $src wofi-sub.sass
sass wofi-sub.sass $out --sourcemap=none --style expanded
'';
alpha = "80";
} // base16)) {};
}