diff --git a/home-manager/modules/common/default.nix b/home-manager/modules/common/default.nix index 561dcbf..185355f 100644 --- a/home-manager/modules/common/default.nix +++ b/home-manager/modules/common/default.nix @@ -1,7 +1,30 @@ -{ config, nixosConfig, ... }: +{ + config, + inputs, + nixosConfig, + pkgs, + system, + ... +}: +let + rebuild = pkgs.writeShellApplication { + name = "rebuild"; + runtimeInputs = [ + pkgs.nixos-rebuild + inputs.attic.packages.${system}.attic-client + ]; + text = '' + nixos-rebuild -j auto switch --use-remote-sudo + if command -v attic &> /dev/null; then + attic push prod /run/current-system + fi + ''; + }; +in { # Home Manager needs a bit of information about you and the # paths it should manage. + home.packages = [ rebuild ]; programs = { dircolors = { enable = true; @@ -14,9 +37,6 @@ enable = true; shellAliases = { nix-generations = "sudo nix-env --list-generations --profile /nix/var/nix/profiles/system"; - rebuild = '' - nixos-rebuild -j auto switch --use-remote-sudo - ''; htop = "btm"; find-garbage = "ls -l /nix/var/nix/gcroots/auto/ | sort | grep '/home/'"; vm = "vim"; diff --git a/home-manager/profiles/work-wsl.nix b/home-manager/profiles/work-wsl.nix index e8e1297..4a3a150 100644 --- a/home-manager/profiles/work-wsl.nix +++ b/home-manager/profiles/work-wsl.nix @@ -2,8 +2,24 @@ config, inputs, pkgs, + system, ... }: +let + hm-rebuild = pkgs.writeShellApplication { + name = "hm-rebuild"; + runtimeInputs = [ + pkgs.nixos-rebuild + inputs.attic.packages.${system}.attic-client + ]; + text = '' + home-manager switch + if command -v attic &> /dev/null; then + attic push prod /run/current-system + fi + ''; + }; +in { imports = [ ./headless.nix ]; @@ -25,6 +41,7 @@ bottom gyre-fonts highlight + hm-rebuild keychain killall mosh @@ -80,7 +97,6 @@ shellAliases = { work-management = "mosh --ssh='ssh -i ~/.ssh/zweili.key' zweili@10.49.0.100 -- tmux new -A -s 0"; work-vm = ''ssh andreas@localhost -p 2222 -t "$@" "tmux new -A -s 0"''; - hm-rebuild = "home-manager switch"; }; }; };