mirror of
https://github.com/nmasur/dotfiles
synced 2025-02-07 09:52:03 +00:00
packaging stuff up
This commit is contained in:
parent
0ebd0bac2c
commit
b123ae3e69
@ -1,15 +1,9 @@
|
|||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
|
|
||||||
|
# TODO: just replace with packages instead of apps
|
||||||
|
|
||||||
type = "app";
|
type = "app";
|
||||||
|
|
||||||
program = builtins.toString (
|
program = "${pkgs.loadkey}/bin/loadkey";
|
||||||
pkgs.writeShellScript "loadkey" ''
|
|
||||||
printf "\nEnter the seed phrase for your SSH key...\n"
|
|
||||||
printf "\nThen press ^D when complete.\n\n"
|
|
||||||
mkdir -p ~/.ssh/
|
|
||||||
${pkgs.melt}/bin/melt restore ~/.ssh/id_ed25519
|
|
||||||
printf "\n\nContinuing activation.\n\n"
|
|
||||||
''
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
{ ... }:
|
|
||||||
{
|
|
||||||
|
|
||||||
imports = [
|
|
||||||
./dotfiles.nix
|
|
||||||
./notes.nix
|
|
||||||
];
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
{
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
|
|
||||||
# Allows me to make sure I can work on my dotfiles locally
|
|
||||||
|
|
||||||
options.dotfiles.enable = lib.mkEnableOption "Clone dotfiles.";
|
|
||||||
|
|
||||||
config = lib.mkIf config.dotfiles.enable {
|
|
||||||
|
|
||||||
home-manager.users.${config.user} = {
|
|
||||||
|
|
||||||
home.activation = {
|
|
||||||
|
|
||||||
# Always clone dotfiles repository if it doesn't exist
|
|
||||||
cloneDotfiles = config.home-manager.users.${config.user}.lib.dag.entryAfter [ "writeBoundary" ] ''
|
|
||||||
if [ ! -d "${config.dotfilesPath}" ]; then
|
|
||||||
$DRY_RUN_CMD mkdir --parents $VERBOSE_ARG $(dirname "${config.dotfilesPath}")
|
|
||||||
$DRY_RUN_CMD ${pkgs.git}/bin/git \
|
|
||||||
clone ${config.dotfilesRepo} "${config.dotfilesPath}"
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
# Set a variable for dotfiles repo, not necessary but convenient
|
|
||||||
home.sessionVariables.DOTS = config.dotfilesPath;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
{
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
|
|
||||||
config = {
|
|
||||||
home-manager.users.${config.user} = {
|
|
||||||
|
|
||||||
programs.bash = {
|
|
||||||
enable = true;
|
|
||||||
shellAliases = config.home-manager.users.${config.user}.programs.fish.shellAliases;
|
|
||||||
initExtra = "";
|
|
||||||
profileExtra = "";
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.starship.enableBashIntegration = false;
|
|
||||||
programs.zoxide.enableBashIntegration = true;
|
|
||||||
programs.fzf.enableBashIntegration = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
7
overlays/pkgs.nix
Normal file
7
overlays/pkgs.nix
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
_final: prev:
|
||||||
|
|
||||||
|
{
|
||||||
|
loadkey = prev.callPackage ../pkgs/tools/misc/loadkey.nix;
|
||||||
|
aws-ec2 = prev.callPackage ../pkgs/tools/misc/aws-ec2/;
|
||||||
|
docker-cleanup = prev.callPackage ../pkgs/tools/misc/docker-cleanup/;
|
||||||
|
}
|
12
pkgs/tools/misc/aws-ec2/package.nix
Normal file
12
pkgs/tools/misc/aws-ec2/package.nix
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
pkgs.writeShellApplication {
|
||||||
|
name = "aws-ec2";
|
||||||
|
runtimeInputs = [
|
||||||
|
pkgs.awscli2
|
||||||
|
pkgs.jq
|
||||||
|
pkgs.fzf
|
||||||
|
pkgs.ssm-session-manager-plugin
|
||||||
|
];
|
||||||
|
text = builtins.readFile ./aws-ec2.sh;
|
||||||
|
}
|
11
pkgs/tools/misc/docker-cleanup/package.nix
Normal file
11
pkgs/tools/misc/docker-cleanup/package.nix
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
pkgs.writeShellApplication {
|
||||||
|
name = "docker-cleanup";
|
||||||
|
runtimeInputs = [
|
||||||
|
pkgs.docker-client
|
||||||
|
pkgs.gawk
|
||||||
|
pkgs.gnugrep
|
||||||
|
];
|
||||||
|
text = builtins.readFile ./docker-cleanup.sh;
|
||||||
|
}
|
@ -10,6 +10,8 @@ else
|
|||||||
input=$1
|
input=$1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# TODO: make available on non-macOS
|
||||||
|
|
||||||
echo '' |
|
echo '' |
|
||||||
fzf --phony \
|
fzf --phony \
|
||||||
--height 100% \
|
--height 100% \
|
10
pkgs/tools/misc/jqr/package.nix
Normal file
10
pkgs/tools/misc/jqr/package.nix
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
pkgs.writeShellApplication {
|
||||||
|
name = "jqr";
|
||||||
|
runtimeInputs = [
|
||||||
|
pkgs.jq
|
||||||
|
pkgs.fzf
|
||||||
|
];
|
||||||
|
text = builtins.readFile ./jqr.sh;
|
||||||
|
}
|
9
pkgs/tools/misc/loadkey.nix
Normal file
9
pkgs/tools/misc/loadkey.nix
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
pkgs.writeShellScriptBin "loadkey" ''
|
||||||
|
printf "\nEnter the seed phrase for your SSH key...\n"
|
||||||
|
printf "\nThen press ^D when complete.\n\n"
|
||||||
|
mkdir -p ~/.ssh/
|
||||||
|
${pkgs.melt}/bin/melt restore ~/.ssh/id_ed25519
|
||||||
|
printf "\n\nContinuing activation.\n\n"
|
||||||
|
''
|
7
pkgs/tools/misc/ocr/package.nix
Normal file
7
pkgs/tools/misc/ocr/package.nix
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
pkgs.writeShellApplication {
|
||||||
|
name = "ocr";
|
||||||
|
runtimeInputs = [ pkgs.tesseract ];
|
||||||
|
text = builtins.readFile ./ocr.sh;
|
||||||
|
}
|
11
pkgs/tools/misc/terraform-init/package.nix
Normal file
11
pkgs/tools/misc/terraform-init/package.nix
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
pkgs.writeShellApplication {
|
||||||
|
name = "terraform-init";
|
||||||
|
runtimeInputs = [
|
||||||
|
pkgs.gawk
|
||||||
|
pkgs.git
|
||||||
|
pkgs.terraform
|
||||||
|
];
|
||||||
|
text = builtins.readFile ./terraform-init.sh;
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.nmasur.presets.services.dotfiles;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
|
||||||
|
# Allows me to make sure I can work on my dotfiles locally
|
||||||
|
|
||||||
|
options.nmasur.preset.services.dotfiles = {
|
||||||
|
enable = lib.mkEnableOption "Clone dotfiles repository";
|
||||||
|
repo = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Git repo containing dotfiles";
|
||||||
|
default = "git@github.com:nmasur/dotfiles";
|
||||||
|
};
|
||||||
|
path = lib.mkOption {
|
||||||
|
type = lib.types.path;
|
||||||
|
description = "Path to dotfiles on disk";
|
||||||
|
default = config.homePath + "/dev/personal/dotfiles";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
|
||||||
|
home.activation = {
|
||||||
|
|
||||||
|
# Always clone dotfiles repository if it doesn't exist
|
||||||
|
cloneDotfiles = config.lib.dag.entryAfter [ "writeBoundary" "loadkey" ] ''
|
||||||
|
if [ ! -d "${cfg.path}" ]; then
|
||||||
|
run mkdir --parents $VERBOSE_ARG $(dirname "${cfg.path}")
|
||||||
|
run ${pkgs.git}/bin/git \
|
||||||
|
clone ${cfg.repo} "${cfg.path}"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# Set a variable for dotfiles repo, not necessary but convenient
|
||||||
|
home.sessionVariables.DOTS = cfg.path;
|
||||||
|
};
|
||||||
|
}
|
@ -18,13 +18,16 @@ in
|
|||||||
home.activation = {
|
home.activation = {
|
||||||
|
|
||||||
# Always load the key if it doesn't exist
|
# Always load the key if it doesn't exist
|
||||||
cloneDotfiles = config.lib.dag.entryAfter [ "writeBoundary" ] ''
|
loadkey = config.lib.dag.entryAfter [ "writeBoundary" ] ''
|
||||||
|
if [ ! -d ~/.ssh ]; then
|
||||||
|
run mkdir --parents $VERBOSE_ARG ~/.ssh/
|
||||||
|
fi
|
||||||
if [ ! -f ~/.ssh/id_ed25519 ]; then
|
if [ ! -f ~/.ssh/id_ed25519 ]; then
|
||||||
run mkdir -p ~/.ssh/
|
printf "\nEnter the seed phrase for your SSH key...\n"
|
||||||
|
printf "\nThen press ^D when complete.\n\n"
|
||||||
$DRY_RUN_CMD mkdir --parents $VERBOSE_ARG $(dirname "${config.dotfilesPath}")
|
mkdir -p ~/.ssh/
|
||||||
$DRY_RUN_CMD ${pkgs.git}/bin/git \
|
${pkgs.melt}/bin/melt restore ~/.ssh/id_ed25519
|
||||||
clone ${config.dotfilesRepo} "${config.dotfilesPath}"
|
printf "\n\nContinuing activation.\n\n"
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
@ -4,19 +4,18 @@
|
|||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.nmasur.presets.services.notes-git-sync;
|
||||||
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
options.nmasur.presets.services.notes-git-sync.enable = lib.mkEnableOption "Sync notes to folder";
|
||||||
|
|
||||||
# This is just a placeholder as I expect to interact with my notes in a
|
config = lib.mkIf cfg.enable {
|
||||||
# certain location
|
|
||||||
|
|
||||||
home-manager.users.${config.user} = {
|
|
||||||
|
|
||||||
home.sessionVariables = {
|
|
||||||
NOTES_PATH = "${config.homePath}/dev/personal/notes/content";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Sync notes for Nextcloud automatically
|
# Sync notes for Nextcloud automatically
|
||||||
systemd.user.timers.refresh-notes = lib.mkIf config.services.nextcloud.enable {
|
systemd.user.timers.refresh-notes = {
|
||||||
Timer = {
|
Timer = {
|
||||||
OnCalendar = "*-*-* *:0/10:50"; # Every 10 minutes
|
OnCalendar = "*-*-* *:0/10:50"; # Every 10 minutes
|
||||||
Unit = "refresh-notes.service";
|
Unit = "refresh-notes.service";
|
Loading…
x
Reference in New Issue
Block a user