wip(home): refactor home modules *WILL NOT BUILD*
This commit is contained in:
parent
2033810429
commit
6a591ecbf7
115 changed files with 1028 additions and 791 deletions
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
imports = [
|
||||
./starship.nix
|
||||
];
|
||||
}
|
||||
18
home/modules/console/tools/bat.nix
Normal file
18
home/modules/console/tools/bat.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{ lib, config, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
cfg = config.ooknet.tools.bat;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
programs.bat = {
|
||||
enable = true;
|
||||
config = {
|
||||
theme = "base16";
|
||||
pager = "less -FR";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
14
home/modules/console/tools/btop.nix
Normal file
14
home/modules/console/tools/btop.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{ lib, config, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
cfg = config.ooknet.tools.btop;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
programs.btop = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
14
home/modules/console/tools/default.nix
Normal file
14
home/modules/console/tools/default.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
imports = [
|
||||
./bat.nix
|
||||
./eza.nix
|
||||
./btop.nix
|
||||
./direnv.nix
|
||||
./fzf.nix
|
||||
./nixIndex.nix
|
||||
./git.nix
|
||||
./starship.nix
|
||||
./utils.nix
|
||||
./ssh.nix
|
||||
];
|
||||
}
|
||||
15
home/modules/console/tools/direnv.nix
Normal file
15
home/modules/console/tools/direnv.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{ lib, config, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
cfg = config.ooknet.tools.direnv;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
14
home/modules/console/tools/eza.nix
Normal file
14
home/modules/console/tools/eza.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{ lib, config, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
cfg = config.ooknet.tools.eza;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
programs.eza = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
25
home/modules/console/tools/fzf.nix
Normal file
25
home/modules/console/tools/fzf.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{ lib, config, osConfig, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
admin = osConfig.ooknet.host.admin;
|
||||
cfg = config.ooknet.tools.fzf;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
fzf = {
|
||||
enable = true;
|
||||
enableFishIntegration = mkIf (admin.shell == "fish") true;
|
||||
defaultCommand = "rg --files --hidden";
|
||||
changeDirWidgetOptions = [
|
||||
"--preview 'eza --icons -L 3 -T --color always {} | head -200'"
|
||||
"--exact"
|
||||
];
|
||||
fileWidgetCommand = "rg --files";
|
||||
fileWidgetOptions = [
|
||||
"--preview 'bat --color=always {}'"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,14 +1,16 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
{ pkgs, config, lib, osConfig, ... }:
|
||||
let
|
||||
cfg = config.ooknet.console.utility.git;
|
||||
inherit (lib) mkIf;
|
||||
cfg = config.ooknet.tools.git;
|
||||
admin = osConfig.ooknet.host.admin;
|
||||
in
|
||||
{
|
||||
config = lib.mkIf cfg.enable {
|
||||
config = mkIf cfg.enable {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
package = pkgs.gitAndTools.gitFull;
|
||||
userName = "ooks-io";
|
||||
userEmail = "ooks@protonmail.com";
|
||||
userName = admin.gitName;
|
||||
userEmail = admin.gitEmail;
|
||||
extraConfig = {
|
||||
gpg."ssh".program = "${pkgs._1password-gui}/bin/op-ssh-sign";
|
||||
};
|
||||
21
home/modules/console/tools/nixIndex.nix
Normal file
21
home/modules/console/tools/nixIndex.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{ lib, config, inputs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
cfg = config.ooknet.tools.nixIndex;
|
||||
in
|
||||
|
||||
{
|
||||
imports = [ inputs.nix-index-db.hmModules.nix-index ];
|
||||
config = mkIf cfg.enable {
|
||||
programs = {
|
||||
nix-index = {
|
||||
enable = true;
|
||||
symlinkToCacheHome = true;
|
||||
};
|
||||
command-not-found.enable = false;
|
||||
nix-index-database.comma.enable = true;
|
||||
};
|
||||
home.sessionVariables.NIX_AUTO_RUN = "1";
|
||||
};
|
||||
}
|
||||
|
|
@ -1,13 +1,12 @@
|
|||
{ lib, config, ... }:
|
||||
{ lib, config, osConfig, ... }:
|
||||
|
||||
let
|
||||
cfg = config.ooknet.console.utility.ssh;
|
||||
hasFish = mkIf config.ooknet.console.shell.fish.enable;
|
||||
inherit (lib) mkIf;
|
||||
cfg = config.ooknet.tools.ssh;
|
||||
admin = osConfig.ooknet.host.admin;
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
|
|
@ -16,7 +15,7 @@ in
|
|||
IdentityAgent "~/.1password/agent.sock"
|
||||
'';
|
||||
};
|
||||
programs.fish.interactiveShellInit = hasFish /* fish */ ''
|
||||
programs.fish.interactiveShellInit = mkIf (admin.shell == "fish") /* fish */ ''
|
||||
set -gx SSH_AUTH_SOCK ~/.1password/agent.sock
|
||||
'';
|
||||
};
|
||||
|
|
@ -1,12 +1,11 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.ooknet.console.prompt.starship;
|
||||
inherit (lib) concatStrings mkEnableOption mkIf;
|
||||
cfg = config.ooknet.tools.starship;
|
||||
inherit (lib) concatStrings mkIf;
|
||||
in
|
||||
|
||||
{
|
||||
options.ooknet.console.prompt.starship.enable = mkEnableOption "";
|
||||
config = mkIf cfg.enable {
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
|
|
@ -44,34 +44,5 @@ in
|
|||
# Nix tooling
|
||||
alejandra
|
||||
];
|
||||
|
||||
programs = {
|
||||
btop.enable = true;
|
||||
eza.enable = true;
|
||||
bat = {
|
||||
enable = true;
|
||||
config = {
|
||||
theme = "base16";
|
||||
pager = "less -FR";
|
||||
};
|
||||
};
|
||||
direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
fzf = {
|
||||
enable = true;
|
||||
enableFishIntegration = lib.mkIf config.ooknet.console.shell.fish.enable true;
|
||||
defaultCommand = "rg --files --hidden";
|
||||
changeDirWidgetOptions = [
|
||||
"--preview 'eza --icons -L 3 -T --color always {} | head -200'"
|
||||
"--exact"
|
||||
];
|
||||
fileWidgetCommand = "rg --files";
|
||||
fileWidgetOptions = [
|
||||
"--preview 'bat --color=always {}'"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
{ lib, ... }:
|
||||
{
|
||||
imports = [
|
||||
./nixIndex
|
||||
./git
|
||||
./tools
|
||||
./ssh
|
||||
];
|
||||
|
||||
options.ooknet.console.utility = {
|
||||
nixIndex = {
|
||||
enable = lib.mkEnableOption "Enable nixIndex configuration";
|
||||
};
|
||||
git = {
|
||||
enable = lib.mkEnableOption "Enable git + tools";
|
||||
};
|
||||
ssh = {
|
||||
enable = lib.mkEnableOption "Enable various console ssh";
|
||||
};
|
||||
tools = {
|
||||
enable = lib.mkEnableOption "Enable various console tools";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
let
|
||||
cfg = config.ooknet.console.utility.nixIndex;
|
||||
update-script = pkgs.writeShellApplication {
|
||||
name = "fetch-nix-index-database";
|
||||
runtimeInputs = with pkgs; [ wget coreutils ];
|
||||
text = ''
|
||||
filename="index-x86_64-linux"
|
||||
mkdir -p ~/.cache/nix-index
|
||||
cd ~/.cache/nix-index
|
||||
wget -N "https://github.com/Mic92/nix-index-database/releases/latest/download/$filename"
|
||||
ln -f "$filename" files
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.nix-index.enable = true;
|
||||
|
||||
systemd.user.services.nix-index-database-sync = {
|
||||
Unit = { Description = "fetch mic92/nix-index-database"; };
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${update-script}/bin/fetch-nix-index-database";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "5m";
|
||||
};
|
||||
};
|
||||
systemd.user.timers.nix-index-database-sync = {
|
||||
Unit = { Description = "Automatic github:mic92/nix-index-database fetching"; };
|
||||
Timer = {
|
||||
OnBootSec = "10m";
|
||||
OnUnitActiveSec = "24h";
|
||||
};
|
||||
Install = { WantedBy = [ "timers.target" ]; };
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue