2022-06-09 21:50:24 +00:00
|
|
|
# docs:
|
|
|
|
# https://rycee.gitlab.io/home-manager/
|
|
|
|
# https://rycee.gitlab.io/home-manager/options.html
|
|
|
|
# man home-configuration.nix
|
|
|
|
#
|
|
|
|
|
2022-07-06 21:36:14 +00:00
|
|
|
{ lib, config, pkgs, ... }:
|
2022-06-09 21:50:24 +00:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
let
|
2022-08-01 07:23:49 +00:00
|
|
|
cfg = config.sane.home-manager;
|
2023-01-02 07:45:05 +00:00
|
|
|
# extract `pkg` from `sane.packages.enabledUserPkgs`
|
2023-01-02 07:16:16 +00:00
|
|
|
pkg-list = pkgspec: builtins.map (e: e.pkg) pkgspec;
|
2022-06-09 21:50:24 +00:00
|
|
|
in
|
2022-05-22 08:27:02 +00:00
|
|
|
{
|
2022-10-21 15:20:30 +00:00
|
|
|
imports = [
|
2022-10-21 16:15:08 +00:00
|
|
|
./aerc.nix
|
2022-11-01 23:23:50 +00:00
|
|
|
./firefox.nix
|
2023-01-06 16:27:05 +00:00
|
|
|
./gfeeds.nix
|
2022-10-21 15:41:28 +00:00
|
|
|
./git.nix
|
2023-01-06 16:27:05 +00:00
|
|
|
./gpodder.nix
|
2023-01-07 01:41:56 +00:00
|
|
|
./keyring.nix
|
2022-10-21 15:24:07 +00:00
|
|
|
./kitty.nix
|
2022-10-21 15:43:57 +00:00
|
|
|
./mpv.nix
|
2022-10-21 15:30:35 +00:00
|
|
|
./neovim.nix
|
2023-01-06 16:27:05 +00:00
|
|
|
./newsflash.nix
|
2022-12-16 07:46:06 +00:00
|
|
|
./splatmoji.nix
|
2022-10-25 12:06:33 +00:00
|
|
|
./ssh.nix
|
2022-10-21 16:10:55 +00:00
|
|
|
./sublime-music.nix
|
2022-10-21 15:47:21 +00:00
|
|
|
./vlc.nix
|
2022-12-21 13:08:23 +00:00
|
|
|
./zsh
|
2022-10-21 15:20:30 +00:00
|
|
|
];
|
|
|
|
|
2022-06-09 21:50:24 +00:00
|
|
|
options = {
|
2022-11-22 05:28:41 +00:00
|
|
|
sane.home-manager.enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
|
|
|
};
|
2022-08-03 08:23:23 +00:00
|
|
|
# attributes to copy directly to home-manager's `wayland.windowManager` option
|
2022-08-01 07:23:49 +00:00
|
|
|
sane.home-manager.windowManager = mkOption {
|
2022-06-09 22:01:38 +00:00
|
|
|
default = {};
|
|
|
|
type = types.attrs;
|
|
|
|
};
|
2022-08-03 09:03:17 +00:00
|
|
|
|
2022-08-03 08:23:23 +00:00
|
|
|
# extra attributes to include in home-manager's `programs` option
|
2022-08-01 07:23:49 +00:00
|
|
|
sane.home-manager.programs = mkOption {
|
2022-06-09 22:05:58 +00:00
|
|
|
default = {};
|
|
|
|
type = types.attrs;
|
|
|
|
};
|
2022-06-09 21:50:24 +00:00
|
|
|
};
|
|
|
|
|
2022-11-22 05:28:41 +00:00
|
|
|
config = lib.mkIf cfg.enable {
|
2022-06-09 21:50:24 +00:00
|
|
|
home-manager.useGlobalPkgs = true;
|
|
|
|
home-manager.useUserPackages = true;
|
|
|
|
|
2022-06-21 06:55:43 +00:00
|
|
|
# XXX this weird rename + closure is to get home-manager's `config.lib.file` to exist.
|
|
|
|
# see: https://github.com/nix-community/home-manager/issues/589#issuecomment-950474105
|
|
|
|
home-manager.users.colin = let sysconfig = config; in { config, ... }: {
|
2022-08-03 08:51:15 +00:00
|
|
|
|
2022-10-06 22:56:37 +00:00
|
|
|
# run `home-manager-help` to access manpages
|
|
|
|
# or `man home-configuration.nix`
|
2022-10-21 07:05:19 +00:00
|
|
|
manual.html.enable = false; # TODO: set to true later (build failure)
|
|
|
|
manual.manpages.enable = false; # TODO: enable after https://github.com/nix-community/home-manager/issues/3344
|
2022-10-06 22:56:37 +00:00
|
|
|
|
2022-11-22 05:11:02 +00:00
|
|
|
home.packages = pkg-list sysconfig.sane.packages.enabledUserPkgs;
|
2022-08-03 08:51:15 +00:00
|
|
|
wayland.windowManager = cfg.windowManager;
|
|
|
|
|
2022-06-09 21:50:24 +00:00
|
|
|
home.stateVersion = "21.11";
|
|
|
|
home.username = "colin";
|
|
|
|
home.homeDirectory = "/home/colin";
|
|
|
|
|
|
|
|
# XDG defines things like ~/Desktop, ~/Downloads, etc.
|
|
|
|
# these clutter the home, so i mostly don't use them.
|
|
|
|
xdg.userDirs = {
|
|
|
|
enable = true;
|
|
|
|
createDirectories = false; # on headless systems, most xdg dirs are noise
|
|
|
|
desktop = "$HOME/.xdg/Desktop";
|
2022-06-18 00:52:31 +00:00
|
|
|
documents = "$HOME/dev";
|
2022-06-09 21:50:24 +00:00
|
|
|
download = "$HOME/tmp";
|
|
|
|
music = "$HOME/Music";
|
|
|
|
pictures = "$HOME/Pictures";
|
|
|
|
publicShare = "$HOME/.xdg/Public";
|
|
|
|
templates = "$HOME/.xdg/Templates";
|
|
|
|
videos = "$HOME/Videos";
|
|
|
|
};
|
2022-09-26 09:21:09 +00:00
|
|
|
|
|
|
|
# the xdg mime type for a file can be found with:
|
|
|
|
# - `xdg-mime query filetype path/to/thing.ext`
|
2022-07-01 11:36:32 +00:00
|
|
|
xdg.mimeApps.enable = true;
|
2022-10-10 00:42:48 +00:00
|
|
|
xdg.mimeApps.defaultApplications = let
|
2023-01-06 16:11:06 +00:00
|
|
|
www = sysconfig.sane.web-browser.browser.desktop;
|
2022-10-10 00:42:48 +00:00
|
|
|
pdf = "org.gnome.Evince.desktop";
|
|
|
|
md = "obsidian.desktop";
|
|
|
|
thumb = "org.gnome.gThumb.desktop";
|
|
|
|
video = "vlc.desktop";
|
2022-10-10 11:58:42 +00:00
|
|
|
# audio = "mpv.desktop";
|
|
|
|
audio = "vlc.desktop";
|
2022-10-10 00:42:48 +00:00
|
|
|
in {
|
2022-09-26 09:21:09 +00:00
|
|
|
# HTML
|
2022-10-10 00:42:48 +00:00
|
|
|
"text/html" = [ www ];
|
|
|
|
"x-scheme-handler/http" = [ www ];
|
|
|
|
"x-scheme-handler/https" = [ www ];
|
|
|
|
"x-scheme-handler/about" = [ www ];
|
|
|
|
"x-scheme-handler/unknown" = [ www ];
|
2022-09-27 00:02:14 +00:00
|
|
|
# RICH-TEXT DOCUMENTS
|
2022-10-10 00:42:48 +00:00
|
|
|
"application/pdf" = [ pdf ];
|
|
|
|
"text/markdown" = [ md ];
|
2022-09-26 09:21:09 +00:00
|
|
|
# IMAGES
|
2022-10-10 00:42:48 +00:00
|
|
|
"image/heif" = [ thumb ]; # apple codec
|
|
|
|
"image/png" = [ thumb ];
|
|
|
|
"image/jpeg" = [ thumb ];
|
2022-09-26 09:21:09 +00:00
|
|
|
# VIDEO
|
2022-10-10 00:42:48 +00:00
|
|
|
"video/mp4" = [ video ];
|
|
|
|
"video/quicktime" = [ video ];
|
|
|
|
"video/x-matroska" = [ video ];
|
2022-09-26 09:21:09 +00:00
|
|
|
# AUDIO
|
2022-10-10 00:42:48 +00:00
|
|
|
"audio/flac" = [ audio ];
|
|
|
|
"audio/mpeg" = [ audio ];
|
|
|
|
"audio/x-vorbis+ogg" = [ audio ];
|
2022-07-01 11:36:32 +00:00
|
|
|
};
|
2022-06-09 21:50:24 +00:00
|
|
|
|
2022-11-06 00:24:19 +00:00
|
|
|
# libreoffice: disable first-run stuff
|
|
|
|
xdg.configFile."libreoffice/4/user/registrymodifications.xcu".text = ''
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<oor:items xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
|
|
<item oor:path="/org.openoffice.Office.Common/Misc"><prop oor:name="FirstRun" oor:op="fuse"><value>false</value></prop></item>
|
|
|
|
<item oor:path="/org.openoffice.Office.Common/Misc"><prop oor:name="ShowTipOfTheDay" oor:op="fuse"><value>false</value></prop></item>
|
|
|
|
</oor:items>
|
|
|
|
'';
|
|
|
|
# <item oor:path="/org.openoffice.Setup/Product"><prop oor:name="LastTimeDonateShown" oor:op="fuse"><value>1667693880</value></prop></item>
|
|
|
|
# <item oor:path="/org.openoffice.Setup/Product"><prop oor:name="LastTimeGetInvolvedShown" oor:op="fuse"><value>1667693880</value></prop></item>
|
|
|
|
|
|
|
|
|
2023-01-09 03:11:14 +00:00
|
|
|
programs = lib.mkMerge [
|
|
|
|
{
|
|
|
|
home-manager.enable = true; # this lets home-manager manage dot-files in user dirs, i think
|
|
|
|
# "command not found" will cause the command to be searched in nixpkgs
|
|
|
|
nix-index.enable = true;
|
|
|
|
}
|
|
|
|
cfg.programs
|
|
|
|
];
|
2022-06-09 21:50:24 +00:00
|
|
|
};
|
2023-01-19 04:03:23 +00:00
|
|
|
|
|
|
|
sane.persist.home.plaintext = [ ".cache/nix-index" ];
|
2022-06-09 21:50:24 +00:00
|
|
|
};
|
2022-05-22 08:27:02 +00:00
|
|
|
}
|