aboutsummaryrefslogtreecommitdiff
path: root/nixos/home.nix
blob: 6271724509951bb65fea9e6786dbf3949458c84c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
{ config, pkgs, username, terminalworkspace, opt, ... }:
{
  users.users.${username} = {
    isNormalUser = true;
    description = "User";
    extraGroups = [ "networkmanager" "wheel" "kvm" "adbusers" "docker" ];
    packages = with pkgs; [];
    shell = pkgs.fish;
  };
  virtualisation.docker.enable = true;
  programs.adb.enable = true;
  programs.fish = {
    enable = true;
    shellInit = ''
function fish_prompt -d "Write out the prompt"
    # This shows up as USER@HOST /home/user/ >, with the directory colored
    # $USER and $hostname are set by fish, so you can just use them
    # instead of using `whoami` and `hostname`
    printf '%s@%s %s%s%s > ' $USER $hostname \
        (set_color $fish_color_cwd) (prompt_pwd) (set_color normal)
end
'' + (if terminalworkspace.tmux then ''
if status is-interactive
    set fish_greeting

    if not set -q TMUX
        tmux new-session -d -s "main" -c "~/dev"
        if not set -q VSCODE_PID
            tmux -u a
        end
    end
end
'' else '''') + (if terminalworkspace.zellij then ''
if status is-interactive
    set fish_greeting

    if status is-interactive
    set fish_greeting

    if not set -q ZELLIJ
        if not set -q VSCODE_PID
            cd ~/dev
            zellij attach --create main
        end
    end
end
end
'' else '''') + ''
zoxide init --cmd cd fish | source
starship init fish | source
if test -f ~/.cache/ags/user/generated/terminal/sequences.txt
    cat ~/.cache/ags/user/generated/terminal/sequences.txt
end

function mkcd
    mkdir -p $argv[1]
    cd $argv[1]
end

if not set -q SSH_AUTH_SOCK
    set agents /tmp/ssh-*/agent.*
    if test (count $agents) -gt 0
        set -x SSH_AUTH_SOCK $agents[1]
    end
end

if not set -q SSH_AUTH_SOCK
    ssh-agent -c | source
end

function run_sshagent
  ssh-add ~/.ssh/id_ed25519
end
'';
    shellAliases = {
      py="python";
      tmux="tmux -u";
      snvim="sudo -E -s nvim";
      ls="eza -hli";
      cat="bat";
      find="fd";
      cloc="tokei";
      scrcpy="scrcpy --render-driver=opengl";
      wisdom="fortune ~/.config/fortune/showerthoughts | cowsay | lolcat";
      search="rg --color=always --line-number --no-heading \"\" | fzf --ansi --phony --query \"\" --bind \"change:reload(rg --color=always --line-number --no-heading {q} || true)\"";
    } // (if opt.vm then {
      vm = ''
        if test "$(virsh --connect qemu:///system domstate ubuntu25.10)" != "running"
          virsh --connect qemu:///system start ubuntu25.10
          sleep 5
        end

        ssh vm@192.168.122.232
      '';
      vmstop = "virsh --connect qemu:///system shutdown ubuntu25.10";
    } else {});
  };
  environment.systemPackages = with pkgs; [
    nushell
    home-manager
  ];
}