split home-manager into their own submodules
This commit is contained in:
@@ -1,67 +0,0 @@
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
options.my.shell.multimedia = {
|
||||
enable = lib.mkEnableOption "multimedia CLI tools and codecs";
|
||||
users = lib.mkOption {
|
||||
type = inputs.self.lib.usersOptionType lib;
|
||||
default = config.my.toggleUsers.shell;
|
||||
description = "Users to install multimedia shell tools for";
|
||||
};
|
||||
};
|
||||
config = lib.mkIf (config.my.shell.multimedia.enable && config.my.secureHost) {
|
||||
sops.secrets."gallery-dl/secrets" =
|
||||
let
|
||||
user = inputs.self.lib.getFirstUser config.my.shell.multimedia.users;
|
||||
in
|
||||
{
|
||||
sopsFile = ../../secrets/gallery.yaml;
|
||||
owner = user;
|
||||
mode = "0400";
|
||||
};
|
||||
home-manager.users =
|
||||
inputs.self.lib.mkHomeManagerUsers lib config.my.shell.multimedia.users
|
||||
(user: {
|
||||
programs = {
|
||||
yt-dlp = {
|
||||
enable = true;
|
||||
settings = {
|
||||
embed-thumbnail = true;
|
||||
embed-subs = true;
|
||||
sub-langs = "all";
|
||||
cookies-from-browser = "firefox+gnomekeyring:/home/${user}/.librewolf/${user}";
|
||||
};
|
||||
};
|
||||
gallery-dl = {
|
||||
enable = true;
|
||||
settings = inputs.self.lib.importDotfile ../../dotfiles/gallery-dl.nix;
|
||||
};
|
||||
${config.my.shell.type} = {
|
||||
initExtra = lib.mkAfter ''
|
||||
if [ -r "${config.sops.secrets."gallery-dl/secrets".path}" ]; then
|
||||
set -a # automatically export all variables
|
||||
source "${config.sops.secrets."gallery-dl/secrets".path}"
|
||||
set +a # stop automatically exporting
|
||||
fi
|
||||
'';
|
||||
};
|
||||
};
|
||||
});
|
||||
users.users =
|
||||
let
|
||||
packages = builtins.attrValues {
|
||||
inherit (pkgs)
|
||||
ffmpeg # not ffmpreg, the coolest video conversion tool!
|
||||
imagemagick # photoshop what??
|
||||
ffpb # make ffmpeg encoding... a bit fun
|
||||
;
|
||||
};
|
||||
in
|
||||
inputs.self.lib.mkUserPackages lib config.my.shell.multimedia.users packages;
|
||||
};
|
||||
}
|
||||
10
modules/shell/multimedia/common.nix
Normal file
10
modules/shell/multimedia/common.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
{ pkgs }:
|
||||
{
|
||||
packages = builtins.attrValues {
|
||||
inherit (pkgs)
|
||||
ffmpeg
|
||||
imagemagick
|
||||
ffpb
|
||||
;
|
||||
};
|
||||
}
|
||||
62
modules/shell/multimedia/home.nix
Normal file
62
modules/shell/multimedia/home.nix
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
osConfig ? null,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
shellType = inputs.self.lib.hmShellType config osConfig;
|
||||
hm = inputs.self.lib.hmModule {
|
||||
inherit
|
||||
config
|
||||
inputs
|
||||
osConfig
|
||||
;
|
||||
optionPath = [
|
||||
"shell"
|
||||
"multimedia"
|
||||
];
|
||||
};
|
||||
cfg = config.my.shell.multimedia;
|
||||
multimedia = import ./common.nix { inherit pkgs; };
|
||||
in
|
||||
{
|
||||
options.my.shell.multimedia.enable = lib.mkEnableOption "multimedia CLI tools and codecs";
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
my.shell.multimedia.enable = lib.mkDefault hm.enabledByDefault;
|
||||
}
|
||||
(lib.mkIf cfg.enable {
|
||||
home.packages = multimedia.packages;
|
||||
programs = {
|
||||
yt-dlp = {
|
||||
enable = true;
|
||||
settings = {
|
||||
embed-thumbnail = true;
|
||||
embed-subs = true;
|
||||
sub-langs = "all";
|
||||
cookies-from-browser = "firefox+gnomekeyring:${config.home.homeDirectory}/.librewolf/${config.home.username}";
|
||||
};
|
||||
};
|
||||
gallery-dl = {
|
||||
enable = true;
|
||||
settings = inputs.self.lib.importDotfile ../../../dotfiles/gallery-dl.nix;
|
||||
};
|
||||
${shellType}.initExtra = lib.mkAfter (
|
||||
if osConfig == null then
|
||||
""
|
||||
else
|
||||
''
|
||||
if [ -r "${osConfig.sops.secrets."gallery-dl/secrets".path}" ]; then
|
||||
set -a
|
||||
source "${osConfig.sops.secrets."gallery-dl/secrets".path}"
|
||||
set +a
|
||||
fi
|
||||
''
|
||||
);
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
||||
27
modules/shell/multimedia/nixos.nix
Normal file
27
modules/shell/multimedia/nixos.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
options.my.shell.multimedia = {
|
||||
enable = lib.mkEnableOption "multimedia CLI tools and codecs";
|
||||
users = lib.mkOption {
|
||||
type = inputs.self.lib.usersOptionType lib;
|
||||
default = config.my.toggleUsers.shell;
|
||||
description = "Users to install multimedia shell tools for";
|
||||
};
|
||||
};
|
||||
config = lib.mkIf (config.my.shell.multimedia.enable && config.my.secureHost) {
|
||||
sops.secrets."gallery-dl/secrets" =
|
||||
let
|
||||
user = inputs.self.lib.getFirstUser config.my.shell.multimedia.users;
|
||||
in
|
||||
{
|
||||
sopsFile = ../../../secrets/gallery.yaml;
|
||||
owner = user;
|
||||
mode = "0400";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -3,22 +3,46 @@
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
osConfig ? null,
|
||||
...
|
||||
}:
|
||||
let
|
||||
shellType = config.my.shell.type;
|
||||
shellType = inputs.self.lib.hmShellType config osConfig;
|
||||
hm = inputs.self.lib.hmModule {
|
||||
inherit
|
||||
config
|
||||
inputs
|
||||
osConfig
|
||||
;
|
||||
optionPath = [
|
||||
"shell"
|
||||
"tools"
|
||||
];
|
||||
};
|
||||
cfg = config.my.shell.tools;
|
||||
in
|
||||
{
|
||||
options.my.shell.tools = {
|
||||
enable = lib.mkEnableOption "shell tools and utilities";
|
||||
users = lib.mkOption {
|
||||
type = inputs.self.lib.usersOptionType lib;
|
||||
default = config.my.toggleUsers.shell;
|
||||
description = "Users to install shell tools for";
|
||||
};
|
||||
};
|
||||
config = lib.mkIf config.my.shell.tools.enable {
|
||||
home-manager.users = inputs.self.lib.mkHomeManagerUsers lib config.my.shell.tools.users (user: {
|
||||
options.my.shell.tools.enable = lib.mkEnableOption "shell tools and utilities";
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
my.shell.tools.enable = lib.mkDefault hm.enabledByDefault;
|
||||
}
|
||||
(lib.mkIf cfg.enable {
|
||||
home.packages = builtins.attrValues {
|
||||
inherit (pkgs)
|
||||
ripgrep
|
||||
dust
|
||||
fd
|
||||
fzf
|
||||
gdu
|
||||
tealdeer
|
||||
trash-cli
|
||||
jq
|
||||
yq
|
||||
smartmontools
|
||||
rmlint
|
||||
;
|
||||
};
|
||||
programs = {
|
||||
hstr.enable = true;
|
||||
htop = {
|
||||
@@ -40,12 +64,12 @@ in
|
||||
config.pager = "less -FR";
|
||||
extraPackages = builtins.attrValues {
|
||||
inherit (pkgs.bat-extras)
|
||||
batman # man pages
|
||||
batpipe # piping
|
||||
batgrep # ripgrep
|
||||
batdiff # this is getting crazy!
|
||||
batwatch # probably my next best friend
|
||||
prettybat # trans your sourcecode!
|
||||
batman
|
||||
batpipe
|
||||
batgrep
|
||||
batdiff
|
||||
batwatch
|
||||
prettybat
|
||||
;
|
||||
};
|
||||
};
|
||||
@@ -60,7 +84,7 @@ in
|
||||
PASSWORD_STORE_NOPAGER = "false";
|
||||
PASSWORD_STORE_NOTIFICATIONS = "false";
|
||||
PASSWORD_STORE_PARSING = "true";
|
||||
PASSWORD_STORE_PATH = "/home/${user}/.local/share/pass";
|
||||
PASSWORD_STORE_PATH = "${config.home.homeDirectory}/.local/share/pass";
|
||||
PASSWORD_STORE_SAFECONTENT = "true";
|
||||
};
|
||||
};
|
||||
@@ -93,39 +117,11 @@ in
|
||||
fi
|
||||
'';
|
||||
};
|
||||
});
|
||||
programs = {
|
||||
starship.enable = true;
|
||||
tmux.enable = true;
|
||||
fzf.fuzzyCompletion = true;
|
||||
neovim = {
|
||||
enable = true;
|
||||
vimAlias = true;
|
||||
home.sessionVariables = {
|
||||
HISTFILE = "\${XDG_STATE_HOME}/bash/history";
|
||||
LESSHISTFILE = "-";
|
||||
RIPGREP_CONFIG_PATH = "\${XDG_CONFIG_HOME}/ripgrep/ripgreprc";
|
||||
};
|
||||
};
|
||||
users.users =
|
||||
let
|
||||
packages = builtins.attrValues {
|
||||
inherit (pkgs)
|
||||
ripgrep # modern grep
|
||||
dust # rusty du similar to gdu
|
||||
fd # modern find, faster searches
|
||||
fzf # fuzzy finder! super cool and useful
|
||||
gdu # disk-space utility checker, somewhat useful
|
||||
tealdeer # man for retards
|
||||
trash-cli # oop! did not meant to delete that
|
||||
jq # json parser
|
||||
yq # yaml parser
|
||||
smartmontools # check hard drie health
|
||||
rmlint # amazing dupe finder that integrates well with BTRFS
|
||||
;
|
||||
};
|
||||
in
|
||||
inputs.self.lib.mkUserPackages lib config.my.shell.tools.users packages;
|
||||
environment.variables = {
|
||||
HISTFILE = "\${XDG_STATE_HOME}/bash/history";
|
||||
LESSHISTFILE = "-";
|
||||
RIPGREP_CONFIG_PATH = "\${XDG_CONFIG_HOME}/ripgrep/ripgreprc";
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
||||
27
modules/shell/tools/nixos.nix
Normal file
27
modules/shell/tools/nixos.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
options.my.shell.tools = {
|
||||
enable = lib.mkEnableOption "shell tools and utilities";
|
||||
users = lib.mkOption {
|
||||
type = inputs.self.lib.usersOptionType lib;
|
||||
default = config.my.toggleUsers.shell;
|
||||
description = "Users to install shell tools for";
|
||||
};
|
||||
};
|
||||
config = lib.mkIf config.my.shell.tools.enable {
|
||||
programs = {
|
||||
starship.enable = true;
|
||||
tmux.enable = true;
|
||||
fzf.fuzzyCompletion = true;
|
||||
neovim = {
|
||||
enable = true;
|
||||
vimAlias = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user