refactor(flake-parts): initial flake-parts configuration

This commit is contained in:
ooks-io 2024-05-13 22:50:56 +12:00
parent 8f67be9e68
commit 5603001d65
230 changed files with 380 additions and 717 deletions

View file

@ -1,28 +0,0 @@
{ lib, ... }:
{
imports = [
./nixIndex
./git
./tools
./ssh
./transientServices
];
options.homeModules.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";
};
transientServices = {
enable = lib.mkEnableOption "Enable various console transientServices";
};
};
}

View file

@ -1,25 +0,0 @@
{ pkgs, config, lib, ... }:
let
cfg = config.homeModules.console.utility.git;
in
{
config = lib.mkIf cfg.enable {
programs.git = {
enable = true;
package = pkgs.gitAndTools.gitFull;
userName = "ooks-io";
userEmail = "ooks@protonmail.com";
extraConfig = {
gpg."ssh".program = "${pkgs._1password-gui}/bin/op-ssh-sign";
};
ignores = [ ".direnv" "result" ];
lfs.enable = true;
};
home.packages = with pkgs; [
git-credential-1password
lazygit
];
};
}

View file

@ -1,38 +0,0 @@
{ pkgs, config, lib, ... }:
let
cfg = config.homeModules.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" ]; };
};
};
}

View file

@ -1,24 +0,0 @@
{ lib, config, ... }:
let
cfg = config.homeModules.console.utility.ssh;
hasFish = mkIf config.homeModules.console.shell.fish.enable;
inherit (lib) mkIf;
in
{
config = mkIf cfg.enable {
programs.ssh = {
enable = true;
extraConfig = /* config */''
Host *
IdentityAgent "~/.1password/agent.sock"
'';
};
programs.fish.interactiveShellInit = hasFish ''
set -gx SSH_AUTH_SOCK ~/.1password/agent.sock
'';
};
}

View file

@ -1,77 +0,0 @@
{ pkgs, lib, config, ... }:
let
cfg = config.homeModules.console.utility.tools;
in
{
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
bc # Calculator
# file utility
duf
du-dust
fd
ripgrep
# archive
zip
unzip
unrar
# file transfer
wget
httpie # Better curl
# resource manager
powertop
#shell scripting
gum
# audio ctrl
pamixer
diffsitter # Better diff
jq # JSON pretty printer and manipulator
comma # Install and run with ","
tldr # Community maintained help pages
progress
killall
acpi
# Notifications
libnotify
# 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.homeModules.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 {}'"
];
};
};
};
}

View file

@ -1,33 +0,0 @@
# taken from github:NotAShelf/fufexan
{ pkgs, config, lib, ... }:
let
cfg = config.homeModules.console.utility.transientServices;
apply-hm-env = pkgs.writeShellScript "apply-hm-env" ''
${lib.optionalString (config.home.sessionPath != []) ''
export PATH=${builtins.concatStringsSep ":" config.home.sessionPath}:$PATH
''}
${builtins.concatStringsSep "\n" (lib.mapAttrsToList (k: v: ''
export ${k}=${toString v}
'')
config.home.sessionVariables)}
${config.home.sessionVariablesExtra}
exec "$@"
'';
# runs processes as systemd transient services
run-as-service = pkgs.writeShellScriptBin "run-as-service" ''
exec ${pkgs.systemd}/bin/systemd-run \
--slice=app-manual.slice \
--property=ExitType=cgroup \
--user \
--wait \
bash -lc "exec ${apply-hm-env} $@"
'';
in
{
config = lib.mkIf cfg.enable {
home = {
packages = [run-as-service];
};
};
}