Compare commits
18 Commits
35ba80b9cc
...
restic
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e662bb181a | ||
|
|
cbce55a4fa | ||
|
|
2e5f045bb2 | ||
|
|
fcb50fb567 | ||
|
|
247d87adae | ||
|
|
e83fdadf7d | ||
|
|
593602d87a | ||
|
|
0c00e983d6 | ||
|
|
4e875f654f | ||
|
|
432453304e | ||
|
|
a7eebbc8c8 | ||
|
|
c442e84e11 | ||
|
|
da0ee1e014 | ||
|
|
8f1ea421dc | ||
|
|
422f662a64 | ||
|
|
7fd49dcfd5 | ||
|
|
d0d73e19d2 | ||
|
|
db0c0a148e |
@@ -34,7 +34,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
mkhomeManagerModules = config: [
|
mkhomeManagerModules = config: [
|
||||||
(self.homeManagerModules.default inputs)
|
self.homeManagerModules.default
|
||||||
# { inherit (config) extraImports; }
|
# { inherit (config) extraImports; }
|
||||||
{
|
{
|
||||||
user = config.user;
|
user = config.user;
|
||||||
@@ -52,8 +52,10 @@
|
|||||||
{
|
{
|
||||||
lib = { inherit mkhomeManagerModules; };
|
lib = { inherit mkhomeManagerModules; };
|
||||||
|
|
||||||
homeManagerModules.default = inputs: {
|
homeManagerModules.default = {
|
||||||
imports = [ ./homeManagerModules ];
|
imports = [
|
||||||
|
./homeManagerModules
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
nixosModules.default = { config, ... }: {
|
nixosModules.default = { config, ... }: {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
../nixosModules/options.nix
|
../nixosModules/options.nix
|
||||||
# inputs._1password-shell-plugins.hmModules.default
|
# inputs._1password-shell-plugins.hmModules.default
|
||||||
# Commented out because it tries to configure fish shell which we don't use
|
# Commented out because it tries to configure fish shell which we don't use
|
||||||
];
|
] ++ lib.optional (inputs ? resticprofile) inputs.resticprofile.homeManagerModules.default;
|
||||||
|
|
||||||
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
|
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
|
||||||
"1password-cli"
|
"1password-cli"
|
||||||
@@ -55,9 +55,12 @@
|
|||||||
btop
|
btop
|
||||||
yazi
|
yazi
|
||||||
uv
|
uv
|
||||||
|
(writeShellScriptBin "nhms" ''
|
||||||
|
nix run home-manager -- switch --flake ~/.config/home-manager --impure
|
||||||
|
'')
|
||||||
(writeShellScriptBin "nhmu" ''
|
(writeShellScriptBin "nhmu" ''
|
||||||
nix flake update --flake ~/.config/home-manager
|
nix flake update --flake ~/.config/home-manager
|
||||||
nix run home-manager -- switch --flake ~/.config/home-manager --impure
|
nhms
|
||||||
'')
|
'')
|
||||||
# # It is sometimes useful to fine-tune packages, for example, by applying
|
# # It is sometimes useful to fine-tune packages, for example, by applying
|
||||||
# # overrides. You can do that directly here, just don't forget the
|
# # overrides. You can do that directly here, just don't forget the
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
enableZshIntegration = true;
|
enableZshIntegration = true;
|
||||||
package = config.lib.nixGL.wrap pkgs.ghostty;
|
package = config.lib.nixGL.wrap pkgs.ghostty;
|
||||||
settings = {
|
settings = {
|
||||||
command = "TERM=xterm-256color /usr/bin/bash";
|
command = "TERM=xterm-256color ${pkgs.zsh}/bin/zsh";
|
||||||
font-size = 12;
|
font-size = 12;
|
||||||
font-family = "Source Code Pro";
|
font-family = "Source Code Pro";
|
||||||
# theme = "idleToes";
|
# theme = "idleToes";
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
name = "Ghostty";
|
name = "Ghostty";
|
||||||
type = "Application";
|
type = "Application";
|
||||||
comment = "A terminal emulator";
|
comment = "A terminal emulator";
|
||||||
exec = "nixGL ghostty";
|
exec = "nixGLMesa ghostty";
|
||||||
icon = "com.mitchellh.ghostty";
|
icon = "com.mitchellh.ghostty";
|
||||||
terminal = false;
|
terminal = false;
|
||||||
startupNotify = true;
|
startupNotify = true;
|
||||||
@@ -75,14 +75,14 @@
|
|||||||
actions = {
|
actions = {
|
||||||
new-window = {
|
new-window = {
|
||||||
name = "New Window";
|
name = "New Window";
|
||||||
exec = "nixGL ghostty";
|
exec = "nixGLMesa ghostty";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# https://discourse.nixos.org/t/apps-installed-via-home-manager-are-not-visible-within-gnome/48252/2
|
# https://discourse.nixos.org/t/apps-installed-via-home-manager-are-not-visible-within-gnome/48252/2
|
||||||
# home.activation.copyDesktopFiles = lib.hm.dag.entryAfter ["installPackages"] ''
|
# home.activation.copyDesktopFiles = lib.hm.dag.entryAfter ["installPackages"] ''
|
||||||
# if [ "$XDG_CURRENT_DESKTOP" = "GNOME" ]; then
|
# if [[ "$XDG_CURRENT_DESKTOP" == "GNOME" || "$XDG_CURRENT_DESKTOP" == "Unity" ]]; then
|
||||||
|
|
||||||
# mkdir -p "${config.home.homeDirectory}/.local/share/applications"
|
# mkdir -p "${config.home.homeDirectory}/.local/share/applications"
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,10 @@
|
|||||||
outputs = { self, nixpkgs, home-manager }:
|
outputs = { self, nixpkgs, home-manager }:
|
||||||
let
|
let
|
||||||
systems = [ "x86_64-linux" "aarch64-linux" ];
|
systems = [ "x86_64-linux" "aarch64-linux" ];
|
||||||
|
forAllSystems = nixpkgs.lib.genAttrs systems;
|
||||||
|
|
||||||
# Define a function to build the resticprofile package for a given system:
|
# Define a function to build the resticprofile package for a given system:
|
||||||
resticprofilePkg = { pkgs, lib, ... }:
|
resticprofilePkg = pkgs:
|
||||||
pkgs.buildGoModule rec {
|
pkgs.buildGoModule rec {
|
||||||
pname = "resticprofile";
|
pname = "resticprofile";
|
||||||
version = "0.32.0";
|
version = "0.32.0";
|
||||||
@@ -19,12 +21,12 @@
|
|||||||
owner = "creativeprojects";
|
owner = "creativeprojects";
|
||||||
repo = "resticprofile";
|
repo = "resticprofile";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
sha256 = "sha256-ezelvyroQG1EW3SU63OVHJ/T4qjN5DRllvPIXnei1Z4="; # source tarball hash
|
sha256 = "sha256-fmYsoGYppNgbtoX18aF5UHBG9ieYorBJ9JZkwrR+UBI="; # source tarball hash
|
||||||
};
|
};
|
||||||
vendorHash = "sha256-M9S6F/Csz7HnOq8PSWjpENKm1704kVx9zDts1ieraTE="; # Correct vendor hash
|
vendorHash = "sha256-/GVWjOvkYe7xMRjANKIKV6FSU0F5VY1ZP/ppgAJyhvw="; # Correct vendor hash
|
||||||
goPackagePath = "github.com/creativeprojects/resticprofile";
|
goPackagePath = "github.com/creativeprojects/resticprofile";
|
||||||
doCheck = false; # Disable tests due to sandboxed build environment
|
doCheck = false; # Disable tests due to sandboxed build environment
|
||||||
meta = with lib; {
|
meta = with pkgs.lib; {
|
||||||
description = "Configuration profiles manager and scheduler for restic backup";
|
description = "Configuration profiles manager and scheduler for restic backup";
|
||||||
homepage = "https://creativeprojects.github.io/resticprofile/";
|
homepage = "https://creativeprojects.github.io/resticprofile/";
|
||||||
license = licenses.gpl3Only;
|
license = licenses.gpl3Only;
|
||||||
@@ -33,14 +35,28 @@
|
|||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
# Provide the package for all supported systems:
|
# Provide the package for all supported systems:
|
||||||
packages = nixpkgs.lib.genAttrs systems (system:
|
packages = forAllSystems (system:
|
||||||
let pkgs = import nixpkgs { inherit system; };
|
let
|
||||||
in { resticprofile = resticprofilePkg { inherit pkgs; lib = pkgs.lib; }; }
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
in {
|
||||||
|
resticprofile = resticprofilePkg pkgs;
|
||||||
|
default = resticprofilePkg pkgs;
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
# Provide the Home Manager module
|
# Provide the Home Manager module
|
||||||
homeManagerModules = {
|
homeManagerModules = {
|
||||||
resticprofile = ./resticprofile.nix;
|
resticprofile = { config, lib, pkgs, ... }:
|
||||||
|
let
|
||||||
|
# Use the package built by this flake
|
||||||
|
resticprofilePackage = self.packages.${pkgs.system}.resticprofile;
|
||||||
|
in {
|
||||||
|
imports = [ ./resticprofile.nix ];
|
||||||
|
config = lib.mkIf config.programs.resticprofile.enable {
|
||||||
|
programs.resticprofile.package = lib.mkDefault resticprofilePackage;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
default = self.homeManagerModules.resticprofile;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,11 +14,13 @@
|
|||||||
backup = {
|
backup = {
|
||||||
verbose = true;
|
verbose = true;
|
||||||
exclude = [
|
exclude = [
|
||||||
".vscode*"
|
|
||||||
".cache"
|
".cache"
|
||||||
|
".devenv"
|
||||||
|
".rustup"
|
||||||
|
".cargo"
|
||||||
".venv"
|
".venv"
|
||||||
".pyenv"
|
".pyenv"
|
||||||
".devenv"
|
".vscode*"
|
||||||
"data/postgres"
|
"data/postgres"
|
||||||
"build"
|
"build"
|
||||||
"__pycache__"
|
"__pycache__"
|
||||||
@@ -33,6 +35,9 @@
|
|||||||
"dist"
|
"dist"
|
||||||
"/home/*/Pictures"
|
"/home/*/Pictures"
|
||||||
"/home/*/Videos"
|
"/home/*/Videos"
|
||||||
|
"/home/*/go"
|
||||||
|
"/home/*/snap"
|
||||||
|
"/home/john/john-nas"
|
||||||
];
|
];
|
||||||
schedule-permission = "user";
|
schedule-permission = "user";
|
||||||
schedule-priority = "background";
|
schedule-priority = "background";
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ let
|
|||||||
baseProfile = import ./profiles/base.nix { inherit lib config; };
|
baseProfile = import ./profiles/base.nix { inherit lib config; };
|
||||||
profiles = lib.recursiveUpdate baseProfile cfg.profiles;
|
profiles = lib.recursiveUpdate baseProfile cfg.profiles;
|
||||||
in {
|
in {
|
||||||
|
# Create the programs.resticprofile option
|
||||||
options.programs.resticprofile = {
|
options.programs.resticprofile = {
|
||||||
enable = mkEnableOption "Enable resticprofile (Restic backup profile manager)";
|
enable = mkEnableOption "Enable resticprofile (Restic backup profile manager)";
|
||||||
|
|
||||||
@@ -45,21 +46,27 @@ in {
|
|||||||
resticprofileCmd = ''
|
resticprofileCmd = ''
|
||||||
${cfg.package}/bin/resticprofile --config "${config.xdg.configHome}/resticprofile/profiles.yaml"
|
${cfg.package}/bin/resticprofile --config "${config.xdg.configHome}/resticprofile/profiles.yaml"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# Define the rp script as a variable so we can reference it
|
||||||
|
rpScript = pkgs.writeShellScriptBin "rp" ''
|
||||||
|
set -e
|
||||||
|
sudo ${cfg.package}/bin/resticprofile --config "${config.xdg.configHome}/resticprofile/profiles.yaml" $@
|
||||||
|
'';
|
||||||
|
rpbackupScript = pkgs.writeShellScriptBin "rp-backup" ''
|
||||||
|
${rpScript}/bin/rp run-schedule backup@default
|
||||||
|
'';
|
||||||
in {
|
in {
|
||||||
# Add a script to manually unschedule and reschedule all resticprofiles
|
# Add a script to manually unschedule and reschedule all resticprofiles
|
||||||
home.packages = [
|
home.packages = [
|
||||||
cfg.package
|
cfg.package
|
||||||
(pkgs.writeShellScriptBin "rp" ''
|
rpScript
|
||||||
set -e
|
rpbackupScript
|
||||||
sudo ${cfg.package}/bin/resticprofile --config "${config.xdg.configHome}/resticprofile/profiles.yaml" $@
|
|
||||||
'')
|
|
||||||
(pkgs.writeShellScriptBin "rps" ''
|
(pkgs.writeShellScriptBin "rps" ''
|
||||||
set -e
|
set -e
|
||||||
rp unschedule --all
|
${rpScript}/bin/rp unschedule --all
|
||||||
rp schedule --all
|
${rpScript}/bin/rp schedule --all
|
||||||
'')
|
'')
|
||||||
(pkgs.writeShellScriptBin "rp-test" "rp run-schedule backup@default --dry-run")
|
(pkgs.writeShellScriptBin "rp-test" "${rpbackupScript}/bin/rp-backup --dry-run")
|
||||||
(pkgs.writeShellScriptBin "rp-test" "rp run-schedule backup@default --dry-run")
|
|
||||||
];
|
];
|
||||||
xdg.configFile."resticprofile/profiles.yaml".source = yamlFormat.generate "profiles" {
|
xdg.configFile."resticprofile/profiles.yaml".source = yamlFormat.generate "profiles" {
|
||||||
version = "2";
|
version = "2";
|
||||||
|
|||||||
@@ -11,9 +11,18 @@
|
|||||||
{
|
{
|
||||||
"*" = {
|
"*" = {
|
||||||
user = "john";
|
user = "john";
|
||||||
forwardAgent = true;
|
|
||||||
serverAliveInterval = 60;
|
# From the help text about the deprecation of the default config:
|
||||||
serverAliveCountMax = 2;
|
forwardAgent = false;
|
||||||
|
addKeysToAgent = "no";
|
||||||
|
compression = false;
|
||||||
|
serverAliveInterval = 0;
|
||||||
|
serverAliveCountMax = 3;
|
||||||
|
hashKnownHosts = false;
|
||||||
|
userKnownHostsFile = "~/.ssh/known_hosts";
|
||||||
|
controlMaster = "no";
|
||||||
|
controlPath = "~/.ssh/master-%r@%n:%p";
|
||||||
|
controlPersist = "no";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
(lib.mkIf (config.profile == "personal") {
|
(lib.mkIf (config.profile == "personal") {
|
||||||
@@ -29,6 +38,10 @@
|
|||||||
hostname = "192.168.1.110";
|
hostname = "192.168.1.110";
|
||||||
user = "root";
|
user = "root";
|
||||||
};
|
};
|
||||||
|
"gitea" = {
|
||||||
|
hostname = "192.168.1.104";
|
||||||
|
user = "john";
|
||||||
|
};
|
||||||
"hermes" = {
|
"hermes" = {
|
||||||
hostname = "192.168.1.150";
|
hostname = "192.168.1.150";
|
||||||
user = "root";
|
user = "root";
|
||||||
@@ -57,6 +70,28 @@
|
|||||||
hostname = "192.168.1.129";
|
hostname = "192.168.1.129";
|
||||||
user = "root";
|
user = "root";
|
||||||
};
|
};
|
||||||
|
"janus" = {
|
||||||
|
hostname = "janus.john-stream.com";
|
||||||
|
user = "root";
|
||||||
|
identitiesOnly = true;
|
||||||
|
identityFile = "~/.ssh/id_ed25519";
|
||||||
|
certificateFile = "~/.ssh/id_ed25519-cert.pub";
|
||||||
|
};
|
||||||
|
"soteria" = {
|
||||||
|
hostname = "soteria.john-stream.com";
|
||||||
|
user = "john";
|
||||||
|
identitiesOnly = true;
|
||||||
|
identityFile = "~/.ssh/id_ed25519";
|
||||||
|
certificateFile = "~/.ssh/id_ed25519-cert.pub";
|
||||||
|
};
|
||||||
|
"*.john-stream.com" = {
|
||||||
|
user = "john";
|
||||||
|
identitiesOnly = true;
|
||||||
|
identityFile = "~/.ssh/id_ed25519";
|
||||||
|
certificateFile = "~/.ssh/id_ed25519-cert.pub";
|
||||||
|
addKeysToAgent = "yes";
|
||||||
|
forwardAgent = true;
|
||||||
|
};
|
||||||
})
|
})
|
||||||
(lib.mkIf (config.profile == "work") {
|
(lib.mkIf (config.profile == "work") {
|
||||||
"ubuntu-nvidia" = {
|
"ubuntu-nvidia" = {
|
||||||
|
|||||||
Reference in New Issue
Block a user