mirror of
				https://github.com/nmasur/dotfiles
				synced 2025-11-04 10:33:16 +00:00 
			
		
		
		
	Compare commits
	
		
			9 Commits
		
	
	
		
			cf19085158
			...
			eblume-mol
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					068cdbf5d4 | ||
| 
						 | 
					c86188d734 | ||
| 
						 | 
					f1cdd4ae98 | ||
| 
						 | 
					332921edd3 | ||
| 
						 | 
					cc69cbaa6c | ||
| 
						 | 
					d165428a37 | ||
| 
						 | 
					3e7955533e | ||
| 
						 | 
					0b9886f93e | ||
| 
						 | 
					2f39eb2ceb | 
@@ -34,6 +34,7 @@ inputs.darwin.lib.darwinSystem {
 | 
			
		||||
        dark = true;
 | 
			
		||||
      };
 | 
			
		||||
      mail.user = globals.user;
 | 
			
		||||
      mole.enable = true;
 | 
			
		||||
      atuin.enable = true;
 | 
			
		||||
      charm.enable = true;
 | 
			
		||||
      neovim.enable = true;
 | 
			
		||||
 
 | 
			
		||||
@@ -112,6 +112,7 @@ inputs.nixpkgs.lib.nixosSystem {
 | 
			
		||||
      mullvad.enable = false;
 | 
			
		||||
      rust.enable = true;
 | 
			
		||||
      terraform.enable = true;
 | 
			
		||||
      wezterm.enable = true;
 | 
			
		||||
      yt-dlp.enable = true;
 | 
			
		||||
      gaming = {
 | 
			
		||||
        dwarf-fortress.enable = true;
 | 
			
		||||
 
 | 
			
		||||
@@ -8,6 +8,7 @@
 | 
			
		||||
    ./firefox.nix
 | 
			
		||||
    ./kitty.nix
 | 
			
		||||
    ./media.nix
 | 
			
		||||
    ./mole.nix
 | 
			
		||||
    ./obsidian.nix
 | 
			
		||||
    ./qbittorrent.nix
 | 
			
		||||
    ./slack.nix
 | 
			
		||||
 
 | 
			
		||||
@@ -159,11 +159,15 @@
 | 
			
		||||
 | 
			
		||||
      xdg.mimeApps = {
 | 
			
		||||
        associations.added = {
 | 
			
		||||
          "text.html" = [ "firefox.desktop" ];
 | 
			
		||||
          "text/html" = [ "firefox.desktop" ];
 | 
			
		||||
        };
 | 
			
		||||
        defaultApplications = {
 | 
			
		||||
          "text.html" = [ "firefox.desktop" ];
 | 
			
		||||
          "text/html" = [ "firefox.desktop" ];
 | 
			
		||||
        };
 | 
			
		||||
        associations.removed = {
 | 
			
		||||
          "text/html" = [ "wine-extension-htm.desktop" ];
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
      xsession.windowManager.i3.config.keybindings = lib.mkIf pkgs.stdenv.isLinux {
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,7 @@
 | 
			
		||||
    environment =
 | 
			
		||||
      { }
 | 
			
		||||
      // lib.attrsets.optionalAttrs (builtins.hasAttr "sessionVariables" config.environment) {
 | 
			
		||||
        sessionVariables.ROFI_SYSTEMD_TERM = "${pkgs.kitty}/bin/kitty";
 | 
			
		||||
        sessionVariables.ROFI_SYSTEMD_TERM = lib.mkDefault "${pkgs.kitty}/bin/kitty";
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
    home-manager.users.${config.user} = {
 | 
			
		||||
@@ -31,7 +31,7 @@
 | 
			
		||||
      xsession.windowManager.i3.config.terminal = lib.mkIf pkgs.stdenv.isLinux "kitty";
 | 
			
		||||
 | 
			
		||||
      # Set the Rofi terminal for running programs
 | 
			
		||||
      programs.rofi.terminal = lib.mkIf pkgs.stdenv.isLinux "${pkgs.kitty}/bin/kitty";
 | 
			
		||||
      programs.rofi.terminal = lib.mkIf pkgs.stdenv.isLinux (lib.mkDefault "${pkgs.kitty}/bin/kitty");
 | 
			
		||||
 | 
			
		||||
      # Display images in the terminal
 | 
			
		||||
      programs.fish.shellAliases = {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										110
									
								
								modules/common/applications/mole.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										110
									
								
								modules/common/applications/mole.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,110 @@
 | 
			
		||||
{
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
 | 
			
		||||
let
 | 
			
		||||
 | 
			
		||||
  # Build kdl-py
 | 
			
		||||
  kdl-py = pkgs.python311.pkgs.buildPythonPackage rec {
 | 
			
		||||
    pname = "kdl-py";
 | 
			
		||||
    version = "1.2.0";
 | 
			
		||||
    pyproject = true;
 | 
			
		||||
    src = pkgs.fetchPypi {
 | 
			
		||||
      inherit pname version;
 | 
			
		||||
      hash = "sha256-Y/P0bGJ33trc5E3PyUZyv25r8zMLkBIuATTCKFfimXM=";
 | 
			
		||||
    };
 | 
			
		||||
    build-system = [ pkgs.python311.pkgs.setuptools ];
 | 
			
		||||
    # has no tests
 | 
			
		||||
    doCheck = false;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  mole = pkgs.python311.pkgs.buildPythonPackage rec {
 | 
			
		||||
    pname = "mole";
 | 
			
		||||
    version = "0.7.1";
 | 
			
		||||
    pyproject = true;
 | 
			
		||||
 | 
			
		||||
    src = pkgs.fetchFromGitHub {
 | 
			
		||||
      owner = "eblume";
 | 
			
		||||
      repo = pname;
 | 
			
		||||
      rev = "30bb052a97050b1fa89c287855d834f7952b195a";
 | 
			
		||||
      sha256 = "sha256-DUWsfyICCfFQ2ZQBYSQVoA3eLdKC8djUylKgGdHIyJo=";
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    patches = [
 | 
			
		||||
      (builtins.toString (
 | 
			
		||||
        pkgs.writeText "pyproject.toml.patch" ''
 | 
			
		||||
          diff --git a/pyproject.toml b/pyproject.toml
 | 
			
		||||
          index 12ce0f5..787e978 100644
 | 
			
		||||
          --- a/pyproject.toml
 | 
			
		||||
          +++ b/pyproject.toml
 | 
			
		||||
          @@ -12,11 +12,11 @@ packages = [
 | 
			
		||||
           [tool.poetry.dependencies]
 | 
			
		||||
           python = "^3.11"
 | 
			
		||||
           # Now back to the regular dependencies
 | 
			
		||||
          -typer = {extras = ["all"], version = "^0.9"}
 | 
			
		||||
          +typer = {extras = ["all"], version = "^0.12"}
 | 
			
		||||
           todoist-api-python = "^2.1.3"
 | 
			
		||||
           openai = "^1.2.4"
 | 
			
		||||
           rich = "^13.4.2"
 | 
			
		||||
          -watchdog = "^3.0.0"
 | 
			
		||||
          +watchdog = "^4.0.0"
 | 
			
		||||
           pydub = "^0.25.1"
 | 
			
		||||
           requests = "^2.31.0"
 | 
			
		||||
           pyyaml = "^6.0.1"
 | 
			
		||||
        ''
 | 
			
		||||
      ))
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    # Used during build time
 | 
			
		||||
    nativeBuildInputs = [ pkgs.python311Packages.poetry-core ];
 | 
			
		||||
 | 
			
		||||
    # Used during run time
 | 
			
		||||
    buildInputs = [
 | 
			
		||||
      pkgs._1password
 | 
			
		||||
      pkgs.nb-cli
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    # Both build and run time
 | 
			
		||||
    propagatedBuildInputs = [
 | 
			
		||||
      pkgs.python311Packages.typer
 | 
			
		||||
      pkgs.python311Packages.todoist-api-python
 | 
			
		||||
      pkgs.python311Packages.openai
 | 
			
		||||
      pkgs.python311Packages.rich
 | 
			
		||||
      pkgs.python311Packages.watchdog
 | 
			
		||||
      pkgs.python311Packages.pydub
 | 
			
		||||
      pkgs.python311Packages.requests
 | 
			
		||||
      pkgs.python311Packages.pyyaml
 | 
			
		||||
      pkgs.python311Packages.pydantic
 | 
			
		||||
      pkgs.python311Packages.pendulum
 | 
			
		||||
      kdl-py
 | 
			
		||||
      pkgs.ffmpeg
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    build-system = [ pkgs.python311.pkgs.setuptools ];
 | 
			
		||||
 | 
			
		||||
    # has no tests
 | 
			
		||||
    doCheck = false;
 | 
			
		||||
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
in
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
  options = {
 | 
			
		||||
    mole = {
 | 
			
		||||
      enable = lib.mkEnableOption {
 | 
			
		||||
        description = "Enable Mole.";
 | 
			
		||||
        default = false;
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  config = lib.mkIf config.mole.enable {
 | 
			
		||||
    home-manager.users.${config.user} = {
 | 
			
		||||
      home.packages = [ mole ];
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
@@ -15,7 +15,11 @@
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  config = lib.mkIf (config.gui.enable && config.wezterm.enable) {
 | 
			
		||||
  config =
 | 
			
		||||
    let
 | 
			
		||||
      font = config.home-manager.users.${config.user}.programs.kitty.font.name;
 | 
			
		||||
    in
 | 
			
		||||
    lib.mkIf (config.gui.enable && config.wezterm.enable) {
 | 
			
		||||
 | 
			
		||||
      # Set the Rofi-Systemd terminal for viewing logs
 | 
			
		||||
      # Using optionalAttrs because only available in NixOS
 | 
			
		||||
@@ -106,19 +110,20 @@
 | 
			
		||||
 | 
			
		||||
                -- Window
 | 
			
		||||
                window_padding = {
 | 
			
		||||
                left = 6,
 | 
			
		||||
                right = 6,
 | 
			
		||||
                top = 0,
 | 
			
		||||
                bottom = 0,
 | 
			
		||||
                  left = 10,
 | 
			
		||||
                  right = 10,
 | 
			
		||||
                  top = 10,
 | 
			
		||||
                  bottom = 10,
 | 
			
		||||
                },
 | 
			
		||||
 | 
			
		||||
              font = wezterm.font 'VictorMono Nerd Font',
 | 
			
		||||
              font_size = 18.0,
 | 
			
		||||
                font = wezterm.font('${font}', { weight = 'Bold'}),
 | 
			
		||||
                font_size = ${if pkgs.stdenv.isLinux then "14.0" else "18.0"},
 | 
			
		||||
 | 
			
		||||
                -- Tab Bar
 | 
			
		||||
                hide_tab_bar_if_only_one_tab = true,
 | 
			
		||||
                window_frame = {
 | 
			
		||||
                font = wezterm.font 'VictorMono Nerd Font',
 | 
			
		||||
                font_size = 16.0,
 | 
			
		||||
                  font = wezterm.font('${font}', { weight = 'Bold'}),
 | 
			
		||||
                  font_size = ${if pkgs.stdenv.isLinux then "12.0" else "16.0"},
 | 
			
		||||
                },
 | 
			
		||||
 | 
			
		||||
                colors = {
 | 
			
		||||
 
 | 
			
		||||
@@ -158,7 +158,11 @@
 | 
			
		||||
          };
 | 
			
		||||
        };
 | 
			
		||||
        extraConfig = {
 | 
			
		||||
          general.unsafe-accounts-conf = true;
 | 
			
		||||
          general = {
 | 
			
		||||
            unsafe-accounts-conf = true;
 | 
			
		||||
            # log-file = "~/.cache/aerc.log";
 | 
			
		||||
            # log-level = "debug";
 | 
			
		||||
          };
 | 
			
		||||
          viewer = {
 | 
			
		||||
            pager = "${pkgs.less}/bin/less -R";
 | 
			
		||||
          };
 | 
			
		||||
 
 | 
			
		||||
@@ -41,7 +41,7 @@ local function worklayout()
 | 
			
		||||
        local u = hs.geometry.unitrect
 | 
			
		||||
        -- set the layout
 | 
			
		||||
        local left = {
 | 
			
		||||
            { "kitty", nil, WORK_ONLY_MONITOR, u(0, 0, 1 / 2, 1), nil, nil, visible = true },
 | 
			
		||||
            { "WezTerm", nil, WORK_ONLY_MONITOR, u(0, 0, 1 / 2, 1), nil, nil, visible = true },
 | 
			
		||||
        }
 | 
			
		||||
        local right = {
 | 
			
		||||
            { "Slack", nil, WORK_ONLY_MONITOR, u(1 / 2, 0, 1 / 2, 1), nil, nil, visible = true },
 | 
			
		||||
 
 | 
			
		||||
@@ -19,10 +19,9 @@
 | 
			
		||||
  options.gaming.enable = lib.mkEnableOption "Enable gaming features.";
 | 
			
		||||
 | 
			
		||||
  config = lib.mkIf (config.gaming.enable && pkgs.stdenv.isLinux) {
 | 
			
		||||
    hardware.opengl = {
 | 
			
		||||
    hardware.graphics = {
 | 
			
		||||
      enable = true;
 | 
			
		||||
      driSupport = true;
 | 
			
		||||
      driSupport32Bit = true;
 | 
			
		||||
      enable32Bit = true;
 | 
			
		||||
    };
 | 
			
		||||
    programs.gamemode.enable = true;
 | 
			
		||||
  };
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,7 @@ let
 | 
			
		||||
 | 
			
		||||
  lockCmd = "${pkgs.betterlockscreen}/bin/betterlockscreen --lock --display 1 --blur 0.5 --span";
 | 
			
		||||
  lockUpdate = "${pkgs.betterlockscreen}/bin/betterlockscreen --update ${config.wallpaper} --display 1 --span";
 | 
			
		||||
  terminal = "wezterm";
 | 
			
		||||
in
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
@@ -47,9 +48,10 @@ in
 | 
			
		||||
            assigns = {
 | 
			
		||||
              "${ws1}" = [ { class = "Firefox"; } ];
 | 
			
		||||
              "${ws2}" = [
 | 
			
		||||
                { class = "kitty"; }
 | 
			
		||||
                { class = "aerc"; }
 | 
			
		||||
                { class = "kitty"; }
 | 
			
		||||
                { class = "obsidian"; }
 | 
			
		||||
                { class = "wezterm"; }
 | 
			
		||||
              ];
 | 
			
		||||
              "${ws3}" = [ { class = "discord"; } ];
 | 
			
		||||
              "${ws4}" = [
 | 
			
		||||
@@ -126,7 +128,9 @@ in
 | 
			
		||||
              "XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
 | 
			
		||||
 | 
			
		||||
              # Launchers
 | 
			
		||||
              "${modifier}+Return" = "exec --no-startup-id kitty; workspace ${ws2}; layout tabbed";
 | 
			
		||||
              "${modifier}+Return" = "exec --no-startup-id ${
 | 
			
		||||
                config.home-manager.users.${config.user}.programs.rofi.terminal
 | 
			
		||||
              }; workspace ${ws2}; layout tabbed";
 | 
			
		||||
              "${modifier}+space" = "exec --no-startup-id ${config.launcherCommand}";
 | 
			
		||||
              "${modifier}+Shift+s" = "exec --no-startup-id ${config.systemdSearch}";
 | 
			
		||||
              "${modifier}+Shift+a" = "exec --no-startup-id ${config.audioSwitchCommand}";
 | 
			
		||||
@@ -138,8 +142,12 @@ in
 | 
			
		||||
              "${modifier}+Shift+r" = "restart";
 | 
			
		||||
              "${modifier}+Shift+q" = ''exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"'';
 | 
			
		||||
              "${modifier}+Shift+x" = "exec ${lockCmd}";
 | 
			
		||||
              "${modifier}+Mod1+h" = "exec --no-startup-id kitty sh -c '${pkgs.home-manager}/bin/home-manager switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
 | 
			
		||||
              "${modifier}+Mod1+r" = "exec --no-startup-id kitty sh -c 'doas nixos-rebuild switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
 | 
			
		||||
              "${modifier}+Mod1+h" = "exec --no-startup-id ${
 | 
			
		||||
                config.home-manager.users.${config.user}.programs.rofi.terminal
 | 
			
		||||
              } -e sh -c '${pkgs.home-manager}/bin/home-manager switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
 | 
			
		||||
              "${modifier}+Mod1+r" = "exec --no-startup-id ${
 | 
			
		||||
                config.home-manager.users.${config.user}.programs.rofi.terminal
 | 
			
		||||
              } -e sh -c 'doas nixos-rebuild switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
 | 
			
		||||
 | 
			
		||||
              # Window options
 | 
			
		||||
              "${modifier}+q" = "kill";
 | 
			
		||||
 
 | 
			
		||||
@@ -18,9 +18,6 @@ in
 | 
			
		||||
 | 
			
		||||
  config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) {
 | 
			
		||||
 | 
			
		||||
    # Set the Rofi-Systemd terminal for viewing logs
 | 
			
		||||
    environment.sessionVariables.ROFI_SYSTEMD_TERM = lib.mkIf config.kitty.enable "${pkgs.kitty}/bin/kitty";
 | 
			
		||||
 | 
			
		||||
    home-manager.users.${config.user} = {
 | 
			
		||||
 | 
			
		||||
      home.packages = with pkgs; [
 | 
			
		||||
 
 | 
			
		||||
@@ -54,9 +54,8 @@
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    # Enable VA-API for hardware transcoding
 | 
			
		||||
    hardware.opengl = {
 | 
			
		||||
    hardware.graphics = {
 | 
			
		||||
      enable = true;
 | 
			
		||||
      driSupport = true;
 | 
			
		||||
      extraPackages = [ pkgs.libva ];
 | 
			
		||||
    };
 | 
			
		||||
    environment.systemPackages = [ pkgs.libva-utils ];
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ let
 | 
			
		||||
 | 
			
		||||
  username = "prometheus";
 | 
			
		||||
 | 
			
		||||
  prometheusConfig = (pkgs.formats.yaml { }).generate "prometheus.yml" {
 | 
			
		||||
  prometheusConfig = {
 | 
			
		||||
    scrape_configs = [
 | 
			
		||||
      {
 | 
			
		||||
        job_name = config.networking.hostName;
 | 
			
		||||
@@ -38,8 +38,6 @@ in
 | 
			
		||||
 | 
			
		||||
  config = {
 | 
			
		||||
 | 
			
		||||
    services.victoriametrics.extraOptions = [ "-promscrape.config=${prometheusConfig}" ];
 | 
			
		||||
 | 
			
		||||
    systemd.services.vmauth = lib.mkIf config.services.victoriametrics.enable {
 | 
			
		||||
      description = "VictoriaMetrics basic auth proxy";
 | 
			
		||||
      after = [ "network.target" ];
 | 
			
		||||
@@ -85,21 +83,18 @@ in
 | 
			
		||||
 | 
			
		||||
    # VMAgent
 | 
			
		||||
 | 
			
		||||
    services.vmagent.prometheusConfig = prometheusConfig; # Overwritten below
 | 
			
		||||
    systemd.services.vmagent.serviceConfig = lib.mkIf config.services.vmagent.enable {
 | 
			
		||||
      ExecStart = lib.mkForce ''
 | 
			
		||||
        ${pkgs.victoriametrics}/bin/vmagent \
 | 
			
		||||
                -promscrape.config=${prometheusConfig} \
 | 
			
		||||
                -remoteWrite.url="https://${config.hostnames.prometheus}/api/v1/write" \
 | 
			
		||||
                -remoteWrite.basicAuth.username=${username} \
 | 
			
		||||
                -remoteWrite.basicAuth.passwordFile=${config.secrets.vmagent.dest}'';
 | 
			
		||||
    services.vmagent = {
 | 
			
		||||
      prometheusConfig = prometheusConfig;
 | 
			
		||||
      remoteWrite = {
 | 
			
		||||
        url = "https://${config.hostnames.prometheus}/api/v1/write";
 | 
			
		||||
        basicAuthUsername = username;
 | 
			
		||||
        basicAuthPasswordFile = config.secrets.vmagent.dest;
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    secrets.vmagent = lib.mkIf config.services.vmagent.enable {
 | 
			
		||||
      source = ../../../private/prometheus.age;
 | 
			
		||||
      dest = "${config.secretsDirectory}/vmagent";
 | 
			
		||||
      owner = "vmagent";
 | 
			
		||||
      group = "vmagent";
 | 
			
		||||
    };
 | 
			
		||||
    systemd.services.vmagent-secret = lib.mkIf config.services.vmagent.enable {
 | 
			
		||||
      requiredBy = [ "vmagent.service" ];
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user