From c9bd5a3766ddb59bc29d54d1f89aca6d85b90905 Mon Sep 17 00:00:00 2001 From: kat witch Date: Wed, 18 Aug 2021 03:11:51 +0100 Subject: [PATCH] profiles and user refactor --- config/hosts/athame/nixos.nix | 1 - config/modules/home/theme.nix | 4 +- config/profiles/base/base16.nix | 2 +- config/profiles/base/default.nix | 4 +- config/profiles/base/net.nix | 7 -- config/profiles/base/network.nix | 13 ++++ config/profiles/gui/adb.nix | 6 -- config/profiles/gui/default.nix | 5 -- config/profiles/gui/dns.nix | 1 - config/profiles/gui/fonts.nix | 5 -- config/profiles/gui/fvwm.nix | 14 ---- config/profiles/gui/mpd.nix | 10 --- config/profiles/gui/nix-doc.nix | 11 --- config/profiles/gui/nixpkgs.nix | 8 -- config/services/fail2ban/default.nix | 41 ----------- config/users/kat/base/base16.nix | 10 +-- config/users/kat/gui/default.nix | 2 +- .../{firefox/default.nix => firefox-tst.nix} | 73 +------------------ .../userChrome.css.nix => firefox-ucc.nix} | 0 config/users/kat/gui/firefox.nix | 70 ++++++++++++++++++ config/users/kat/gui/ranger.nix | 1 - config/users/kat/media/default.nix | 3 - .../kat/{media => services/mpd}/beets.nix | 0 config/users/kat/services/mpd/default.nix | 9 +++ .../users/kat/{media => services/mpd}/mpd.nix | 5 ++ .../kat/{media => services/mpd}/ncmpcpp.nix | 0 config/users/kat/sway/default.nix | 3 +- .../kat/sway/{waybar => }/waybar.css.nix | 0 .../sway/{waybar/default.nix => waybar.nix} | 17 +---- config/users/kat/sway/wofi.nix | 41 +++++++++++ 30 files changed, 153 insertions(+), 213 deletions(-) delete mode 100644 config/profiles/base/net.nix create mode 100644 config/profiles/base/network.nix delete mode 100644 config/profiles/gui/adb.nix delete mode 100644 config/profiles/gui/fvwm.nix delete mode 100644 config/profiles/gui/mpd.nix delete mode 100644 config/profiles/gui/nix-doc.nix delete mode 100644 config/profiles/gui/nixpkgs.nix delete mode 100644 config/services/fail2ban/default.nix rename config/users/kat/gui/{firefox/default.nix => firefox-tst.nix} (59%) rename config/users/kat/gui/{firefox/userChrome.css.nix => firefox-ucc.nix} (100%) create mode 100644 config/users/kat/gui/firefox.nix rename config/users/kat/{media => services/mpd}/beets.nix (100%) create mode 100644 config/users/kat/services/mpd/default.nix rename config/users/kat/{media => services/mpd}/mpd.nix (89%) rename config/users/kat/{media => services/mpd}/ncmpcpp.nix (100%) rename config/users/kat/sway/{waybar => }/waybar.css.nix (100%) rename config/users/kat/sway/{waybar/default.nix => waybar.nix} (87%) create mode 100644 config/users/kat/sway/wofi.nix diff --git a/config/hosts/athame/nixos.nix b/config/hosts/athame/nixos.nix index a3b7f3f6..f5a551ad 100644 --- a/config/hosts/athame/nixos.nix +++ b/config/hosts/athame/nixos.nix @@ -9,7 +9,6 @@ with lib; profiles.hardware.hcloud-imperative users.kat.server users.kat.services.weechat - services.fail2ban services.filehost services.gitea services.grafana diff --git a/config/modules/home/theme.nix b/config/modules/home/theme.nix index c9edbd41..e30c1c5d 100644 --- a/config/modules/home/theme.nix +++ b/config/modules/home/theme.nix @@ -13,7 +13,9 @@ let cfg = config.kw; in { type = types.nullOr (types.listOf types.path); default = [ ../../users/kat/sway/wallpapers/left.jpg ../../users/kat/sway/wallpapers/main.png ../../users/kat/sway/wallpapers/right.jpg ]; }; - + hexColors = mkOption { + type = types.attrsOf types.str; + }; font = { name = mkOption { type = types.str; diff --git a/config/profiles/base/base16.nix b/config/profiles/base/base16.nix index 0c8cde2f..07ec4e4a 100644 --- a/config/profiles/base/base16.nix +++ b/config/profiles/base/base16.nix @@ -4,7 +4,7 @@ base16 = { console = { enable = true; - scheme = "rebecca.rebecca"; + scheme = config.home-manager.users.kat.alias.default; }; }; } diff --git a/config/profiles/base/default.nix b/config/profiles/base/default.nix index 25d1463b..fa972c1a 100644 --- a/config/profiles/base/default.nix +++ b/config/profiles/base/default.nix @@ -3,16 +3,14 @@ { imports = with meta; [ users.kat.base -# users.kairi.base TODO users.arc users.hexchen ./system.nix - ./dns.nix ./home.nix ./profiles.nix ./shell.nix ./base16.nix - ./net.nix + ./network.nix ./access.nix ./locale.nix ./nix.nix diff --git a/config/profiles/base/net.nix b/config/profiles/base/net.nix deleted file mode 100644 index 18b5b072..00000000 --- a/config/profiles/base/net.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ config, lib, ... }: - -{ - network.nftables.enable = lib.mkDefault true; - network.enable = true; - network.dns.enable = true; -} diff --git a/config/profiles/base/network.nix b/config/profiles/base/network.nix new file mode 100644 index 00000000..8ef92756 --- /dev/null +++ b/config/profiles/base/network.nix @@ -0,0 +1,13 @@ +{ config, lib, ... }: + +{ + network = { + enable = true; + nftables.enable = true; + dns = { + enable = true; + email = "kat@kittywit.ch"; + tld = "kittywit.ch."; + }; + }; +} diff --git a/config/profiles/gui/adb.nix b/config/profiles/gui/adb.nix deleted file mode 100644 index 88a5d298..00000000 --- a/config/profiles/gui/adb.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ config, ... }: - -{ - programs.adb.enable = true; - users.users.kat.extraGroups = [ "adbusers" ]; -} diff --git a/config/profiles/gui/default.nix b/config/profiles/gui/default.nix index dcf0759e..3612a257 100644 --- a/config/profiles/gui/default.nix +++ b/config/profiles/gui/default.nix @@ -2,18 +2,13 @@ { imports = [ - ./adb.nix ./fonts.nix ./sway.nix - ./fvwm.nix ./filesystems.nix ./gpg.nix ./xdg-portals.nix ./dns.nix ./nfs.nix - ./nix-doc.nix - ./mpd.nix - ./nixpkgs.nix ./mingetty.nix ./sound.nix ]; diff --git a/config/profiles/gui/dns.nix b/config/profiles/gui/dns.nix index d9fb65fe..2af2cce5 100644 --- a/config/profiles/gui/dns.nix +++ b/config/profiles/gui/dns.nix @@ -1,6 +1,5 @@ { config, lib, pkgs, ... }: { networking = { - # networkmanager.enable = true; resolvconf.useLocalResolver = true; networkmanager.dns = "none"; }; diff --git a/config/profiles/gui/fonts.nix b/config/profiles/gui/fonts.nix index 0038aeea..de5b4679 100644 --- a/config/profiles/gui/fonts.nix +++ b/config/profiles/gui/fonts.nix @@ -16,12 +16,7 @@ }; fonts.fonts = with pkgs; [ - font-awesome - nerdfonts - vegur - creep cozette - emacs-all-the-icons-fonts twitter-color-emoji ]; } diff --git a/config/profiles/gui/fvwm.nix b/config/profiles/gui/fvwm.nix deleted file mode 100644 index 101a117d..00000000 --- a/config/profiles/gui/fvwm.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ config, lib, ... }: - -with lib; - -{ - config = mkIf (any (user: user.programs.fvwm.enable) (attrValues config.home-manager.users)) { - services.xserver.enable = true; - services.xserver.displayManager.startx.enable = true; - services.xserver.windowManager.fvwm = { - enable = true; - gestures = true; - }; - }; -} diff --git a/config/profiles/gui/mpd.nix b/config/profiles/gui/mpd.nix deleted file mode 100644 index 5cd4c3e7..00000000 --- a/config/profiles/gui/mpd.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ config, lib, ... }: - -with lib; - -{ - network.firewall = { - public.tcp.ports = [ 6600 32101 ]; - private.tcp.ports = [ 6600 32101 ]; - }; -} diff --git a/config/profiles/gui/nix-doc.nix b/config/profiles/gui/nix-doc.nix deleted file mode 100644 index 312bee12..00000000 --- a/config/profiles/gui/nix-doc.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, ... }: - -{ - nix.extraOptions = '' - plugin-files = ${pkgs.nix-doc}/lib/libnix_doc_plugin.so - ''; - - environment.systemPackages = with pkgs; [ - nix-doc - ]; -} diff --git a/config/profiles/gui/nixpkgs.nix b/config/profiles/gui/nixpkgs.nix deleted file mode 100644 index 69721e77..00000000 --- a/config/profiles/gui/nixpkgs.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ pkgs, config, lib, ... }: - -{ - nixpkgs.config = { - allowUnfree = true; - pulseaudio = true; - }; -} diff --git a/config/services/fail2ban/default.nix b/config/services/fail2ban/default.nix deleted file mode 100644 index d9808502..00000000 --- a/config/services/fail2ban/default.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ config, pkgs, ... }: - -{ - services.fail2ban = { - enable = true; - packageFirewall = pkgs.nftables; - banaction = "nftables-multiport"; - banaction-allports = "nftables-allports"; - jails = { - default = '' - bantime = 7d - blocktype = DROP - action = nftables-allports - logpath = /var/log/auth.log - ''; - ssh = '' - enabled = true - filter = sshd - maxretry = 4 - action = nftables-multiport[name=SSH, port=ssh, protocol=tcp] - ''; - sshd-ddos = '' - enabled = true - filter = sshd-ddos - maxretry = 4 - action = nftables-multiport[name=ssh, port=ssh, protocol=tcp] - ''; - }; - }; - - environment.etc."fail2ban/filter.d/sshd-ddos.conf" = { - enable = true; - text = '' - [Definition] - failregex = sshd(?:\[\d+\])?: Did not receive identification string from $ - ignoreregex = - ''; - }; - - systemd.services.fail2ban.serviceConfig.LimitSTACK = 128 * 1024; -} diff --git a/config/users/kat/base/base16.nix b/config/users/kat/base/base16.nix index cc20a88c..861db8e6 100644 --- a/config/users/kat/base/base16.nix +++ b/config/users/kat/base/base16.nix @@ -1,14 +1,12 @@ -{ config, ... }: +{ config, lib, ... }: { base16 = { shell.enable = true; - schemes = [ "atelier.atelier-cave" "atelier.atelier-cave-light" "tomorrow.tomorrow-night-eighties" "tomorrow.tomorrow" ]; + schemes = [ "atelier.atelier-cave" "atelier.atelier-cave-light" ]; alias.light = "atelier.atelier-cave-light"; alias.dark = "atelier.atelier-cave"; }; - # home.base16-shell = { - # enable = true; - # defaultTheme = "rebecca.rebecca"; - # }; + + kw.hexColours = lib.mapAttrs' (k: v: lib.nameValuePair k "#${v.hex.rgb}") config.lib.arc.base16.schemeForAlias.default; } diff --git a/config/users/kat/gui/default.nix b/config/users/kat/gui/default.nix index a63b8526..b8370c6d 100644 --- a/config/users/kat/gui/default.nix +++ b/config/users/kat/gui/default.nix @@ -1,5 +1,5 @@ { config, ... }: { - imports = [ ./firefox ./packages.nix ./gtk.nix ./foot.nix ./xdg.nix ./ranger.nix ./fonts.nix ]; + imports = [ ./firefox.nix ./firefox-tst.nix ./packages.nix ./gtk.nix ./foot.nix ./xdg.nix ./ranger.nix ./fonts.nix ]; } diff --git a/config/users/kat/gui/firefox/default.nix b/config/users/kat/gui/firefox-tst.nix similarity index 59% rename from config/users/kat/gui/firefox/default.nix rename to config/users/kat/gui/firefox-tst.nix index a6189ffa..0ab316c9 100644 --- a/config/users/kat/gui/firefox/default.nix +++ b/config/users/kat/gui/firefox-tst.nix @@ -1,34 +1,7 @@ -{ config, lib, pkgs, superConfig, ... }: +{ config, ... }: -let - commonSettings = { - "app.update.auto" = false; - "identity.fxaccounts.account.device.name" = superConfig.networking.hostName; - "signon.rememberSignons" = false; - "browser.download.lastDir" = "/home/kat/downloads"; - "browser.urlbar.placeholderName" = "DuckDuckGo"; - "toolkit.legacyUserProfileCustomizations.stylesheets" = true; - "svg.context-properties.content.enabled" = true; - }; - base16 = lib.mapAttrs' (k: v: lib.nameValuePair k "#${v.hex.rgb}") - config.lib.arc.base16.schemeForAlias.default; -in { - programs.zsh.shellAliases = { - ff-pm = "firefox --ProfileManager"; - ff-main = "firefox -P main"; - }; - - programs.browserpass = { - enable = true; - browsers = [ "firefox" ]; - }; - - home.sessionVariables = { - XDG_CURRENT_DESKTOP = "sway"; - }; - - home.file.".mozilla/tst.css".text = '' + home.file.".mozilla/tst.css".text = let base16 = config.kw.hexColors; in '' /* Hide border on tab bar, force its state to 'scroll', adjust margin-left for width of scrollbar. */ #tabbar { border: 0; overflow-y: scroll !important; } @@ -151,46 +124,4 @@ in opacity: 0.5; } ''; - - programs.firefox = { - enable = true; - package = pkgs.firefox-wayland; - extensions = with pkgs.nur.repos.rycee.firefox-addons; [ - sponsorblock - floccus - link-cleaner - octotree - betterttv - canvasblocker - view-image - pkgs.nur.repos.crazazy.firefox-addons.new-tab-override - wappalyzer - auto-tab-discard - bitwarden - darkreader - decentraleyes - foxyproxy-standard - clearurls - df-youtube - old-reddit-redirect - privacy-badger - reddit-enhancement-suite - refined-github - stylus - temporary-containers - browserpass - tree-style-tab - multi-account-containers - ublock-origin - violentmonkey - ]; - profiles = { - main = { - id = 0; - isDefault = true; - settings = commonSettings // { }; - userChrome = import ./userChrome.css.nix { profile = "main"; inherit base16; }; - }; - }; - }; } diff --git a/config/users/kat/gui/firefox/userChrome.css.nix b/config/users/kat/gui/firefox-ucc.nix similarity index 100% rename from config/users/kat/gui/firefox/userChrome.css.nix rename to config/users/kat/gui/firefox-ucc.nix diff --git a/config/users/kat/gui/firefox.nix b/config/users/kat/gui/firefox.nix new file mode 100644 index 00000000..7082aaf9 --- /dev/null +++ b/config/users/kat/gui/firefox.nix @@ -0,0 +1,70 @@ +{ config, lib, pkgs, superConfig, ... }: + +let + commonSettings = { + "app.update.auto" = false; + "identity.fxaccounts.account.device.name" = superConfig.networking.hostName; + "signon.rememberSignons" = false; + "browser.download.lastDir" = "/home/kat/downloads"; + "browser.urlbar.placeholderName" = "DuckDuckGo"; + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + "svg.context-properties.content.enabled" = true; + }; +in +{ + programs.zsh.shellAliases = { + ff-pm = "firefox --ProfileManager"; + ff-main = "firefox -P main"; + }; + + programs.browserpass = { + enable = true; + browsers = [ "firefox" ]; + }; + + home.sessionVariables = { + XDG_CURRENT_DESKTOP = "sway"; + }; + + programs.firefox = { + enable = true; + package = pkgs.firefox-wayland; + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + sponsorblock + floccus + link-cleaner + octotree + betterttv + canvasblocker + view-image + pkgs.nur.repos.crazazy.firefox-addons.new-tab-override + wappalyzer + auto-tab-discard + bitwarden + darkreader + decentraleyes + foxyproxy-standard + clearurls + df-youtube + old-reddit-redirect + privacy-badger + reddit-enhancement-suite + refined-github + stylus + temporary-containers + browserpass + tree-style-tab + multi-account-containers + ublock-origin + violentmonkey + ]; + profiles = { + main = { + id = 0; + isDefault = true; + settings = commonSettings // { }; + userChrome = import ./firefox-ucc.nix { profile = "main"; base16 = config.kw.hexColors; }; + }; + }; + }; +} diff --git a/config/users/kat/gui/ranger.nix b/config/users/kat/gui/ranger.nix index 0e294078..e6447f5c 100644 --- a/config/users/kat/gui/ranger.nix +++ b/config/users/kat/gui/ranger.nix @@ -7,6 +7,5 @@ xdg.configFile."ranger/rc.conf".text = '' set preview_images true - set preview_images_method iterm2 ''; } diff --git a/config/users/kat/media/default.nix b/config/users/kat/media/default.nix index 9bf2a65f..efaf126e 100644 --- a/config/users/kat/media/default.nix +++ b/config/users/kat/media/default.nix @@ -5,9 +5,6 @@ ./mpv.nix ./obs.nix ./syncplay.nix - ./beets.nix - ./mpd.nix - ./ncmpcpp.nix ./packages.nix ]; } diff --git a/config/users/kat/media/beets.nix b/config/users/kat/services/mpd/beets.nix similarity index 100% rename from config/users/kat/media/beets.nix rename to config/users/kat/services/mpd/beets.nix diff --git a/config/users/kat/services/mpd/default.nix b/config/users/kat/services/mpd/default.nix new file mode 100644 index 00000000..d76cedf4 --- /dev/null +++ b/config/users/kat/services/mpd/default.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + imports = [ + ./mpd.nix + ./beets.nix + ./ncmpcpp.nix + ]; +} diff --git a/config/users/kat/media/mpd.nix b/config/users/kat/services/mpd/mpd.nix similarity index 89% rename from config/users/kat/media/mpd.nix rename to config/users/kat/services/mpd/mpd.nix index c257f7a9..d081c017 100644 --- a/config/users/kat/media/mpd.nix +++ b/config/users/kat/services/mpd/mpd.nix @@ -1,6 +1,11 @@ { config, pkgs, ... }: { + network.firewall = { + public.tcp.ports = [ 6600 32101 ]; + private.tcp.ports = [ 6600 32101 ]; + }; + services.mpd = { enable = true; package = pkgs.mpd-youtube-dl; diff --git a/config/users/kat/media/ncmpcpp.nix b/config/users/kat/services/mpd/ncmpcpp.nix similarity index 100% rename from config/users/kat/media/ncmpcpp.nix rename to config/users/kat/services/mpd/ncmpcpp.nix diff --git a/config/users/kat/sway/default.nix b/config/users/kat/sway/default.nix index b7b486b5..d6e7df1b 100644 --- a/config/users/kat/sway/default.nix +++ b/config/users/kat/sway/default.nix @@ -2,7 +2,8 @@ { imports = [ - ./waybar + ./waybar.nix + ./wofi.nix ./mako.nix ./sway.nix ./gammastep.nix diff --git a/config/users/kat/sway/waybar/waybar.css.nix b/config/users/kat/sway/waybar.css.nix similarity index 100% rename from config/users/kat/sway/waybar/waybar.css.nix rename to config/users/kat/sway/waybar.css.nix diff --git a/config/users/kat/sway/waybar/default.nix b/config/users/kat/sway/waybar.nix similarity index 87% rename from config/users/kat/sway/waybar/default.nix rename to config/users/kat/sway/waybar.nix index ba84f720..ad19ba22 100644 --- a/config/users/kat/sway/waybar/default.nix +++ b/config/users/kat/sway/waybar.nix @@ -14,7 +14,7 @@ in }; settings = [{ modules-left = [ "sway/workspaces" "sway/mode" "sway/window" ]; - modules-center = ["clock" "clock#arc" "clock#miku" "clock#hex" ]; # "clock" "custom/weather" + modules-center = ["clock" "clock#arc" "clock#miku" "clock#hex" ]; modules-right = [ "pulseaudio" "cpu" @@ -22,9 +22,7 @@ in "temperature" "backlight" "battery" - #"mpd" "network" - #"custom/weather" "idle_inhibitor" "custom/konawall" "custom/gpg-status" @@ -37,13 +35,6 @@ in format = " {}"; max-length = 50; }; - #"custom/weather" = { - # format = "{}"; - # interval = 3600; - # on-click = "xdg-open 'https://google.com/search?q=weather'"; - # exec = - # "${pkgs.kat-weather}/bin/kat-weather ${witch.secrets.profiles.sway.city} ${witch.secrets.profiles.sway.api_key}"; - #}; tray = { icon-size = 12; spacing = 2; @@ -64,12 +55,6 @@ in on-click-right = "systemctl --user restart konawall"; }; cpu = { format = " {usage}%"; }; - #mpd = { - # format = " {albumArtist} - {title}"; - # format-stopped = "ﱙ"; - # format-paused = " Paused"; - # title-len = 16; - #}; memory = { format = " {percentage}%"; }; temperature = { format = " {temperatureC}°C"; diff --git a/config/users/kat/sway/wofi.nix b/config/users/kat/sway/wofi.nix new file mode 100644 index 00000000..d6eb0370 --- /dev/null +++ b/config/users/kat/sway/wofi.nix @@ -0,0 +1,41 @@ +{ config, lib, ... }: + +{ + xdg.configFile."wofi/wofi.css".text = let base16 = config.kw.hexColors; in '' + #scroll, #input { + background: ${base16.base01}; + } + + window { + font-family: ${config.kw.font.name}; + background: ${lib.hextorgba base16.base00 0.75}; + border-radius: 1em; + font-size: ${config.kw.font.size_css}; + color: ${base16.base07}; + } + + #outer-box { + margin: 1em; + } + + #scroll { + border: 1px solid ${base16.base03}; + } + + #input { + border: 1px solid ${base16.base0C}; + margin: 1em; + background: ${base16.base02}; + color: ${base16.base04}; + } + + #entry { + border-bottom: 1px dashed ${base16.base04}; + padding: .75em; + } + + #entry:selected { + background-color: ${base16.base0D}; + } + ''; +}