diff --git a/flake.nix b/flake.nix index cb0b251..25703a5 100644 --- a/flake.nix +++ b/flake.nix @@ -13,6 +13,7 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + cherrykitten-website = { url = "git+https://git.cherrykitten.dev/sammy/cherrykitten.dev?ref=nix"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/hosts/dinictis/default.nix b/hosts/dinictis/default.nix index ad0de6a..9924701 100644 --- a/hosts/dinictis/default.nix +++ b/hosts/dinictis/default.nix @@ -1,4 +1,4 @@ -{ ... }: { +{ pkgs, ... }: { imports = [ ../../profiles/desktop ./hardware-configuration.nix @@ -7,8 +7,7 @@ boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - networking.hostName = "dinictis"; # Define your hostname. - networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + networking.wireless.iwd.enable = true; # Enable CUPS to print documents. services.printing.enable = true; @@ -17,6 +16,64 @@ # sound.enable = true; hardware.pulseaudio.enable = true; + home-manager.users.sammy.programs.ssh.includes = [ + "./famedly-config" + ]; + home-manager.users.sammy.programs.git.includes = [ + { + path = "~/famedly/.gitconfig"; + condition = "gitdir:~/famedly/"; + } + ]; + system.stateVersion = "23.11"; # Did you read the comment? + # Famedly compliance foo - stolen from evelyn :3 + + systemd.user.services.usbguard-notifier.enable = true; + + services.clamav = { + daemon = { + enable = true; + }; + updater = { + enable = true; + frequency = 24; + interval = "hourly"; + }; + }; + + deployment.keys."osquery-secret.txt" = { + keyCommand = [ "pass" "work/osquery-secret" ]; + + destDir = "/etc/osquery/"; + uploadAt = "pre-activation"; + }; + + services.osquery = { + enable = true; + flags = { + tls_hostname = "fleet.famedly.de"; + host_identifier = "instance"; + enroll_secret_path = "/etc/osquery/osquery-secret.txt"; + enroll_tls_endpoint = "/api/osquery/enroll"; + config_plugin = "tls"; + config_tls_endpoint = "/api/v1/osquery/config"; + config_refresh = "10"; + disable_distributed = "false"; + distributed_plugin = "tls"; + distributed_interval = "10"; + distributed_tls_max_attempts = "3"; + distributed_tls_read_endpoint = "/api/v1/osquery/distributed/read"; + distributed_tls_write_endpoint = "/api/v1/osquery/distributed/write"; + logger_plugin = "tls"; + logger_tls_endpoint = "/api/v1/osquery/log"; + logger_tls_period = "10"; + disable_carver = "false"; + carver_start_endpoint = "/api/v1/osquery/carve/begin"; + carver_continue_endpoint = "/api/v1/osquery/carve/block"; + carver_block_size = "2000000"; + tls_server_certs = "/etc/ssl/certs/ca-certificates.crt"; + }; + }; } diff --git a/modules/home/foot/default.nix b/modules/home/foot/default.nix deleted file mode 100644 index 3e04758..0000000 --- a/modules/home/foot/default.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ lib, ... }: -{ - options.cherrykitten.foot = { - enable = lib.mkEnableOption "Foot Terminal Emulator"; - } // { default = true; }; - config = { - programs.foot = { - enable = true; - settings = { - main = { - font = "monospace:size=8"; - dpi-aware = "yes"; - initial-window-size-pixels = "1920x1080"; - }; - - bell.visual = "yes"; - - # colors taken from https://codeberg.org/dnkl/foot/src/branch/master/themes/catppuccin - cursor.color = "1A1826 D9E0EE"; - colors = { - foreground = "D9E0EE"; - background = "1E1D2F"; - regular0 = "6E6C7E"; - regular1 = "F28FAD"; - regular2 = "ABE9B3"; - regular3 = "FAE3B0"; - regular4 = "96CDFB"; - regular5 = "F5C2E7"; - regular6 = "89DCEB"; - regular7 = "D9E0EE"; - bright0 = "988BA2"; - bright1 = "F28FAD"; - bright2 = "ABE9B3"; - bright3 = "FAE3B0"; - bright4 = "96CDFB"; - bright5 = "F5C2E7"; - bright6 = "89DCEB"; - bright7 = "D9E0EE"; - }; - }; - }; - }; -} diff --git a/profiles/desktop/default.nix b/profiles/desktop/default.nix index b678c0c..591abda 100644 --- a/profiles/desktop/default.nix +++ b/profiles/desktop/default.nix @@ -1,15 +1,48 @@ { pkgs, ... }: { + + imports = [ + ./sway.nix + ./mako.nix + ./wofi.nix + ./waybar.nix + ./foot.nix + ./firefox.nix + ]; + + users.users.sammy.packages = with pkgs; [ + telegram-desktop + ]; + + services.logind.lidSwitch = "suspend-then-hibernate"; + services.logind.powerKey = "hibernate"; + services.logind.powerKeyLongPress = "poweroff"; + services.xserver = { enable = true; displayManager.sddm.enable = true; - desktopManager.plasma5.enable = true; libinput.enable = true; xkb.layout = "de"; xkb.options = "caps:escape"; }; + fonts = { - enableDefaultPackages = true; - packages = [ pkgs.noto-fonts-emoji ]; + packages = with pkgs; [ + jetbrains-mono + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + nerdfonts + font-awesome + source-han-sans + source-han-sans-japanese + source-han-serif-japanese + ]; + fontconfig.defaultFonts = { + serif = [ "Noto Serif" "Source Han Serif" ]; + sansSerif = [ "Noto Sans" "Source Han Sans" ]; + monospace = [ "JetBrains Mono" ]; + emoji = [ "noto-fonts-emoji" "font-awesome" ]; + }; }; } diff --git a/profiles/desktop/firefox.nix b/profiles/desktop/firefox.nix new file mode 100644 index 0000000..393b1cc --- /dev/null +++ b/profiles/desktop/firefox.nix @@ -0,0 +1,39 @@ +{ lib, ... }: { + programs.firefox = { + enable = true; + policies = { + DisableTelemetry = true; + DefaultDownloadDirectory = "\${home}/Downloads"; + DisableFirefoxStudies = true; + DisablePocket = true; + EnableTrackingProtection = { + Value = true; + Locked = true; + Cryptomining = true; + Fingerprinting = true; + }; + ExtensionSettings = lib.mapAttrs + (id: shortName: { + installation_mode = "force_installed"; + install_url = "https://addons.mozilla.org/firefox/downloads/latest/${shortName}/latest.xpi"; + }) + { + "FirefoxColor@mozilla.com" = "firefox-color"; + "{446900e4-71c2-419f-a6a7-df9c091e268b}" = "bitwarden-password-manager"; + "uBlock0@raymondhill.net" = "ublock-origin"; + "8c0c987e-1d1c-4a3f-97b9-705e7b7dbea4" = "kagi-search-for-firefox"; + }; + NoDefaultBookmarks = true; + PasswordManagerEnabled = false; + UserMessaging = { + WhatsNew = true; + ExtensionRecommendations = false; + FeatureRecommendations = false; + UrlbarInterventions = true; + SkipOnboarding = true; + MoreFromMozilla = false; + Locked = true; + }; + }; + }; +} diff --git a/profiles/desktop/foot.nix b/profiles/desktop/foot.nix new file mode 100644 index 0000000..041bbb6 --- /dev/null +++ b/profiles/desktop/foot.nix @@ -0,0 +1,37 @@ +{ ... }: { + home-manager.users.sammy.programs.foot = { + enable = true; + settings = { + main = { + font = "JetBrains Mono:size=8"; + dpi-aware = "yes"; + initial-window-size-pixels = "1920x1080"; + }; + + bell.visual = "yes"; + + # colors taken from https://codeberg.org/dnkl/foot/src/branch/master/themes/catppuccin + cursor.color = "1A1826 D9E0EE"; + colors = { + foreground = "D9E0EE"; + background = "1E1D2F"; + regular0 = "6E6C7E"; + regular1 = "F28FAD"; + regular2 = "ABE9B3"; + regular3 = "FAE3B0"; + regular4 = "96CDFB"; + regular5 = "F5C2E7"; + regular6 = "89DCEB"; + regular7 = "D9E0EE"; + bright0 = "988BA2"; + bright1 = "F28FAD"; + bright2 = "ABE9B3"; + bright3 = "FAE3B0"; + bright4 = "96CDFB"; + bright5 = "F5C2E7"; + bright6 = "89DCEB"; + bright7 = "D9E0EE"; + }; + }; + }; +} diff --git a/profiles/desktop/mako.nix b/profiles/desktop/mako.nix new file mode 100644 index 0000000..8c2473b --- /dev/null +++ b/profiles/desktop/mako.nix @@ -0,0 +1,16 @@ +{ pkgs, ... }: { + users.users.sammy.packages = with pkgs; [ mako ]; + home-manager.users.sammy = { + services.mako = { + enable = true; + defaultTimeout = 10000; + borderColor = "#ffffff"; + backgroundColor = "#00000070"; + textColor = "#ffffff"; + }; + wayland.windowManager.sway.config.startup = [{ + command = "${pkgs.mako}/bin/mako"; + always = false; + }]; + }; +} diff --git a/profiles/desktop/sway.nix b/profiles/desktop/sway.nix new file mode 100644 index 0000000..9bb091f --- /dev/null +++ b/profiles/desktop/sway.nix @@ -0,0 +1,182 @@ +{ config, pkgs, ... }: { + hardware.opengl.enable = true; + + programs.sway.enable = true; + programs.light.enable = true; + + users.users.sammy.packages = with pkgs; [ + qt5.qtwayland + wdisplays + waypipe + wl-clipboard + ]; + + environment.variables.SDL_VIDEODRIVER = "wayland"; + environment.variables.QT_QPA_PLATFORM = "wayland"; + environment.variables.QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; + environment.variables._JAVA_AWT_WM_NONREPARENTING = "1"; + environment.variables.NIXOS_OZONE_WL = "1"; + + xdg.portal.enable = true; + xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-wlr ]; + + security.pam.services.swaylock.rules.auth.fprintd = { + order = config.security.pam.services.swaylock.rules.auth.unix.order + 10; + }; + + home-manager.users.sammy = { + services.swayidle = + let + lockCommand = "${pkgs.writeShellScript "swaylock-command" '' + ${pkgs.grim}/bin/grim -t png -l 1 /tmp/lock-screenshot.png + ${pkgs.imagemagick}/bin/magick /tmp/lock-screenshot.png -blur 80x40 /tmp/lock-screenshot.png + ${pkgs.swaylock}/bin/swaylock -i /tmp/lock-screenshot.png + ''}"; + in + { + enable = true; + events = [ + { event = "before-sleep"; command = lockCommand; } + { event = "lock"; command = lockCommand; } + ]; + timeouts = [ + { timeout = 300; command = lockCommand; } + ]; + }; + wayland.windowManager.sway = + let + cfg = config.home-manager.users.sammy.wayland.windowManager.sway; + modifier = "Mod4"; + in + { + enable = true; + wrapperFeatures.gtk = true; + + config = { + fonts = { + names = [ "JetBrains Mono" ]; + size = 8.0; + }; + terminal = "foot"; + menu = "wofi --show drun"; + + bars = [ ]; + + window = { + border = 0; + hideEdgeBorders = "both"; + }; + gaps.inner = 10; + + output = { + "*" = { }; + }; + + input = { + "*" = { + xkb_layout = "de"; + xkb_options = "caps:escape"; + }; + "type:touchpad" = { + tap = "enabled"; + }; + }; + + keybindings = { + "${modifier}+Return" = "exec ${cfg.config.terminal}"; + + "${modifier}+Left" = "focus left"; + "${modifier}+Down" = "focus down"; + "${modifier}+Up" = "focus up"; + "${modifier}+Right" = "focus right"; + + "${modifier}+Shift+Left" = "move left"; + "${modifier}+Shift+Down" = "move down"; + "${modifier}+Shift+Up" = "move up"; + "${modifier}+Shift+Right" = "move right"; + + "${modifier}+h" = "split h"; + "${modifier}+v" = "split v"; + + "${modifier}+s" = "layout stacked"; + "${modifier}+w" = "layout tabbed"; + + "${modifier}+Shift+space" = "floating toggle"; + "${modifier}+space" = "focus mode_toggle"; + "${modifier}+a" = "focus parent"; + + "${modifier}+f" = "fullscreen toggle"; + + "${modifier}+1" = "workspace 1"; + "${modifier}+2" = "workspace 2"; + "${modifier}+3" = "workspace 3"; + "${modifier}+4" = "workspace 4"; + "${modifier}+5" = "workspace 5"; + "${modifier}+6" = "workspace 6"; + "${modifier}+7" = "workspace 7"; + "${modifier}+8" = "workspace 8"; + "${modifier}+9" = "workspace 9"; + "${modifier}+0" = "workspace 10"; + "${modifier}+F1" = "workspace 11"; + "${modifier}+F2" = "workspace 12"; + "${modifier}+F3" = "workspace 13"; + "${modifier}+F4" = "workspace 14"; + "${modifier}+F5" = "workspace 15"; + "${modifier}+F6" = "workspace 16"; + "${modifier}+F7" = "workspace 17"; + "${modifier}+F8" = "workspace 18"; + "${modifier}+F9" = "workspace 19"; + "${modifier}+F10" = "workspace 20"; + + "${modifier}+Shift+1" = "move container to workspace 1"; + "${modifier}+Shift+2" = "move container to workspace 2"; + "${modifier}+Shift+3" = "move container to workspace 3"; + "${modifier}+Shift+4" = "move container to workspace 4"; + "${modifier}+Shift+5" = "move container to workspace 5"; + "${modifier}+Shift+6" = "move container to workspace 6"; + "${modifier}+Shift+7" = "move container to workspace 7"; + "${modifier}+Shift+8" = "move container to workspace 8"; + "${modifier}+Shift+9" = "move container to workspace 9"; + "${modifier}+Shift+0" = "move container to workspace 10"; + "${modifier}+Shift+F1" = "move container to workspace 11"; + "${modifier}+Shift+F2" = "move container to workspace 12"; + "${modifier}+Shift+F3" = "move container to workspace 13"; + "${modifier}+Shift+F4" = "move container to workspace 14"; + "${modifier}+Shift+F5" = "move container to workspace 15"; + "${modifier}+Shift+F6" = "move container to workspace 16"; + "${modifier}+Shift+F7" = "move container to workspace 17"; + "${modifier}+Shift+F8" = "move container to workspace 18"; + "${modifier}+Shift+F9" = "move container to workspace 19"; + "${modifier}+Shift+F10" = "move container to workspace 20"; + + "XF86AudioRaiseVolume" = "exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -i 5"; + "XF86AudioLowerVolume" = "exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -d 5"; + "XF86AudioMute" = "exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -t"; + "XF86AudioMicMute" = "exec --no-startup-id ${pkgs.pamixer}/bin/pamixer --default-source -t"; + "XF86MonBrightnessDown" = "exec ${pkgs.light}/bin/light -U 5"; + "XF86MonBrightnessUp" = "exec ${pkgs.light}/bin/light -A 5"; + + "${modifier}+l" = "exec loginctl lock-session"; + "${modifier}+d" = "exec ${cfg.config.menu}"; + + "${modifier}+Shift+c" = "reload"; + "${modifier}+Shift+e" = "exit"; + "${modifier}+Shift+q" = "kill"; + + "${modifier}+r" = "mode resize"; + + "${modifier}+Shift+s" = "exec ${pkgs.grim}/bin/grim -t png -l 1 -g \"$(${pkgs.slurp}/bin/slurp)\" ~/screenshot-$(date +%Y-%m-%d_%H-%m-%s).png"; + }; + + }; + + extraConfig = '' + client.focused #00000000 #000000cc #FFFFFF + client.unfocused #00000000 #00000070 #FFFFFF + client.focused_inactive #00000000 #00000090 #FFFFFF + titlebar_border_thickness 3 + titlebar_padding 8 6 + ''; + }; + }; +} diff --git a/profiles/desktop/waybar-config.json b/profiles/desktop/waybar-config.json new file mode 100644 index 0000000..30973f5 --- /dev/null +++ b/profiles/desktop/waybar-config.json @@ -0,0 +1,69 @@ +{ + "layer": "top", + "position": "bottom", + "modules-left": [ + "sway/workspaces", + "sway/mode", + "tray" + ], + "modules-right": [ + "network", + "pulseaudio", + "temperature", + "cpu", + "memory", + "battery", + "clock" + ], + "cpu": { + "format": " {usage}%" + }, + "memory": { + "format": " {percentage}%", + "states": { + "warning": 15, + "critical": 75 + } + }, + "battery": { + "format": "{icon} {capacity}%", + "format-icons": [ + "", + "", + "", + "", + "" + ], + "states": { + "critical": 10, + "warning": 25 + } + }, + "pulseaudio": { + "format": "{icon} {volume}%", + "format-icons": [ + "", + "" + ], + "format-muted": " muted" + }, + "clock": { + "format": "{:%a %Y-%m-%d %H:%M:%S%z}", + "interval": 1 + }, + "network": { + "format-wifi": " {essid} ({signalStrength}%)", + "format-ethernet": " connected", + "format-disconnected": "no network", + //An empty format will hide the module. + "tooltip-format": "IPv4: {ipaddr}/{cidr}\nFrequency: {frequency}MHz\nStrength:{signaldBm}dBm", + "max-length": 50, + "interval": 5 + }, + "temperature": { + "critical-threshold": 70, + "format": " {temperatureC}°C", + "interval": 1, + "hwmon-path": "/sys/class/hwmon/hwmon5/temp1_input" + } +} diff --git a/profiles/desktop/waybar-style.css b/profiles/desktop/waybar-style.css new file mode 100644 index 0000000..76ece20 --- /dev/null +++ b/profiles/desktop/waybar-style.css @@ -0,0 +1,60 @@ +* { + border: none; + border-radius: 0; + font-family: "JetBrains Mono", sans-serif; + font-size: 8pt; +} + +window { + background: linear-gradient(rgba(0, 0, 0, .6), rgba(0, 0, 0, 0.4)); + color: #fff; +} +#workspaces { + padding-right: 15px; +} + +#workspaces button { + transition: none; + padding: 0 5px; + background: rgba(255, 255, 255, .2); + color: #fff; +} + +#workspaces button.icon label { + font-size: 10px; +} + +#workspaces button.focused { + color: #333; + background: #fff; +} + +/* :sparkles: maybe needs to be changed to button, when waybar breaks */ +window>*>*>*>label { + margin: 0 7px; + padding: 5px; + background-color: rgba(255, 255, 255, .2); + color: #fff; +} + +#tray { + margin-left: 10px; +} + +#pulseaudio.muted { + color: #ffbb00 +} +#network.disconnected, +#battery:not(.charging).warning, +#temperature.critical { + background: #ffbb00; + color: black; +} +#battery:not(.charging).critical { + background: #c50014; + color: white; +} + +#battery.charging { + background: #2a7230; +} diff --git a/profiles/desktop/waybar.nix b/profiles/desktop/waybar.nix new file mode 100644 index 0000000..a78cfb6 --- /dev/null +++ b/profiles/desktop/waybar.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: { + users.users.sammy.packages = with pkgs; [ waybar ]; + home-manager.users.sammy = { + xdg.configFile."waybar/config".source = ./waybar-config.json; + xdg.configFile."waybar/style.css".source = ./waybar-style.css; + wayland.windowManager.sway.config.startup = [{ + command = "${pkgs.waybar}/bin/waybar"; + always = true; + }]; + }; +} + diff --git a/profiles/desktop/wofi.nix b/profiles/desktop/wofi.nix new file mode 100644 index 0000000..eefc393 --- /dev/null +++ b/profiles/desktop/wofi.nix @@ -0,0 +1,49 @@ +{ pkgs, ... }: + +{ + home-manager.users.sammy = { + programs.wofi = { + enable = true; + style = '' + window { + margin: 0px; + background-color: #2D2A2E; + } + + #input { + margin: 2.5px; + border: none; + color: #a0e300; + background-color: #3F3A40; + } + + #inner-box { + margin: 2.5px; + border: none; + background-color: #2D2A2E; + } + + #outer-box { + margin: 2.5px; + border: none; + background-color: #2D2A2E; + } + + #scroll { + margin: 0px; + border: none; + } + + #text { + margin: 2.5px; + border: none; + color: #FCFCFA; + } + + #entry:selected { + background-color: #3F3A40; + } + ''; + }; + }; +} diff --git a/profiles/iso/default.nix b/profiles/iso/default.nix index 891c3a9..3507c75 100644 --- a/profiles/iso/default.nix +++ b/profiles/iso/default.nix @@ -43,9 +43,6 @@ ]; home-manager.users.nixos = { - imports = [ - ../../modules/home/foot - ]; home.stateVersion = "23.11"; }; diff --git a/users/sammy@chansey/home.nix b/users/sammy@chansey/home.nix deleted file mode 100644 index fcd6d85..0000000 --- a/users/sammy@chansey/home.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ ... }: { - imports = [ - ../sammy/home.nix - ]; - programs.ssh.includes = [ - "./famedly-config" - ]; - programs.git.includes = [ - { - path = "~/famedly/.gitconfig"; - condition = "gitdir:~/famedly/"; - } - ]; -}