~ruther/nixos-config

6904cf1761334d033556f106c82d79b48e6657f4 — Frantisek Bohacek 1 year, 1 day ago 5b1602c
refactor: modularize the configuration
98 files changed, 1442 insertions(+), 1802 deletions(-)

M flake.nix
R hosts/home.nix => home/default.nix
A home/laptop.nix
A home/modules/default.nix
A home/modules/home-config.nix
R modules/programs/firefox.nix => home/modules/profiles/base.nix
A home/modules/profiles/default.nix
A home/modules/profiles/desktop/default.nix
R modules/desktop/gnome/home.nix => home/modules/profiles/desktop/gnome.nix
R modules/services/autorandr.nix => home/modules/profiles/desktop/qtile/autorandr.nix
R modules/desktop/qtile/config/.envrc => home/modules/profiles/desktop/qtile/config/.envrc
R modules/desktop/qtile/config/.gitignore => home/modules/profiles/desktop/qtile/config/.gitignore
R modules/desktop/qtile/config/autostart.sh => home/modules/profiles/desktop/qtile/config/autostart.sh -rwxr-xr-x => -rw-r--r--
R modules/desktop/qtile/config/bars.py => home/modules/profiles/desktop/qtile/config/bars.py
R modules/desktop/qtile/config/brightness.sh => home/modules/profiles/desktop/qtile/config/brightness.sh -rwxr-xr-x => -rw-r--r--
R modules/desktop/qtile/config/config.py => home/modules/profiles/desktop/qtile/config/config.py
R modules/desktop/qtile/config/flake.lock => home/modules/profiles/desktop/qtile/config/flake.lock
R modules/desktop/qtile/config/flake.nix => home/modules/profiles/desktop/qtile/config/flake.nix
R modules/desktop/qtile/config/functions.py => home/modules/profiles/desktop/qtile/config/functions.py
R modules/desktop/qtile/config/screens.py => home/modules/profiles/desktop/qtile/config/screens.py
R modules/desktop/qtile/config/sequence-detector.config.json => home/modules/profiles/desktop/qtile/config/sequence-detector.config.json
R modules/desktop/qtile/config/styling.py => home/modules/profiles/desktop/qtile/config/styling.py
R modules/desktop/qtile/config/tasklist.py => home/modules/profiles/desktop/qtile/config/tasklist.py
R modules/desktop/qtile/config/utils.py => home/modules/profiles/desktop/qtile/config/utils.py
R modules/desktop/qtile/config/xmonadcustom.py => home/modules/profiles/desktop/qtile/config/xmonadcustom.py
R modules/desktop/qtile/home.nix => home/modules/profiles/desktop/qtile/default.nix
R modules/programs/rofi.nix => home/modules/profiles/desktop/qtile/launcher.nix
R modules/desktop/qtile/scripts/xephyr => home/modules/profiles/desktop/qtile/scripts/xephyr
R modules/services/dunst.nix => home/modules/profiles/desktop/qtile/services.nix
R modules/shell/git.nix => home/modules/profiles/development/default.nix
R modules/editors/emacs/home.nix => home/modules/profiles/development/emacs/default.nix
R modules/editors/emacs/doom.d/config.el => home/modules/profiles/development/emacs/doom.d/config.el
R modules/editors/emacs/doom.d/custom.el => home/modules/profiles/development/emacs/doom.d/custom.el
R modules/editors/emacs/doom.d/init.el => home/modules/profiles/development/emacs/doom.d/init.el
R modules/editors/emacs/doom.d/packages.el => home/modules/profiles/development/emacs/doom.d/packages.el
R modules/editors/nvim/home.nix => home/modules/profiles/development/nvim.nix
R modules/editors/vscode/home.nix => home/modules/profiles/development/vscode.nix
A home/modules/profiles/matrix.nix
R modules/desktop/virtualisation/default.nix => home/modules/programs/default.nix
R modules/programs/iamb.nix => home/modules/programs/iamb.nix
D hosts/laptop-phobos/home.nix
D modules/desktop/dm/gdm.nix
D modules/desktop/dm/greetd.nix
D modules/desktop/dm/sddm-themes/sugar-dark.nix
D modules/desktop/dm/sddm.nix
D modules/desktop/virtualisation/podman.nix
D modules/editors/home.nix
D modules/hardware/default.nix
D modules/hardware/rocm/default.nix
D modules/programs/alacritty.nix
D modules/programs/clipmenu.nix
D modules/programs/email.nix
D modules/programs/fpga/vivado/default.nix
D modules/programs/fpga/vivado/fhs.nix
D modules/programs/fpga/vivado/home.nix
D modules/programs/fpga/vivado/udev/52-xilinx-digilent-usb.rules
D modules/programs/fpga/vivado/udev/52-xilinx-ftdi-usb.rules
D modules/programs/fpga/vivado/udev/52-xilinx-pcusb.rules
D modules/programs/fpga/vivado/vivado-pkg.nix
D modules/programs/games.nix
D modules/programs/home.nix
D modules/services/default.nix
D modules/services/flameshot.nix
D modules/services/home.nix
D modules/services/mpris-ctl.nix
D modules/services/picom.nix
D modules/services/redshift.nix
D modules/services/ssh.nix
D modules/services/udiskie.nix
D modules/services/wg-options.nix
D modules/shell/direnv.nix
D modules/shell/home.nix
D modules/shell/zsh.nix
R hosts/default.nix => nixos/default.nix
R hosts/configuration.nix => nixos/hosts/configuration.nix
R hosts/desktop-clotho/default.nix => nixos/hosts/desktop-clotho/default.nix
R hosts/desktop-clotho/hardware-configuration.nix => nixos/hosts/desktop-clotho/hardware-configuration.nix
R hosts/desktop-clotho/home.nix => nixos/hosts/desktop-clotho/home.nix
R hosts/laptop-iapetus/default.nix => nixos/hosts/laptop-iapetus/default.nix
R hosts/laptop-iapetus/hardware-configuration.nix => nixos/hosts/laptop-iapetus/hardware-configuration.nix
R hosts/laptop-iapetus/home.nix => nixos/hosts/laptop-iapetus/home.nix
R hosts/laptop-phobos/default.nix => nixos/hosts/laptop-phobos/default.nix
R hosts/laptop-phobos/hardware-configuration.nix => nixos/hosts/laptop-phobos/hardware-configuration.nix
A nixos/hosts/laptop-phobos/home.nix
R hosts/vm/default.nix => nixos/hosts/vm/default.nix
R hosts/vm/hardware-configuration.nix => nixos/hosts/vm/hardware-configuration.nix
R hosts/vm/home.nix => nixos/hosts/vm/home.nix
R modules/hardware/bluetooth.nix => nixos/modules/default.nix
R hosts/nixos-config-options.nix => nixos/modules/nixos-config.nix
A nixos/modules/profiles/default.nix
R modules/desktop/default.nix => nixos/modules/profiles/desktop/default.nix
R modules/desktop/gnome/default.nix => nixos/modules/profiles/desktop/gnome.nix
R modules/desktop/qtile/default.nix => nixos/modules/profiles/desktop/qtile.nix
R hosts/laptop-phobos/udev.nix => nixos/modules/profiles/development.nix
R modules/services/syncthing.nix => nixos/modules/profiles/sync.nix
R modules/desktop/virtualisation/qemu.nix => nixos/modules/profiles/virtualisation.nix
R modules/services/wireguard.nix => nixos/modules/profiles/vpn.nix
R modules/themes/colors.nix => themes/colors.nix
M flake.nix => flake.nix +6 -1
@@ 48,12 48,17 @@
      pkgs = nixpkgs.legacyPackages.x86_64-linux;
    in {
      nixosConfigurations = (
        import ./hosts {
        import ./nixos {
          inherit (nixpkgs) lib;
          inherit inputs nixpkgs nixpkgs-stable nix-index-database nur;
        }
      );

      packages.x86_64-linux = {
        mpris-ctl = pkgs.callPackage ./pkgs/rutherther/mpris-ctl.nix {};
        sequence-detector = pkgs.callPackage ./pkgs/rutherther/sequence-detector.nix {};
      };

      devShells.x86_64-linux.default = pkgs.mkShell {
        packages = [
          pkgs.nil

R hosts/home.nix => home/default.nix +18 -34
@@ 1,24 1,10 @@
#
#  General Home-manager configuration
#
#  flake.nix
#   ├─ ./hosts
#   │   └─ home.nix *
#   └─ ./modules
#       ├─ ./programs
#       │   └─ default.nix
#       └─ ./services
#           └─ default.nix
#

{ config, inputs, pkgs, ... }:

{
  imports = [
    ../modules/programs/home.nix
    ../modules/shell/home.nix
    ../modules/editors/home.nix
    ../modules/services/home.nix
    ./modules
    ../nixos/modules/nixos-config.nix
    ./laptop.nix
  ];

  nix = {


@@ 133,17 119,9 @@
      wget              # Downloader
      #
      # General home-manager
      alacritty         # Terminal Emulator
      vim               # Text Editor
      #
      # Xorg configuration
      #xclip            # Console Clipboard
      #xorg.xev         # Input Viewer
      #xorg.xkill       # Kill Applications
      #xorg.xrandr      # Screen Settings
      #
      # Xorg home-manager
      #
      alacritty
      kitty

      # Desktop
      discord           # Chat
      telegram-desktop  # Chat


@@ 159,14 137,10 @@
      ripgrep

      pinta

      easyeffects
    ];

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



@@ 179,6 153,16 @@
    };
  };

  services = {
    easyeffects.enable = true;
  };

  home.pointerCursor = {
    gtk.enable = true;
    name = "Catppuccin-Frappe-Sapphire-Cursors";
    package = pkgs.catppuccin-cursors.frappeSapphire;
    size = 16;
  };
  gtk = {                                     # Theming
    enable = true;
    theme = {

A home/laptop.nix => home/laptop.nix +24 -0
@@ 0,0 1,24 @@
{ config, lib, pkgs, ... }:

{
  config = lib.mkIf config.nixos-config.isLaptop {
    home.packages = [
      pkgs.acpi
    ];

    services.cbatticon = {
      enable = true;
      criticalLevelPercent = 10;
      lowLevelPercent = 20;
    };

    # TODO put to qtile under if isLaptop
    systemd.user.services.cbatticon = lib.mkIf config.services.cbatticon.enable {
      Unit = {
        After = lib.mkForce [];
        PartOf = lib.mkForce [ "wm-services.target" ];
      };
      Install.WantedBy = lib.mkForce [ "wm-services.target" ];
    };
  };
}

A home/modules/default.nix => home/modules/default.nix +7 -0
@@ 0,0 1,7 @@
{
  imports = [
    ./home-config.nix
    ./profiles/default.nix
    ./programs/default.nix
  ];
}

A home/modules/home-config.nix => home/modules/home-config.nix +32 -0
@@ 0,0 1,32 @@
{ config, pkgs, lib, ... }:

{
  options = {
    home-config = {
      defaultTerminal = lib.mkPackageOption pkgs "kitty" {};
      defaultTerminalExe = lib.mkOption {
        type = lib.types.str;
        readOnly = true;
      };

      defaultFont = lib.mkOption {
        type = lib.types.str;
        default = "FiraCode Nerd Font Mono";
      };

      startup = {
        apps = lib.mkOption {
          type = lib.types.listOf lib.types.str;
          default = [];
          description = ''
            Which apps to start when entering GUI
          '';
        };
      };
    };
  };

  config = {
    home-config.defaultTerminalExe = (lib.getExe config.home-config.defaultTerminal);
  };
}

R modules/programs/firefox.nix => home/modules/profiles/base.nix +221 -117
@@ 1,129 1,233 @@
{ inputs, config, pkgs, ... }:
{ inputs, config, lib, pkgs, ... }:

let
  nur = import inputs.nur {
    # TODO replace this x86 64 linux with actual host system
    #  will have to be passed from nixos config probably
    nurpkgs = import inputs.nixpkgs { system = "x86_64-linux"; };
    nurpkgs = import inputs.nixpkgs { inherit (pkgs) system; };
    inherit pkgs;
  };
in {
  home.packages = [
    # pkgs.firefoxpwa
  ];

  programs.firefox = {
    enable = true;
    package = pkgs.firefox.override {
      nativeMessagingHosts = [
        pkgs.tridactyl-native
      ];
  options = {
    profiles.base = {
      enable = lib.mkOption {
        type = lib.types.bool;
        default = true;
      };
    };
  };

  config = lib.mkIf config.profiles.base.enable {
    home-config.startup.apps = [ (lib.getExe pkgs.firefox) ];

    programs = {

    dircolors = {
      enable = true;
      settings = {
        OTHER_WRITABLE = "01;35"; # Make ntfs colors readable
      };
    };
    profiles = {
      default = {
        id = 0;
        name = "Default";
        isDefault = true;

        userChrome = ''
          #navigator-toolbox { font-family:Ubuntu !important }

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

    alacritty = {
      enable = true;
      settings = {
        font = {
          normal.family = "FiraCode Nerd Font";
          bold = { style = "Bold"; };
          size = 12;
        };
        # offset = {                            # Positioning
        #   x = -1;
        #   y = 0;
        # };
      };
    };

      starship = {
        enable = true;
      };

      zsh = {
        enable = true;
        autosuggestion.enable = true;
        syntaxHighlighting.enable = true;
        enableCompletion = true;
        history.size = 100000;

        oh-my-zsh = {                               # Extra plugins for zsh
        enable = true;
        plugins = [ "git" ];
        };

        initExtra = ''
            function loc {
            nix-locate --top-level -w /bin/$1
            }
            function exa-nixpkgs-derivation {
            nix run nixpkgs#eza -- --tree $(nix build nixpkgs#$1 --print-out-paths --out-link /tmp/$1)
            }

            # source /etc/set-environment
        '';
      };

      firefox = {
        enable = true;
        package = pkgs.firefox.override {
          nativeMessagingHosts = [
            pkgs.tridactyl-native
          ];
        };
        profiles = {
          default = {
            id = 0;
            name = "Default";
            isDefault = true;

            userChrome = ''
                #navigator-toolbox { font-family:Ubuntu !important }
            '';

            extensions = with nur.repos.rycee.firefox-addons; [
              # Basic
              proton-pass                # Password manager
              darkreader                 # Dark pages
              ublock-origin              # Ad block
              tridactyl                  # Vim-like keybindings

              # Containers
              multi-account-containers

              # Site specific
              # social fixer for facebook

              # UI
              text-contrast-for-dark-themes

              # Utility
              istilldontcareaboutcookies
              h264ify
              youtube-shorts-block

              # Privacy
              link-cleaner
              clearurls
              decentraleyes
              privacy-badger
              skip-redirect

              # Paywalls
              # bypass-paywalls-clean
            ];

            settings = {
              "beacon.enabled" = false;
              "browser.contentblocking.category" = "strict";

              "browser.newtabpage.enabled" = false; # Blank new tab page.
              "browser.startup.page" = 3; # Resume last session.
              "browser.tabs.closeWindowWithLastTab" = false;

              "browser.download.dir" = "${config.home.homeDirectory}/download";
              "browser.toolbars.bookmarks.visibility" = "newtab";
              "signon.rememberSignons" = false;
              "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons" = false;
              "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features" = false;

              "layout.css.prefers-color-scheme.content-override" = 2;
              "browser.uidensity" = 1; # Dense.
              "extensions.unifiedExtensions.enabled" = false; # Disable extensions symbol in bar
              "layout.css.devPixelsPerPx" = 1; # Default zoom?

              "media.ffmpeg.vaapi.enabled" = true;
              "gfx.webrender.all" = true;

              "network.IDN_show_punycode" = true;

              "permissions.default.shortcuts" = 3; # Don't steal my shortcuts!

              "toolkit.legacyUserProfileCustomizations.stylesheets" = true;

              # Privacy
              "browser.search.hiddenOneOffs" =
                "Google,Yahoo,Bing,Amazon.com,Twitter";
                "browser.send_pings" = false;
                "dom.battery.enabled" = false;
                "dom.security.https_only_mode" = true;
                "network.dns.disablePrefetch" = true;
                "geo.enabled" = false;
                "browser.urlbar.speculativeConnect.enabled" = false; # Do not resolve dns before clicking
                "network.prefetch-next" = false;
                "media.video_stats.enabled" = false;

                "network.http.referer.XOriginPolicy" = 2;
                "network.http.referer.XOriginTrimmingPolicy" = 2;
                "network.http.referer.trimmingPolicy" = 1;

                "privacy.donottrackheader.enabled" = true;
                "privacy.donottrackheader.value" = 1;
                "privacy.firstparty.isolate" = true;

                # Fully disable Pocket. See
                # https://www.reddit.com/r/linux/comments/zabm2a.
                "extensions.pocket.enabled" = false;
                "extensions.pocket.api" = "0.0.0.0";
                "extensions.pocket.loggedOutVariant" = "";
                "extensions.pocket.oAuthConsumerKey" = "";
                "extensions.pocket.onSaveRecs" = false;
                "extensions.pocket.onSaveRecs.locales" = "";
                "extensions.pocket.showHome" = false;
                "extensions.pocket.site" = "0.0.0.0";
                "browser.newtabpage.activity-stream.pocketCta" = "";
                "browser.newtabpage.activity-stream.section.highlights.includePocket" =
                  false;
                  "services.sync.prefs.sync.browser.newtabpage.activity-stream.section.highlights.includePocket" =
                    false;
            };
          };
        };
      };

      # Email
      thunderbird = {
        enable = true;
        profiles = {
          default = {
            isDefault = true;
          };
        };
      };
    };

        extensions = with nur.repos.rycee.firefox-addons; [
          # Basic
          proton-pass                # Password manager
          darkreader                 # Dark pages
          ublock-origin              # Ad block
          tridactyl                  # Vim-like keybindings

          # Containers
          multi-account-containers

          # Site specific
          # social fixer for facebook

          # UI
          text-contrast-for-dark-themes

          # Utility
          istilldontcareaboutcookies
          h264ify
          youtube-shorts-block

          # Privacy
          link-cleaner
          clearurls
          decentraleyes
          privacy-badger
          skip-redirect

          # Paywalls
          # bypass-paywalls-clean
        ];

        settings = {
          "beacon.enabled" = false;
          "browser.contentblocking.category" = "strict";

          "browser.newtabpage.enabled" = false; # Blank new tab page.
          "browser.startup.page" = 3; # Resume last session.
          "browser.tabs.closeWindowWithLastTab" = false;

          "browser.download.dir" = "${config.home.homeDirectory}/download";
          "browser.toolbars.bookmarks.visibility" = "newtab";
          "signon.rememberSignons" = false;
          "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons" = false;
          "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features" = false;

          "layout.css.prefers-color-scheme.content-override" = 2;
          "browser.uidensity" = 1; # Dense.
          "extensions.unifiedExtensions.enabled" = false; # Disable extensions symbol in bar
          "layout.css.devPixelsPerPx" = 1; # Default zoom?

          "media.ffmpeg.vaapi.enabled" = true;
          "gfx.webrender.all" = true;

          "network.IDN_show_punycode" = true;

          "permissions.default.shortcuts" = 3; # Don't steal my shortcuts!

          "toolkit.legacyUserProfileCustomizations.stylesheets" = true;

          # Privacy
          "browser.search.hiddenOneOffs" =
            "Google,Yahoo,Bing,Amazon.com,Twitter";
          "browser.send_pings" = false;
          "dom.battery.enabled" = false;
          "dom.security.https_only_mode" = true;
          "network.dns.disablePrefetch" = true;
          "geo.enabled" = false;
          "browser.urlbar.speculativeConnect.enabled" = false; # Do not resolve dns before clicking
          "network.prefetch-next" = false;
          "media.video_stats.enabled" = false;

          "network.http.referer.XOriginPolicy" = 2;
          "network.http.referer.XOriginTrimmingPolicy" = 2;
          "network.http.referer.trimmingPolicy" = 1;

          "privacy.donottrackheader.enabled" = true;
          "privacy.donottrackheader.value" = 1;
          "privacy.firstparty.isolate" = true;

          # Fully disable Pocket. See
          # https://www.reddit.com/r/linux/comments/zabm2a.
          "extensions.pocket.enabled" = false;
          "extensions.pocket.api" = "0.0.0.0";
          "extensions.pocket.loggedOutVariant" = "";
          "extensions.pocket.oAuthConsumerKey" = "";
          "extensions.pocket.onSaveRecs" = false;
          "extensions.pocket.onSaveRecs.locales" = "";
          "extensions.pocket.showHome" = false;
          "extensions.pocket.site" = "0.0.0.0";
          "browser.newtabpage.activity-stream.pocketCta" = "";
          "browser.newtabpage.activity-stream.section.highlights.includePocket" =
            false;
          "services.sync.prefs.sync.browser.newtabpage.activity-stream.section.highlights.includePocket" =
            false;
    accounts.email = {
      accounts = {
        ctu = {
          primary = true;
          thunderbird = {
            enable = true;
          };
          address = "bohacfr2@fel.cvut.cz";
          userName = "bohacfr2";
          realName = "František Boháček";
          imap = {
            host = "imap.fel.cvut.cz";
            port = 993;
          };
          smtp = {
            host = "smtpx.fel.cvut.cz";
            port = 465;
            tls = {
              enable = true;
            };
          };
        };
      };
    };

A home/modules/profiles/default.nix => home/modules/profiles/default.nix +8 -0
@@ 0,0 1,8 @@
{
  imports = [
    ./desktop
    ./development
    ./base.nix
    ./matrix.nix
  ];
}

A home/modules/profiles/desktop/default.nix => home/modules/profiles/desktop/default.nix +18 -0
@@ 0,0 1,18 @@
{ config, lib, ... }:

{
  imports = [
    ./qtile
    ./gnome.nix
  ];

  options = {
    profiles.desktop = {
      enable = lib.mkEnableOption "desktop";
    };
  };

  config = lib.mkIf config.profiles.desktop.enable {
    # TODO?
  };
}

R modules/desktop/gnome/home.nix => home/modules/profiles/desktop/gnome.nix +133 -133
@@ 1,140 1,140 @@
#
# Gnome Home-Manager Configuration
#
# Dconf settings can be found by running "$ dconf watch /"
#

{ config, lib, pkgs, ... }:
{ config, lib, ... }:

{
  dconf.settings = {
    "org/gnome/shell" = {
      favorite-apps = [
        "Alacritty.desktop"
        "firefox.desktop"
        "emacs.desktop"
        "org.gnome.Nautilus.desktop"
        "discord.desktop"
        "telegram-desktop.desktop"
        "blueman-manager.desktop"
        "pavucontrol.desktop"
      ];
      disable-user-extensions = false;
      enabled-extensions = [
        "paperwm@paperwm.github.com"
        "auto-move-windows@gnome-shell-extensions.gcampax.github.com"
        "launch-new-instance@gnome-shell-extensions.gcampax.github.com"
        "native-window-placement@gnome-shell-extensions.gcampax.github.com"
        "places-menu@gnome-shell-extensions.gcampax.github.com"
        "drive-menu@gnome-shell-extensions.gcampax.github.com"
        "Vitals@CoreCoding.com"
        "clipboard-history@alexsaveau.dev"
        "switcher@landau.fi"
        "fullscreen-avoider@noobsai.github.com"
        "instantworkspaceswitcher@amalantony.net"
      ];
    };

    "org/gnome/desktop/interface" = {
      color-scheme = "prefer-dark";
      enable-hot-corners = false;
      clock-show-weekday = true;
      #gtk-theme = "Adwaita-dark";
    };
    "org/gnome/desktop/privacy" = {
      report-technical-problems = "false";
    };
    "org/gnome/desktop/calendar" = {
      show-weekdate = true;
    };
    "org/gnome/desktop/wm/preferences" = {
      action-right-click-titlebar = "toggle-maximize";
      action-middle-click-titlebar = "minimize";
      resize-with-right-button = true;
      mouse-button-modifier = "<Super>";
      button-layout = ":minimize,close";
      num-workspaces = 9;
    };

    # "org/gnome/shell/keybindings" = builtins.listToAttrs (builtins.map (i: { name = "switch-to-application-${i}"; value = ["@as []"]; }) (builtins.genList (y: y + 1) 9));
    "org/gnome/shell/keybindings" = builtins.listToAttrs (builtins.map (i: { name = "switch-to-application-${builtins.toString i}"; value = ["@as []"]; }) (builtins.genList (y: y + 1) 9));
    "org/gnome/desktop/wm/keybindings" =
      builtins.listToAttrs (builtins.map (i: { name = "switch-to-workspace-${builtins.toString i}"; value = ["<Super>${builtins.toString i}"]; }) (builtins.genList (y: y + 1) 9)) //
      builtins.listToAttrs (builtins.map (i: { name = "move-to-workspace-${builtins.toString i}"; value = ["<Shift><Super>${builtins.toString i}"]; }) (builtins.genList (y: y + 1) 9)) //
      {
      move-to-workspace-left = ["<Super><Shift>a"];
      move-to-workspace-right = ["<Super><Shift>d"];

      close = ["<Super>w" "<Alt>F4"];
      toggle-fullscreen = ["<Super>f"];

      panel-run-dialog = ["@as []"];
    };

    "org/gnome/settings-daemon/plugins/power" = {
      sleep-interactive-ac-type = "nothing";
    };

    "org/gnome/settings-daemon/plugins/media-keys" = {
      custom-keybindings = [
        "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/"
        "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/"
      ];
    };
    "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
      binding = "<Shift><Super>Return";
      command = "alacritty";
      name = "open-terminal";
    };
    "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = {
      binding = "<Super>e";
      command = "emacs-client";
      name = "open-emacs";
    };

    "org/gnome/shell/extensions/paperwm" = {
      restore-workspaces-only-on-primary = false;
      window-gap = 10;
      winprops = [ "{\"wm_class\":\"Spotify\",\"scratch_layer\":true}" ];
    };

    "org/gnome/shell/extensions/paperwm/keybindings" = {
      move-left = ["<Shift><Super>k"];
      move-right = ["<Shift><Super>j"];

      switch-previous = ["<Super>k"];
      switch-next = ["<Super>j"];

      move-monitor-left = ["<Shift><Super>a"];
      move-monitor-below = ["<Shift><Super>s"];
      move-monitor-right = ["<Shift><Super>d"];
      move-monitor-above = ["<Shift><Super>w"];

      swap-monitor-left = ["<Control><Super>a"];
      swap-monitor-below = ["<Control><Super>s"];
      swap-monitor-right = ["<Control><Super>d"];
      swap-monitor-above = ["<Control><Super>w"];

      switch-monitor-left = ["<Super>a"];
      switch-monitor-below = ["<Super>s"];
      switch-monitor-right = ["<Super>d"];
      switch-monitor-above = ["<Super>w"];

      new-window = ["<Super>n"];

      paper-toggle-fullscreen = ["<Shift><Super>f"];

      toggle-maximize-width = ["<Super>f"];

      toggle-scratch = ["<Shift><Super>g"];
      toggle-scratch-layer = ["<Super>g"];
  options = {
    profiles.desktop.gnome = {
      enable = lib.mkEnableOption "gnome";
    };
  };

    "org/gnome/shell/extensions/switcher" = {
      show-switcher = ["<Super>semicolon"];
  config = lib.mkIf config.profiles.desktop.gnome.enable {

    dconf.settings = {
      "org/gnome/shell" = {
        favorite-apps = [
          "Alacritty.desktop"
          "firefox.desktop"
          "emacs.desktop"
          "org.gnome.Nautilus.desktop"
          "discord.desktop"
          "telegram-desktop.desktop"
          "blueman-manager.desktop"
          "pavucontrol.desktop"
        ];
        disable-user-extensions = false;
        enabled-extensions = [
          "paperwm@paperwm.github.com"
          "auto-move-windows@gnome-shell-extensions.gcampax.github.com"
          "launch-new-instance@gnome-shell-extensions.gcampax.github.com"
          "native-window-placement@gnome-shell-extensions.gcampax.github.com"
          "places-menu@gnome-shell-extensions.gcampax.github.com"
          "drive-menu@gnome-shell-extensions.gcampax.github.com"
          "Vitals@CoreCoding.com"
          "clipboard-history@alexsaveau.dev"
          "switcher@landau.fi"
          "fullscreen-avoider@noobsai.github.com"
          "instantworkspaceswitcher@amalantony.net"
        ];
      };

      "org/gnome/desktop/interface" = {
        color-scheme = "prefer-dark";
        enable-hot-corners = false;
        clock-show-weekday = true;
        #gtk-theme = "Adwaita-dark";
      };
      "org/gnome/desktop/privacy" = {
        report-technical-problems = "false";
      };
      "org/gnome/desktop/calendar" = {
        show-weekdate = true;
      };
      "org/gnome/desktop/wm/preferences" = {
        action-right-click-titlebar = "toggle-maximize";
        action-middle-click-titlebar = "minimize";
        resize-with-right-button = true;
        mouse-button-modifier = "<Super>";
        button-layout = ":minimize,close";
        num-workspaces = 9;
      };

      # "org/gnome/shell/keybindings" = builtins.listToAttrs (builtins.map (i: { name = "switch-to-application-${i}"; value = ["@as []"]; }) (builtins.genList (y: y + 1) 9));
      "org/gnome/shell/keybindings" = builtins.listToAttrs (builtins.map (i: { name = "switch-to-application-${builtins.toString i}"; value = ["@as []"]; }) (builtins.genList (y: y + 1) 9));
      "org/gnome/desktop/wm/keybindings" =
        builtins.listToAttrs (builtins.map (i: { name = "switch-to-workspace-${builtins.toString i}"; value = ["<Super>${builtins.toString i}"]; }) (builtins.genList (y: y + 1) 9)) //
        builtins.listToAttrs (builtins.map (i: { name = "move-to-workspace-${builtins.toString i}"; value = ["<Shift><Super>${builtins.toString i}"]; }) (builtins.genList (y: y + 1) 9)) //
        {
        move-to-workspace-left = ["<Super><Shift>a"];
        move-to-workspace-right = ["<Super><Shift>d"];

        close = ["<Super>w" "<Alt>F4"];
        toggle-fullscreen = ["<Super>f"];

        panel-run-dialog = ["@as []"];
      };

      "org/gnome/settings-daemon/plugins/power" = {
        sleep-interactive-ac-type = "nothing";
      };

      "org/gnome/settings-daemon/plugins/media-keys" = {
        custom-keybindings = [
          "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/"
          "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/"
        ];
      };
      "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
        binding = "<Shift><Super>Return";
        command = "alacritty";
        name = "open-terminal";
      };
      "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = {
        binding = "<Super>e";
        command = "emacs-client";
        name = "open-emacs";
      };

      "org/gnome/shell/extensions/paperwm" = {
        restore-workspaces-only-on-primary = false;
        window-gap = 10;
        winprops = [ "{\"wm_class\":\"Spotify\",\"scratch_layer\":true}" ];
      };

      "org/gnome/shell/extensions/paperwm/keybindings" = {
        move-left = ["<Shift><Super>k"];
        move-right = ["<Shift><Super>j"];

        switch-previous = ["<Super>k"];
        switch-next = ["<Super>j"];

        move-monitor-left = ["<Shift><Super>a"];
        move-monitor-below = ["<Shift><Super>s"];
        move-monitor-right = ["<Shift><Super>d"];
        move-monitor-above = ["<Shift><Super>w"];

        swap-monitor-left = ["<Control><Super>a"];
        swap-monitor-below = ["<Control><Super>s"];
        swap-monitor-right = ["<Control><Super>d"];
        swap-monitor-above = ["<Control><Super>w"];

        switch-monitor-left = ["<Super>a"];
        switch-monitor-below = ["<Super>s"];
        switch-monitor-right = ["<Super>d"];
        switch-monitor-above = ["<Super>w"];

        new-window = ["<Super>n"];

        paper-toggle-fullscreen = ["<Shift><Super>f"];

        toggle-maximize-width = ["<Super>f"];

        toggle-scratch = ["<Shift><Super>g"];
        toggle-scratch-layer = ["<Super>g"];
      };

      "org/gnome/shell/extensions/switcher" = {
        show-switcher = ["<Super>semicolon"];
      };
    };
  };

  home.packages = with pkgs; [
  ];
}

R modules/services/autorandr.nix => home/modules/profiles/desktop/qtile/autorandr.nix +87 -82
@@ 1,96 1,101 @@
{ lib, config, ... }:
{ inputs, config, lib, pkgs, ... }:

{
  services.autorandr = {
    enable = true;
  };
let
  inherit (config.lib.formats.rasi) mkLiteral;        # Theme.rasi alternative. Add Theme here
  colors = import "${inputs.self}/themes/colors.nix";

  systemd.user.services.autorandr = lib.mkIf config.services.autorandr.enable {
    Unit.PartOf = lib.mkForce [ "qtile-services.target" ];
    Install.WantedBy = lib.mkForce [ "qtile-services.target" ];
  themes-collection = pkgs.fetchFromGitHub {
    owner = "newmanls";
    repo = "rofi-themes-collection";
    rev = "f87e08300cb1c984994efcaf7d8ae26f705226fd";
    hash = "sha256-A6zIAQvjfe/XB5GZefs4TWgD+eGICQP2Abz/sQynJPo=";
  };
in
{
  config = lib.mkIf config.profiles.desktop.qtile.enable {
    programs.autorandr = {

  programs.autorandr = {
    enable = true;
    hooks = {
      postswitch = {
        # "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";
      };
    };
    profiles = {
      "home-docked" = {
        fingerprint = {
          "DP-7" = "00ffffffffffff0009d1e77801010101261e0104a5351e783a05f5a557529c270b5054a56b80d1c0b300a9c08180810081c001010101023a801871382d40582c45000f282100001e000000ff00455442394c3033373432534c30000000fd00324c1e5311010a202020202020000000fc0042656e51204757323438300a2001e002031cf14f901f041303120211011406071516052309070783010000023a801871382d40582c45000f282100001f011d8018711c1620582c25000f282100009f011d007251d01e206e2855000f282100001e8c0ad08a20e02d10103e96000f28210000180000000000000000000000000000000000000000000000000000008d";
          "DP-8" = "00ffffffffffff0009d1e778455400000d1c0104a5351e783a0565a756529c270f5054a56b80d1c0b300a9c08180810081c001010101023a801871382d40582c45000f282100001e000000ff0058334a30303131303031510a20000000fd00324c1e5311010a202020202020000000fc0042656e51204757323438300a20017d02031cf14f901f041303120211011406071516052309070783010000023a801871382d40582c45000f282100001f011d8018711c1620582c25000f282100009f011d007251d01e206e2855000f282100001e8c0ad08a20e02d10103e96000f28210000180000000000000000000000000000000000000000000000000000008d";
          "DP-9" = "00ffffffffffff0009d1d978455400002b1a010380351e782e6c40a755519f27145054a56b80d1c081c081008180a9c0b30001010101023a801871382d40582c45000f282100001e000000ff0054414730333931303031390a20000000fd00324c1e5311000a202020202020000000fc0042656e51204757323437300a200161020322f14f901f05140413031207161501061102230907078301000065030c001000023a801871382d40582c45000f282100001e011d8018711c1620582c25000f282100009e011d007251d01e206e2855000f282100001e8c0ad08a20e02d10103e96000f282100001800000000000000000000000000000000000000000005";
        };
        config = {
          DP-9 = {
            enable = true;
            position = "0x0";
            mode = "1920x1080";
          };
          DP-7 = {
            enable = true;
            primary = true;
            position = "1920x0";
            mode = "1920x1080";
          };
          DP-8 = {
            enable = true;
            position = "3840x0";
            mode = "1920x1080";
          };
          eDP-1 = {
            enable = false;
          };
      enable = true;
      hooks = {
        postswitch = {
          # "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";
        };
      };
      "home-internal" = {
        fingerprint = {
          "DP-7" = "00ffffffffffff0009d1e77801010101261e0104a5351e783a05f5a557529c270b5054a56b80d1c0b300a9c08180810081c001010101023a801871382d40582c45000f282100001e000000ff00455442394c3033373432534c30000000fd00324c1e5311010a202020202020000000fc0042656e51204757323438300a2001e002031cf14f901f041303120211011406071516052309070783010000023a801871382d40582c45000f282100001f011d8018711c1620582c25000f282100009f011d007251d01e206e2855000f282100001e8c0ad08a20e02d10103e96000f28210000180000000000000000000000000000000000000000000000000000008d";
          "DP-8" = "00ffffffffffff0009d1e778455400000d1c0104a5351e783a0565a756529c270f5054a56b80d1c0b300a9c08180810081c001010101023a801871382d40582c45000f282100001e000000ff0058334a30303131303031510a20000000fd00324c1e5311010a202020202020000000fc0042656e51204757323438300a20017d02031cf14f901f041303120211011406071516052309070783010000023a801871382d40582c45000f282100001f011d8018711c1620582c25000f282100009f011d007251d01e206e2855000f282100001e8c0ad08a20e02d10103e96000f28210000180000000000000000000000000000000000000000000000000000008d";
          "DP-9" = "00ffffffffffff0009d1d978455400002b1a010380351e782e6c40a755519f27145054a56b80d1c081c081008180a9c0b30001010101023a801871382d40582c45000f282100001e000000ff0054414730333931303031390a20000000fd00324c1e5311000a202020202020000000fc0042656e51204757323437300a200161020322f14f901f05140413031207161501061102230907078301000065030c001000023a801871382d40582c45000f282100001e011d8018711c1620582c25000f282100009e011d007251d01e206e2855000f282100001e8c0ad08a20e02d10103e96000f282100001800000000000000000000000000000000000000000005";
          "eDP-1" = "00ffffffffffff0009e5660b000000001a200104a51e137807e957a7544c9a26115457000000010101010101010101010101010101019c3e80c870b03c40302036002ebc1000001a163280c870b03c40302036002ebc1000001a000000fd001e3c4c4c10010a202020202020000000fe004e4531343057554d2d4e36470a00f7";
        };

        config = {
          DP-9 = {
            enable = true;
            position = "0x0";
            mode = "1920x1080";
      profiles = {
        "home-docked" = {
          fingerprint = {
            "DP-7" = "00ffffffffffff0009d1e77801010101261e0104a5351e783a05f5a557529c270b5054a56b80d1c0b300a9c08180810081c001010101023a801871382d40582c45000f282100001e000000ff00455442394c3033373432534c30000000fd00324c1e5311010a202020202020000000fc0042656e51204757323438300a2001e002031cf14f901f041303120211011406071516052309070783010000023a801871382d40582c45000f282100001f011d8018711c1620582c25000f282100009f011d007251d01e206e2855000f282100001e8c0ad08a20e02d10103e96000f28210000180000000000000000000000000000000000000000000000000000008d";
            "DP-8" = "00ffffffffffff0009d1e778455400000d1c0104a5351e783a0565a756529c270f5054a56b80d1c0b300a9c08180810081c001010101023a801871382d40582c45000f282100001e000000ff0058334a30303131303031510a20000000fd00324c1e5311010a202020202020000000fc0042656e51204757323438300a20017d02031cf14f901f041303120211011406071516052309070783010000023a801871382d40582c45000f282100001f011d8018711c1620582c25000f282100009f011d007251d01e206e2855000f282100001e8c0ad08a20e02d10103e96000f28210000180000000000000000000000000000000000000000000000000000008d";
            "DP-9" = "00ffffffffffff0009d1d978455400002b1a010380351e782e6c40a755519f27145054a56b80d1c081c081008180a9c0b30001010101023a801871382d40582c45000f282100001e000000ff0054414730333931303031390a20000000fd00324c1e5311000a202020202020000000fc0042656e51204757323437300a200161020322f14f901f05140413031207161501061102230907078301000065030c001000023a801871382d40582c45000f282100001e011d8018711c1620582c25000f282100009e011d007251d01e206e2855000f282100001e8c0ad08a20e02d10103e96000f282100001800000000000000000000000000000000000000000005";
          };
          DP-7 = {
            enable = true;
            position = "1920x0";
            mode = "1920x1080";
          config = {
            DP-9 = {
              enable = true;
              position = "0x0";
              mode = "1920x1080";
            };
            DP-7 = {
              enable = true;
              primary = true;
              position = "1920x0";
              mode = "1920x1080";
            };
            DP-8 = {
              enable = true;
              position = "3840x0";
              mode = "1920x1080";
            };
            eDP-1 = {
              enable = false;
            };
          };
          DP-8 = {
            enable = true;
            position = "3840x0";
            mode = "1920x1080";
        };
        "home-internal" = {
          fingerprint = {
            "DP-7" = "00ffffffffffff0009d1e77801010101261e0104a5351e783a05f5a557529c270b5054a56b80d1c0b300a9c08180810081c001010101023a801871382d40582c45000f282100001e000000ff00455442394c3033373432534c30000000fd00324c1e5311010a202020202020000000fc0042656e51204757323438300a2001e002031cf14f901f041303120211011406071516052309070783010000023a801871382d40582c45000f282100001f011d8018711c1620582c25000f282100009f011d007251d01e206e2855000f282100001e8c0ad08a20e02d10103e96000f28210000180000000000000000000000000000000000000000000000000000008d";
            "DP-8" = "00ffffffffffff0009d1e778455400000d1c0104a5351e783a0565a756529c270f5054a56b80d1c0b300a9c08180810081c001010101023a801871382d40582c45000f282100001e000000ff0058334a30303131303031510a20000000fd00324c1e5311010a202020202020000000fc0042656e51204757323438300a20017d02031cf14f901f041303120211011406071516052309070783010000023a801871382d40582c45000f282100001f011d8018711c1620582c25000f282100009f011d007251d01e206e2855000f282100001e8c0ad08a20e02d10103e96000f28210000180000000000000000000000000000000000000000000000000000008d";
            "DP-9" = "00ffffffffffff0009d1d978455400002b1a010380351e782e6c40a755519f27145054a56b80d1c081c081008180a9c0b30001010101023a801871382d40582c45000f282100001e000000ff0054414730333931303031390a20000000fd00324c1e5311000a202020202020000000fc0042656e51204757323437300a200161020322f14f901f05140413031207161501061102230907078301000065030c001000023a801871382d40582c45000f282100001e011d8018711c1620582c25000f282100009e011d007251d01e206e2855000f282100001e8c0ad08a20e02d10103e96000f282100001800000000000000000000000000000000000000000005";
            "eDP-1" = "00ffffffffffff0009e5660b000000001a200104a51e137807e957a7544c9a26115457000000010101010101010101010101010101019c3e80c870b03c40302036002ebc1000001a163280c870b03c40302036002ebc1000001a000000fd001e3c4c4c10010a202020202020000000fe004e4531343057554d2d4e36470a00f7";
          };
          eDP-1 = {
            enable = true;
            primary = true;
            position = "1920x1080";
            mode = "1920x1200";

          config = {
            DP-9 = {
              enable = true;
              position = "0x0";
              mode = "1920x1080";
            };
            DP-7 = {
              enable = true;
              position = "1920x0";
              mode = "1920x1080";
            };
            DP-8 = {
              enable = true;
              position = "3840x0";
              mode = "1920x1080";
            };
            eDP-1 = {
              enable = true;
              primary = true;
              position = "1920x1080";
              mode = "1920x1200";
            };
          };
        };
      };
      "notebook" = {
        fingerprint = {
          "eDP-1" = "00ffffffffffff0009e5660b000000001a200104a51e137807e957a7544c9a26115457000000010101010101010101010101010101019c3e80c870b03c40302036002ebc1000001a163280c870b03c40302036002ebc1000001a000000fd001e3c4c4c10010a202020202020000000fe004e4531343057554d2d4e36470a00f7";
        };
        config = {
          eDP-1 = {
            enable = true;
            primary = true;
            position = "0x0";
            mode = "1920x1200";
        "notebook" = {
          fingerprint = {
            "eDP-1" = "00ffffffffffff0009e5660b000000001a200104a51e137807e957a7544c9a26115457000000010101010101010101010101010101019c3e80c870b03c40302036002ebc1000001a163280c870b03c40302036002ebc1000001a000000fd001e3c4c4c10010a202020202020000000fe004e4531343057554d2d4e36470a00f7";
          };
          config = {
            eDP-1 = {
              enable = true;
              primary = true;
              position = "0x0";
              mode = "1920x1200";
            };
          };
        };
      };

R modules/desktop/qtile/config/.envrc => home/modules/profiles/desktop/qtile/config/.envrc +0 -0
R modules/desktop/qtile/config/.gitignore => home/modules/profiles/desktop/qtile/config/.gitignore +0 -0
R modules/desktop/qtile/config/autostart.sh => home/modules/profiles/desktop/qtile/config/autostart.sh +1 -1
@@ 1,6 1,6 @@
#!/usr/bin/env sh

systemctl start --user qtile-services.target
systemctl start --user wm-services.target

# Browser
firefox &

R modules/desktop/qtile/config/bars.py => home/modules/profiles/desktop/qtile/config/bars.py +0 -0
R modules/desktop/qtile/config/brightness.sh => home/modules/profiles/desktop/qtile/config/brightness.sh +0 -0
R modules/desktop/qtile/config/config.py => home/modules/profiles/desktop/qtile/config/config.py +0 -0
R modules/desktop/qtile/config/flake.lock => home/modules/profiles/desktop/qtile/config/flake.lock +0 -0
R modules/desktop/qtile/config/flake.nix => home/modules/profiles/desktop/qtile/config/flake.nix +0 -0
R modules/desktop/qtile/config/functions.py => home/modules/profiles/desktop/qtile/config/functions.py +0 -0
R modules/desktop/qtile/config/screens.py => home/modules/profiles/desktop/qtile/config/screens.py +0 -0
R modules/desktop/qtile/config/sequence-detector.config.json => home/modules/profiles/desktop/qtile/config/sequence-detector.config.json +0 -0
R modules/desktop/qtile/config/styling.py => home/modules/profiles/desktop/qtile/config/styling.py +0 -0
R modules/desktop/qtile/config/tasklist.py => home/modules/profiles/desktop/qtile/config/tasklist.py +0 -0
R modules/desktop/qtile/config/utils.py => home/modules/profiles/desktop/qtile/config/utils.py +0 -0
R modules/desktop/qtile/config/xmonadcustom.py => home/modules/profiles/desktop/qtile/config/xmonadcustom.py +0 -0
R modules/desktop/qtile/home.nix => home/modules/profiles/desktop/qtile/default.nix +34 -26
@@ 1,38 1,46 @@
{ config, pkgs, ... }:
{ lib, config, pkgs, ... }:

{
  systemd.user.targets.qtile-services = {
    Unit = {
      Description = "A target that is enabled when starting Qtile";
      Requires = [ "graphical-session.target" ];
  imports = [
    ./launcher.nix
    ./services.nix
    ./autorandr.nix
  ];

  options = {
    profiles.desktop.qtile = {
      enable = lib.mkEnableOption "qtile";
    };
  };

  home.packages = [
    pkgs.ksnip
  ];
  config = lib.mkIf config.profiles.desktop.qtile.enable {

  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;
  xdg.configFile."qtile/bars.py".source = ./config/bars.py;
  xdg.configFile."qtile/screens.py".source = ./config/screens.py;
  xdg.configFile."qtile/styling.py".source = ./config/styling.py;
    home.packages = [
      pkgs.ksnip
    ];

  xdg.configFile."qtile/tasklist.py".source = ./config/tasklist.py;
  xdg.configFile."qtile/xmonadcustom.py".source = ./config/xmonadcustom.py;
  xdg.configFile."qtile/sequence-detector.config.json".source = ./config/sequence-detector.config.json;
    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;
    xdg.configFile."qtile/bars.py".source = ./config/bars.py;
    xdg.configFile."qtile/screens.py".source = ./config/screens.py;
    xdg.configFile."qtile/styling.py".source = ./config/styling.py;

  xdg.configFile."qtile/nixenvironment.py".text = ''
    from string import Template
    import os
    xdg.configFile."qtile/tasklist.py".source = ./config/tasklist.py;
    xdg.configFile."qtile/xmonadcustom.py".source = ./config/xmonadcustom.py;
    xdg.configFile."qtile/sequence-detector.config.json".source = ./config/sequence-detector.config.json;

    setupLocationRef = Template("${config.nixos-config.location}")
    configLocationRef = Template("${config.nixos-config.location}/modules/desktop/qtile/config")
    xdg.configFile."qtile/nixenvironment.py".text = ''
      from string import Template
      import os

    setupLocation = setupLocationRef.substitute(os.environ)
    configLocation = configLocationRef.substitute(os.environ)
      setupLocationRef = Template("${config.nixos-config.location}")
      configLocationRef = Template("${config.nixos-config.location}/modules/desktop/qtile/config")

    sequenceDetectorExec = "sequence_detector -c /home/${config.nixos-config.defaultUser}/.config/qtile/sequence-detector.config.json "
  '';
      setupLocation = setupLocationRef.substitute(os.environ)
      configLocation = configLocationRef.substitute(os.environ)

      sequenceDetectorExec = "sequence_detector -c /home/${config.nixos-config.defaultUser}/.config/qtile/sequence-detector.config.json "
    '';
  };
}

R modules/programs/rofi.nix => home/modules/profiles/desktop/qtile/launcher.nix +107 -111
@@ 1,12 1,8 @@
#
# System Menu
#

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

let
  inherit (config.lib.formats.rasi) mkLiteral;        # Theme.rasi alternative. Add Theme here
  colors = import ../themes/colors.nix;
  colors = import "${inputs.self}/themes/colors.nix";

  themes-collection = pkgs.fetchFromGitHub {
    owner = "newmanls";


@@ 16,113 12,113 @@ let
  };
in
{
  home = {
    packages = with pkgs; [
      rofi-power-menu
  config = lib.mkIf config.profiles.desktop.qtile.enable {
    home.packages = [
      pkgs.rofi-power-menu
    ];
  };

  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;
      terminal = "${pkgs.alacritty}/bin/alacritty";           # Alacritty is default terminal emulator
      location = "center";
      font = "FiraCode Nerd Font Mono 11";
      theme =  with colors.scheme.doom; {
        # Based on spotlight theme
        "*" = {
          font =  "Montserrat 12";

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

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

          margin = mkLiteral "0";
          padding = mkLiteral "0";
          spacing = mkLiteral "0";
        };

        "window" = {
          background-color = mkLiteral "@bg0";

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

        "inputbar" =  {
          font = "Montserrat 20";
          padding = mkLiteral "12px";
          spacing = mkLiteral "12px";
          children = mkLiteral "[ icon-search, entry ]";
        };

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

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

        "entry" = {
          font = mkLiteral "inherit";

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

        "message" = {
          border = mkLiteral "2px 0 0";
          border-color = mkLiteral "@bg1";
          background-color = mkLiteral "@bg1";
        };

        "textbox" = {
          padding = mkLiteral "8px 24px";
        };

        "listview" = {
          lines = 10;
          columns = mkLiteral "1";

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

        "element" = {
          padding = mkLiteral "8px 16px";
          spacing = mkLiteral "16px";
          background-color = mkLiteral "transparent";
        };

        "element normal active" = {
          text-color = mkLiteral "@bg2";
        };

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

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

        "element-text" = {
          text-color = mkLiteral "inherit";
    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;
        terminal = "${config.home-config.defaultTerminalExe}";
        location = "center";
        font = "${config.home-config.defaultFont} 11";
        theme =  with colors.scheme.doom; {
          # Based on spotlight theme
          "*" = {
            font =  "Montserrat 12";

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

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

            margin = mkLiteral "0";
            padding = mkLiteral "0";
            spacing = mkLiteral "0";
          };

          "window" = {
            background-color = mkLiteral "@bg0";

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

          "inputbar" =  {
            font = "Montserrat 20";
            padding = mkLiteral "12px";
            spacing = mkLiteral "12px";
            children = mkLiteral "[ icon-search, entry ]";
          };

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

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

          "entry" = {
            font = mkLiteral "inherit";

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

          "message" = {
            border = mkLiteral "2px 0 0";
            border-color = mkLiteral "@bg1";
            background-color = mkLiteral "@bg1";
          };

          "textbox" = {
            padding = mkLiteral "8px 24px";
          };

          "listview" = {
            lines = 10;
            columns = mkLiteral "1";

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

          "element" = {
            padding = mkLiteral "8px 16px";
            spacing = mkLiteral "16px";
            background-color = mkLiteral "transparent";
          };

          "element normal active" = {
            text-color = mkLiteral "@bg2";
          };

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

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

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

R modules/desktop/qtile/scripts/xephyr => home/modules/profiles/desktop/qtile/scripts/xephyr +0 -0
R modules/services/dunst.nix => home/modules/profiles/desktop/qtile/services.nix +210 -78
@@ 1,90 1,222 @@
#
# System notifications
#

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

let
  colors = import ../themes/colors.nix;                 # Import colors theme
in
{
  home.packages = lib.mkIf config.services.dunst.enable [ pkgs.libnotify ];                   # Dependency

  # Remove dunst dbus Notification link so it's not started under Gnome!
  xdg.dataFile."dbus-1/services/org.knopwob.dunst.service".enable = false;

  systemd.user.services.dunst = lib.mkIf config.services.dunst.enable {
    Unit = {
      PartOf = lib.mkForce [ "qtile-services.target" ];
      After = lib.mkForce [];
    };
    Service = {
      # Remove reference to BusName so dunst is not started under Gnome!
      Type = lib.mkForce "simple";
      BusName = lib.mkForce "empty.dbus.name.placeholder";
    };
    Install = {
      WantedBy = lib.mkForce [ "qtile-services.target" ];
  colors = import "${inputs.self}/themes/colors.nix";
  mpris-ctl = inputs.self.packages.${pkgs.system}.mpris-ctl;
  sequence-detector = inputs.self.packages.${pkgs.system}.sequence-detector;
in {
  config = lib.mkIf config.profiles.desktop.qtile.enable {

    home.packages = lib.mkMerge [
      (lib.mkIf config.services.dunst.enable [ pkgs.libnotify ])
      [
        mpris-ctl
        sequence-detector
      ]
    ];

    services = {                            # Applets
      network-manager-applet.enable = true; # Network
      autorandr.enable = true;

      dunst = {
        enable = true;
        iconTheme = {                                       # Icons
          name = "Papirus Dark";
          package = pkgs.papirus-icon-theme;
          size = "16x16";
        };
        settings = with colors.scheme.doom; {               # Settings
          global = {
            monitor = 0;
            follow = "keyboard";
            # geometry [{width}x{height}][+/-{x}+/-{y}]
            # geometry = "600x50-50+65";
            width = 300;
            height = 200;
            origin = "top-right";
            offset = "50x50";
            shrink = "yes";
            transparency = 10;
            padding = 16;
            horizontal_padding = 16;
            frame_width = 3;
            frame_color = "#${bg}";
            separator_color = "frame";
            font = "FiraCode Nerd Font 10";
            line_height = 4;
            idle_threshold = 120;
            markup = "full";
            format = ''<b>%s</b>\n%b'';
            alignment = "left";
            vertical_alignment = "center";
            icon_position = "left";
            word_wrap = "yes";
            ignore_newline = "no";
            show_indicators = "yes";
            sort = true;
            stack_duplicates = true;
            # startup_notification = false;
            hide_duplicate_count = true;
          };
          urgency_low = {                                   # Colors
            background = "#${bg}";
            foreground = "#${text}";
            timeout = 4;
          };
          urgency_normal = {
            background = "#${bg}";
            foreground = "#${text}";
            timeout = 4;
          };
          urgency_critical = {
            background = "#${bg}";
            foreground = "#${text}";
            frame_color = "#${red}";
            timeout = 10;
          };
        };
      };

      picom = {
        enable = true;
        package = pkgs.picom;

        backend = "glx";                              # Rendering either with glx or xrender. You'll know if you need to switch this.
        vSync = true;                                 # Should fix screen tearing

        #activeOpacity = 0.93;                         # Node transparency
        #inactiveOpacity = 0.93;
        #menuOpacity = 0.93;

        shadow = false;                               # Shadows
        shadowOpacity = 0.75;
        fade = true;                                  # Fade
        fadeDelta = 10;
        opacityRules = [                              # Opacity rules if transparency is prefered
        #  "100:name = 'Picture in picture'"
        #  "100:name = 'Picture-in-Picture'"
        #  "85:class_i ?= 'rofi'"
          # "90:class_i *= 'discord'"
          # "90:class_i *= 'telegram-desktop'"
          # "90:class_i *= 'emacs'"
          # "90:class_i *= 'Alacritty'"
        #  "100:fullscreen"
        ];                                            # Find with $ xprop | grep "WM_CLASS"

        settings = {
          daemon = true;
          use-damage = false;                         # Fixes flickering and visual bugs with borders
          resize-damage = 1;
          refresh-rate = 0;
          corner-radius = 5;                          # Corners
          round-borders = 5;

          # Extras
          detect-rounded-corners = true;              # Below should fix multiple issues
          detect-client-opacity = false;
          detect-transient = true;
          detect-client-leader = false;
          mark-wmwim-focused = true;
          mark-ovredir-focues = true;
          unredir-if-possible = true;
          glx-no-stencil = true;
          glx-no-rebind-pixmap = true;
        };                                           # Extra options for picom.conf (mostly for pijulius fork)
      };

      redshift = {
        enable = true;
        temperature.night = 3000;
        latitude = 50.2332933;
        longitude = 14.3225926;
      };

      udiskie = {                         # Udiskie wil automatically mount storage devices
        enable = true;
        automount = true;
        tray = "auto";                    # Will only show up in systray when active
      };
    };
  };
    xdg.dataFile."dbus-1/services/org.knopwob.dunst.service".source = "${pkgs.dunst}/share/dbus-1/services/org.knopwob.dunst.service";

  services.dunst = {
    enable = true;
    iconTheme = {                                       # Icons
      name = "Papirus Dark";
      package = pkgs.papirus-icon-theme;
      size = "16x16";
    systemd.user.targets.wm-services = {
      Unit = {
        Description = "A target that is enabled when starting Qtile";
        Requires = [ "graphical-session.target" ];
      };
    };
    settings = with colors.scheme.doom; {               # Settings
      global = {
        monitor = 0;
        follow = "keyboard";
        # geometry [{width}x{height}][+/-{x}+/-{y}]
        # geometry = "600x50-50+65";
        width = 300;
        height = 200;
        origin = "top-right";
        offset = "50x50";
        shrink = "yes";
        transparency = 10;
        padding = 16;
        horizontal_padding = 16;
        frame_width = 3;
        frame_color = "#${bg}";
        separator_color = "frame";
        font = "FiraCode Nerd Font 10";
        line_height = 4;
        idle_threshold = 120;
        markup = "full";
        format = ''<b>%s</b>\n%b'';
        alignment = "left";
        vertical_alignment = "center";
        icon_position = "left";
        word_wrap = "yes";
        ignore_newline = "no";
        show_indicators = "yes";
        sort = true;
        stack_duplicates = true;
        # startup_notification = false;
        hide_duplicate_count = true;

    systemd.user.services = {
      mpris-ctld = {
        Unit = {
          Description = "Daemon for mpris-ctl cli, that will keep track of last playing media";
          PartOf = [ "wm-services.target" ];
        };

        Install = {
          WantedBy = [ "wm-services.target" ];
        };

        Service = {
          ExecStart = "${mpris-ctl}/bin/mpris-ctld";
        };
      };

      network-manager-applet = lib.mkIf config.services.network-manager-applet.enable {
        Unit = {
          After = lib.mkForce [];
          PartOf = lib.mkForce [ "wm-services.target" ];
        };
        Install.WantedBy = lib.mkForce [ "wm-services.target" ];
      };

      autorandr = lib.mkIf config.services.autorandr.enable {
        Unit.PartOf = lib.mkForce [ "wm-services.target" ];
        Install.WantedBy = lib.mkForce [ "wm-services.target" ];
      };

      dunst = lib.mkIf config.services.dunst.enable {
        Unit = {
          PartOf = lib.mkForce [ "wm-services.target" ];
          After = lib.mkForce [];
        };
        Service = {
          # Remove reference to BusName so dunst is not started under Gnome!
          Type = lib.mkForce "simple";
          BusName = lib.mkForce "empty.dbus.name.placeholder";
        };
        Install = {
          WantedBy = lib.mkForce [ "wm-services.target" ];
        };
      };
      urgency_low = {                                   # Colors
        background = "#${bg}";
        foreground = "#${text}";
        timeout = 4;

      flameshot = lib.mkIf config.services.flameshot.enable {
        Unit = {
          PartOf = lib.mkForce [ "wm-services.target" ];
        };
        Install = {
          WantedBy = lib.mkForce [ "wm-services.target" ];
        };
      };
      urgency_normal = {
        background = "#${bg}";
        foreground = "#${text}";
        timeout = 4;

      picom = lib.mkIf config.services.picom.enable {
        Unit = {
          PartOf = lib.mkForce [ "wm-services.target" ];
        };
        Install = {
          WantedBy = lib.mkForce [ "wm-services.target" ];
        };
      };
      urgency_critical = {
        background = "#${bg}";
        foreground = "#${text}";
        frame_color = "#${red}";
        timeout = 10;

      redshift = lib.mkIf config.services.redshift.enable {
        Unit = {
          PartOf = lib.mkForce [ "wm-services.target" ];
        };
        Install = {
          WantedBy = lib.mkForce [ "wm-services.target" ];
        };
      };
    };
  };
  xdg.dataFile."dbus-1/services/org.knopwob.dunst.service".source = "${pkgs.dunst}/share/dbus-1/services/org.knopwob.dunst.service";
}

R modules/shell/git.nix => home/modules/profiles/development/default.nix +32 -16
@@ 1,22 1,38 @@
#
# Git
#
{ config, lib, ... }:

{
  programs = {
    git = {
      enable = true;
      includes = [{
        contents = {
          user = {
            email = "rutherther@proton.me";
            name = "Rutherther";
          };
          init = {
            defaultBranch = "main";
  options = {
    profiles.development = {
      enable = lib.mkEnableOption "Enable development profile (emacs, nvim)";
    };
  };

  imports = [
    ./emacs
    ./nvim.nix
  ];

  config = lib.mkIf config.profiles.development.enable {
    programs = {
      direnv = {
        enable = true;
        nix-direnv.enable = true;
      };

      git = {
        enable = true;
        includes = [{
          contents = {
            user = {
              email = "rutherther@proton.me";
              name = "Rutherther";
            };
            init = {
              defaultBranch = "main";
            };
          };
        };
      }];
        }];
      };
    };
  };
}

R modules/editors/emacs/home.nix => home/modules/profiles/development/emacs/default.nix +50 -48
@@ 11,66 11,68 @@
#


{ lib, pkgs, config, ... }:
{ config, lib, pkgs, ... }:

let
  doomRev = "5f5a163c49207a7083ab1ecc9e78d268fd6600b8";
in {
  services.emacs = {
    enable = true;
    client = {
  config = lib.mkIf config.profiles.development.enable {
    services.emacs = {
      enable = true;
      client = {
        enable = true;
      };
      startWithUserSession = "graphical";
    };
    startWithUserSession = "graphical";
  };

  programs.emacs = {
    enable = true;
    package = pkgs.emacs29-gtk3;
    extraPackages = epkgs: [
      epkgs.vterm
      epkgs.sqlite
      epkgs.treesit-grammars.with-all-grammars
    ];
  };
    programs.emacs = {
      enable = true;
      package = pkgs.emacs29-gtk3;
      extraPackages = epkgs: [
        epkgs.vterm
        epkgs.sqlite
        epkgs.treesit-grammars.with-all-grammars
      ];
    };

  home.activation = {
    linkDoomConfig = {
      after = [ "writeBoundary" "createXdgUserDirectories" ];
      before = [  ];
      data =
        ''
            EMACS=$HOME/.emacs.d
            if [ ! -d "$EMACS" ]; then
              ${pkgs.git}/bin/git clone https://github.com/doomemacs/doomemacs $EMACS
              (cd $EMACS && ${pkgs.git}/bin/git checkout ${doomRev})
            else
              curr_rev=$(cd $EMACS && ${lib.getExe pkgs.git} rev-parse HEAD)
              if [[ "$curr_rev" != "${doomRev}" ]]; then
                (cd $EMACS && ${lib.getExe pkgs.git} fetch --all && ${lib.getExe pkgs.git} checkout ${doomRev})
    home.activation = {
      linkDoomConfig = {
        after = [ "writeBoundary" "createXdgUserDirectories" ];
        before = [  ];
        data =
          ''
              EMACS=$HOME/.emacs.d
              if [ ! -d "$EMACS" ]; then
                ${pkgs.git}/bin/git clone https://github.com/doomemacs/doomemacs $EMACS
                (cd $EMACS && ${pkgs.git}/bin/git checkout ${doomRev})
              else
                curr_rev=$(cd $EMACS && ${lib.getExe pkgs.git} rev-parse HEAD)
                if [[ "$curr_rev" != "${doomRev}" ]]; then
                  (cd $EMACS && ${lib.getExe pkgs.git} fetch --all && ${lib.getExe pkgs.git} checkout ${doomRev})
                fi
              fi
            fi
            if [ ! -d "$HOME/.doom.d" ]; then
                ln -s ${config.nixos-config.location}/modules/editors/emacs/doom.d $HOME/.doom.d
            fi
        '';
              if [ ! -d "$HOME/.doom.d" ]; then
                  ln -s ${config.nixos-config.location}/modules/editors/emacs/doom.d $HOME/.doom.d
              fi
          '';
      };
    };
  };

  home.packages = with pkgs; [
    emacs-all-the-icons-fonts
    #binutils # for native comp
    home.packages = with pkgs; [
      emacs-all-the-icons-fonts
      #binutils # for native comp

    ## Doom emacs dependencies
    gnutls
    fd
    ripgrep
      ## Doom emacs dependencies
      gnutls
      fd
      ripgrep

    delta
      delta

    ## Optional dependencies
    fd
    imagemagick
    #zstd
  ];
      ## Optional dependencies
      fd
      imagemagick
      #zstd
    ];
  };
}

R modules/editors/emacs/doom.d/config.el => home/modules/profiles/development/emacs/doom.d/config.el +0 -0
R modules/editors/emacs/doom.d/custom.el => home/modules/profiles/development/emacs/doom.d/custom.el +0 -0
R modules/editors/emacs/doom.d/init.el => home/modules/profiles/development/emacs/doom.d/init.el +0 -0
R modules/editors/emacs/doom.d/packages.el => home/modules/profiles/development/emacs/doom.d/packages.el +0 -0
R modules/editors/nvim/home.nix => home/modules/profiles/development/nvim.nix +35 -33
@@ 2,53 2,55 @@
# Neovim
#

{ pkgs, ... }:
{ config, pkgs, lib, ... }:

{
  programs = {
    neovim = {
      enable = true;
      viAlias = true;
      vimAlias = true;
  config = lib.mkIf config.profiles.development.enable {
    programs = {
      neovim = {
        enable = true;
        viAlias = true;
        vimAlias = true;

      plugins = with pkgs.vimPlugins; [
        direnv-vim
        plugins = with pkgs.vimPlugins; [
          direnv-vim

        vim-nix
        vim-markdown
          vim-nix
          vim-markdown

        vim-lastplace
        auto-pairs
        vim-gitgutter
          vim-lastplace
          auto-pairs
          vim-gitgutter

        wombat256-vim
        srcery-vim
          wombat256-vim
          srcery-vim

        lightline-vim
        indent-blankline-nvim
          lightline-vim
          indent-blankline-nvim

        nvim-surround
        vim-easymotion
        vim-sneak
          nvim-surround
          vim-easymotion
          vim-sneak

        vim-commentary
      ];
          vim-commentary
        ];

      extraConfig = ''
        syntax enable                             " Syntax highlighting
        colorscheme srcery                        " Color scheme text
        extraConfig = ''
          syntax enable                             " Syntax highlighting
          colorscheme srcery                        " Color scheme text

        set iskeyword=!-~,^*,^45,^124,^34,192-255,^_,^.,^,,^/,^\
          set iskeyword=!-~,^*,^45,^124,^34,192-255,^_,^.,^,,^/,^\

        let g:lightline = {
          \ 'colorscheme': 'wombat',
          \ }                                     " Color scheme lightline
          let g:lightline = {
            \ 'colorscheme': 'wombat',
            \ }                                     " Color scheme lightline

        highlight Comment cterm=italic gui=italic " Comments become italic
        hi Normal guibg=NONE ctermbg=NONE         " Remove background, better for personal theme
          highlight Comment cterm=italic gui=italic " Comments become italic
          hi Normal guibg=NONE ctermbg=NONE         " Remove background, better for personal theme

        set number                                " Set numbers
      '';
          set number                                " Set numbers
        '';
      };
    };
  };
}

R modules/editors/vscode/home.nix => home/modules/profiles/development/vscode.nix +0 -0
A home/modules/profiles/matrix.nix => home/modules/profiles/matrix.nix +44 -0
@@ 0,0 1,44 @@
{ config, lib, pkgs, ... }:

{
  options = {
    profiles.matrix =  {
      enable = lib.mkEnableOption "Enable matrix client";
    };
  };

  config = lib.mkIf config.profiles.matrix.enable {
    home.packages = [
      pkgs.element
      pkgs.cinny
    ];

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

        settings = {
          username_display = "displayname";
          image_preview = {};

          sort.rooms = [ "favorite" "unread" "recent" "lowpriority" "name" ];

        };

        macros = {
          normal = {
            "<C-h>" = "<C-W>v50<C-W>><C-W>l:dms<CR><C-W>h";
            "V" = "<C-w>m";
          };
        };
      };
    };

    home-config.startup.apps = [ (lib.getExe pkgs.element) ];
  };
}

R modules/desktop/virtualisation/default.nix => home/modules/programs/default.nix +1 -2
@@ 1,6 1,5 @@
{
  imports = [
    ./qemu.nix
    ./podman.nix
    ./iamb.nix
  ];
}

R modules/programs/iamb.nix => home/modules/programs/iamb.nix +0 -0
D hosts/laptop-phobos/home.nix => hosts/laptop-phobos/home.nix +0 -62
@@ 1,62 0,0 @@
#
#  Home-manager configuration for laptop
#
#  flake.nix
#   ├─ ./hosts
#   │   └─ ./laptop
#   │       └─ home.nix *
#   └─ ./modules
#       └─ ./desktop
#           └─ ./bspwm
#              └─ home.nix
#

{ pkgs, lib, config, ... }:

{
  imports =
    [
      ../../modules/desktop/qtile/home.nix # Window Manager
      ../../modules/desktop/gnome/home.nix
    ];

  home = {                                # Specific packages for laptop
    packages = [
      pkgs.distrobox

      # Power Management
      pkgs.acpi

      pkgs.easyeffects
    ];
  };

  systemd.user.services.cbatticon = lib.mkIf config.services.cbatticon.enable {
    Unit = {
      After = lib.mkForce [];
      PartOf = lib.mkForce [ "qtile-services.target" ];
    };
    Install.WantedBy = lib.mkForce [ "qtile-services.target" ];
  };

  systemd.user.services.network-manager-applet = lib.mkIf config.services.network-manager-applet.enable {
    Unit = {
      After = lib.mkForce [];
      PartOf = lib.mkForce [ "qtile-services.target" ];
    };
    Install.WantedBy = lib.mkForce [ "qtile-services.target" ];
  };

  services = {                            # Applets
    network-manager-applet.enable = true; # Network
    cbatticon = {
     enable = true;
     criticalLevelPercent = 10;
     lowLevelPercent = 20;
    };

    easyeffects = {
      enable = true;
    };
  };
}

D modules/desktop/dm/gdm.nix => modules/desktop/dm/gdm.nix +0 -7
@@ 1,7 0,0 @@
{ config, lib, pkgs, ... }:

{
  services = {
    xserver.displayManager.gdm.enable = true;
  };
}

D modules/desktop/dm/greetd.nix => modules/desktop/dm/greetd.nix +0 -17
@@ 1,17 0,0 @@
{ pkgs, ... }:

{
  services.greetd = {
    enable = true;
    settings = {
      default_session = {
        user = "ruther";
        command = "${pkgs.greetd.tuigreet}/bin/tuigreet --cmd '${pkgs.qtile}/bin/qtile start'";
      };
      gnome = {
        user = "ruther";
        command = "${pkgs.greetd.tuigreet}/bin/tuigreet --cmd '${pkgs.gnome.gnome-session}/bin/gnome-session'";
      };
    };
  };
}

D modules/desktop/dm/sddm-themes/sugar-dark.nix => modules/desktop/dm/sddm-themes/sugar-dark.nix +0 -32
@@ 1,32 0,0 @@
{ stdenv, fetchFromGitHub, libsForQt5 }:

{
  sddm-sugar-dark = stdenv.mkDerivation rec {
    pname = "sddm-sugar-dark-theme";
    version = "1.2";
    dontBuild = true;

    propagatedBuildInputs = [
      libsForQt5.qt5.qtquickcontrols2
      libsForQt5.qt5.qtgraphicaleffects
      libsForQt5.qt5.qtsvg
    ];

    installPhase = ''
      mkdir -p $out/share/sddm/themes/sugar-dark

      cat << EOT >> theme.conf.user
        ForceHideCompletePassword="true"
      EOT

      cp -aR $src/* theme.conf.user $out/share/sddm/themes/sugar-dark/
    '';

    src = fetchFromGitHub {
      owner = "MarianArlt";
      repo = "sddm-sugar-dark";
      rev = "v${version}";
      sha256 = "0gx0am7vq1ywaw2rm1p015x90b75ccqxnb1sz3wy8yjl27v82yhb";
    };
  };
}

D modules/desktop/dm/sddm.nix => modules/desktop/dm/sddm.nix +0 -18
@@ 1,18 0,0 @@
{ config, lib, pkgs, ... }:

let
  themes = pkgs.callPackage ./sddm-themes/sugar-dark.nix {};
in {
  environment.systemPackages = [
    themes.sddm-sugar-dark
  ];

  services = {
    xserver = {
      displayManager.sddm = {
        enable = true;
        theme = "sugar-dark";
      };
    };
  };
}

D modules/desktop/virtualisation/podman.nix => modules/desktop/virtualisation/podman.nix +0 -19
@@ 1,19 0,0 @@
#
# Docker
#

{ config, pkgs, user, ... }:

{
  users.groups.podman.members = [ "root" config.nixos-config.defaultUser ];

  virtualisation.podman = {
    enable = true;
    dockerCompat = true;
    defaultNetwork.settings.dns_enabled = true;
  };

  environment.systemPackages = with pkgs; [
    podman-compose
  ];
}

D modules/editors/home.nix => modules/editors/home.nix +0 -19
@@ 1,19 0,0 @@
#
#  Editors
#
#  flake.nix
#   ├─ ./hosts
#   │   └─ ./home.nix
#   └─ ./modules
#       └─ ./services
#           └─ default.nix *
#               └─ ...
#
{
  imports = [
    ./emacs/home.nix
    ./nvim/home.nix
  ];
}

# Comment out emacs if you are not using native doom emacs. (import from host configuration.nix)

D modules/hardware/default.nix => modules/hardware/default.nix +0 -17
@@ 1,17 0,0 @@
#
#  Hardware
#
#  flake.nix
#   ├─ ./hosts
#   │   └─ ./<host>
#   │       └─ default.nix
#   └─ ./modules
#       └─ ./hardware
#           └─ default.nix *
#               └─ ...
#
{
  imports = [
    ./bluetooth.nix
  ];
}

D modules/hardware/rocm/default.nix => modules/hardware/rocm/default.nix +0 -13
@@ 1,13 0,0 @@
{ pkgs }:

{
  systemd.tmpfiles.rules = [
    "L+    /opt/rocm/hip   -    -    -     -    ${pkgs.rocmPackages.clr}"
  ];

  # nixpkgs.config.rocmSupport = true;

  hardware.opengl.extraPackages = with pkgs; [
    rocmPackages.clr.icd
  ];
}

D modules/programs/alacritty.nix => modules/programs/alacritty.nix +0 -58
@@ 1,58 0,0 @@
#
# Terminal Emulator
#
# Hardcoded as terminal for rofi and doom emacs
#

{ pkgs, lib, ... }:

{

  programs = {
    dircolors = {
      enable = true;
      settings = {
        OTHER_WRITABLE = "01;35"; # Make ntfs colors readable
      };
    };

    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 = {
        font = rec {                          # Font - Laptop has size manually changed at home.nix
          normal.family = "FiraCode Nerd Font";
          bold = { style = "Bold"; };
          size = 12;
        };
        # offset = {                            # Positioning
        #   x = -1;
        #   y = 0;
        # };
      };
    };
  };
}

D modules/programs/clipmenu.nix => modules/programs/clipmenu.nix +0 -10
@@ 1,10 0,0 @@
{ config, lib, pkgs, ... }:

{
  home.packages = with pkgs; [
    dmenu
    clipmenu
  ];

  # services.clipmenu.enable = true;
}

D modules/programs/email.nix => modules/programs/email.nix +0 -37
@@ 1,37 0,0 @@
{ config, lib, pkgs, location, ... }:

{
  programs.thunderbird = {
    enable = true;
    profiles = {
      default = {
        isDefault = true;
      };
    };
  };

  accounts.email = {
    accounts = {
      ctu = {
        primary = true;
        thunderbird = {
          enable = true;
        };
        address = "bohacfr2@fel.cvut.cz";
        userName = "bohacfr2";
        realName = "František Boháček";
        imap = {
          host = "imap.fel.cvut.cz";
          port = 993;
        };
        smtp = {
          host = "smtpx.fel.cvut.cz";
          port = 465;
          tls = {
            enable = true;
          };
        };
      };
    };
  };
}

D modules/programs/fpga/vivado/default.nix => modules/programs/fpga/vivado/default.nix +0 -8
@@ 1,8 0,0 @@
{ inputs, system, config, lib, pkgs, vivadoPath, ... }:

{
  services.udev.packages = [
    inputs.nix-fpga-tools.packages.x86_64-linux.ise-udev-rules
    inputs.nix-fpga-tools.packages.x86_64-linux.vivado-udev-rules
  ];
}

D modules/programs/fpga/vivado/fhs.nix => modules/programs/fpga/vivado/fhs.nix +0 -29
@@ 1,29 0,0 @@
{ stdenv, config, lib, stable, pkgs, vivadoPath, ... }:

stable.buildFHSEnv {
  name = "vivado-wrapped";

  targetPkgs = pkgs: with pkgs; [
    coreutils
    stdenv.cc.cc
    ncurses5
    ncurses
    zlib
    xorg.libX11
    xorg.libXrender
    xorg.libxcb
    xorg.libXext
    xorg.libXtst
    xorg.libXi
    freetype
    gtk2
    glib
    libxcrypt-legacy
    gperftools
    glibc.dev
    fontconfig
    liberation_ttf
  ];

  runScript = "${vivadoPath}";
}

D modules/programs/fpga/vivado/home.nix => modules/programs/fpga/vivado/home.nix +0 -10
@@ 1,10 0,0 @@
{ config, lib, pkgs, vivadoPath, stable, ... }:

let
  vivadoPkg = pkgs.callPackage ./vivado-pkg.nix { inherit vivadoPath stable; };
  fhsPkg = pkgs.callPackage ./fhs.nix { inherit vivadoPath stable; };
in {
  home.packages = [
    fhsPkg
  ];
}

D modules/programs/fpga/vivado/udev/52-xilinx-digilent-usb.rules => modules/programs/fpga/vivado/udev/52-xilinx-digilent-usb.rules +0 -54
@@ 1,54 0,0 @@
###########################################################################
#                                                                         #
#  52-digilent-usb.rules -- UDEV rules for Digilent USB Devices           #
#                                                                         #
###########################################################################
#  Author: MTA                                                            #
#  Copyright 2010 Digilent Inc.                                           #
###########################################################################
#  File Description:                                                      #
#                                                                         #
#  This file contains the rules used by UDEV when creating entries for    #
#  Digilent USB devices. In order for Digilent's shared libraries and     #
#  applications to access these devices without root privalages it is     #
#  necessary for UDEV to create entries for which all users have read     #
#  and write permission.                                                  #
#                                                                         #
#  Usage:                                                                 #
#                                                                         #
#  Copy this file to "/etc/udev/rules.d/" and execute                     #
#  "/censored/censored reload_rules" as root. This only needs to be done   #
#  immediately after installation. Each time you reboot your system the   #
#  rules are automatically loaded by UDEV.                                #
#                                                                         #
###########################################################################
#  Revision History:                                                      #
#                                                                         #
#  04/15/2010(MTA): created                                               #
#  02/28/2011(MTA): modified to support FTDI based devices                #
#  07/10/2012(MTA): modified to work with UDEV versions 098 or newer      #
#  04/19/2013(MTA): modified mode assignment to use ":=" insetead of "="  #
#       so that our permission settings can't be overwritten by other     #
#       rules files                                                       #
#  07/28/2014(MTA): changed default application path                      #
#                                                                         #
###########################################################################

# Create "/dev" entries for Digilent device's with read and write
# permission granted to all users.
ATTR{idVendor}=="1443", MODE:="666"
ACTION=="add", ATTR{idVendor}=="0403", ATTR{manufacturer}=="Digilent", MODE:="666"

# The following rules (if present) cause UDEV to ignore all UEVENTS for
# which the subsystem is "usb_endpoint" and the action is "add" or
# "remove". These rules are necessary to work around what appears to be a
# bug in the Kernel used by Red Hat Enterprise Linux 5/CentOS 5. The Kernel
# sends UEVENTS to remove and then add entries for the endpoints of a USB
# device in "/dev" each time a process releases an interface. This occurs
# each time a data transaction occurs. When an FPGA is configured or flash
# device is written a large number of transactions take place. If the
# following lines are commented out then UDEV will be overloaded for a long
# period of time while it tries to process the massive number of UEVENTS it
# receives from the kernel. Please note that this work around only applies
# to systems running RHEL5 or CentOS 5 and as a result the rules will only
# be present on those systems.

D modules/programs/fpga/vivado/udev/52-xilinx-ftdi-usb.rules => modules/programs/fpga/vivado/udev/52-xilinx-ftdi-usb.rules +0 -47
@@ 1,47 0,0 @@
###########################################################################
#                                                                         #
#  52-xilinx-ftdi-usb.rules -- UDEV rules for Xilinx USB Devices          #
#                                                                         #
###########################################################################
#  Author: EST                                                            #
#  Copyright 2016 Xilinx Inc.                                             #
###########################################################################
#  File Description:                                                      #
#                                                                         #
#  This file contains the rules used by UDEV when creating entries for    #
#  Xilinx USB devices. In order for Xilinx's shared libraries and         #
#  applications to access these devices without root privalages it is     #
#  necessary for UDEV to create entries for which all users have read     #
#  and write permission.                                                  #
#                                                                         #
#  Usage:                                                                 #
#                                                                         #
#  Copy this file to "/etc/udev/rules.d/" and execute                     #
#  "/censored/censored reload_rules" as root. This only needs to be done   #
#  immediately after installation. Each time you reboot your system the   #
#  rules are automatically loaded by UDEV.                                #
#                                                                         #
###########################################################################
#  Revision History:                                                      #
#                                                                         #
#  10/18/2016(EST): created                                               #
#                                                                         #
###########################################################################
# version 0001
# Create "/dev" entries for Xilinx device's with read and write
# permission granted to all users.
ACTION=="add", ATTR{idVendor}=="0403", ATTR{manufacturer}=="Xilinx", MODE:="666"

# The following rules (if present) cause UDEV to ignore all UEVENTS for
# which the subsystem is "usb_endpoint" and the action is "add" or
# "remove". These rules are necessary to work around what appears to be a
# bug in the Kernel used by Red Hat Enterprise Linux 6/CentOS 5. The Kernel
# sends UEVENTS to remove and then add entries for the endpoints of a USB
# device in "/dev" each time a process releases an interface. This occurs
# each time a data transaction occurs. When an FPGA is configured or flash
# device is written a large number of transactions take place. If the
# following lines are commented out then UDEV will be overloaded for a long
# period of time while it tries to process the massive number of UEVENTS it
# receives from the kernel. Please note that this work around only applies
# to systems running RHEL6 or CentOS 5 and as a result the rules will only
# be present on those systems.

D modules/programs/fpga/vivado/udev/52-xilinx-pcusb.rules => modules/programs/fpga/vivado/udev/52-xilinx-pcusb.rules +0 -8
@@ 1,8 0,0 @@
# version 0002
ATTR{idVendor}=="03fd", ATTR{idProduct}=="0008", MODE="666"
ATTR{idVendor}=="03fd", ATTR{idProduct}=="0007", MODE="666"
ATTR{idVendor}=="03fd", ATTR{idProduct}=="0009", MODE="666"
ATTR{idVendor}=="03fd", ATTR{idProduct}=="000d", MODE="666"
ATTR{idVendor}=="03fd", ATTR{idProduct}=="000f", MODE="666"
ATTR{idVendor}=="03fd", ATTR{idProduct}=="0013", MODE="666"
ATTR{idVendor}=="03fd", ATTR{idProduct}=="0015", MODE="666"

D modules/programs/fpga/vivado/vivado-pkg.nix => modules/programs/fpga/vivado/vivado-pkg.nix +0 -21
@@ 1,21 0,0 @@
{ stdenv, config, lib, pkgs, ... }:

# Only udev rules...

stdenv.mkDerivation {
  name = "vivado-2023.1";

  nativeBuildInputs = [ pkgs.zlib ];
  buildInputs = [ pkgs.patchelf pkgs.procps pkgs.ncurses5 pkgs.makeWrapper ];

  src = ./.;

  installPhase = ''
    mkdir -p $out/lib/udev/rules.d/
    cp udev/* $out/lib/udev/rules.d/
  '';

  dontPatch = true;
  dontConfigure = true;
  dontBuild = true;
}

D modules/programs/games.nix => modules/programs/games.nix +0 -35
@@ 1,35 0,0 @@
#
# Gaming
# Steam + MC + Emulation
#
# Do not forget to enable Steam play for all title in the settings menu
#

{ pkgs, lib, ... }:

{
  environment.systemPackages = [
    pkgs.lunar-client
    # pkgs.heroic
    # pkgs.lutris
    # pkgs.prismlauncher
    # pkgs.retroarchFull
    # pcsx2
  ];

  programs = {                                  # Needed to succesfully start Steam
    steam = {
      enable = true;
    };
    gamemode.enable = true;                     # Better gaming performance
                                                # Steam: Right-click game - Properties - Launch options: gamemoderun %command%
                                                # Lutris: General Preferences - Enable Feral GameMode
                                                #                             - Global options - Add Environment Variables: LD_PRELOAD=/nix/store/*-gamemode-*-lib/lib/libgamemodeauto.so
  };

  nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
    "steam"
    "steam-original"
    "steam-runtime"
  ];                                            # Use Steam for Linux libraries
}

D modules/programs/home.nix => modules/programs/home.nix +0 -22
@@ 1,22 0,0 @@
#
#  Apps
#
#  flake.nix
#   ├─ ./hosts
#   │   └─ home.nix
#   └─ ./modules
#       └─ ./programs
#           └─ default.nix *
#               └─ ...
#

{
  imports = [
    ./alacritty.nix
    ./iamb.nix
    ./rofi.nix
    ./clipmenu.nix
    ./firefox.nix
    ./email.nix
  ];
}

D modules/services/default.nix => modules/services/default.nix +0 -19
@@ 1,19 0,0 @@
#
#  Services
#
#  flake.nix
#   ├─ ./hosts
#   │   └─ home.nix
#   └─ ./modules
#       └─ ./services
#           └─ default.nix *
#               └─ ...
#

{
  imports = [
    ./syncthing.nix
    ./wireguard.nix
    ./ssh.nix
  ];
}

D modules/services/flameshot.nix => modules/services/flameshot.nix +0 -40
@@ 1,40 0,0 @@
#
# Screenshots
#

{ config, lib, ... }:

let
  screensDir = "${config.home.homeDirectory}/screens";
in {

  systemd.user.services.flameshot = lib.mkIf config.services.flameshot.enable {
    Unit = {
      PartOf = lib.mkForce [ "qtile-services.target" ];
    };
    Install = {
      WantedBy = lib.mkForce [ "qtile-services.target" ];
    };
  };

  services = {                                    # sxhkd shortcut = Printscreen button (Print)
    flameshot = {
      enable = true;
      settings = {
        General = {                               # Settings
          savePath = screensDir;
          saveAsFileExtension = ".png";
          uiColor = "#2d0096";
          showHelp = "false";
          disabledTrayIcon = "true";              # Hide from systray
        };
      };
    };
  };

  home.activation = {
    ensureScreensDirCreated = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
      mkdir -p ${screensDir}
    '';
  };
}

D modules/services/home.nix => modules/services/home.nix +0 -23
@@ 1,23 0,0 @@
#
#  Services
#
#  flake.nix
#   ├─ ./hosts
#   │   └─ home.nix
#   └─ ./modules
#       └─ ./services
#           └─ default.nix *
#               └─ ...
#

{
  imports = [
    ./dunst.nix
    ./flameshot.nix
    ./picom.nix
    ./udiskie.nix
    ./redshift.nix
    ./mpris-ctl.nix
    ./autorandr.nix
  ];
}

D modules/services/mpris-ctl.nix => modules/services/mpris-ctl.nix +0 -29
@@ 1,29 0,0 @@
{ pkgs, ... }:

let
  mpris-ctl = pkgs.callPackage ../../pkgs/rutherther/mpris-ctl.nix {};
  sequence-detector = pkgs.callPackage ../../pkgs/rutherther/sequence-detector.nix {};
in {
  home.packages = [
    sequence-detector
    mpris-ctl
  ];

  systemd.user.services = {
    mpris-ctld = {
      Unit = {
        Description = "Daemon for mpris-ctl cli, that will keep track of last playing media";
        PartOf = [ "qtile-services.target" ];
      };

      Install = {
        WantedBy = [ "qtile-services.target" ];
      };

      Service = {
        ExecStart = "${mpris-ctl}/bin/mpris-ctld";
      };
    };
  };

}

D modules/services/picom.nix => modules/services/picom.nix +0 -63
@@ 1,63 0,0 @@
#
# Compositor
#

{ config, lib, pkgs, ... }:

{
  systemd.user.services.picom = lib.mkIf config.services.picom.enable {
    Unit = {
      PartOf = lib.mkForce [ "qtile-services.target" ];
    };
    Install = {
      WantedBy = lib.mkForce [ "qtile-services.target" ];
    };
  };

  services.picom = {
    enable = true;
    package = pkgs.picom;

    backend = "glx";                              # Rendering either with glx or xrender. You'll know if you need to switch this.
    vSync = true;                                 # Should fix screen tearing

    #activeOpacity = 0.93;                         # Node transparency
    #inactiveOpacity = 0.93;
    #menuOpacity = 0.93;

    shadow = false;                               # Shadows
    shadowOpacity = 0.75;
    fade = true;                                  # Fade
    fadeDelta = 10;
    opacityRules = [                              # Opacity rules if transparency is prefered
    #  "100:name = 'Picture in picture'"
    #  "100:name = 'Picture-in-Picture'"
    #  "85:class_i ?= 'rofi'"
      # "90:class_i *= 'discord'"
      # "90:class_i *= 'telegram-desktop'"
      # "90:class_i *= 'emacs'"
      # "90:class_i *= 'Alacritty'"
    #  "100:fullscreen"
    ];                                            # Find with $ xprop | grep "WM_CLASS"

    settings = {
      daemon = true;
      use-damage = false;                         # Fixes flickering and visual bugs with borders
      resize-damage = 1;
      refresh-rate = 0;
      corner-radius = 5;                          # Corners
      round-borders = 5;

      # Extras
      detect-rounded-corners = true;              # Below should fix multiple issues
      detect-client-opacity = false;
      detect-transient = true;
      detect-client-leader = false;
      mark-wmwim-focused = true;
      mark-ovredir-focues = true;
      unredir-if-possible = true;
      glx-no-stencil = true;
      glx-no-rebind-pixmap = true;
    };                                           # Extra options for picom.conf (mostly for pijulius fork)
  };
}

D modules/services/redshift.nix => modules/services/redshift.nix +0 -24
@@ 1,24 0,0 @@
#
#  Screen color temperature changer
#
{ config, lib, pkgs, ...}:

{
  systemd.user.services.redshift = lib.mkIf config.services.redshift.enable {
    Unit = {
      PartOf = lib.mkForce [ "qtile-services.target" ];
    };
    Install = {
      WantedBy = lib.mkForce [ "qtile-services.target" ];
    };
  };

  services = {
    redshift = {
      enable = true;
      temperature.night = 3000;
      latitude = 50.2332933;
      longitude = 14.3225926;
    };
  };
}

D modules/services/ssh.nix => modules/services/ssh.nix +0 -20
@@ 1,20 0,0 @@
{ config, ... }:

{
  services.openssh = {
    enable = true;
    startWhenNeeded = true;

    settings = {
      KbdInteractiveAuthentication = false;
      PasswordAuthentication = false;
      PermitRootLogin = "no";
    };
  };

  users.users.${config.nixos-config.defaultUser}.openssh.authorizedKeys.keys = [
    "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCLdKvP+WQmsoJebj4x0o8k/RniDpYDv3H+b+PWByChKPq4ThEnpL6P4sr0dpZ4NbWmDT9YPGuDEyZRxhrIerUKw+z8Jm32b8FeeYcEdoBlZTBz4WuN7G9FkDIYdqBYdnUaWh8/KeuZbUp/jB/d1Uv8rBdPSML1JlUPg8U/Z5Oky68LYUO60DfLoQZ+qD5AeTw4zPRACA5OOJj20eIDhiXKyp60eTXAiwrfC2RZJWURc4i92Oforua3OZEZfL1Z+xOjAhbKymPZIzKuzIIIVP/abnWv3b/shCCrR70wuZZ6QleY+DTcNsburmDfUP+3f+C1fF3mg6loZaGokGMwKtNI/0UVWHQW5BPkWfvkQmsW4jl02P174IlAGwvEkhTfBzmuaPKuf+0D+rJH+1FengEFmAPhaN6WIMFYGTScbOn46BS8v3oWhW5A+CQ1pMA9myu1fDr7WKrNCDdW9X398ByKA88OpEOU+vQcwgg6EPb/SuAlFDYBSgz0TX6IGl4demc= ruther@ntb-nixos"
    "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQD0mhvKW3dgLTGLGMgGdMgUFz14F16pRzSAH7IU/OssnYXmi+TlkXLakHtmNWLdb6IEEjS2od0iDW4I71awJjL/VqRSBBt/1t6ndM6M79pD6feU9uYaPMB20ORyZh5D+1zjWX4cFVlcfCQ2bUyV0D+VRoDrN/YWFhPU0XNMZjatqN8JNKljM0hwWt9OPuQdlwG5KnrbDPUn8gf6kZtfVWRamDrLLMKsGBeGw4oZVJLAPYJlaYps15VuySTw114n6/L16qpH/rUgDc5QFyrmtIE+l5wd5QteH489eG+8gAZfsbYj+pihek09rHch318ecsLYz/DxotB71BXsQH7nb0NPHk1VI8L6//meoCXNJc4Itbg7Jh2Oo/bDfYX9IyPEw2TRa3P+rbEO9N4vMxCgX+TuHNX/mTk0OFpJVu8AAwMlF2lalI8fpBKospP5PFoyIgrW7ab5dkQRGDTk+Bw1ed4KXMKl6RJejvDPuOAmpeOlosinz6OPj/rbR9hR48makxk= ruther@desktop-nixos"
    "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIbHBbRaxwfOIyYYL6caWx8Afre8R+GRIgbX/zSGNmMq ruther@nord2-phone"
  ];
}

D modules/services/udiskie.nix => modules/services/udiskie.nix +0 -15
@@ 1,15 0,0 @@
#
# Mounting tool
#

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

{
  services = {
    udiskie = {                         # Udiskie wil automatically mount storage devices
      enable = true;
      automount = true;
      tray = "auto";                    # Will only show up in systray when active
    };
  };
}

D modules/services/wg-options.nix => modules/services/wg-options.nix +0 -9
@@ 1,9 0,0 @@
{ lib, ... }:

{
  options.wg = {
    ip = lib.mkOption {
      type = lib.types.str;
    };
  };
}

D modules/shell/direnv.nix => modules/shell/direnv.nix +0 -20
@@ 1,20 0,0 @@
#
# Direnv
#
# create a shell.nix
# create a .envrc and add use nix shell.nix
# direnv allow
# add direnv package to emacs
# add 'eval "$(direnv hook zsh)"' to .zshrc (and same for bash)
#

{ config, lib, pkgs, ... }:

{
  programs = {
    direnv = {
      enable = true;
      nix-direnv.enable = true;
    };
  };
}

D modules/shell/home.nix => modules/shell/home.nix +0 -19
@@ 1,19 0,0 @@
#
#  Shell
#
#  flake.nix
#   ├─ ./hosts
#   │   └─ home.nix
#   └─ ./modules
#       └─ ./shell
#           └─ default.nix *
#               └─ ...
#

{
  imports = [
    ./git.nix
    ./zsh.nix
    ./direnv.nix
  ];
}

D modules/shell/zsh.nix => modules/shell/zsh.nix +0 -36
@@ 1,36 0,0 @@
#
# Shell
#

{ pkgs, ... }:

{
  programs = {
    starship = {
      enable = true;
    };
    zsh = {
      enable = true;
      autosuggestion.enable = true;
      syntaxHighlighting.enable = true;
      enableCompletion = true;
      history.size = 100000;

      oh-my-zsh = {                               # Extra plugins for zsh
        enable = true;
        plugins = [ "git" ];
      };

      initExtra = ''
        function loc {
          nix-locate --top-level -w /bin/$1
        }
        function exa-nixpkgs-derivation {
          nix run nixpkgs#eza -- --tree $(nix build nixpkgs#$1 --print-out-paths --out-link /tmp/$1)
        }

        # source /etc/set-environment
      '';
    };
  };
}

R hosts/default.nix => nixos/default.nix +8 -8
@@ 25,8 25,8 @@
      inputs.nixos-hardware.nixosModules.common-pc-laptop
      inputs.nixos-hardware.nixosModules.common-pc-laptop-acpi_call
      inputs.nixos-hardware.nixosModules.common-pc-laptop-ssd
      ./laptop-iapetus
      ./configuration.nix
      ./hosts/laptop-iapetus
      ./hosts/configuration.nix
    ];
  };



@@ 38,8 38,8 @@
    modules = [
      inputs.lanzaboote.nixosModules.lanzaboote
      inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t14s-amd-gen1
      ./laptop-phobos
      ./configuration.nix
      ./hosts/laptop-phobos
      ./hosts/configuration.nix
    ];
  };



@@ 48,8 48,8 @@
      inherit inputs;
    };
    modules = [
      ./desktop-clotho
      ./configuration.nix
      ./hosts/desktop-clotho
      ./hosts/configuration.nix
    ];
  };



@@ 58,8 58,8 @@
      inherit inputs;
    };
    modules = [
      ./vm
      ./configuration.nix
      ./hosts/vm
      ./hosts/configuration.nix
    ];
  };
}

R hosts/configuration.nix => nixos/hosts/configuration.nix +15 -33
@@ 1,32 1,11 @@
#
#  Main system configuration. More information available in configuration.nix(5) man page.
#
#  flake.nix
#   ├─ ./hosts
#   │   └─ configuration.nix *
#   └─ ./modules
#       ├─ ./editors
#       │   └─ default.nix
#       └─ ./shell
#           └─ default.nix
#

{ stable, pkgs, inputs, config, ... }:

{
  imports = [
    ../modules/desktop
    ../modules/services
    ./nixos-config-options.nix

    inputs.home-manager.nixosModules.home-manager
    ../modules
  ];

  boot.tmp = {
    cleanOnBoot = true;
    useTmpfs = true;
  };

  home-manager.useUserPackages = true;
  home-manager.useGlobalPkgs = true;
  home-manager.extraSpecialArgs = {


@@ 35,18 14,19 @@
  home-manager.users.${config.nixos-config.defaultUser} = {
    imports = [
      inputs.nix-index-database.hmModules.nix-index
      ./home.nix
      ./${config.networking.hostName}/home.nix
      ./nixos-config-options.nix

      ../../home
      {
        nixos-config = {
          inherit (config.nixos-config) defaultUser location;
        };
        inherit (config) nixos-config;
      }
    ];
  };

  boot.tmp = {
    cleanOnBoot = true;
    useTmpfs = true;
  };

  hardware.pulseaudio.enable = false;

  users.users.${config.nixos-config.defaultUser} = {


@@ 86,6 66,13 @@
    };
  };

  services.xserver.serverFlagsSection = ''
    Option "BlankTime" "15"
    Option "StandbyTime" "30"
    Option "SuspendTime" "30"
    Option "OffTime" "60"
  '';

  security.polkit.enable = true;

  fonts.packages = with pkgs; [                # Fonts


@@ 117,11 104,6 @@
  };

  environment = {
    variables = {
      TERMINAL = "kitty";
      EDITOR = "emacsclient";
      VISUAL = "emacsclient";
    };
    pathsToLink = [ "/share/zsh" ];
    systemPackages = with pkgs; [           # Default packages installed system-wide
      alsa-utils

R hosts/desktop-clotho/default.nix => nixos/hosts/desktop-clotho/default.nix +0 -0
R hosts/desktop-clotho/hardware-configuration.nix => nixos/hosts/desktop-clotho/hardware-configuration.nix +0 -0
R hosts/desktop-clotho/home.nix => nixos/hosts/desktop-clotho/home.nix +0 -0
R hosts/laptop-iapetus/default.nix => nixos/hosts/laptop-iapetus/default.nix +0 -0
R hosts/laptop-iapetus/hardware-configuration.nix => nixos/hosts/laptop-iapetus/hardware-configuration.nix +0 -0
R hosts/laptop-iapetus/home.nix => nixos/hosts/laptop-iapetus/home.nix +0 -0
R hosts/laptop-phobos/default.nix => nixos/hosts/laptop-phobos/default.nix +16 -12
@@ 21,14 21,21 @@
{
  imports = [
    ./hardware-configuration.nix
    ../../modules/desktop/dm/gdm.nix
    ../../modules/desktop/qtile/default.nix
    ../../modules/desktop/gnome/default.nix
    ../../modules/hardware
    ../../modules/desktop/virtualisation
    ./udev.nix
  ];

  nixos-config.isLaptop = true;
  profiles.virtualisation.enable = true;
  profiles.desktop.qtile.enable = true;
  profiles.desktop.gnome.enable = true;
  profiles.vpn.enable = true;
  profiles.sync.enable = true;
  profiles.development = {
    enable = true;

    fpga.cables = [ "vivado" "ise" ];
    mcu.cables = [ "tiva-c" "st-link" "trezor" ];
  };

  networking.hostName = "laptop-phobos";

  boot = {                                  # Boot options


@@ 65,15 72,12 @@
    };
  };

  security.pam.services.login.fprintAuth = false;
  security.pam.services.sddm.fprintAuth = false;
  security.pam.services.sddm-greeter.fprintAuth = false;
  # services.fprintd.enable = true;

  # TODO under qtile
  hardware = {                              # No xbacklight, this is the alterantive
    brillo.enable = true;
  };

  # TODO under qtile
  programs = {
    xss-lock = let
    xsecurelock = (pkgs.xsecurelock.overrideAttrs(attrs: {


@@ 108,5 112,5 @@
  };

  # Wireguard
  wg.ip = "192.168.32.25";
  profiles.vpn.lanIp = "192.168.32.25";
}

R hosts/laptop-phobos/hardware-configuration.nix => nixos/hosts/laptop-phobos/hardware-configuration.nix +0 -0
A nixos/hosts/laptop-phobos/home.nix => nixos/hosts/laptop-phobos/home.nix +6 -0
@@ 0,0 1,6 @@
{
  profiles.development.enable = true;
  profiles.desktop.qtile.enable = true;
  profiles.desktop.gnome.enable = true;
  profiles.matrix.enable = true;
}

R hosts/vm/default.nix => nixos/hosts/vm/default.nix +0 -0
R hosts/vm/hardware-configuration.nix => nixos/hosts/vm/hardware-configuration.nix +0 -0
R hosts/vm/home.nix => nixos/hosts/vm/home.nix +0 -0
R modules/hardware/bluetooth.nix => nixos/modules/default.nix +18 -13
@@ 1,17 1,22 @@
#
# Bluetooth
#

{ pkgs, ... }:
{ config, lib, ... }:

{
  hardware.bluetooth = {
    enable = true;
    settings = {
      General = {
        Enable = "Source,Sink,Media,Socket";
  imports = [
    ./profiles
    ./nixos-config.nix
  ];

  config = lib.mkMerge [
    (lib.mkIf config.nixos-config.useBluetooth {
      hardware.bluetooth = {
        enable = true;
        settings = {
          General = {
            Enable = "Source,Sink,Media,Socket";
          };
        };
      };
    };
  };
  services.blueman.enable = true;
      services.blueman.enable = true;
    })
  ];
}

R hosts/nixos-config-options.nix => nixos/modules/nixos-config.nix +10 -0
@@ 11,5 11,15 @@
      type = lib.types.str;
      default = "$HOME/.setup";
    };

    isLaptop = lib.mkOption {
      type = lib.types.bool;
      default = false;
    };

    useBluetooth = lib.mkOption {
      type = lib.types.bool;
      default = true;
    };
  };
}

A nixos/modules/profiles/default.nix => nixos/modules/profiles/default.nix +11 -0
@@ 0,0 1,11 @@
{ ... }:

{
  imports = [
    ./desktop
    ./development.nix
    ./vpn.nix
    ./sync.nix
    ./virtualisation.nix
  ];
}

R modules/desktop/default.nix => nixos/modules/profiles/desktop/default.nix +31 -11
@@ 1,18 1,38 @@
{ pkgs, ... }:
{ config, lib, pkgs, ... }:

{
  services = {
    xserver = {
      enable = true;
  imports = [
    ./qtile.nix
    ./gnome.nix
  ];

      xkb = {
        layout = "us,cz";                              # Keyboard layout & €-sign
        variant = ",qwerty";
        options = "grp:alt_shift_toggle, ctrl:nocaps";
  options = {
    profiles.desktop = {
      enable = lib.mkEnableOption "desktop";
    };
  };

  config = lib.mkIf config.profiles.desktop.enable {

    environment.systemPackages = [
      pkgs.xkblayout-state
    ];

    services = {
      xserver = {
        enable = true;

        displayManager.gdm.enable = true;

        xkb = {
          layout = "us,cz";                              # Keyboard layout & €-sign
          variant = ",qwerty";
          options = "grp:alt_shift_toggle, ctrl:nocaps";
        };
        libinput.enable = true;
        modules = [ pkgs.xf86_input_wacom ];        # Both needed for wacom tablet usage
        wacom.enable = true;
      };
      libinput.enable = true;
      modules = [ pkgs.xf86_input_wacom ];        # Both needed for wacom tablet usage
      wacom.enable = true;
    };
  };
}

R modules/desktop/gnome/default.nix => nixos/modules/profiles/desktop/gnome.nix +53 -52
@@ 1,60 1,61 @@
#
# Gnome configuration
#

{ pkgs, ... }:
{ config, lib, pkgs, ... }:

{
  programs = {
    zsh.enable = true;
    dconf.enable = true;
    kdeconnect = {                                # For GSConnect
      enable = true;
      package = pkgs.gnomeExtensions.gsconnect;
  options = {
    profiles.desktop.gnome = {
      enable = lib.mkEnableOption "gnome";
    };
  };

  services = {
    xserver.desktopManager.gnome.enable = true;
    udev.packages = with pkgs; [
      gnome.gnome-settings-daemon
    ];
  };
  config = lib.mkIf config.profiles.desktop.gnome.enable {
    profiles.desktop.enable = lib.mkDefault true;

    programs = {
      dconf.enable = true;
    };

  environment = {
    systemPackages = with pkgs; [                 # Packages installed
      gnome.dconf-editor
      gnome.gnome-tweaks
      gnome.adwaita-icon-theme
      gnomeExtensions.fullscreen-avoider
      gnomeExtensions.vitals
      gnomeExtensions.openweather
      gnomeExtensions.clipboard-history
      gnomeExtensions.forge
      gnomeExtensions.switcher
      (gnomeExtensions.disable-workspace-switch-animation-for-gnome-40.overrideAttrs {
        src = pkgs.fetchFromGitHub {
          owner = "tmke8";
          repo = "gnome-shell-extension-instant-workspace-switcher";
          rev = "patch-1";
          hash = "sha256-Ual7kAOeGPe3DF5XHf5eziscYeMLUnDktEGU41Yl4E4=";
        } + "/instantworkspaceswitcher@amalantony.net";
      })
    ];
    gnome.excludePackages = (with pkgs; [         # Gnome ignored packages
      gnome-tour
    ]) ++ (with pkgs.gnome; [
      pkgs.gedit
      epiphany
      geary
      gnome-characters
      tali
      iagno
      hitori
      atomix
      yelp
      gnome-contacts
      gnome-initial-setup
    ]);
    services = {
      xserver.desktopManager.gnome.enable = true;
      udev.packages = with pkgs; [
        gnome.gnome-settings-daemon
      ];
    };

    environment = {
      systemPackages = with pkgs; [                 # Packages installed
        gnome.dconf-editor
        gnome.gnome-tweaks
        gnome.adwaita-icon-theme
        gnomeExtensions.fullscreen-avoider
        gnomeExtensions.vitals
        gnomeExtensions.openweather
        gnomeExtensions.clipboard-history
        gnomeExtensions.forge
        gnomeExtensions.switcher
        (gnomeExtensions.disable-workspace-switch-animation-for-gnome-40.overrideAttrs {
          src = pkgs.fetchFromGitHub {
            owner = "tmke8";
            repo = "gnome-shell-extension-instant-workspace-switcher";
            rev = "patch-1";
            hash = "sha256-Ual7kAOeGPe3DF5XHf5eziscYeMLUnDktEGU41Yl4E4=";
          } + "/instantworkspaceswitcher@amalantony.net";
        })
      ];
      gnome.excludePackages = (with pkgs; [         # Gnome ignored packages
        gnome-tour
      ]) ++ (with pkgs.gnome; [
        pkgs.gedit
        epiphany
        geary
        gnome-characters
        tali
        iagno
        hitori
        atomix
        yelp
        gnome-contacts
        gnome-initial-setup
      ]);
    };
  };
}

R modules/desktop/qtile/default.nix => nixos/modules/profiles/desktop/qtile.nix +14 -13
@@ 1,4 1,4 @@
{ config, lib, pkgs, nixpkgs, ... }:
{ config, lib, pkgs, ... }:

let
  pythonEnvPackages = ppkgs: [


@@ 9,22 9,23 @@ let
    ppkgs.pydbus
  ];
in {
  environment.systemPackages = with pkgs; [
    xkblayout-state
  ];
  options = {
    profiles.desktop.qtile = {
      enable = lib.mkEnableOption "gnome";
    };
  };

  config = lib.mkIf config.profiles.desktop.qtile.enable {
    profiles.desktop.enable = lib.mkDefault true;

  services = {
    xserver = {
    services.xserver.windowManager.qtile = {
      enable = true;
      windowManager.qtile = {
        enable = true;

        package = pkgs.qtile-unwrapped.overridePythonAttrs(oldAttrs: {
          propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ pythonEnvPackages pkgs.python3Packages;
        });
      package = pkgs.qtile-unwrapped.overridePythonAttrs(oldAttrs: {
        propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ pythonEnvPackages pkgs.python3Packages;
      });

        extraPackages = pythonEnvPackages;
      };
      extraPackages = pythonEnvPackages;
    };
  };
}

R hosts/laptop-phobos/udev.nix => nixos/modules/profiles/development.nix +25 -9
@@ 1,4 1,4 @@
{ inputs, config, pkgs, ... }:
{ config, inputs, lib, pkgs, ... }:

let
    trezor-udev-rules = pkgs.writeTextFile {


@@ 65,13 65,29 @@ let
        SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3753", MODE="600", TAG+="uaccess", SYMLINK+="stlinkv3_%n"
      '';
    };
in {
  services.udev.packages = [
    trezor-udev-rules
    ti-udev-rules
    stlink-udev-rules

    inputs.nix-fpga-tools.packages.${config.nixpkgs.hostPlatform.system}.ise-udev-rules
    inputs.nix-fpga-tools.packages.${config.nixpkgs.hostPlatform.system}.vivado-udev-rules
  ];
    cfg = config.profiles.development;
in
{
  options = {
    profiles.development = {
      enable = lib.mkEnableOption "development";

      fpga.cables = lib.mkOption {
        type = lib.types.listOf lib.types.str;
      };
      mcu.cables = lib.mkOption {
        type = lib.types.listOf lib.types.str;
      };
    };
  };

  config = lib.mkIf cfg.enable {
    services.udev.packages =
      lib.lists.optional (builtins.elem "st-link" cfg.mcu.cables) stlink-udev-rules ++
      lib.lists.optional (builtins.elem "tiva-c" cfg.mcu.cables) ti-udev-rules ++
      lib.lists.optional (builtins.elem "trezor" cfg.mcu.cables) trezor-udev-rules ++
      lib.lists.optional (builtins.elem "ise" cfg.fpga.cables) inputs.nix-fpga-tools.packages.${pkgs.system}.ise-udev-rules ++
      lib.lists.optional (builtins.elem "ise" cfg.fpga.cables) inputs.nix-fpga-tools.packages.${pkgs.system}.vivado-udev-rules;
  };
}

R modules/services/syncthing.nix => nixos/modules/profiles/sync.nix +47 -37
@@ 1,53 1,63 @@
{ config, ... }:
{ config, lib, ... }:

let
  user = config.nixos-config.defaultUser;
  homePath = config.home-manager.users.${user}.home.homeDirectory;
in {
  networking.firewall = {
    allowedTCPPorts = [ 22000 ];
    allowedUDPPorts = [ 22000 21027 ];

  options = {
    profiles.sync = {
      enable = lib.mkEnableOption "sync";
    };
  };

  services.syncthing = {
    enable = true;
    user = "${user}";
    dataDir = "/home/${user}";
    configDir = "/home/${user}/.config/syncthing";
    overrideDevices = true;
    overrideFolders = true;
    settings = {
  config = lib.mkIf config.profiles.sync.enable {

      devices = {
        phone = { id = "SRCBWOD-UBR76WT-ZB4OLV2-34U6TRL-YLVMSGQ-I5JYZP6-VD7XR6S-5732ZAZ"; };
        desktop = { id = "BVFWKZE-DWZTSJR-OHCLGY3-X2PU7F3-XMPMGEH-QONACL5-MMRJE5O-CHRY4Q5"; };
        laptop = { id = "3AGVM6S-RFTHVHR-OGK5RHI-YDEO6GN-RU4ZH77-VLBZAC7-JVHD6S6-VISXGQT"; };
      };
    networking.firewall = {
      allowedTCPPorts = [ 22000 ];
      allowedUDPPorts = [ 22000 21027 ];
    };

      folders = {
        "uni" = {
          path = "${homePath}/doc/uni";
          devices = [ "phone" "desktop" "laptop" ];
        };
        "notes" = {
          path = "${homePath}/doc/notes/obsidian/Notes";
          devices = [ "phone" "desktop" "laptop" ];
    services.syncthing = {
      enable = true;
      user = "${user}";
      dataDir = "${homePath}";
      configDir = "${homePath}/.config/syncthing";
      overrideDevices = true;
      overrideFolders = true;
      settings = {

        devices = {
          phone = { id = "SRCBWOD-UBR76WT-ZB4OLV2-34U6TRL-YLVMSGQ-I5JYZP6-VD7XR6S-5732ZAZ"; };
          desktop = { id = "BVFWKZE-DWZTSJR-OHCLGY3-X2PU7F3-XMPMGEH-QONACL5-MMRJE5O-CHRY4Q5"; };
          laptop = { id = "3AGVM6S-RFTHVHR-OGK5RHI-YDEO6GN-RU4ZH77-VLBZAC7-JVHD6S6-VISXGQT"; };
        };
        "camera" = {
          path = "${homePath}/doc/camera";
          devices = [ "phone" "desktop" "laptop" ];

        folders = {
          "uni" = {
            path = "${homePath}/doc/uni";
            devices = [ "phone" "desktop" "laptop" ];
          };
          "notes" = {
            path = "${homePath}/doc/notes/obsidian/Notes";
            devices = [ "phone" "desktop" "laptop" ];
          };
          "camera" = {
            path = "${homePath}/doc/camera";
            devices = [ "phone" "desktop" "laptop" ];
          };
          "study" = {
            path = "${homePath}/doc/study";
            devices = [ "phone" "desktop" "laptop" ];
          };
        };
        "study" = {
          path = "${homePath}/doc/study";
          devices = [ "phone" "desktop" "laptop" ];
        options = {
          natenabled = false;
          relaysEnabled = false;
          globalAnnounceEnabled = false;
          localAnnounceEnabled = true;
        };
      };
      options = {
        natenabled = false;
        relaysEnabled = false;
        globalAnnounceEnabled = false;
        localAnnounceEnabled = true;
      };
    };
  };
}

R modules/desktop/virtualisation/qemu.nix => nixos/modules/profiles/virtualisation.nix +71 -40
@@ 1,50 1,81 @@
#
# Qemu/KVM with virt-manager
#

{ config, pkgs, ... }:

{
  users.groups.libvirtd.members = [ "root" config.nixos-config.defaultUser ];
  users.groups.kvm.members = [ "root" config.nixos-config.defaultUser ];

  virtualisation = {
    libvirtd = {
      enable = true;
      qemu = {
        ovmf.enable = true;
        ovmf.packages = [ pkgs.OVMFFull.fd ];
        verbatimConfig = ''
         nvram = [ "${pkgs.OVMF}/FV/OVMF.fd:${pkgs.OVMF}/FV/OVMF_VARS.fd" ]
        '';
        swtpm.enable = true;
{ config, lib, pkgs, ... }:

let
  cfg = config.profiles.virtualisation;
in {
  options = {
    profiles.virtualisation = {
      enable = lib.mkEnableOption "virtualisation";

      qemu.enable = lib.mkOption {
        type = lib.types.bool;
        default = true;
      };
      podman.enable = lib.mkOption {
        type = lib.types.bool;
        default = true;
      };
    };
    spiceUSBRedirection.enable = true;        # USB passthrough
  };

  environment = {
    etc = {
      "ovmf/edk2-x86_64-secure-code.fd" = {
        source = config.virtualisation.libvirtd.qemu.package + "/share/qemu/edk2-x86_64-secure-code.fd";
  config = lib.mkIf cfg.enable (lib.mkMerge [
    (lib.mkIf cfg.podman.enable {
      users.groups.podman.members = [ config.nixos-config.defaultUser ];

      virtualisation.podman = {
        enable = true;
        dockerCompat = true;
        defaultNetwork.settings.dns_enabled = true;
      };

      "ovmf/edk2-i386-vars.fd" = {
        source = config.virtualisation.libvirtd.qemu.package + "/share/qemu/edk2-i386-vars.fd";
      environment.systemPackages = with pkgs; [
        podman-compose
      ];
    })
    (lib.mkIf cfg.qemu.enable {
      users.groups.libvirtd.members = [ "root" config.nixos-config.defaultUser ];
      users.groups.kvm.members = [ "root" config.nixos-config.defaultUser ];

      virtualisation = {
        libvirtd = {
          enable = true;
          qemu = {
            ovmf.enable = true;
            ovmf.packages = [ pkgs.OVMFFull.fd ];
            verbatimConfig = ''
              nvram = [ "${pkgs.OVMF}/FV/OVMF.fd:${pkgs.OVMF}/FV/OVMF_VARS.fd" ]
            '';
            swtpm.enable = true;
          };
        };
        spiceUSBRedirection.enable = true;        # USB passthrough
      };
    };

    systemPackages = with pkgs; [
      virt-manager
      virt-viewer
      qemu
      OVMF
      gvfs # Used for shared folders between Linux and Windows
      swtpm
    ];
  };
      environment = {
        etc = {
          "ovmf/edk2-x86_64-secure-code.fd" = {
            source = config.virtualisation.libvirtd.qemu.package + "/share/qemu/edk2-x86_64-secure-code.fd";
          };

          "ovmf/edk2-i386-vars.fd" = {
            source = config.virtualisation.libvirtd.qemu.package + "/share/qemu/edk2-i386-vars.fd";
          };
        };

        systemPackages = with pkgs; [
          virt-manager
          virt-viewer
          qemu
          OVMF
          gvfs # Used for shared folders between Linux and Windows
          swtpm
        ];
      };

      services = { # Enable file sharing between OS
      gvfs.enable = true;
      };
    })
  ]);

  services = { # Enable file sharing between OS
    gvfs.enable = true;
  };
}

R modules/services/wireguard.nix => nixos/modules/profiles/vpn.nix +49 -32
@@ 1,48 1,65 @@
{ config, ... }:
{ config, lib, ... }:

{
  imports = [
    ./wg-options.nix
  ];
  options = {
    profiles.vpn = {
      enable = lib.mkEnableOption "vpn";
      lanIp = lib.mkOption {
        type = lib.types.str;
      };

  networking.firewall = {
    allowedUDPPorts = [ 51820 ];
      server = lib.mkOption {
        type = lib.types.str;
        default = "78.46.201.50:51820";
      };

      serverLanIp = lib.mkOption {
        type = lib.types.str;
        default = "192.168.32.0/24";
      };
    };
  };

  networking = {
    nameservers = [
      "1.1.1.1"
      "1.0.0.1"
    ];
  config = lib.mkIf config.profiles.vpn.enable {
    networking.firewall = {
      allowedUDPPorts = [ 51820 ];
    };

    # disable auto resolving
    dhcpcd.extraConfig = "nohook resolv.conf";
    networkmanager.dns = "none";
  };
    networking = {
      nameservers = [
        "1.1.1.1"
        "1.0.0.1"
      ];

  networking.resolvconf.extraOptions = [
    "timeout: 2"
  ];
      # disable auto resolving
      dhcpcd.extraConfig = "nohook resolv.conf";
      networkmanager.dns = "none";
    };

  networking.wireguard.interfaces = {
    wg0 = {
      ips = [ "${config.wg.ip}/32" ];
      listenPort = 51820;
    networking.resolvconf.extraOptions = [
      "timeout: 2"
    ];

      generatePrivateKeyFile = true;
      privateKeyFile = "/etc/wireguard/pk.pem";
    networking.wireguard.interfaces = {
      wg0 = {
        ips = [ "${config.profiles.vpn.lanIp}/32" ];
        listenPort = 51820;

      peers = [
        {
          publicKey = "ZOVjmgUak67kLhNVgZwyb0bro3Yi4vCJbGArv+35IWQ=";
          endpoint = "78.46.201.50:51820";
        generatePrivateKeyFile = true;
        privateKeyFile = "/etc/wireguard/pk.pem";

        peers = [
          {
            publicKey = "ZOVjmgUak67kLhNVgZwyb0bro3Yi4vCJbGArv+35IWQ=";
            endpoint = config.profiles.vpn.server;

            # The ip is not refreshed, as the kernel cannot perform DNS resolution. Use dynamicEndpointRefreshSeconds,
            # in case the ip is refreshed often. If not, sync after refresh should be alright.
          allowedIPs = [ "192.168.32.0/24" ];
          persistentKeepalive = 25;
        }
      ];
            allowedIPs = [ config.profiles.vpn.serverLanIp ];
            persistentKeepalive = 25;
          }
        ];
      };
    };
  };
}

R modules/themes/colors.nix => themes/colors.nix +0 -0
Do not follow this link