~ruther/nixos-config

83a8a9540adf86155220703b70c5fbdc9c6c3def — Frantisek Bohacek 1 year, 3 days ago b97d300
feat: some updates

too lazy to comment all of them :(
M hosts/configuration.nix => hosts/configuration.nix +22 -8
@@ 11,7 11,7 @@
#           └─ default.nix
#

{ config, lib, pkgs, inputs, user, ... }:
{ config, nixpkgs, lib, pkgs, inputs, user, ... }:

{
  imports =                                   # Home Manager Modules


@@ 28,7 28,7 @@
  users.groups.plugdev.members = [ "${user}" ];
  users.users.${user} = {                   # System User
    isNormalUser = true;
    extraGroups = [ "wheel" "video" "audio" "camera" "networkmanager" "lp" "scanner" "kvm" "libvirtd" "plex" "podman" ];
    extraGroups = [ "wheel" "video" "audio" "camera" "networkmanager" "lp" "scanner" "kvm" "libvirtd" "plex" "podman" "input" "tty" ];
    shell = pkgs.zsh;                       # Default shell
  };
  programs.zsh.enable = true; # has to be here to set shell to zsh


@@ 158,26 158,34 @@
      "nixpkgs-stable=flake:nixpkgs-stable"
    ];

    # package = pkgs.nixVersions.stable.overrideAttrs (old: {
    #   patches = old.patches or [ ] ++ [
    #     (pkgs.fetchpatch {
    #       url = "https://github.com/NixOS/nix/commit/b6ae3be9c6ec4e9de55479188e76fc330b2304dd.patch";
    #       hash = "sha256-VyIywGo1ie059wXmGWx+bNeHz9lNk6nlkJ/Qgd1kmzw=";
    #     })
    #   ];
    # });

    settings = {
      # reject-flake-config = true;

      connect-timeout = 5;

      flake-registry = "";
      flake-registry = ""; # Do not pollute with external flake registry

      auto-optimise-store = true;           # Optimise syslinks
      substituters = [
        "https://cache.nixos.org"
        "https://rutherther.cachix.org"
      ];
      trusted-public-keys = [
        "rutherther.cachix.org-1:O9st5Dq/VHb0T8+vwZ0aP4sjzzCn7Ry60wSyXaRW7j8="
      ];
    };

    gc = {                                  # Automatic garbage collection
      automatic = true;
      dates = "weekly";
      options = "--delete-older-than 2d";
    };
    package = pkgs.nixVersions.unstable;    # Enable nixFlakes on system

    extraOptions = ''
      experimental-features = nix-command flakes
      keep-outputs          = true


@@ 186,6 194,12 @@
  };
  nixpkgs.config.allowUnfree = true;        # Allow proprietary software.

  # nixpkgs.overlays = [
  #   (final: prev: {
  #     xz = inputs.nixpkgs-stable.legacyPackages.${prev.hostPlatform.system}.xz;
  #   })
  # ];

  boot.binfmt.emulatedSystems = [ "aarch64-linux" ];

  system = {                                # NixOS settings

M hosts/home.nix => hosts/home.nix +4 -2
@@ 156,12 156,14 @@
      comma
      bat
      ripgrep

      pinta
    ];

    pointerCursor = {                         # This will set cursor system-wide so applications can not choose their own
      gtk.enable = true;
      name = "Catppuccin-Frappe-Lavender-Cursors";
      package = pkgs.catppuccin-cursors.frappeLavender;
      name = "Catppuccin-Frappe-Sapphire-Cursors";
      package = pkgs.catppuccin-cursors.frappeSapphire;
      size = 16;
    };
    stateVersion = "23.05";

M modules/desktop/qtile/config/config.py => modules/desktop/qtile/config/config.py +5 -3
@@ 78,9 78,10 @@ keys.extend([

# Spwning programs
keys.extend([
    EzKey('M-<semicolon>', lazy.spawn('rofi -show drun')),
    EzKey('M-<semicolon>', lazy.spawn('rofi -show drun -show-icons')),
    EzKey('A-<semicolon>', lazy.spawn('rofi -show windowcd -modi window,windowcd')),
    EzKey('M-S-<semicolon>', lazy.spawn('rofi -show window -modi window,windowcd')),
    EzKey('M-S-<semicolon>', lazy.spawn('rofi -show drun -theme launchpad -show-icons')),
    # EzKey('M-S-<semicolon>', lazy.spawn('rofi -show window -modi window,windowcd')),
    EzKey('M-S-<Return>', lazy.spawn(terminal)),
])



@@ 133,7 134,8 @@ keys.extend([

# Printscreen
keys.extend([
    EzKey('<Print>', lazy.spawn('flameshot gui')),
    EzKey('<Print>', lazy.spawn('ksnip -r')),
    # EzKey('S-<Print>', lazy.spawn('ksnip -r -s')),
])

# Locking

M modules/desktop/qtile/config/screens.py => modules/desktop/qtile/config/screens.py +14 -10
@@ 16,17 16,13 @@ def init_screens():
    screens_count = len(screens_info)
    screens = [None] * screens_count

    logger.warning(f'setting up {screens_count} screens')

    for i in range(0, screens_count):
        screen_info = screens_info[i]
        systray = False
        if screens_count <= 2 and i == 0:
            systray = True
            print(f'Putting systray on {i}')
        elif i == 1:
            systray  = True
            print(f'Putting systray on {i}')

        top_bar = bars.create_top_bar(systray = systray)



@@ 34,16 30,24 @@ def init_screens():

    return screens

def get_screen_physical_order():
    screens = enumerate(screeninfo.get_monitors())
    s = sorted(screens, key = lambda x: (x[1].y, x[1].x))
    return map(lambda x: x[0], s)

def init_navigation_keys(keys, screens):
    if len(screens) >= 4:
        monitor_navigation_keys = ['q', 'w', 'e', 'r']
    else:
        monitor_navigation_keys = ['w', 'e', 'r']
    order = list(get_screen_physical_order())

    # TODO: how to specify this better?
    # Could be based on the fingerprint for example
    monitor_navigation_keys = ['r', 'w', 'e', 'q']
    for i, key in enumerate(monitor_navigation_keys):
        if i >= len(order):
            break

        keys.extend([
            EzKey(f'M-{key}', go_to_screen(i), desc = f'Move focus to screen {i}'),
            EzKey(f'M-S-{key}', lazy.window.toscreen(i), desc = f'Move window to screen {i}'),
            EzKey(f'M-{key}', go_to_screen(order[i]), desc = f'Move focus to screen {i}'),
            EzKey(f'M-S-{key}', lazy.window.toscreen(order[i]), desc = f'Move window to screen {i}'),
        ])

# Monitors changing connected displays and the lid.

M modules/desktop/qtile/config/xmonadcustom.py => modules/desktop/qtile/config/xmonadcustom.py +2 -2
@@ 801,7 801,7 @@ class MonadTall(_SimpleLayoutBase):
            self.master_length = 1

        if normalize:
            self.group.layout_all()
            # self.group.layout_all()
            self.normalize()

    @expose_command()


@@ 811,7 811,7 @@ class MonadTall(_SimpleLayoutBase):
            self.master_length = len(self.clients) - 1

        if normalize:
            self.group.layout_all()
            # self.group.layout_all()
            self.normalize()

    @expose_command

M modules/desktop/qtile/home.nix => modules/desktop/qtile/home.nix +4 -0
@@ 8,6 8,10 @@
    };
  };

  home.packages = [
    pkgs.ksnip
  ];

  xdg.configFile."qtile/config.py".source = ./config/config.py;
  xdg.configFile."qtile/utils.py".source = ./config/utils.py;
  xdg.configFile."qtile/functions.py".source = ./config/functions.py;

M modules/programs/alacritty.nix => modules/programs/alacritty.nix +25 -0
@@ 7,6 7,7 @@
{ pkgs, lib, ... }:

{

  programs = {
    dircolors = {
      enable = true;


@@ 15,6 16,30 @@
      };
    };

    iamb = {
      enable = true;
      settings = {
        profiles = {
          "ditigal.xyz" = {
            user_id = "@ruther:ditigal.xyz";
          };
        };
        settings = {
          username_display = "displayname";
          image_preview = {};
        };
      };
    };

    kitty = {
      enable = true;
      font = {
        name = "FiraCode Nerd Font";
        size = 12;
      };
      theme = "Chalk";
    };

    alacritty = {
      enable = true;
      settings = {

M modules/programs/home.nix => modules/programs/home.nix +1 -0
@@ 12,6 12,7 @@

[
  ./alacritty.nix
  ./iamb.nix
  ./rofi.nix
  ./clipmenu.nix
  ./firefox.nix

M modules/programs/rofi.nix => modules/programs/rofi.nix +65 -51
@@ 7,6 7,13 @@
let
  inherit (config.lib.formats.rasi) mkLiteral;        # Theme.rasi alternative. Add Theme here
  colors = import ../themes/colors.nix;

  themes-collection = pkgs.fetchFromGitHub {
    owner = "newmanls";
    repo = "rofi-themes-collection";
    rev = "f87e08300cb1c984994efcaf7d8ae26f705226fd";
    hash = "sha256-A6zIAQvjfe/XB5GZefs4TWgD+eGICQP2Abz/sQynJPo=";
  };
in
{
  home = {


@@ 15,6 22,9 @@ in
    ];
  };

  xdg.dataFile."rofi/themes/launchpad.rasi".source = "${themes-collection}/themes/launchpad.rasi";
  xdg.dataFile."rofi/themes/spotlight.rasi".source = "${themes-collection}/themes/spotlight-dark.rasi";

  programs = {
    rofi = {
      enable = true;


@@ 22,94 32,98 @@ in
      location = "center";
      font = "FiraCode Nerd Font Mono 11";
      theme =  with colors.scheme.doom; {
        # Based on spotlight theme
        "*" = {
          bg0 = mkLiteral "#${bg}";
          bg1 = mkLiteral "#414868";
          font =  "Montserrat 12";

          bg0 = mkLiteral "#222223e6";
          bg1 = mkLiteral "#44444480";
          bg2 = mkLiteral "#51afefe6";
          fg0 = mkLiteral "#${text}";
          fg1 = mkLiteral "#${text-alt}";
          fg1 = mkLiteral "#d5d5d5";
          fg2 = mkLiteral "#${fg}";

          background-color = mkLiteral "transparent";
          text-color = mkLiteral "@fg0";

          margin = 0;
          padding = 0;
          spacing = 0;
        };

        "element-icon, element-text, scrollbar" = {
          cursor = mkLiteral "pointer";
          margin = mkLiteral "0";
          padding = mkLiteral "0";
          spacing = mkLiteral "0";
        };

        "window" = {
          location = mkLiteral "northwest";
          width = mkLiteral "280px";
          x-offset = mkLiteral "8px";
          y-offset = mkLiteral "34px";

          background-color = mkLiteral "@bg0";
          border = mkLiteral "1px";
          border-color = mkLiteral "@bg1";
          border-radius = mkLiteral "6px";

          location = mkLiteral "center";
          width = mkLiteral "640";
          border-radius = mkLiteral "0";
        };

        "inputbar" = {
          spacing = mkLiteral "8px";
          padding = mkLiteral "4px 8px";
          children = mkLiteral "[ entry ]";
          background-color = mkLiteral "@bg0";
        "inputbar" =  {
          font = "Montserrat 20";
          padding = mkLiteral "12px";
          spacing = mkLiteral "12px";
          children = mkLiteral "[ icon-search, entry ]";
        };

        "icon-search" =  {
          expand = false;
          filename = "search";
          size = mkLiteral "28px";
        };

        "entry, element-icon, element-text" = {
        "icon-search, entry, element-icon, element-text" = {
          vertical-align = mkLiteral "0.5";
        };

        "textbox" = {
          padding = mkLiteral "4px 8px";
          background-color = mkLiteral "@bg0";
        "entry" = {
          font = mkLiteral "inherit";

          placeholder = "Search";
          placeholder-color = mkLiteral "@fg2";
        };

        "listview" = {
          padding = mkLiteral "4px 0px";
          lines = 6;
          columns = 1;
          scrollbar = true;
        "message" = {
          border = mkLiteral "2px 0 0";
          border-color = mkLiteral "@bg1";
          background-color = mkLiteral "@bg1";
        };

        "element" = {
          padding = mkLiteral "4px 8px";
          spacing = mkLiteral "8px";
        "textbox" = {
          padding = mkLiteral "8px 24px";
        };

        "element normal urgent" = {
          text-color = mkLiteral "@fg1";
        "listview" = {
          lines = 10;
          columns = mkLiteral "1";

          fixed-height = false;
          border = mkLiteral "1px 0 0";
          border-color = mkLiteral "@bg1";
        };

        "element normal active" = {
          text-color = mkLiteral "@fg1";
        "element" = {
          padding = mkLiteral "8px 16px";
          spacing = mkLiteral "16px";
          background-color = mkLiteral "transparent";
        };

        "element selected" = {
          text-color = mkLiteral "@bg0"; #1
          background-color = mkLiteral "@fg1";
        "element normal active" = {
          text-color = mkLiteral "@bg2";
        };

        "element selected urgent" = {
          background-color = mkLiteral "@fg1";
        "element selected normal, element selected active" = {
          background-color = mkLiteral "@bg2";
          text-color = mkLiteral "@fg1";
        };

        "element-icon" = {
          size = mkLiteral "0.8em";
          size = mkLiteral "1em";
        };

        "element-text" = {
          text-color = mkLiteral "inherit";
        };

        "scrollbar" = {
          handle-width = mkLiteral "4px";
          handle-color = mkLiteral "@fg1";
          padding = mkLiteral "0 4px";
        };
      };
    };
  };

M modules/services/autorandr.nix => modules/services/autorandr.nix +2 -2
@@ 14,10 14,10 @@
    enable = true;
    hooks = {
      postswitch = {
        "notify-qtile" = "qtile cmd-obj -o cmd -f restart";
        # "notify-qtile" = "qtile cmd-obj -o cmd -f restart";
        # Looks to me like after restarting QTile,
        # the system becomes slower until picom is restarted
        "restart-picom" = "systemctl restart --user picom";
        # "restart-picom" = "systemctl restart --user picom";
      };
    };
    profiles = {

M modules/services/dunst.nix => modules/services/dunst.nix +2 -1
@@ 37,7 37,8 @@ in
    };
    settings = with colors.scheme.doom; {               # Settings
      global = {
        monitor = 2;
        monitor = 0;
        follow = "keyboard";
        # geometry [{width}x{height}][+/-{x}+/-{y}]
        # geometry = "600x50-50+65";
        width = 300;

Do not follow this link