This commit is contained in:
Lucy Hochkamp 2023-12-10 12:21:59 +01:00
parent 2707a0bd5d
commit defee15663
No known key found for this signature in database
7 changed files with 152 additions and 52 deletions

58
flake.lock generated
View file

@ -298,16 +298,16 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1699748081, "lastModified": 1702195709,
"narHash": "sha256-MOmMapBydd7MTjhX4eeQZzKlCABWw8W6iSHSG4OeFKE=", "narHash": "sha256-+zRjWkm5rKqQ57PuLZ3JF3xi3vPMiOJzItb1m/43Cq4=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "04bac349d585c9df38d78e0285b780a140dc74a4", "rev": "6761b8188b860f374b457eddfdb05c82eef9752f",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"ref": "release-23.05", "ref": "release-23.11",
"repo": "home-manager", "repo": "home-manager",
"type": "github" "type": "github"
} }
@ -484,16 +484,16 @@
}, },
"nixpkgs-darwin": { "nixpkgs-darwin": {
"locked": { "locked": {
"lastModified": 1700097215, "lastModified": 1702161203,
"narHash": "sha256-ODQ3gBTv1iHd7lG21H+ErVISB5wVeOhd/dEogOqHs/I=", "narHash": "sha256-nq40oP9Pk/bC9/3ShxUah2FWsyHcObtS2NU5rV8shXY=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "9fb122519e9cd465d532f736a98c1e1eb541ef6f", "rev": "901fc6ea49ca9e9bbf636c48e2611588802e7b16",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixpkgs-23.05-darwin", "ref": "nixpkgs-23.11-darwin",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@ -550,16 +550,16 @@
}, },
"nixpkgs_3": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1699994397, "lastModified": 1701952659,
"narHash": "sha256-xxNeIcMNMXH2EA9IAX6Cny+50mvY22LhIBiGZV363gc=", "narHash": "sha256-TJv2srXt6fYPUjxgLAL0cy4nuf1OZD4KuA1TrCiQqg0=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d4b5a67bbe9ef750bd2fdffd4cad400dd5553af8", "rev": "b4372c4924d9182034066c823df76d6eaf1f4ec4",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-23.05", "ref": "nixos-23.11",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@ -708,6 +708,8 @@
"spoons": "spoons", "spoons": "spoons",
"utils": "utils", "utils": "utils",
"x": "x", "x": "x",
"xonsh-direnv": "xonsh-direnv",
"xonsh-fish-completer": "xonsh-fish-completer",
"xynoblog": "xynoblog", "xynoblog": "xynoblog",
"zsh-completions": "zsh-completions", "zsh-completions": "zsh-completions",
"zsh-syntax-highlighting": "zsh-syntax-highlighting", "zsh-syntax-highlighting": "zsh-syntax-highlighting",
@ -828,6 +830,38 @@
"type": "github" "type": "github"
} }
}, },
"xonsh-direnv": {
"flake": false,
"locked": {
"lastModified": 1655602282,
"narHash": "sha256-h56Gx/MMCW4L6nGwLAhBkiR7bX+qfFk80LEsJMiDtjQ=",
"owner": "74th",
"repo": "xonsh-direnv",
"rev": "3bea5847b9459c5799c64966ec85e624d0be69b9",
"type": "github"
},
"original": {
"owner": "74th",
"repo": "xonsh-direnv",
"type": "github"
}
},
"xonsh-fish-completer": {
"flake": false,
"locked": {
"lastModified": 1685515780,
"narHash": "sha256-PV6u21iU0zR+xusqJmXKnosAKAS1iX7pEDx6bMPBjkE=",
"owner": "xonsh",
"repo": "xontrib-fish-completer",
"rev": "ed14c56eb7436aa9f3b6c4f299b1ce281b1b5364",
"type": "github"
},
"original": {
"owner": "xonsh",
"repo": "xontrib-fish-completer",
"type": "github"
}
},
"xynoblog": { "xynoblog": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [

View file

@ -5,12 +5,12 @@
utils.url = "github:numtide/flake-utils"; utils.url = "github:numtide/flake-utils";
## nixos/nix-darwin dependencies ## nixos/nix-darwin dependencies
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
nixpkgs-darwin.url = "github:NixOS/nixpkgs/nixpkgs-23.05-darwin"; nixpkgs-darwin.url = "github:NixOS/nixpkgs/nixpkgs-23.11-darwin";
nixpkgs-master.url = "github:NixOS/nixpkgs/master"; nixpkgs-master.url = "github:NixOS/nixpkgs/master";
agenix.url = "github:ryantm/agenix/main"; agenix.url = "github:ryantm/agenix/main";
agenix.inputs.nixpkgs.follows = "nixpkgs"; agenix.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager/release-23.05"; home-manager.url = "github:nix-community/home-manager/release-23.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
impermanence.url = "github:nix-community/impermanence"; impermanence.url = "github:nix-community/impermanence";
nixos-hardware.url = "github:NixOS/nixos-hardware/master"; nixos-hardware.url = "github:NixOS/nixos-hardware/master";
@ -58,6 +58,12 @@
agkozak-zsh-prompt.url = "github:agkozak/agkozak-zsh-prompt"; agkozak-zsh-prompt.url = "github:agkozak/agkozak-zsh-prompt";
agkozak-zsh-prompt.flake = false; agkozak-zsh-prompt.flake = false;
## xonsh
xonsh-fish-completer.url = "github:xonsh/xontrib-fish-completer";
xonsh-fish-completer.flake = false;
xonsh-direnv.url = "github:74th/xonsh-direnv";
xonsh-direnv.flake = false;
## hammerspoon ## hammerspoon
miro.url = "github:miromannino/miro-windows-manager"; miro.url = "github:miromannino/miro-windows-manager";
miro.flake = false; miro.flake = false;

View file

@ -19,5 +19,6 @@
run-shell -b '~/.config/tmux-switch-colors/start_theme_switcher.sh' run-shell -b '~/.config/tmux-switch-colors/start_theme_switcher.sh'
''; '';
}; };
home.file.".config/tmux-switch-colors".source = ./tmux-switch-colors; home.file.".config/tmux-switch-colors".source = ./tmux-switch-colors;
} }

View file

@ -1,12 +1,81 @@
{ pkgs, config, lib, inputs, ... }: { pkgs, config, lib, inputs, ... }:
let let
cfg = config.ragon.xonsh; cfg = config.ragon.xonsh;
xonsh =
pkgs.unstable.xonsh.override {
extraPackages = ps: [
(ps.buildPythonPackage {
pname = "xonsh-direnv";
version = "0.0.0";
src = inputs.xonsh-direnv;
})
(ps.buildPythonPackage {
pname = "xonsh-fish-completer";
version = "0.0.0";
format = "pyproject";
doCheck = false;
src = inputs.xonsh-fish-completer;
propagatedBuildInputs = [
ps.setuptools
];
})
];
};
in in
{ {
options.ragon.xonsh.enable = lib.mkOption { default = false; }; options.ragon.xonsh.enable = lib.mkOption { default = false; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = [
xonsh xonsh
]; ];
programs.fish.enable = true; # for completions
home.file.".xonshrc".text = ''
$PROMPT_FIELDS['rootuser'] = lambda: "{RED}{user}{RESET}" if $USER == "root" else None
$PROMPT_FIELDS['sshhostname'] = lambda: "{user}@{hostname}" if "SSH_TTY" in ''${...} else $PROMPT_FIELDS['rootuser']()
$PROMPT = '{gitstatus:{RESET}[{}{RESET}] }{sshhostname:{} }{BOLD_GREEN}{short_cwd}{RED}{last_return_code_if_nonzero: [{BOLD_INTENSE_RED}{}{RED}] }{RESET}{BOLD_BLUE}{RESET}> '
$VI_MODE = True
aliases['v'] = "nvim"
aliases['c'] = "code"
aliases['vim'] = "nvim"
aliases['gpl'] = "git pull"
aliases['gpf'] = "git push --force-with-lease --force-if-includes"
aliases['gp'] = "git push"
aliases['gd'] = "git diff"
aliases['lg'] = "lazygit"
aliases['gc'] = "git commit -v"
# aliases['kb'] = "git commit -m \"\$(curl -s http://whatthecommit.com/index.txt)\""
aliases['gs'] = "git status -v"
aliases['gfc'] = "git fetch && git checkout"
aliases['gl'] = "git log --graph"
aliases['l'] = "exa -la --git"
aliases['la'] = "exa -la --git"
aliases['ls'] = "exa"
aliases['ll'] = "exa -l --git"
aliases['cat'] = "bat"
aliases['p'] = "cd ~/proj"
aliases['pd'] = "cd ~/proj/devsaur"
# https://xon.sh/xonshrc.html?highlight=nix#use-the-nix-package-manager-with-xonsh
import os.path
if os.path.exists(f"{$HOME}/.nix-profile") and not __xonsh__.env.get("NIX_PATH"):
$NIX_REMOTE="daemon"
$NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/" + $USER
$NIX_PROFILES="/nix/var/nix/profiles/default " + $HOME + "/.nix-profile"
$NIX_SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt"
$NIX_PATH="nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs:/nix/var/nix/profiles/per-user/root/channels"
$PATH += [f"{$HOME}/.nix-profile/bin", "/nix/var/nix/profiles/default/bin"]
xontrib load direnv
xontrib load fish_completer
'';
programs.vscode.userSettings."terminal.integrated.profiles.osx" = {
xonsh = {
path = "${xonsh}/bin/xonsh";
};
};
programs.vscode.userSettings."terminal.integrated.defaultProfile.osx" = "xonsh";
programs.tmux.extraConfig = ''
set-option -g default-command "${xonsh}/bin/xonsh"
'';
}; };
} }

View file

@ -47,6 +47,8 @@ with lib.my;
#}; #};
}; };
environment.pathsToLink = [ "/share/fish" ];
ragon.services.borgmatic = ragon.services.borgmatic =
let let
tmMountPath = "/tmp/timeMachineSnapshotForBorg"; tmMountPath = "/tmp/timeMachineSnapshotForBorg";
@ -149,7 +151,7 @@ with lib.my;
pandoc pandoc
#unstable.qutebrowser #unstable.qutebrowser
unstable.python311Packages.adblock #unstable.python311Packages.adblock
]; ];

View file

@ -73,23 +73,17 @@ in
services.borgmatic = { services.borgmatic = {
enable = true; enable = true;
configurations."ds9-offsite" = { configurations."ds9-offsite" = {
location = { source_directories = [ "/backups" "/data" "/persistent" ];
source_directories = [ "/backups" "/data" "/persistent" ]; repositories = [ "ssh://root@gatebridge/media/backup/ds9" ];
repositories = [ "ssh://root@gatebridge/media/backup/ds9" ]; exclude_if_present = [ ".nobackup" ];
exclude_if_present = [ ".nobackup" ];
};
#upload_rate_limit = "4000"; #upload_rate_limit = "4000";
storage = { encryption_passcommand = "${pkgs.coreutils}/bin/cat ${config.age.secrets.borgmaticEncryptionKey.path}";
encryption_passcommand = "${pkgs.coreutils}/bin/cat ${config.age.secrets.borgmaticEncryptionKey.path}"; compression = "auto,zstd,10";
compression = "auto,zstd,10"; ssh_command = "ssh -o GlobalKnownHostsFile=${config.age.secrets.gatebridgeHostKeys.path} -i ${config.age.secrets.ds9OffsiteBackupSSH.path}";
ssh_command = "ssh -o GlobalKnownHostsFile=${config.age.secrets.gatebridgeHostKeys.path} -i ${config.age.secrets.ds9OffsiteBackupSSH.path}"; before_actions = [ "${pkgs.curl}/bin/curl -fss -m 10 --retry 5 -o /dev/null $(${pkgs.coreutils}/bin/cat ${config.age.secrets.ds9SyncoidHealthCheckUrl.path})/start" ];
}; after_actions = [ "${pkgs.curl}/bin/curl -fss -m 10 --retry 5 -o /dev/null $(${pkgs.coreutils}/bin/cat ${config.age.secrets.ds9SyncoidHealthCheckUrl.path})" ];
hooks = { on_error = [ "${pkgs.curl}/bin/curl -fss -m 10 --retry 5 -o /dev/null $(${pkgs.coreutils}/bin/cat ${config.age.secrets.ds9SyncoidHealthCheckUrl.path})/fail" ];
before_actions = [ "${pkgs.curl}/bin/curl -fss -m 10 --retry 5 -o /dev/null $(${pkgs.coreutils}/bin/cat ${config.age.secrets.ds9SyncoidHealthCheckUrl.path})/start" ]; # postgresql_databases = [{ name = "all"; pg_dump_command = "${pkgs.sudo}/bin/sudo -u postgres ${pkgs.postgresql}/bin/pg_dumpall"; pg_restore_command = "${pkgs.sudo}/bin/sudo -u postgres ${pkgs.postgresql}/bin/pg_restore"; }];
after_actions = [ "${pkgs.curl}/bin/curl -fss -m 10 --retry 5 -o /dev/null $(${pkgs.coreutils}/bin/cat ${config.age.secrets.ds9SyncoidHealthCheckUrl.path})" ];
on_error = [ "${pkgs.curl}/bin/curl -fss -m 10 --retry 5 -o /dev/null $(${pkgs.coreutils}/bin/cat ${config.age.secrets.ds9SyncoidHealthCheckUrl.path})/fail" ];
# postgresql_databases = [{ name = "all"; pg_dump_command = "${pkgs.sudo}/bin/sudo -u postgres ${pkgs.postgresql}/bin/pg_dumpall"; pg_restore_command = "${pkgs.sudo}/bin/sudo -u postgres ${pkgs.postgresql}/bin/pg_restore"; }];
};
retention = { retention = {
keep_daily = 7; keep_daily = 7;
keep_weekly = 4; keep_weekly = 4;

View file

@ -145,31 +145,25 @@
services.borgmatic = { services.borgmatic = {
enable = true; enable = true;
configurations."picard-ds9" = { configurations."picard-ds9" = {
location = { source_directories = [ "/persistent" ];
source_directories = [ "/persistent" ]; repositories = [
repositories = [ "ssh://picardbackup@ds9/backups/picard/borgmatic"
"ssh://picardbackup@ds9/backups/picard/borgmatic" "ssh://root@gatebridge/media/backup/picard"
"ssh://root@gatebridge/media/backup/picard" ];
]; exclude_if_present = [ ".nobackup" ];
exclude_if_present = [ ".nobackup" ]; encryption_passcommand = "${pkgs.coreutils}/bin/cat ${config.age.secrets.picardResticPassword.path}";
}; compression = "auto,zstd,10";
storage = { ssh_command = "ssh -o GlobalKnownHostsFile=${config.age.secrets.gatebridgeHostKeys.path} -i ${config.age.secrets.picardResticSSHKey.path}";
encryption_passcommand = "${pkgs.coreutils}/bin/cat ${config.age.secrets.picardResticPassword.path}";
compression = "auto,zstd,10";
ssh_command = "ssh -o GlobalKnownHostsFile=${config.age.secrets.gatebridgeHostKeys.path} -i ${config.age.secrets.picardResticSSHKey.path}";
};
retention = { retention = {
keep_daily = 7; keep_daily = 7;
keep_weekly = 4; keep_weekly = 4;
keep_monthly = 12; keep_monthly = 12;
keep_yearly = 10; keep_yearly = 10;
}; };
hooks = { before_actions = [ "${pkgs.curl}/bin/curl -fss -m 10 --retry 5 -o /dev/null $(${pkgs.coreutils}/bin/cat ${config.age.secrets.picardResticHealthCheckUrl.path})/start" ];
before_actions = [ "${pkgs.curl}/bin/curl -fss -m 10 --retry 5 -o /dev/null $(${pkgs.coreutils}/bin/cat ${config.age.secrets.picardResticHealthCheckUrl.path})/start" ]; after_actions = [ "${pkgs.curl}/bin/curl -fss -m 10 --retry 5 -o /dev/null $(${pkgs.coreutils}/bin/cat ${config.age.secrets.picardResticHealthCheckUrl.path})" ];
after_actions = [ "${pkgs.curl}/bin/curl -fss -m 10 --retry 5 -o /dev/null $(${pkgs.coreutils}/bin/cat ${config.age.secrets.picardResticHealthCheckUrl.path})" ]; on_error = [ "${pkgs.curl}/bin/curl -fss -m 10 --retry 5 -o /dev/null $(${pkgs.coreutils}/bin/cat ${config.age.secrets.picardResticHealthCheckUrl.path})/fail" ];
on_error = [ "${pkgs.curl}/bin/curl -fss -m 10 --retry 5 -o /dev/null $(${pkgs.coreutils}/bin/cat ${config.age.secrets.picardResticHealthCheckUrl.path})/fail" ]; postgresql_databases = [{ name = "all"; pg_dump_command = "${pkgs.postgresql}/bin/pg_dumpall"; pg_restore_command = "${pkgs.postgresql}/bin/pg_restore"; }];
postgresql_databases = [{ name = "all"; pg_dump_command = "${pkgs.postgresql}/bin/pg_dumpall"; pg_restore_command = "${pkgs.postgresql}/bin/pg_restore"; }];
};
}; };
}; };