~sumner/home-manager-config

3437ed2ff70ae123880af546a138266db09aa309 — Sumner Evans 8 months ago ef0b10e
Moving to module system
49 files changed, 121 insertions(+), 78 deletions(-)

M home.nix
R programs/alacritty.nix => modules/alacritty.nix
R programs/browsers.nix => modules/browsers.nix
A modules/calendar/default.nix
R services/vdirsyncer.nix => modules/calendar/ics-subscription-import.nix
A modules/calendar/khal.nix
A modules/calendar/vdirsyncer.nix
A modules/default.nix
R email/accounts/account-config-helper.nix => modules/email/accounts/account-config-helper.nix
R email/accounts/admin-accounts.nix => modules/email/accounts/admin-accounts.nix
R email/accounts/default.nix => modules/email/accounts/default.nix
R email/accounts/gmail.nix => modules/email/accounts/gmail.nix
R email/accounts/mines.nix => modules/email/accounts/mines.nix
R email/accounts/personal.nix => modules/email/accounts/personal.nix
R email/bin/mutt-display-filter.py => modules/email/bin/mutt-display-filter.py
R email/default.nix => modules/email/default.nix
R email/icalview.py => modules/email/icalview.py
R email/mailcap.nix => modules/email/mailcap.nix
R email/mbsync.nix => modules/email/mbsync.nix
R email/neomutt.nix => modules/email/neomutt.nix
R services/offlinemsmtp.nix => modules/email/offlinemsmtp.nix
R email/quotes => modules/email/quotes
R programs/git.nix => modules/git.nix
R services/default.nix => modules/gpg.nix
R programs/neovim.nix => modules/neovim.nix
R programs/newsboat.nix => modules/newsboat.nix
A modules/scripts/default.nix
R programs/projectsync.nix => modules/scripts/projectsync.nix
A modules/syncthing.nix
R programs/tmux.nix => modules/tmux.nix
A modules/udiskie.nix
R services/window-manager/common.nix => modules/window-manager/common.nix
R services/window-manager/default.nix => modules/window-manager/default.nix
R programs/i3status-rust.nix => modules/window-manager/i3status-rust.nix
R programs/rofi.nix => modules/window-manager/rofi.nix
R services/wallpaper.nix => modules/window-manager/wallpaper.nix
R services/window-manager/wayland.nix => modules/window-manager/wayland.nix
R services/writeping.nix => modules/window-manager/writeping.nix
R services/window-manager/xorg.nix => modules/window-manager/xorg.nix
A modules/xdg.nix
R programs/zsh/aliases.nix => modules/zsh/aliases.nix
R programs/zsh/completion.nix => modules/zsh/completion.nix
R programs/zsh/default.nix => modules/zsh/default.nix
R programs/zsh/dir-hashes.nix => modules/zsh/dir-hashes.nix
R programs/zsh/functions.nix => modules/zsh/functions.nix
R programs/zsh/key-widgets.zsh => modules/zsh/key-widgets.zsh
R programs/zsh/plugins.nix => modules/zsh/plugins.nix
R programs/zsh/prompt.zsh => modules/zsh/prompt.zsh
M programs/default.nix
M home.nix => home.nix +4 -4
@@ 1,13 1,10 @@
{ config, pkgs, ... }: {
  imports = [
    ./email
    ./modules
    ./programs
    ./services
    ./host-config.nix
  ];

  qt = { enable = true; platformTheme = "gtk"; };

  nixpkgs.overlays = [
    (
      self: super: rec {


@@ 36,4 33,7 @@
    username = "sumner";
    homeDirectory = "/home/sumner";
  };

  # Always restart/start/stop systemd services on home manager switch.
  systemd.user.startServices = "sd-switch";
}

R programs/alacritty.nix => modules/alacritty.nix +0 -0
R programs/browsers.nix => modules/browsers.nix +0 -0
A modules/calendar/default.nix => modules/calendar/default.nix +7 -0
@@ 0,0 1,7 @@
{
  imports = [
    ./ics-subscription-import.nix
    ./khal.nix
    ./vdirsyncer.nix
  ];
}

R services/vdirsyncer.nix => modules/calendar/ics-subscription-import.nix +2 -27
@@ 1,44 1,19 @@
{ lib, config, pkgs, ... }: with lib; let
  vdirsyncer = "${pkgs.vdirsyncer}/bin/vdirsyncer";
  vdirsyncerScript = pkgs.writeShellScript "vdirsyncer" ''
    ${vdirsyncer} discover
    ${vdirsyncer} sync
    ${vdirsyncer} metasync
  '';

  # ICS import settings
  icsSubscriptions = [
    { uri = "https://lug.mines.edu/schedule/ical.ics"; importTo = "LUG"; }
    { uri = "https://acm.mines.edu/schedule/ical.ics"; importTo = "ACM"; }
  ];

  icsImportCurl = { uri, importTo }:
    "${pkgs.curl}/bin/curl '${uri}' | ${pkgs.khal}/bin/khal import --batch -a ${importTo}";

  icsSubscriptionImport = pkgs.writeShellScript "ics-subscription-import" ''
    set -xe
    ${concatMapStringsSep "\n" icsImportCurl icsSubscriptions}
  '';
in
{
  systemd.user.services.vdirsyncer = {
    Unit.Description = "Synchronize Calendar and Contacts";

    Service = {
      Type = "oneshot";
      ExecStart = "${vdirsyncerScript}";
    };
  };

  systemd.user.timers.vdirsyncer = {
    Unit.Description = "Synchronize Calendar and Contacts";

    Timer = {
      OnCalendar = "*:0/15"; # Every 15 minutes
      Unit = "vdirsyncer.service";
    };

    Install = { WantedBy = [ "timers.target" ]; };
  };

  systemd.user.services."ics-subscription-import" = {
    Unit.Description = "Download the icsSubscriptions and import using khal.";


A modules/calendar/khal.nix => modules/calendar/khal.nix +21 -0
@@ 0,0 1,21 @@
{ lib, config, pkgs, ... }: {
  xdg.configFile."khal/config".text = ''
    [calendars]

    [[xandikos_calendar_local]]
    path = ${config.xdg.dataHome}/vdirsyncer/calendars/*
    type = discover

    [[xandikos_contacts_local]]
    path = ${config.xdg.dataHome}/vdirsyncer/contacts/addressbook
    type = birthdays

    [locale]
    timeformat = %H:%M
    dateformat = %Y-%m-%d
    longdateformat = %Y-%m-%d
    datetimeformat = %Y-%m-%d %H:%M
    longdatetimeformat = %Y-%m-%d %H:%M
    firstweekday = 6
  '';
}

A modules/calendar/vdirsyncer.nix => modules/calendar/vdirsyncer.nix +29 -0
@@ 0,0 1,29 @@
{ lib, config, pkgs, ... }: with lib; let
  vdirsyncer = "${pkgs.vdirsyncer}/bin/vdirsyncer";
  vdirsyncerScript = pkgs.writeShellScript "vdirsyncer" ''
    ${vdirsyncer} discover
    ${vdirsyncer} sync
    ${vdirsyncer} metasync
  '';
in
{
  systemd.user.services.vdirsyncer = {
    Unit.Description = "Synchronize Calendar and Contacts";

    Service = {
      Type = "oneshot";
      ExecStart = "${vdirsyncerScript}";
    };
  };

  systemd.user.timers.vdirsyncer = {
    Unit.Description = "Synchronize Calendar and Contacts";

    Timer = {
      OnCalendar = "*:0/15"; # Every 15 minutes
      Unit = "vdirsyncer.service";
    };

    Install = { WantedBy = [ "timers.target" ]; };
  };
}

A modules/default.nix => modules/default.nix +19 -0
@@ 0,0 1,19 @@
{
  imports = [
    ./alacritty.nix
    ./browsers.nix
    ./calendar
    ./email
    ./git.nix
    ./gpg.nix
    ./neovim.nix
    ./newsboat.nix
    ./scripts
    ./syncthing.nix
    ./tmux.nix
    ./udiskie.nix
    ./window-manager
    ./xdg.nix
    ./zsh
  ];
}

R email/accounts/account-config-helper.nix => modules/email/accounts/account-config-helper.nix +0 -0
R email/accounts/admin-accounts.nix => modules/email/accounts/admin-accounts.nix +0 -0
R email/accounts/default.nix => modules/email/accounts/default.nix +0 -0
R email/accounts/gmail.nix => modules/email/accounts/gmail.nix +0 -0
R email/accounts/mines.nix => modules/email/accounts/mines.nix +0 -0
R email/accounts/personal.nix => modules/email/accounts/personal.nix +0 -0
R email/bin/mutt-display-filter.py => modules/email/bin/mutt-display-filter.py +0 -0
R email/default.nix => modules/email/default.nix +1 -0
@@ 4,6 4,7 @@
    ./mailcap.nix
    ./mbsync.nix
    ./neomutt.nix
    ./offlinemsmtp.nix
  ];

  services.imapnotify.enable = true;

R email/icalview.py => modules/email/icalview.py +0 -0
R email/mailcap.nix => modules/email/mailcap.nix +0 -0
R email/mbsync.nix => modules/email/mbsync.nix +0 -0
R email/neomutt.nix => modules/email/neomutt.nix +0 -0
R services/offlinemsmtp.nix => modules/email/offlinemsmtp.nix +1 -1
@@ 1,5 1,5 @@
{ config, pkgs, ... }: with pkgs; let
  offlinemsmtp = callPackage ../pkgs/offlinemsmtp.nix {};
  offlinemsmtp = callPackage ../../pkgs/offlinemsmtp.nix {};
in
{
  systemd.user.services.offlinemsmtp = {

R email/quotes => modules/email/quotes +0 -0
R programs/git.nix => modules/git.nix +0 -0
R services/default.nix => modules/gpg.nix +0 -27
@@ 1,14 1,4 @@
{ pkgs, ... }: {
  imports = [
    ./offlinemsmtp.nix
    ./vdirsyncer.nix
    ./wallpaper.nix
    ./window-manager
    ./writeping.nix
  ];

  services.blueman-applet.enable = true;

  # Make the gpg-agent work
  services.gpg-agent = let
    ttl = 60 * 60 * 4; # 4 hours


@@ 20,21 10,4 @@
      pinentryFlavor = "gnome3";
      verbose = true;
    };

  services.kdeconnect = { enable = true; indicator = true; };

  services.network-manager-applet.enable = true;

  services.syncthing.enable = true;

  services.udiskie.enable = true;

  systemd.user.startServices = "sd-switch";

  # use systemd.user.tmpfiles.rules?

  xdg = {
    enable = true;
    # TODO mimeTypes?
  };
}

R programs/neovim.nix => modules/neovim.nix +0 -0
R programs/newsboat.nix => modules/newsboat.nix +0 -0
A modules/scripts/default.nix => modules/scripts/default.nix +5 -0
@@ 0,0 1,5 @@
{
  imports = [
    ./projectsync.nix
  ];
}

R programs/projectsync.nix => modules/scripts/projectsync.nix +0 -0
A modules/syncthing.nix => modules/syncthing.nix +3 -0
@@ 0,0 1,3 @@
{
  services.syncthing.enable = true;
}

R programs/tmux.nix => modules/tmux.nix +0 -0
A modules/udiskie.nix => modules/udiskie.nix +3 -0
@@ 0,0 1,3 @@
{
  services.udiskie.enable = true;
}

R services/window-manager/common.nix => modules/window-manager/common.nix +0 -0
R services/window-manager/default.nix => modules/window-manager/default.nix +14 -0
@@ 6,7 6,11 @@
in
{
  imports = [
    ./i3status-rust.nix
    ./rofi.nix
    ./wallpaper.nix
    ./wayland.nix
    ./writeping.nix
    ./xorg.nix
  ];



@@ 48,5 52,15 @@ in
        gtk-toolbar-icon-size = "GTK_ICON_SIZE_LARGE_TOOLBAR";
      };
    };

    qt = {
      enable = true;
      platformTheme = "gtk";
    };

    # Enable GUI services
    services.blueman-applet.enable = true;
    services.kdeconnect = { enable = true; indicator = true; };
    services.network-manager-applet.enable = true;
  };
}

R programs/i3status-rust.nix => modules/window-manager/i3status-rust.nix +1 -1
@@ 17,7 17,7 @@
    };
  };

  config = {
  config = mkIf (config.wayland.enable || config.xorg.enable) {
    programs.i3status-rust = {
      enable = true;


R programs/rofi.nix => modules/window-manager/rofi.nix +0 -0
R services/wallpaper.nix => modules/window-manager/wallpaper.nix +0 -0
R services/window-manager/wayland.nix => modules/window-manager/wayland.nix +0 -0
R services/writeping.nix => modules/window-manager/writeping.nix +0 -0
R services/window-manager/xorg.nix => modules/window-manager/xorg.nix +0 -0
A modules/xdg.nix => modules/xdg.nix +6 -0
@@ 0,0 1,6 @@
{
  xdg = {
    enable = true;
    # TODO mimeTypes?
  };
}

R programs/zsh/aliases.nix => modules/zsh/aliases.nix +0 -0
R programs/zsh/completion.nix => modules/zsh/completion.nix +0 -0
R programs/zsh/default.nix => modules/zsh/default.nix +4 -0
@@ 112,6 112,10 @@
        '';
    };

    programs.direnv.enableZshIntegration = true;
    programs.fzf.enableZshIntegration = true;
    programs.opam.enableZshIntegration = true;

    home.sessionPath = [
      "${config.home.homeDirectory}/.local/bin"
      "${config.home.homeDirectory}/.cargo/bin"

R programs/zsh/dir-hashes.nix => modules/zsh/dir-hashes.nix +0 -0
R programs/zsh/functions.nix => modules/zsh/functions.nix +0 -0
R programs/zsh/key-widgets.zsh => modules/zsh/key-widgets.zsh +0 -0
R programs/zsh/plugins.nix => modules/zsh/plugins.nix +0 -0
R programs/zsh/prompt.zsh => modules/zsh/prompt.zsh +0 -0
M programs/default.nix => programs/default.nix +1 -18
@@ 10,19 10,6 @@
  tracktime = callPackage ../pkgs/tracktime.nix {};
in
{
  imports = [
    ./alacritty.nix
    ./browsers.nix
    ./git.nix
    ./i3status-rust.nix
    ./neovim.nix
    ./newsboat.nix
    ./projectsync.nix
    ./rofi.nix
    ./tmux.nix
    ./zsh
  ];

  home.packages = [
    # Shell Utilities
    aspell


@@ 143,17 130,13 @@ in
  programs.direnv = {
    enable = true;
    enableNixDirenvIntegration = true;
    enableZshIntegration = true;
  };

  programs.feh.enable = true;

  # TODO firefox

  programs.fzf = {
    enable = true;
    defaultCommand = "fd --type f --hidden --follow --exclude .git";
    enableZshIntegration = true;
  };

  programs.gpg.enable = true;


@@ 180,7 163,7 @@ in
  programs.obs-studio.enable = true;
  programs.obs-studio.plugins = with pkgs; [ obs-wlrobs obs-v4l2sink ];

  programs.opam = { enable = true; enableZshIntegration = true; };
  programs.opam.enable = true;

  programs.password-store.enable = true;