starting with Chrome/ Chromium only by copying command from https://github.com/FiloSottile/captive-browser/
		
			
				
	
	
		
			178 lines
		
	
	
	
		
			4.5 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			178 lines
		
	
	
	
		
			4.5 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
{
 | 
						|
  pkgs,
 | 
						|
  inputs,
 | 
						|
  config,
 | 
						|
  system,
 | 
						|
  lib,
 | 
						|
  ...
 | 
						|
}:
 | 
						|
{
 | 
						|
  imports = [
 | 
						|
    ./modules/packages.nix
 | 
						|
    ./modules/vscodium.nix
 | 
						|
    ./modules/fonts.nix
 | 
						|
    ./modules/captive-browser.nix
 | 
						|
  ];
 | 
						|
  home.homeDirectory =
 | 
						|
    if pkgs.stdenv.isDarwin then "/Users/${config.home.username}" else "/home/${config.home.username}";
 | 
						|
  programs.home-manager.enable = true;
 | 
						|
 | 
						|
  programs.bat.enable = true;
 | 
						|
  programs.direnv = {
 | 
						|
    enable = true;
 | 
						|
    nix-direnv.enable = true;
 | 
						|
    enableZshIntegration = true;
 | 
						|
  };
 | 
						|
 | 
						|
  programs.tmux = {
 | 
						|
    enable = true;
 | 
						|
    keyMode = "vi";
 | 
						|
    extraConfig =
 | 
						|
      # for direnv not messing up the environment
 | 
						|
      ''
 | 
						|
        set-option -g update-environment "DIRENV_DIFF DIRENV_DIR DIRENV_WATCHES"
 | 
						|
                  set-environment -gu DIRENV_DIFF
 | 
						|
                  set-environment -gu DIRENV_DIR
 | 
						|
                  set-environment -gu DIRENV_WATCHES
 | 
						|
                  set-environment -gu DIRENV_LAYOUT
 | 
						|
                
 | 
						|
                  bind-key -T copy-mode-vi 'v' send -X begin-selection
 | 
						|
                  bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel'';
 | 
						|
    terminal = "screen-256color";
 | 
						|
  };
 | 
						|
 | 
						|
  programs.git = {
 | 
						|
    enable = true;
 | 
						|
    extraConfig = {
 | 
						|
      credential.helper = "cache";
 | 
						|
      push.default = "simple";
 | 
						|
      push.forceIfIncludes = true; # avoid accidental force overrides when remote is autofetched in background
 | 
						|
      init.defaultBranch = "mainline";
 | 
						|
      diff.tool = "vimdiff";
 | 
						|
      merge.tool = "vimdiff";
 | 
						|
      # provide `git mergetool -t nixfmt`
 | 
						|
      mergetool.nixfmt = {
 | 
						|
        cmd = "${lib.getExe pkgs.nixfmt-rfc-style} --mergetool \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"";
 | 
						|
        trustExitCode = true;
 | 
						|
      };
 | 
						|
      core.excludesfile = toString (
 | 
						|
        pkgs.writeText ".gitignore_global" ''
 | 
						|
          # Direnv stuff #
 | 
						|
          ################
 | 
						|
          .direnv
 | 
						|
          .envrc
 | 
						|
          # Editor files #
 | 
						|
          ################
 | 
						|
          *~
 | 
						|
          *.swp
 | 
						|
          *.swo
 | 
						|
          # macOS foo #
 | 
						|
          #############
 | 
						|
          .DS_Store
 | 
						|
        ''
 | 
						|
      );
 | 
						|
      core.whitespace = "-blank-at-eol,blank-at-eof,space-before-tab";
 | 
						|
      rerere.enabled = true;
 | 
						|
    };
 | 
						|
    lfs.enable = true;
 | 
						|
    delta = {
 | 
						|
      enable = true;
 | 
						|
      options = {
 | 
						|
        line-numbers = true;
 | 
						|
        side-by-side = true;
 | 
						|
        #dark = true;
 | 
						|
      };
 | 
						|
    };
 | 
						|
  };
 | 
						|
  programs.lazygit = {
 | 
						|
    enable = true;
 | 
						|
    settings = {
 | 
						|
      git = {
 | 
						|
        autoFetch = false;
 | 
						|
        mainBranches = [
 | 
						|
          "main"
 | 
						|
          "master"
 | 
						|
          "mainline"
 | 
						|
        ];
 | 
						|
      };
 | 
						|
      update.method = "never";
 | 
						|
    };
 | 
						|
  };
 | 
						|
 | 
						|
  # shell config
 | 
						|
  programs.zsh = {
 | 
						|
    enable = true;
 | 
						|
    syntaxHighlighting.enable = true;
 | 
						|
    history.ignoreSpace = true;
 | 
						|
    initContent = ''
 | 
						|
      # Uncomment following line if you want red dots to be displayed while waiting for completion
 | 
						|
      COMPLETION_WAITING_DOTS="true"
 | 
						|
      ### Fix slowness of pastes with zsh-syntax-highlighting.zsh
 | 
						|
      pasteinit() {
 | 
						|
        OLD_SELF_INSERT=''${''${(s.:.)widgets[self-insert]}[2,3]}
 | 
						|
        zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
 | 
						|
      }
 | 
						|
 | 
						|
      pastefinish() {
 | 
						|
        zle -N self-insert $OLD_SELF_INSERT
 | 
						|
      }
 | 
						|
      zstyle :bracketed-paste-magic paste-init pasteinit
 | 
						|
      zstyle :bracketed-paste-magic paste-finish pastefinish
 | 
						|
 | 
						|
      # automatic rehash of path completion
 | 
						|
      zstyle ':completion:*' rehash true
 | 
						|
 | 
						|
      eval "$(${pkgs.thefuck}/bin/thefuck --alias)"
 | 
						|
 | 
						|
      ##  helper functions
 | 
						|
      nixify() {
 | 
						|
        if [ ! -e ./.envrc ]; then
 | 
						|
          echo "eval \"$(lorri direnv)\"" > .envrc
 | 
						|
          direnv allow
 | 
						|
        fi
 | 
						|
        if [ ! -e shell.nix ]; then
 | 
						|
          cat > shell.nix <<'EOF'
 | 
						|
      with import <nixpkgs> {};
 | 
						|
      mkShell {
 | 
						|
        buildInputs = [
 | 
						|
          bashInteractive
 | 
						|
        ];
 | 
						|
      }
 | 
						|
      EOF
 | 
						|
          ${"EDITOR:-vim"} default.nix
 | 
						|
        fi
 | 
						|
      }
 | 
						|
 | 
						|
      binpath() {
 | 
						|
        realpath $(${pkgs.which}/bin/which $1)
 | 
						|
      }
 | 
						|
    '';
 | 
						|
 | 
						|
    oh-my-zsh = {
 | 
						|
      enable = true;
 | 
						|
      theme = "bira";
 | 
						|
      plugins = [
 | 
						|
        "git"
 | 
						|
        "python"
 | 
						|
        "systemd"
 | 
						|
        "gpg-agent"
 | 
						|
      ];
 | 
						|
    };
 | 
						|
  };
 | 
						|
  home.shellAliases = {
 | 
						|
    ip = "ip --color";
 | 
						|
    ipb = "ip --color --brief";
 | 
						|
    ll = "ls -l";
 | 
						|
    wavesynth = "nix-shell -p sox --run 'play -n synth brownnoise synth pinknoise mix synth 0 0 0 15 40 80 trapezium amod 0.2 20'";
 | 
						|
    vim = "nvim";
 | 
						|
  };
 | 
						|
  home.sessionVariables = {
 | 
						|
    EDITOR = "nvim";
 | 
						|
  };
 | 
						|
 | 
						|
  home.activation.reportChanges = config.lib.dag.entryAnywhere ''
 | 
						|
    if [[ -v oldGenPath ]]; then
 | 
						|
      run nix store diff-closures $oldGenPath $newGenPath
 | 
						|
    fi
 | 
						|
  '';
 | 
						|
}
 |