aboutsummaryrefslogtreecommitdiffstats
path: root/home/default.nix
blob: 61f4e1327855537f8454b4ca577319fc8cee4ede (plain) (blame)
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
{
  inputs,
  config,
  vars,
  pkgs,
  ...
}:
let
  unstable = import inputs.nixpkgs-unstable {
    system = pkgs.stdenv.hostPlatform.system;
    config.allowUnfree = true;
  };
in
{
  imports = [
    # ./quickshell
    (import ./nvim { inherit unstable; })
    ./bt.nix
    ./cargo.nix
    ./chromium.nix
    ./dav
    ./dunst.nix
    ./fastfetch.nix
    ./firefox.nix
    ./fish.nix
    ./git.nix
    ./goose.nix
    ./hyprland.nix
    ./hyprlock.nix
    ./mail
    ./mpv.nix
    ./newsboat.nix
    ./nom.nix
    ./ntfy.nix
    ./nushell.nix
    ./tenere.nix
    ./ticker.nix
    ./vale.nix
    ./walker.nix
    ./wallpapers
    ./waybar
    ./zaread.nix
  ];

  home = {
    file = {
      "Calendar/radicale/.keep".text = "";
      "Contacts/radicale/.keep".text = "";
      Downloads.source = config.lib.file.mkOutOfStoreSymlink "/media/skydrive/Downloads";
    };
    enableNixpkgsReleaseCheck = true;
    stateVersion = "25.05";
    shell = {
      enableBashIntegration = true;
      enableFishIntegration = true;
      enableNushellIntegration = true;
    };
    username = "${vars.user}";
    sessionVariables = {
      BROWSER = "${pkgs.firefox}/bin/firefox";
      CARGO_REGISTRIES_RELESOFT_CREDENTIAL_PROVIDER = "cargo:token";
      CARGO_REGISTRIES_RELESOFT_INDEX = "sparse+https://git.relesoft.io/api/packages/relesoft/cargo/";
      CARGO_REGISTRIES_RELESOFT_IO_PROTOCOL = "sparse";
      CARGO_REGISTRIES_RELESOFT_TOKEN = "$(${pkgs.coreutils}/bin/cat ${config.age.secrets.relesoft_cargo_token.path})";
      CC = "clang";
      CURSOR_SIZE = "16";
      DEFAULT_BROWSER = "${pkgs.firefox}/bin/firefox";
      ELECTRON_OZONE_PLATFORM_HINT = "auto";
      GDK_SCALE = "1";
      MOZ_USE_XINPUT2 = "1";
      NIXOS_OZONE_WL = "1";
      OPENAI_API_KEY = "$(${pkgs.coreutils}/bin/cat ${config.age.secrets.openai_auth_token.path})";
      PAGER = "${pkgs.nvimpager}/bin/nvimpager";
      PISTOL_CHROMA_FORMATTER = "terminal256";
      PISTOL_CHROMA_STYLE = "monokai";
      SHIORI_PASSWORD = "$(${pkgs.coreutils}/bin/cat ${config.age.secrets.shiori_password.path})";
      TERMCMD = "${pkgs.ghostty}/bin/ghostty";
      UNSPLASH_ACCESS_KEY = "$(${pkgs.coreutils}/bin/cat ${config.age.secrets.unsplash_access_key.path})";
      VISUAL = "${pkgs.neovim}/bin/nvim";
    };

    pointerCursor = {
      package = pkgs.rose-pine-hyprcursor;
      hyprcursor.enable = true;
      gtk.enable = true;
      name = "rose-pine-hyprcursor";
      size = 22;
    };

    homeDirectory = "/home/${vars.user}";
    packages = with pkgs; [
      # tui tools
      bluetui # bluetooth management
      clipse # clipboard management
      impala # iwd terminal ui
      lux # youtube-downloader
      rmpc # tui for mpd
      rtorrent # torrent
      systemctl-tui
      tenere # llm tui
      ticker # stock ticker
      wthrr # weather forecast from openmeteo

      # gui
      foliate # ebook reader
      ghostty # terminal emulator
      hypridle
      hyprpaper
      libreoffice
      lxqt.pavucontrol-qt
      rose-pine-hyprcursor # hyprcursor theme
      sqlitebrowser # sqlite
      swayimg # image viewer
      wireshark

      # spell checking
      aspell
      aspellDicts.en # english aspell dictionary
      aspellDicts.en-computers
      aspellDicts.en-science
      aspellDicts.fi # finnish aspell dictionary
      enchant # spell cherker interface
      hunspell
      hunspellDicts.en-us
      libvoikko # finnish spelling
      nuspell # spell checker

      # support
      ethtool # ethernet driver info
      ffmpeg
      libcamera # source camera stack
      libnotify # send notifications
      libwebp
      material-icons
      material-symbols
      mermaid-cli # diagrams
      wl-clipboard
      wttrbar # weather bar

      # cli-tools
      appimage-run
      attic-client # nix cache client
      brightnessctl
      cloc # count llines of code
      dmidecode # memory information
      espflash # ESP32 flasher
      espup # ESP32 development
      fd # find files by filenames
      file # show the type of file
      font-awesome # icons
      forgejo-cli # forgejo-cli
      gat # cat but with extra features
      grim # screen capture
      inxi # system innformation
      jq # commandline json parser
      kramdown-asciidoc # command to convert markdown to asciidoc
      minio-client # minio command line
      moor # less replacement
      ntfy-sh # notifications
      nvimpager # use neovim as pager
      pistol # file preview
      pkg-config # needed for compilation
      poppler-utils # pdf utilities
      rdrview # extract content from web page
      reader # extract web page and pipe
      recutils # text-based database
      ripgrep # faster grep
      slurp # screen are capture
      sqlite # simple database
      timg # show image in shell
      unstable.goose-cli # llm cli
      unstable.vale # spellcheck
      unstable.valeStyles.microsoft # spellcheck linters
      unstable.valeStyles.write-good # spellcheck linters
      whisper-cpp # tts
      wlogout # logout helper
      xdg-utils
      xh # curl replacement
      xxd # view binary files
      zellij # terminal multiplexer

      # Development
      antora # documentation tool for asciidoc
      asciidoctor-with-extensions # asciidoc is a markdown replacement
      clang # c and rust
      cmake # c
      couchbase-shell # couchbase
      d2 # graphs
      gnumake # makefile
      lean4 # theorem prover - broken
      lld # c and rust linker
      nodePackages.jsdoc # javascript documentation
      unstable.go
      unstable.golint # linter for go
      uv # python package installer
    ];
  };

  age = {
    identityPaths = [ "${config.home.homeDirectory}/.ssh/id_ed25519" ];
    secrets = {
      miniflux_api_key = {
        path = "${config.home.homeDirectory}/.secrets/miniflux_api_key";
        file = ../secrets/miniflux_api_key.age;
      };
      openai_auth_token.file = ../secrets/openai_auth_token.age;
      minio = {
        path = "${config.home.homeDirectory}/.mc/config.json";
        file = ../secrets/minio.age;
      };
      relesoft_cargo_token.file = ../secrets/relesoft_cargo_token.age;
      shiori_password.file = ../secrets/shiori_password.age;
      radicale = {
        path = "${config.home.homeDirectory}/.secrets/radicale";
        file = ../secrets/radicale.age;
      };
      unsplash_access_key = {
        path = "${config.home.homeDirectory}/.secrets/unsplash";
        file = ../secrets/unsplash_access_key.age;
      };
      gmail = {
        file = ../secrets/gmail.age;
        path = "${config.home.homeDirectory}/.secrets/gmail";
        mode = "600";
      };
      relesoft = {
        file = ../secrets/relesoft.age;
        path = "${config.home.homeDirectory}/.secrets/relesoft";
        mode = "600";
      };
    };
  };

  gtk = {
    colorScheme = "dark";
    enable = true;
    theme = {
      package = pkgs.whitesur-gtk-theme;
      name = "WhiteSur-Dark";
    };
    iconTheme = {
      package = pkgs.nordzy-icon-theme;
      name = "Nordzy";
    };
    font = {
      package = pkgs.roboto-flex;
      name = "Roboto Flex 11";
    };
  };

  qt = {
    enable = false;
    style = {
      package = pkgs.darkly;
      name = "Darkly";
    };
  };

  programs = {
    obsidian = {
      enable = true;
      defaultSettings.app = {
        strictLineBreaks = true;
        showUnsupportedFiles = true;
        alwaysUpdateLinks = true;
        pdfExportSettings = {
          includeName = true;
          pageSize = "A4";
          landscape = false;
          margin = "0";
          downscalePercent = 100;
        };
      };
      vaults = {
        obsidian-vault = {
          enable = true;
          target = "Documents/obsidian-vault";
          settings = {
            communityPlugins = [
              #obsidian-livesync = {
              #    enable = true;
              #};
              #lean-syntax-highlight = {
              #  enable = true;
              #};
            ];
          };
        };
      };
    };
    home-manager.enable = true;
    chawan = {
      enable = true;
      settings = {
        buffer = {
          autofocus = true;
          history = true;
          images = true;
          scripting = true;
          styling = true;
        };
        input = {
          vi-numeric-prefix = true;
        };
      };
    };
    nix-search-tv = {
      enable = true;
      enableTelevisionIntegration = true;
      settings = {
        indexes = [
          "nixpkgs"
          "home-manager"
          "nixos"
        ];
        experimental = { };
      };
    };
    television = {
      enable = true;
      enableFishIntegration = true;
    };
    zathura = {
      enable = true;
      extraConfig = ''
        set selection-clipboard clipboard
        set database sqlite
      '';
    };
    rbw = {
      enable = true;
      settings = {
        email = "${vars.email}";
        base_url = "https://vault.tammi.cc";
        pinentry = pkgs.pinentry-gnome3;
      };
    };
    element-desktop = {
      enable = true;
      settings = {
        "m.homeserver" = {
          base_url = "https://matrix.relesoft.io";
          server_name = "relesoft.io";
        };
        default_theme = "dark";
      };
    };
    zellij = {
      # modern tmux
      enable = true;
      enableFishIntegration = false;
    };
    zoxide = {
      # smarter cd command
      enable = true;
      enableFishIntegration = true;
      enableNushellIntegration = true;
    };

    carapace = {
      enable = true;
      enableNushellIntegration = true;
      enableFishIntegration = true;
    };
    gpg = {
      enable = true;
      settings = {
        no-comments = true;
      };
    };
    fzf = {
      enable = true;
      enableFishIntegration = true; # use CTRL+t for files, CTRL + r for history
      defaultOptions = [
        "--style full"
        "--preview '${pkgs.pistol}/bin/pistol {}'"
      ];
    };
    yazi = {
      # file browser
      enable = true;
      enableNushellIntegration = true;
      enableFishIntegration = true;
      settings = {
        mgr = {
          show_hidden = true;
          show_symlink = true;
          sort_by = "mtime";
          sort_dir_first = true;
          sort_reverse = true;
        };
        preview = {
          image_filter = "lanczos3";
          image_quality = 90;
        };
      };
    };
    atuin = {
      enable = true;
      enableFishIntegration = true;
      enableNushellIntegration = true;
      daemon = {
        enable = true;
      };
      settings = {
        auto_sync = true;
        style = "compact";
        sync_address = "https://atuin.tammi.cc";
        sync_frequency = "5m";
        update_check = false;
        workspaces = true;
      };
    };
    starship = {
      enable = true;
      enableFishIntegration = true;
      enableTransience = true;
      enableNushellIntegration = true;
    };
    eza = {
      enable = true;
      enableFishIntegration = true;
      enableNushellIntegration = true;
      git = true;
      icons = "auto";
      extraOptions = [
        "--color=always"
        "--tree"
        "--level=1"
        "--group-directories-first"
        "--dereference"
      ];
    };
    nix-index = {
      enable = true;
      enableFishIntegration = true;
      enableNushellIntegration = true;
    };
    pistol.enable = true;
    ghostty = {
      enable = true;
      systemd = {
        enable = true;
      };
      installVimSyntax = true;
      enableFishIntegration = true;
      settings = {
        copy-on-select = true;
        font-family = "Iosevka Nerd Font";
        font-size = 12;
        mouse-hide-while-typing = true;
        theme = "nord";
      };
      themes = {
        nord = {
          background = "#2e3440";
          cursor-color = "#d8dee9";
          cursor-text = "#2e3440";
          foreground = "#d8dee9";
          selection-background = "#3f4758";
          selection-foreground = "#d8dee9";
          palette = [
            "0=#3b4252"
            "1=#bf616a"
            "2=#a3be8c"
            "3=#ebcb8b"
            "4=#81a1c1"
            "5=#b48ead"
            "6=#88c0d0"
            "7=#e5e9f0"
            "8=#4c566a"
            "9=#bf616a"
            "10=#a3be8c"
            "11=#ebcb8b"
            "12=#81a1c1"
            "13=#b48ead"
            "14=#8fbcbb"
            "15=#eceff4"
          ];
        };
      };
    };
    ssh = {
      enableDefaultConfig = false;
      enable = true;
      matchBlocks."*" = {
        compression = true;
        controlMaster = "auto";
        controlPersist = "10m";
        serverAliveInterval = 1;
      };
    };
  };

  services = {
    home-manager.autoExpire.enable = true;
    ssh-agent = {
      enable = true;
      enableFishIntegration = true;
      enableNushellIntegration = true;
    };
    mpris-proxy.enable = true;
    mpd = {
      enable = true;
      musicDirectory = "/media/skydrive/Music/";
      # extraArgs = [ "--verbose" ];
      network = {
        listenAddress = "any";
        startWhenNeeded = true;
        port = 6600;
      };
    };
    wl-clip-persist = {
      enable = true;
    };
    psd = {
      enable = true;
      backupLimit = 5;
    };
    gpg-agent = {
      defaultCacheTtl = 1800;
      enable = true;
      enableFishIntegration = true;
      enableNushellIntegration = true;
      enableSshSupport = true;
      pinentry.package = pkgs.pinentry-gnome3;
    };
    clipse = {
      enable = true;
    };
  };

  manual = {
    html.enable = true;
    json.enable = true;
  };

  fonts = {
    fontconfig = {
      enable = true;
      defaultFonts = {
        serif = [ "Roboto Serif" ];
        sansSerif = [ "Roboto Flex" ];
        monospace = [ "Iosevka Nerd Font" ];
        emoji = [ "Twitter Color Emoji" ];
      };
    };
  };

  xdg = {
    enable = true;
    autostart.enable = true;
    portal = {
      enable = true;
      config.common = {
        default = [ "*" ];
        "org.freedesktop.impl.portal.FileChooser" = "termfilechooser";
      };
      xdgOpenUsePortal = true;
      extraPortals = with pkgs; [
        xdg-desktop-portal-wlr
        xdg-desktop-portal-termfilechooser
      ];
    };
    desktopEntries = {
      nvim = {
        categories = [ ];
        comment = "A text editor";
        exec = ''${pkgs.neovim}/bin/nvim'';
        genericName = "Editor";
        name = "nvim";
        terminal = true;
      };
    };

    mimeApps = {
      enable = true;
      defaultApplications = {
        "application/pdf" = [ "org.pwmt.zathura.desktop" ];
        "inode/directory" = "yazi.desktop";
        "image/jpeg" = [ "swayimg.desktop" ];
        "image/png" = [ "swayimg.desktop" ];
        "image/webp" = [ "swayimg.desktop" ];
        "text/html" = [ "firefox.desktop" ];
        "text/json" = [ "nvim.desktop" ];
        "text/markdown" = "nvim.desktop";
        "text/plain" = "nvim.desktop";
        "video/mp4" = "mpv.desktop";
        "video/webm" = "mpv.desktop";
        "x-scheme-handler/about" = "firefox.desktop";
        "x-scheme-handler/http" = "firefox.desktop";
        "x-scheme-handler/https" = "firefox.desktop";
        "x-scheme-handler/unknown" = "firefox.desktop";
      };
    };
  };
  systemd.user = {
    startServices = "sd-switch";
  };

  xdg.configFile."xdg-desktop-portal-termfilechooser/config".source =
    (pkgs.formats.toml { }).generate "termfilechooser-config"
      {
        filechooser = {
          cmd = "yazi-wrapper.sh";
          default_dir = "/home/petri/Downloads";
          open_mode = "suggested";
          save_mode = "last";
        };
      };

  xdg.configFile."xdg-desktop-portal-termfilechooser/yazi-wrapper.sh" = {
    force = true;
    executable = true;
    source = pkgs.writeShellScript "yazi-wrapper" ''
      # This wrapper script is invoked by xdg-desktop-portal-termfilechooser.
      # For more information about input/output arguments read `xdg-desktop-portal-termfilechooser(5)`
      set -e

      if [ "$6" -ge 4 ]; then
        set -x
      fi

      multiple="$1"
      directory="$2"
      save="$3"
      path="$4"
      out="$5"

      # Build yazi arguments
      yazi_args=""
      if [ "$save" = "1" ]; then
        # save a file
        yazi_args="--chooser-file=$out $path"
      elif [ "$directory" = "1" ]; then
        # upload files from a directory
        yazi_args="--chooser-file=$out --cwd-file=$out.1 $path"
      elif [ "$multiple" = "1" ]; then
        # upload multiple files
        yazi_args="--chooser-file=$out $path"
      else
        # upload only 1 file
        yazi_args="--chooser-file=$out $path"
      fi

      # Execute ghostty with yazi
      ${pkgs.ghostty}/bin/ghostty -e ${pkgs.yazi}/bin/yazi $yazi_args

      # Handle directory case output
      if [ "$directory" = "1" ]; then
        if [ ! -s "$out" ] && [ -s "$out.1" ]; then
          ${pkgs.coreutils}/bin/cat "$out.1" > "$out"
          rm -f "$out.1"
        else
          rm -f "$out.1"
        fi
      fi
    '';
  };
}