From ed926635df7b2d8da16a8a39b8ab4fb24d8e036f Mon Sep 17 00:00:00 2001 From: Yusuf Bera Ertan Date: Wed, 23 Dec 2020 19:54:51 +0300 Subject: [PATCH] more stuff --- flake.lock | 85 ++++ hosts/default.nix | 37 +- hosts/lungmen.nix | 23 +- lib/utils.nix | 17 +- overlays/hikari.nix | 8 +- profiles/core.nix | 112 ++--- profiles/develop/editor/default.nix | 4 +- profiles/network/dns/stubby/nextdns.nix | 24 +- profiles/network/nginx.nix | 35 ++ users/patriot/home.nix | 548 ++++++++++++++---------- users/profiles/hikari.nix | 14 +- 11 files changed, 576 insertions(+), 331 deletions(-) create mode 100644 flake.lock create mode 100644 profiles/network/nginx.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..19131db --- /dev/null +++ b/flake.lock @@ -0,0 +1,85 @@ +{ + "nodes": { + "home": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1608681543, + "narHash": "sha256-6YNP8GBG0nhqLMQVkCBxRirTYaaGhI8gKCwgcJ5+sLc=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "3627ec4de58d7fbda13c82dfec94eace10198f23", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "impermanence": { + "flake": false, + "locked": { + "lastModified": 1607963610, + "narHash": "sha256-GbThFdlYfh9ujQjXX6Ngn88s2ALd1aepKsbxj0lgm28=", + "owner": "nix-community", + "repo": "impermanence", + "rev": "2cda5cd30bc7c56240a1a91ec8d44c6d5222ee17", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "impermanence", + "type": "github" + } + }, + "mynex": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1607689647, + "narHash": "sha256-pUpUCcp8usppbByFveRrV2NNS5sFrlvMndZt7xYOQL4=", + "owner": "yusdacra", + "repo": "nix-exprs", + "rev": "e9c16b956180d23c3cb8ec3e2843b2be662d43ef", + "type": "gitlab" + }, + "original": { + "owner": "yusdacra", + "repo": "nix-exprs", + "type": "gitlab" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1608700021, + "narHash": "sha256-timIYNV0uwrbjg5L3zloUbPeFpBXnEtosbUaWdqR72U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2ae527c50e049570dd25132f9325527aa2320e32", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable-small", + "type": "indirect" + } + }, + "root": { + "inputs": { + "home": "home", + "impermanence": "impermanence", + "mynex": "mynex", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/hosts/default.nix b/hosts/default.nix index 5fa953e..f7f06db 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -15,30 +15,33 @@ let nixosPersistence = "${impermanence}/nixos.nix"; }; - modules = let - inherit (home.nixosModules) home-manager; - inherit (mynex.nixosModules) security networking; + modules = + let + inherit (home.nixosModules) home-manager; + inherit (mynex.nixosModules) security networking; - core = ../profiles/core.nix; + core = ../profiles/core.nix; - global = { - networking.hostName = hostName; - nix.nixPath = [ - "nixpkgs=${nixpkgs}" - "nixos-config=/etc/nixos/configuration.nix" - "nixpkgs-overlays=/etc/nixos/overlays" - ]; + global = { + networking.hostName = hostName; + nix.nixPath = [ + "nixpkgs=${nixpkgs}" + "nixos-config=/etc/nixos/configuration.nix" + "nixpkgs-overlays=/etc/nixos/overlays" + ]; - nixpkgs = { inherit pkgs; }; - nixpkgs.overlays = [ mynex.overlay ]; - }; + nixpkgs = { inherit pkgs; }; + nixpkgs.overlays = [ mynex.overlay ]; + }; - local = import "${toString ./.}/${hostName}.nix"; - in [ core global local home-manager security networking ]; + local = import "${toString ./.}/${hostName}.nix"; + in + [ core global local home-manager security networking ]; }; hosts = recImport { dir = ./.; _import = config; }; -in hosts +in +hosts diff --git a/hosts/lungmen.nix b/hosts/lungmen.nix index 16cd4a1..a8f3598 100644 --- a/hosts/lungmen.nix +++ b/hosts/lungmen.nix @@ -30,11 +30,13 @@ let sudo umount /mnt ''; -in { +in +{ imports = [ ../users/patriot ../users/root ../profiles/network + # ../profiles/network/nginx.nix ../profiles/develop (modulesPath + "/installer/scan/not-detected.nix") nixosPersistence @@ -148,7 +150,7 @@ in { }; environment = { - systemPackages = [ btrfsDiff ]; + systemPackages = [ btrfsDiff pkgs.docker-compose ]; pathsToLink = [ "/share/zsh" ]; persistence."/persist" = { directories = [ "/etc/nixos" ]; @@ -161,6 +163,23 @@ in { # enable = true; # videoDrivers = [ "amdgpu" ]; # }; + virtualisation.docker.enable = true; + services.postgresql = { + enable = true; + enableTCPIP = true; + authentication = pkgs.lib.mkOverride 10 '' + local all all trust + host all all 0.0.0.0/0 md5 + ''; + settings = { + listen_addresses = "*"; + }; + initialScript = pkgs.writeText "backend-initScript" '' + CREATE ROLE harmony WITH LOGIN PASSWORD 'harmony' CREATEDB; + CREATE DATABASE harmony; + GRANT ALL PRIVILEGES ON DATABASE harmony TO harmony; + ''; + }; system.stateVersion = "20.09"; } diff --git a/lib/utils.nix b/lib/utils.nix index a0f25e5..53ccfe7 100644 --- a/lib/utils.nix +++ b/lib/utils.nix @@ -3,7 +3,8 @@ let inherit (builtins) attrNames isAttrs isInt readDir toJSON; inherit (lib) filterAttrs hasSuffix mapAttrs' nameValuePair removeSuffix; -in rec { +in +rec { # mapFilterAttrs :: # (name -> value -> bool ) # (name -> value -> { name = any; value = any; }) @@ -11,14 +12,16 @@ in rec { mapFilterAttrs = seive: f: attrs: filterAttrs seive (mapAttrs' f attrs); recImport = { dir, _import ? base: import "${dir}/${base}.nix" }: - mapFilterAttrs (_: v: v != null) (n: v: - if n != "default.nix" && hasSuffix ".nix" n && v == "regular" + mapFilterAttrs (_: v: v != null) + (n: v: + if n != "default.nix" && hasSuffix ".nix" n && v == "regular" - then - let name = removeSuffix ".nix" n; in nameValuePair (name) (_import name) + then + let name = removeSuffix ".nix" n; in nameValuePair (name) (_import name) - else - nameValuePair ("") (null)) (readDir dir); + else + nameValuePair ("") (null)) + (readDir dir); pkgBin = name: "${pkgs."${name}"}/bin/${name}"; } diff --git a/overlays/hikari.nix b/overlays/hikari.nix index 32fc2d6..368d75f 100644 --- a/overlays/hikari.nix +++ b/overlays/hikari.nix @@ -1,3 +1,9 @@ final: prev: { - hikari = prev.hikari.overrideAttrs (old: rec { version = "2.2.2"; }); + hikari = prev.hikari.overrideAttrs (old: rec { + src = prev.fetchzip { + url = "https://hub.darcs.net/raichoo/hikari/dist/hikari.zip"; + sha256 = "sha256-wguyND2LDyWtIoFibuxfFf9fi2D/0v7/fnGXy3JGjgM="; + }; + buildInputs = old.buildInputs ++ [ prev.pandoc ]; + }); } diff --git a/profiles/core.nix b/profiles/core.nix index 4d72210..b03a7d4 100644 --- a/profiles/core.nix +++ b/profiles/core.nix @@ -3,7 +3,8 @@ let inherit (util) pkgBin; inherit (lib) fileContents mkIf; -in { +in +{ imports = [ ../local/locale.nix ]; boot = { @@ -13,67 +14,72 @@ in { console.font = "7x14"; - environment = let - coreBin = v: "${pkgs.coreutils}/bin/${v}"; - nixBin = "${config.nix.package}/bin/nix"; - in { - systemPackages = with pkgs; [ - bat - exa - ripgrep - curl - git - gotop - gptfdisk - iputils - lm_sensors - mkpasswd - ]; + environment = + let + coreBin = v: "${pkgs.coreutils}/bin/${v}"; + nixBin = "${config.nix.package}/bin/nix"; + in + { + systemPackages = with pkgs; [ + bat + exa + ripgrep + curl + git + gotop + gptfdisk + iputils + lm_sensors + mkpasswd + ntfs3g + ]; - shellAliases = let ifSudo = string: mkIf config.security.sudo.enable string; - in { - g = pkgBin "git"; + shellAliases = + let ifSudo = string: mkIf config.security.sudo.enable string; + in + { + g = pkgBin "git"; - grep = "${pkgs.ripgrep}/bin/rg"; - cat = "${pkgBin "bat"} -pp --theme=base16"; - c = "${pkgBin "bat"} -pp --theme=base16"; + grep = "${pkgs.ripgrep}/bin/rg"; + cat = "${pkgBin "bat"} -pp --theme=base16"; + c = "${pkgBin "bat"} -pp --theme=base16"; - df = "${coreBin "df"} -h"; - free = "${pkgs.procps}/bin/free -h"; + df = "${coreBin "df"} -h"; + free = "${pkgs.procps}/bin/free -h"; - ls = pkgBin "exa"; - l = "${pkgBin "exa"} -lhg --git"; - la = "${pkgBin "exa"} -lhg --git -a"; - t = "${pkgBin "exa"} -lhg --git -T"; - ta = "${pkgBin "exa"} -lhg --git -a -T"; + ls = pkgBin "exa"; + l = "${pkgBin "exa"} -lhg --git"; + la = "${pkgBin "exa"} -lhg --git -a"; + t = "${pkgBin "exa"} -lhg --git -T"; + ta = "${pkgBin "exa"} -lhg --git -a -T"; - n = nixBin; - nf = "${nixBin} flake"; - nfc = "${nixBin} flake check"; - nfu = "${nixBin} flake update"; - nfua = "${nixBin} flake update --recreate-lock-file"; - nfs = "${nixBin} flake show"; - np = "${nixBin} profile"; - npl = "${nixBin} profile info"; - npi = "${nixBin} profile install"; - npr = "${nixBin} profile remove"; - nsh = "${nixBin} shell"; - ndev = "${nixBin} develop"; + n = nixBin; + nf = "${nixBin} flake"; + nfc = "${nixBin} flake check"; + nfu = "${nixBin} flake update"; + nfua = "${nixBin} flake update --recreate-lock-file"; + nfs = "${nixBin} flake show"; + np = "${nixBin} profile"; + npl = "${nixBin} profile info"; + npi = "${nixBin} profile install"; + npr = "${nixBin} profile remove"; + nsh = "${nixBin} shell"; + ndev = "${nixBin} develop"; - nosce = "cd /etc/nixos"; - nosr = ifSudo "sudo nixos-rebuild --fast"; - nosrs = ifSudo "sudo nixos-rebuild switch"; - nosrb = ifSudo "sudo nixos-rebuild boot"; - nosrt = ifSudo "sudo nixos-rebuild test"; - ncg = ifSudo "sudo nix-collect-garbage"; - ncgdo = ifSudo "sudo nix-collect-garbage --delete-old"; + nosce = "cd /etc/nixos"; + nosr = ifSudo "sudo nixos-rebuild --fast"; + nosrs = ifSudo "sudo nixos-rebuild switch"; + nosrb = ifSudo "sudo nixos-rebuild boot"; + nosrt = ifSudo "sudo nixos-rebuild test"; + ncg = ifSudo "sudo nix-collect-garbage"; + ncgdo = ifSudo "sudo nix-collect-garbage --delete-old"; - top = pkgBin "gotop"; + top = pkgBin "gotop"; - myip = - "${pkgs.dnsutils}/bin/dig +short myip.opendns.com @208.67.222.222 2>&1"; + myip = + "${pkgs.dnsutils}/bin/dig +short myip.opendns.com @208.67.222.222 2>&1"; + }; }; - }; nix = { package = pkgs.nixFlakes; diff --git a/profiles/develop/editor/default.nix b/profiles/develop/editor/default.nix index 464fa42..cb9e219 100644 --- a/profiles/develop/editor/default.nix +++ b/profiles/develop/editor/default.nix @@ -1,6 +1,6 @@ { pkgs, ... }: { imports = [ ./kakoune.nix ]; - environment.systemPackages = with pkgs; [ nixfmt ]; - environment.shellAliases = { nixf-all = "nixfmt **/**.nix"; }; + environment.systemPackages = with pkgs; [ nixpkgs-fmt ]; + environment.shellAliases = { nixf-all = "nixpkgs-fmt **/**.nix"; }; } diff --git a/profiles/network/dns/stubby/nextdns.nix b/profiles/network/dns/stubby/nextdns.nix index 9b34004..d15363a 100644 --- a/profiles/network/dns/stubby/nextdns.nix +++ b/profiles/network/dns/stubby/nextdns.nix @@ -1,16 +1,18 @@ { services.stubby = { roundRobinUpstreams = false; - upstreamServers = let nextDnsId = "75e43d"; - in '' - - address_data: 45.90.28.0 - tls_auth_name: "${nextDnsId}.dns1.nextdns.io" - - address_data: 2a07:a8c0::0 - tls_auth_name: "${nextDnsId}.dns1.nextdns.io" - - address_data: 45.90.30.0 - tls_auth_name: "${nextDnsId}.dns2.nextdns.io" - - address_data: 2a07:a8c1::0 - tls_auth_name: "${nextDnsId}.dns2.nextdns.io" - ''; + upstreamServers = + let nextDnsId = "75e43d"; + in + '' + - address_data: 45.90.28.0 + tls_auth_name: "${nextDnsId}.dns1.nextdns.io" + - address_data: 2a07:a8c0::0 + tls_auth_name: "${nextDnsId}.dns1.nextdns.io" + - address_data: 45.90.30.0 + tls_auth_name: "${nextDnsId}.dns2.nextdns.io" + - address_data: 2a07:a8c1::0 + tls_auth_name: "${nextDnsId}.dns2.nextdns.io" + ''; }; } diff --git a/profiles/network/nginx.nix b/profiles/network/nginx.nix new file mode 100644 index 0000000..428b5c8 --- /dev/null +++ b/profiles/network/nginx.nix @@ -0,0 +1,35 @@ +{ ... }: { + # services.nginx = { + # enable = true; + # enableReload = true; + # statusPage = true; + # recommendedGzipSettings = true; + # recommendedOptimisation = true; + # recommendedProxySettings = true; + # recommendedTlsSettings = true; + # virtualHosts."yusdacras-host.ydns.eu" = { + # # addSSL = true; + # # enableACME = true; + # listen = [ + # { addr = "0.0.0.0"; port = 8080; } + # { addr = "[::]"; port = 8080; } + # # { addr = "0.0.0.0"; port = 8081; ssl = true; } + # ]; + # locations = { + # "/matrix" = { proxyPass = "http://localhost:8000"; }; + # "/page" = { + # root = "/var/www/yusdacras-host"; + # }; + # }; + # }; + # }; + + # security.acme = { + # acceptTerms = true; + # certs = { + # "yusdacras-host.ydns.eu".email = "y.bera003.06@protonmail.com"; + # }; + # }; + + networking.firewall.allowedTCPPorts = [ 8000 8448 ]; +} diff --git a/users/patriot/home.nix b/users/patriot/home.nix index 403c74b..cc0c3d8 100644 --- a/users/patriot/home.nix +++ b/users/patriot/home.nix @@ -16,13 +16,13 @@ let kideSrc = pkgs.fetchgit { url = "https://gitlab.com/yusdacra/kide.git"; - rev = "c4116d433add520d8e18382e0bfee9c49bf67fd0"; - sha256 = "sha256-RTYl0rFR7Tv5UisQXL4Wucrlw3NZeTKIqrXTdx095y0="; + rev = "40cb21c7e553fcc0fed99ed93dabbc1ffca0dbd0"; + sha256 = "sha256-MLHyQWFs7/I12dzXGKJAIlyO3tw3y4otVeVjeXxrqY4="; fetchSubmodules = true; }; kideFiles = mapAttrs' (n: _: nameValuePair "kak/${n}" { source = "${kideSrc}/${n}"; }) - (readDir kideSrc); + (readDir kideSrc); kideDeps = with pkgs; [ fzf bat @@ -46,6 +46,7 @@ let }; normal = { black = "ece3cc"; + gray = "5b5b5b"; red = "d2212d"; green = "489100"; yellow = "ad8900"; @@ -56,6 +57,7 @@ let }; bright = { black = "d5cdb6"; + gray = "7b7b7b"; red = "cc1729"; green = "428b00"; yellow = "a78300"; @@ -66,19 +68,20 @@ let }; }; - colorSchemeDark = { + colorSchemeDark = rec { primary = { normal = { background = "181818"; foreground = "b9b9b9"; }; bright = { - background = "3b3b3b"; - foreground = "dedede"; + background = bright.black; + foreground = bright.white; }; }; normal = { black = "252525"; + gray = "5b5b5b"; red = "ed4a46"; green = "70b433"; yellow = "dbb32d"; @@ -89,6 +92,7 @@ let }; bright = { black = "3b3b3b"; + gray = "7b7b7b"; red = "ff5e56"; green = "83c746"; yellow = "efc541"; @@ -100,7 +104,8 @@ let }; colorScheme = - if builtins.pathExists ./light then colorSchemeLight else colorSchemeDark; + # if builtins.pathExists ./light then colorSchemeLight else colorSchemeDark; + colorSchemeDark; bgColor = colorScheme.primary.normal.background; fgColor = colorScheme.primary.bright.foreground; @@ -145,21 +150,45 @@ let indicator = "#111111"; # don't care }; fonts = [ fontComb ]; -in { +in +{ home-manager.users.patriot = { config, pkgs, ... }: { imports = [ ../profiles/hikari.nix ]; + gtk = { + # enable = true; + font = { + package = pkgs.dejavu_fonts; + name = "DejaVu Sans 12"; + }; + iconTheme = { + package = pkgs.papirus-icon-theme; + name = "Papirus Dark"; + }; + theme = { + package = pkgs.numix-gtk-theme; + name = "Numix Dark"; + }; + }; + + qt = { + # enable = true; + platformTheme = "gtk"; + }; + fonts.fontconfig.enable = true; home = { homeDirectory = nixosConfig.users.users.patriot.home; packages = with pkgs; [ - darcs - discord + # Font stuff fontPackage noto-fonts-cjk + noto-fonts-emoji-blob-bin font-awesome - nerdfonts + (nerdfonts.override { fonts = [ "Iosevka" ]; }) + # Programs + appimage-run bitwarden pfetch neofetch @@ -169,15 +198,17 @@ in { youtube-dl ffmpeg mupdf + transmission-gtk + gitAndTools.gh steam-run lutris xdg_utils # xdg-user-dirs + tagref # gnome3.zenity # x11 docker stuff # x11docker # weston - xwayland # xpra # xdotool # xorg.setxkbmap @@ -202,9 +233,12 @@ in { # use this if they aren't displayed properly: export _JAVA_AWT_WM_NONREPARENTING=1 ''; + wrapperFeatures.gtk = true; config = { inherit fonts; - bars = [ ]; # no + bars = [{ + command = "${pkgBin "waybar"}"; + }]; colors = { background = "#${bgColor}"; focused = addIndSway focusedWorkspace; @@ -216,43 +250,47 @@ in { menu = "${pkgBin "rofi"} -show drun | ${pkgs.sway}/bin/swaymsg --"; modifier = "Mod4"; terminal = pkgBin "alacritty"; - keybindings = let - mod = config.wayland.windowManager.sway.config.modifier; - cat = pkgs.coreutils + "/bin/cat"; - grim = pkgBin "grim"; - slurp = pkgBin "slurp"; - pactl = pkgs.pulseaudio + "/bin/pactl"; - playerctl = pkgBin "playerctl"; - wf-recorder = pkgBin "wf-recorder"; - wl-copy = pkgs.wl-clipboard + "/bin/wl-copy"; - wl-paste = pkgs.wl-clipboard + "/bin/wl-paste"; - shotFile = config.home.homeDirectory - + "/shots/shot_$(date '+%Y_%m_%d_%H_%M')"; - in lib.mkOptionDefault { - "${mod}+q" = "kill"; - # Screenshot and copy it to clipboard - "Mod1+s" = '' - exec export SFILE="${shotFile}.png" && ${grim} "$SFILE" && ${cat} "$SFILE" | ${wl-copy} -t image/png - ''; - # Save selected area as a picture and copy it to clipboard - "Mod1+Shift+s" = '' - exec export SFILE="${shotFile}.png" && ${grim} -g "$(${slurp})" "$SFILE" && ${cat} "$SFILE" | ${wl-copy} -t image/png - ''; - # Record screen - "Mod1+r" = ''exec ${wf-recorder} -f "${shotFile}.mp4"''; - # Record an area - "Mod1+Shift+r" = - ''exec ${wf-recorder} -g "$(${slurp})" -f "${shotFile}.mp4"''; - # Stop recording - "Mod1+c" = "exec pkill -INT wf-recorder"; - "XF86AudioRaiseVolume" = "exec ${pactl} set-sink-volume 0 +5%"; - "XF86AudioLowerVolume" = "exec ${pactl} set-sink-volume 0 -5%"; - "XF86AudioMute" = "exec ${pactl} set-sink-mute 0 toggle"; - "XF86AudioPlay" = "exec ${playerctl} play-pause"; - "XF86AudioPrev" = "exec ${playerctl} previous"; - "XF86AudioNext" = "exec ${playerctl} next"; - "XF86AudioStop" = "exec ${playerctl} stop"; - }; + keybindings = + let + mod = config.wayland.windowManager.sway.config.modifier; + cat = pkgs.coreutils + "/bin/cat"; + grim = pkgBin "grim"; + slurp = pkgBin "slurp"; + pactl = pkgs.pulseaudio + "/bin/pactl"; + playerctl = pkgBin "playerctl"; + wf-recorder = pkgBin "wf-recorder"; + wl-copy = pkgs.wl-clipboard + "/bin/wl-copy"; + wl-paste = pkgs.wl-clipboard + "/bin/wl-paste"; + shotFile = config.home.homeDirectory + + "/shots/shot_$(date '+%Y_%m_%d_%H_%M')"; + in + lib.mkOptionDefault { + "${mod}+q" = "kill"; + "${mod}+Shift+e" = "exit"; + "${mod}+Shift+r" = "reload"; + # Screenshot and copy it to clipboard + "Mod1+s" = '' + exec export SFILE="${shotFile}.png" && ${grim} "$SFILE" && ${cat} "$SFILE" | ${wl-copy} -t image/png + ''; + # Save selected area as a picture and copy it to clipboard + "Mod1+Shift+s" = '' + exec export SFILE="${shotFile}.png" && ${grim} -g "$(${slurp})" "$SFILE" && ${cat} "$SFILE" | ${wl-copy} -t image/png + ''; + # Record screen + "Mod1+r" = ''exec ${wf-recorder} -f "${shotFile}.mp4"''; + # Record an area + "Mod1+Shift+r" = + ''exec ${wf-recorder} -g "$(${slurp})" -f "${shotFile}.mp4"''; + # Stop recording + "Mod1+c" = "exec pkill -INT wf-recorder"; + "XF86AudioRaiseVolume" = "exec ${pactl} set-sink-volume 0 +5%"; + "XF86AudioLowerVolume" = "exec ${pactl} set-sink-volume 0 -5%"; + "XF86AudioMute" = "exec ${pactl} set-sink-mute 0 toggle"; + "XF86AudioPlay" = "exec ${playerctl} play-pause"; + "XF86AudioPrev" = "exec ${playerctl} previous"; + "XF86AudioNext" = "exec ${playerctl} next"; + "XF86AudioStop" = "exec ${playerctl} stop"; + }; input = { "*" = { xkb_layout = nixosConfig.services.xserver.layout; @@ -293,28 +331,43 @@ in { set -g status off ''; }; - qutebrowser = { + chromium = { enable = true; + # package = pkgs.ungoogled-chromium; + extensions = [ + "gcbommkclmclpchllfjekcdonpmejbdp" # https everywhere + "cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock + "nngceckbapebfimnlniiiahkandclblb" # bitwarden + "ldpochfccmkkmhdbclfhpagapcfdljkj" # decentraleyes + "annfbnbieaamhaimclajlajpijgkdblo" # dark theme + "eimadpbcbfnmbkopoojfekhnkhdbieeh" # dark reader + "hlepfoohegkhhmjieoechaddaejaokhf" # github refined + ]; + }; + qutebrowser = { + # enable = true; settings = { content.javascript.enabled = false; colors.webpage.darkmode.enabled = true; tabs = { show = "multiple"; }; }; - extraConfig = let - domains = [ - "github.com" - "gitlab.com" - "nixos.org" - "protonmail.com" - "bitwarden.com" - "duckduckgo.com" - "youtube.com" - "docker.com" - ]; - enableJsForDomain = d: '' - config.set('content.javascript.enabled', True, 'https://*.${d}') - ''; - in lib.concatStrings (map enableJsForDomain domains); + extraConfig = + let + domains = [ + "github.com" + "gitlab.com" + "nixos.org" + "protonmail.com" + "bitwarden.com" + "duckduckgo.com" + "youtube.com" + "docker.com" + ]; + enableJsForDomain = d: '' + config.set('content.javascript.enabled', True, 'https://*.${d}') + ''; + in + lib.concatStrings (map enableJsForDomain domains); }; git = { enable = true; @@ -354,14 +407,15 @@ in { compression = true; hashKnownHosts = true; userKnownHostsFile = "~/.local/share/ssh/known-hosts"; - extraConfig = '' - Host hub.darcs.net - ControlMaster no - ForwardAgent no - ForwardX11 no - Ciphers +aes256-cbc - MACs +hmac-sha1 - ''; + # Only needed for darcs + # extraConfig = '' + # Host hub.darcs.net + # ControlMaster no + # ForwardAgent no + # ForwardX11 no + # Ciphers +aes256-cbc + # MACs +hmac-sha1 + # ''; }; zsh = { enable = true; @@ -369,21 +423,23 @@ in { enableVteIntegration = true; enableAutosuggestions = true; enableCompletion = true; - plugins = let - fast-syntax-highlighting = { - name = "fast-syntax-highlighting"; - src = "${pkgs.zsh-fast-syntax-highlighting}"; - }; - per-directory-history = { - name = "per-directory-history"; - src = pkgs.fetchFromGitHub { - owner = "jimhester"; - repo = "per-directory-history"; - rev = "d2e291dd6434e340d9be0e15e1f5b94f32771c06"; - hash = "sha256-VHRgrVCqzILqOes8VXGjSgLek38BFs9eijmp0JHtD5Q="; + plugins = + let + fast-syntax-highlighting = rec { + name = "fast-syntax-highlighting"; + src = pkgs."zsh-${name}".out; }; - }; - in [ fast-syntax-highlighting per-directory-history ]; + per-directory-history = { + name = "per-directory-history"; + src = pkgs.fetchFromGitHub { + owner = "jimhester"; + repo = "per-directory-history"; + rev = "d2e291dd6434e340d9be0e15e1f5b94f32771c06"; + hash = "sha256-VHRgrVCqzILqOes8VXGjSgLek38BFs9eijmp0JHtD5Q="; + }; + }; + in + [ fast-syntax-highlighting per-directory-history ]; # xdg compliant dotDir = ".config/zsh"; history.path = ".local/share/zsh/history"; @@ -396,11 +452,15 @@ in { # use this if they aren't displayed properly: export _JAVA_AWT_WM_NONREPARENTING=1 ''; - loginExtra = '' - if [ "$(${pkgs.coreutils}/bin/tty)" = "/dev/tty1" ]; then - exec ${pkgBin "hikari"} - fi - ''; + loginExtra = + let + deCmd = if config.wayland.windowManager.sway.enable then "sway" else (if config.wayland.windowManager.hikari.enable then "hikari" else throw "Need a window manager to start!"); + in + '' + if [ "$(${pkgs.coreutils}/bin/tty)" = "/dev/tty1" ]; then + exec ${pkgBin deCmd} + fi + ''; initExtra = '' bindkey "$terminfo[kRIT5]" forward-word bindkey "$terminfo[kLFT5]" backward-word @@ -428,180 +488,196 @@ in { enableNixDirenvIntegration = true; }; fzf.enable = true; - rofi = let - bgc = "#${bgColor}"; - fgc = "#${fgColor}"; - acc = "#${acColor}"; - in { - enable = true; - colors = { - window = { - background = bgc; - border = bgc; - separator = bgc; - }; - rows = { - normal = { + rofi = + let + bgc = "#${bgColor}"; + fgc = "#${fgColor}"; + acc = "#${acColor}"; + in + { + enable = true; + colors = { + window = { background = bgc; - foreground = fgc; - backgroundAlt = bgc; - highlight = { + border = bgc; + separator = bgc; + }; + rows = { + normal = { background = bgc; - foreground = acc; + foreground = fgc; + backgroundAlt = bgc; + highlight = { + background = bgc; + foreground = acc; + }; }; }; }; + font = fontComb; + separator = "none"; + terminal = pkgBin "alacritty"; }; - font = fontComb; - separator = "none"; - terminal = pkgBin "alacritty"; - }; - waybar = { - enable = true; - settings = [{ - layer = "top"; - position = "top"; - modules-left = [ ]; - modules-center = [ ]; - modules-right = - [ "pulseaudio" "cpu" "memory" "temperature" "clock" "tray" ]; - modules = { - "tray" = { spacing = 8; }; - "cpu" = { format = "/cpu {usage}/"; }; - "memory" = { format = "/mem {}/"; }; - "temperature" = { - hwmon-path = "/sys/class/hwmon/hwmon1/temp2_input"; - format = "/tmp {temperatureC}C/"; + waybar = + let + swayEnabled = config.wayland.windowManager.sway.enable; + in + { + enable = true; + settings = [{ + layer = "top"; + position = "top"; + modules-left = if swayEnabled then [ "sway/workspaces" ] else [ ]; + modules-center = if swayEnabled then [ "sway/window" ] else [ ]; + modules-right = + [ "pulseaudio" "cpu" "memory" "temperature" "clock" "tray" ]; + modules = { + "tray" = { spacing = 8; }; + "cpu" = { format = "/cpu {usage}/"; }; + "memory" = { format = "/mem {}/"; }; + "temperature" = { + hwmon-path = "/sys/class/hwmon/hwmon1/temp2_input"; + format = "/tmp {temperatureC}C/"; + }; + "pulseaudio" = { + format = "/vol {volume}/ {format_source}"; + format-bluetooth = "/volb {volume}/ {format_source}"; + format-bluetooth-muted = "/volb/ {format_source}"; + format-muted = "/vol/ {format_source}"; + format-source = "/mic {volume}/"; + format-source-muted = "/mic/"; + }; }; - "pulseaudio" = { - format = "/vol {volume}/ {format_source}"; - format-bluetooth = "/volb {volume}/ {format_source}"; - format-bluetooth-muted = "/volb/ {format_source}"; - format-muted = "/vol/ {format_source}"; - format-source = "/mic {volume}/"; - format-source-muted = "/mic/"; - }; - }; - }]; - style = '' - * { - border: none; - border-radius: 0; - /* `otf-font-awesome` is required to be installed for icons */ - font-family: ${font}; - font-size: 13px; - min-height: 0; - } + }]; + style = + let + makeBorder = color: "border-bottom: 3px solid #${color};"; + makeInfo = color: '' + color: #${color}; + ${makeBorder color} + ''; - window#waybar { - background-color: #222222; - border-bottom: 0px solid rgba(100, 114, 125, 0.5); - color: #ffffff; - transition-property: background-color; - transition-duration: .5s; - } + clockColor = colorScheme.bright.magenta; + cpuColor = colorScheme.bright.green; + memColor = colorScheme.bright.blue; + pulseColor = { + normal = colorScheme.bright.cyan; + muted = colorScheme.bright.gray; + }; + tmpColor = { + normal = colorScheme.bright.yellow; + critical = colorScheme.bright.red; + }; + in + '' + * { + border: none; + border-radius: 0; + /* `otf-font-awesome` is required to be installed for icons */ + font-family: ${font}; + font-size: 13px; + min-height: 0; + } - #workspaces button { - padding: 0 5px; - background-color: transparent; - color: #ffffff; - border-bottom: 3px solid transparent; - } + window#waybar { + background-color: #${bgColor}; + /* border-bottom: 0px solid rgba(100, 114, 125, 0.5); */ + color: #${fgColor}; + transition-property: background-color; + transition-duration: .5s; + } - /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ - #workspaces button:hover { - background: rgba(0, 0, 0, 0.2); - box-shadow: inherit; - border-bottom: 3px solid #ffffff; - } + #workspaces button { + padding: 0 5px; + background-color: transparent; + color: #${fgColor}; + border-bottom: 3px solid transparent; + } - #workspaces button.focused { - background-color: #64727D; - border-bottom: 3px solid #ffffff; - } + /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ + #workspaces button:hover { + background: rgba(0, 0, 0, 0.2); + box-shadow: inherit; + border-bottom: 3px solid #ffffff; + } - #workspaces button.urgent { - background-color: #eb4d4b; - } + #workspaces button.focused { + border-bottom: 3px solid #${acColor}; + } - #mode { - background-color: #64727D; - border-bottom: 3px solid #ffffff; - } + #workspaces button.urgent { + background-color: #${acColor}; + color: #${bgColor}; + } - #clock, - #battery, - #cpu, - #memory, - #temperature, - #backlight, - #network, - #pulseaudio, - #custom-media, - #tray, - #mode, - #idle_inhibitor, - #mpd { - padding: 0 10px; - margin: 0 4px; - color: #ffffff; - } + #mode { + background-color: #64727D; + border-bottom: 3px solid #ffffff; + } - #clock { - background-color: #64727D; - color: #000000; - } + #clock, + #battery, + #cpu, + #memory, + #temperature, + #backlight, + #network, + #pulseaudio, + #custom-media, + #tray, + #mode, + #idle_inhibitor, + #mpd { + padding: 0 10px; + margin: 0 4px; + background-color: transparent; + ${makeInfo fgColor} + } - label:focus { - background-color: #000000; - } + label:focus { + color: #000000; + } - #cpu { - background-color: #2ecc71; - color: #000000; - } + #clock { + ${makeInfo clockColor} + } - #memory { - background-color: #9b59b6; - color: #000000; - } + #cpu { + ${makeInfo cpuColor} + } - #pulseaudio { - background-color: #f1c40f; - color: #000000; - } + #memory { + ${makeInfo memColor} + } - #pulseaudio.muted { - background-color: #90b1b1; - color: #2a5c45; - } + #pulseaudio { + ${makeInfo pulseColor.normal} + } - #temperature { - background-color: #f0932b; - color: #000000; - } + #pulseaudio.muted { + ${makeInfo pulseColor.muted} + } - #temperature.critical { - background-color: #eb4d4b; - color: #000000; - } + #temperature { + ${makeInfo tmpColor.normal} + } - #tray { - background-color: #2980b9; - } - ''; - }; + #temperature.critical { + ${makeInfo tmpColor.critical} + } + ''; + }; }; services = { - gpg-agent = { + gpg-agent = rec { enable = true; enableSshSupport = true; sshKeys = [ "8369D9CA26C3EAAAB8302A88CEE6FD14B58AA965" ]; defaultCacheTtl = 3600 * 6; - defaultCacheTtlSsh = 3600 * 6; + defaultCacheTtlSsh = defaultCacheTtl; maxCacheTtl = 3600 * 24; - maxCacheTtlSsh = 3600 * 24; + maxCacheTtlSsh = maxCacheTtl; grabKeyboardAndMouse = false; pinentryFlavor = "gtk2"; }; diff --git a/users/profiles/hikari.nix b/users/profiles/hikari.nix index ee40124..41bd38e 100644 --- a/users/profiles/hikari.nix +++ b/users/profiles/hikari.nix @@ -1,9 +1,14 @@ { lib, config, pkgs, ... }: with lib; let cfg = config.wayland.windowManager.hikari; -in { +in +{ options.wayland.windowManager.hikari = { enable = mkEnableOption "hikari window manager"; + xwayland = mkOption { + type = types.bool; + default = true; + }; font = mkOption { type = types.str; default = "Iosevka"; @@ -11,7 +16,7 @@ in { }; config = mkIf cfg.enable { - home.packages = with pkgs; [ hikari ]; + home.packages = with pkgs; [ hikari ] ++ (optional cfg.xwayland xwayland); xdg = { enable = true; @@ -50,6 +55,11 @@ in { } } } + pointers { + "*" { + accel-profile = "flat" + } + } } layouts {