Tarsnap, nix shell tweaks, services
parent
609291820e
commit
cd209ea820
|
@ -48,7 +48,7 @@ in
|
||||||
homebrew.masApps = {
|
homebrew.masApps = {
|
||||||
Bitwarden = 1352778147;
|
Bitwarden = 1352778147;
|
||||||
Spark = 1176895641;
|
Spark = 1176895641;
|
||||||
Wireguard = 1451685025;
|
Tailscale = 1475387142;
|
||||||
Xcode = 497799835;
|
Xcode = 497799835;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ in
|
||||||
|
|
||||||
# Configuration related to casks
|
# Configuration related to casks
|
||||||
environment.variables.SSH_AUTH_SOCK = mkIfCaskPresent "secretive"
|
environment.variables.SSH_AUTH_SOCK = mkIfCaskPresent "secretive"
|
||||||
"/Users/${config.users.primaryUser.username}/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/socket.ssh";
|
"${config.home.homeDirectory}/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/socket.ssh";
|
||||||
|
|
||||||
# For cli packages that aren't currently available for macOS in `nixpkgs`.Packages should be
|
# For cli packages that aren't currently available for macOS in `nixpkgs`.Packages should be
|
||||||
# installed in `../home/default.nix` whenever possible.
|
# installed in `../home/default.nix` whenever possible.
|
||||||
|
@ -98,6 +98,7 @@ in
|
||||||
"fileicon"
|
"fileicon"
|
||||||
"fzf"
|
"fzf"
|
||||||
"gifsicle"
|
"gifsicle"
|
||||||
|
"tarsnap"
|
||||||
"unison-language"
|
"unison-language"
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -274,7 +274,10 @@
|
||||||
# configs
|
# configs
|
||||||
configs-starship-symbols = import ./home/configs/starship-symbols.nix;
|
configs-starship-symbols = import ./home/configs/starship-symbols.nix;
|
||||||
copyApplications = import ./home/copyApplications.nix;
|
copyApplications = import ./home/copyApplications.nix;
|
||||||
dark-mode-notify-service = import ./home/dark-mode-notify-service.nix;
|
# services
|
||||||
|
dark-mode-notify-service = import ./home/services/dark-mode-notify.nix;
|
||||||
|
tarsnap-service = import ./home/services/tarsnap.nix;
|
||||||
|
# etc
|
||||||
files = import ./home/files.nix;
|
files = import ./home/files.nix;
|
||||||
fish = import ./home/fish.nix;
|
fish = import ./home/fish.nix;
|
||||||
git = import ./home/git.nix;
|
git = import ./home/git.nix;
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
{ pkgs, ... }: {
|
|
||||||
# dark-mode-notify configuration
|
|
||||||
# {{{
|
|
||||||
launchd.agents.dark-mode-notify = {
|
|
||||||
enable = true;
|
|
||||||
config = {
|
|
||||||
Label = "ke.bou.dark-mode-notify";
|
|
||||||
KeepAlive = true;
|
|
||||||
StandardErrorPath = null;
|
|
||||||
StandardOutPath = null;
|
|
||||||
ProgramArguments = [
|
|
||||||
"${pkgs.dark-mode-notify}/bin/dark-mode-notify"
|
|
||||||
"${pkgs.fish}/bin/fish"
|
|
||||||
"-c"
|
|
||||||
"set-background-to-env DARKMODE"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
# }}}
|
|
||||||
}
|
|
|
@ -5,11 +5,21 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
home.file.".pijulconfig".text = ''
|
home.file = {
|
||||||
[author]
|
".pijulconfig".text = ''
|
||||||
name = "mat"
|
[author]
|
||||||
full_name = "${config.programs.git.userName}"
|
name = "${config.home.primaryUser.username}"
|
||||||
email = "${config.programs.git.userEmail}"
|
full_name = "${config.home.primaryUser.fullName}"
|
||||||
'';
|
email = "${config.home.primaryUser.email}"
|
||||||
|
'';
|
||||||
|
".tarsnaprc".text = ''
|
||||||
|
cachedir ${config.xdg.cacheHome}
|
||||||
|
keyfile ${config.xdg.configHome}/tarsnap/read-write-delete.key
|
||||||
|
nodump
|
||||||
|
print-stats
|
||||||
|
checkpoint-bytes 1G
|
||||||
|
humanize-numbers
|
||||||
|
'';
|
||||||
|
};
|
||||||
# }}}
|
# }}}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,7 @@
|
||||||
programs.fish.enable = true;
|
programs.fish.enable = true;
|
||||||
|
|
||||||
# Add Fish plugins
|
# Add Fish plugins
|
||||||
home.packages = with pkgs.fishPlugins; [
|
home.packages = with pkgs.fishPlugins; [ done ];
|
||||||
done
|
|
||||||
];
|
|
||||||
|
|
||||||
programs.fish.plugins = [
|
programs.fish.plugins = [
|
||||||
{
|
{
|
||||||
|
@ -154,7 +152,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
darwin-rebuild-edit-with = {
|
darwin-rebuild-edit-with = {
|
||||||
argumentNames = [ "file" "editor" ];
|
argumentNames = [ "editor" "file" ];
|
||||||
body = ''
|
body = ''
|
||||||
if test -z "$file"
|
if test -z "$file"
|
||||||
set file flake.nix
|
set file flake.nix
|
||||||
|
@ -162,6 +160,13 @@
|
||||||
from-nix $editor $file
|
from-nix $editor $file
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nix-unfree = {
|
||||||
|
argumentNames = [ "cmd" ];
|
||||||
|
body = ''
|
||||||
|
env NIX_ALLOW_UNFREE=1 nix $cmd --impure
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
@ -170,11 +175,11 @@
|
||||||
# Aliases
|
# Aliases
|
||||||
programs.fish.shellAliases =
|
programs.fish.shellAliases =
|
||||||
let
|
let
|
||||||
nixConfigDir = "${config.home.homeDirectory}/dotfiles.nix";
|
inherit (config.home.primaryUser) nixConfigDirectory;
|
||||||
in
|
in
|
||||||
with pkgs; {
|
with pkgs; {
|
||||||
# Nix related
|
# Nix related
|
||||||
from-nix = "from-dir ${nixConfigDir}";
|
from-nix = "from-dir ${nixConfigDirectory}";
|
||||||
# darwin-rebuild build
|
# darwin-rebuild build
|
||||||
drb = "from-nix darwin-rebuild build --flake .";
|
drb = "from-nix darwin-rebuild build --flake .";
|
||||||
# darwin-rebuild switch full
|
# darwin-rebuild switch full
|
||||||
|
@ -182,19 +187,22 @@
|
||||||
# darwin-rebuild switch (no homebrew)
|
# darwin-rebuild switch (no homebrew)
|
||||||
drs = "from-nix darwin-rebuild switch --flake . --override-input homebrew-enabled github:boolean-option/false";
|
drs = "from-nix darwin-rebuild switch --flake . --override-input homebrew-enabled github:boolean-option/false";
|
||||||
# edit darwin-rebuild config in code/codium
|
# edit darwin-rebuild config in code/codium
|
||||||
drc = "code ${nixConfigDir}";
|
drc = "code ${nixConfigDirectory}";
|
||||||
# edit darwin-rebuild config in vim
|
# edit darwin-rebuild config in vim
|
||||||
drv = "vim ${nixConfigDir}";
|
drv = "vim ${nixConfigDirectory}";
|
||||||
# edit darwin-rebuild config in helix
|
# edit darwin-rebuild config in helix
|
||||||
drh = "darwin-rebuild-edit-with hx";
|
drh = "darwin-rebuild-edit-with hx";
|
||||||
flakeup = "nix flake update ${nixConfigDir}/";
|
flakeup = "nix flake update ${nixConfigDirectory}/";
|
||||||
nb = "nix build";
|
nb = "nix build";
|
||||||
nd = "nix develop";
|
nd = "nix develop";
|
||||||
nf = "nix flake";
|
nf = "nix flake";
|
||||||
nr = "nix run";
|
nr = "nix run";
|
||||||
|
nru = "nix-unfree run";
|
||||||
ns = "nix search nixpkgs";
|
ns = "nix search nixpkgs";
|
||||||
nsh = "nix shell";
|
nsh = "nix shell";
|
||||||
nrp = "nix repl --expr '{pkgs=(import <nixpkgs> {});}'";
|
nshu = "nix-unfree shell";
|
||||||
|
nrp = "nix repl --expr '{ pkgs = (import <nixpkgs> { }); }'";
|
||||||
|
nrpu = "nix repl --expr '{ pkgs = (import <nixpkgs> { config.allowUnfree = true; }); }' --impure";
|
||||||
|
|
||||||
# Other
|
# Other
|
||||||
".." = "cd ..";
|
".." = "cd ..";
|
||||||
|
@ -212,7 +220,7 @@
|
||||||
tb = "toggle-background";
|
tb = "toggle-background";
|
||||||
} // lib.optionalAttrs stdenv.isDarwin {
|
} // lib.optionalAttrs stdenv.isDarwin {
|
||||||
sb = "set-background-to-macOS";
|
sb = "set-background-to-macOS";
|
||||||
conda-init = "eval /opt/homebrew/Caskroom/miniforge/base/bin/conda 'shell.fish' 'hook' $argv | source";
|
conda-init = "eval /opt/homebrew/bin/conda 'shell.fish' 'hook' $argv | source";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Configuration that should be above `loginShellInit` and `interactiveShellInit`.
|
# Configuration that should be above `loginShellInit` and `interactiveShellInit`.
|
||||||
|
|
|
@ -51,8 +51,7 @@
|
||||||
UseKeychain = "yes";
|
UseKeychain = "yes";
|
||||||
AddKeysToAgent = "yes";
|
AddKeysToAgent = "yes";
|
||||||
} // lib.optionalAttrs pkgs.stdenv.isDarwin {
|
} // lib.optionalAttrs pkgs.stdenv.isDarwin {
|
||||||
# TODO: gate this behind a check if the cask is present
|
IdentityAgent = "${config.home.homeDirectory}/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/socket.ssh";
|
||||||
IdentityAgent = "~/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/socket.ssh";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
# vscode
|
# vscode
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
{ pkgs, ... }: {
|
||||||
|
# dark-mode-notify configuration
|
||||||
|
# {{{
|
||||||
|
launchd.agents.dark-mode-notify =
|
||||||
|
let logPath = "/var/log/dark-mode-notify"; in
|
||||||
|
{
|
||||||
|
enable = true;
|
||||||
|
config = {
|
||||||
|
Label = "ke.bou.dark-mode-notify";
|
||||||
|
KeepAlive = true;
|
||||||
|
StandardErrorPath = "${logPath}/error.log";
|
||||||
|
StandardOutPath = "${logPath}/out.log";
|
||||||
|
ProgramArguments = [
|
||||||
|
"${pkgs.dark-mode-notify}/bin/dark-mode-notify"
|
||||||
|
"${pkgs.fish}/bin/fish"
|
||||||
|
"-c"
|
||||||
|
"set-background-to-env DARKMODE"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
# }}}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
{ config, pkgs, ... }: {
|
||||||
|
# tarsnap periodic backup configuration
|
||||||
|
# {{{
|
||||||
|
launchd.agents.tarsnap =
|
||||||
|
let
|
||||||
|
logPath = "/var/log/tarsnap";
|
||||||
|
tarsnapBackup = pkgs.writeShellScriptBin "tarsnap-backup-helper" ''
|
||||||
|
/opt/homebrew/bin/tarsnap -v -c \
|
||||||
|
--configfile ${config.home.homeDirectory}/.tarsnaprc \
|
||||||
|
-f $(uname -n)-$(date -u +%Y-%m-%dT%H:%M:%SZ) \
|
||||||
|
${config.home.homeDirectory}/{dotfiles.nix,Desktop,Development,Documents,Downloads}
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
{
|
||||||
|
enable = true;
|
||||||
|
config = {
|
||||||
|
Label = "com.tarsnap.tarsnap";
|
||||||
|
StandardErrorPath = "${logPath}/error.log";
|
||||||
|
StandardOutPath = "${logPath}/out.log";
|
||||||
|
StartCalendarInterval = [
|
||||||
|
{
|
||||||
|
# every sunday
|
||||||
|
Weekday = 0;
|
||||||
|
# at midnight
|
||||||
|
Hour = 0;
|
||||||
|
Minute = 0;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
# every wednesday
|
||||||
|
Weekday = 3;
|
||||||
|
# at noon
|
||||||
|
Hour = 12;
|
||||||
|
Minute = 0;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
Program = "${tarsnapBackup}/bin/tarsnap-backup-helper";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
# }}}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue