Moved phoenix script to its own file

This commit is contained in:
Emmet 2023-05-13 20:48:39 -05:00
parent a86b50de25
commit 0acd3eccb6
2 changed files with 31 additions and 25 deletions

29
user/bin/phoenix.nix Normal file
View file

@ -0,0 +1,29 @@
{ config, lib, pkgs, myName, myDotfilesDir, ... }:
let
# This sets up my "phoenix" script with my configuration paths
# =phoenix= is just my wrapper script for easier access to nix/nixos commands
myPhoenixScript = ''
if [ "$1" = "sync" ]; then
if [ "$2" != "user" ]; then
pushd ''+myDotfilesDir+'';
sudo nixos-rebuild switch --flake .#;
popd;
fi
if [ "2" != "system" ]; then
pushd ''+myDotfilesDir+'';
home-manager switch --flake .#''+myName+'';
popd;
fi
elif [ "$1" = "update" ]; then
pushd ''+myDotfilesDir+'';
nix flake update;
popd;
fi
'';
in
{
home.packages = [
(pkgs.writeScriptBin "phoenix" myPhoenixScript)
];
}

View file

@ -1,28 +1,5 @@
{ config, lib, pkgs, myName, myEmail, myHomeDir, myDotfilesDir, myTheme, ... }: { config, lib, pkgs, myName, myEmail, myHomeDir, myDotfilesDir, myTheme, ... }:
let
# This sets up my "phoenix" script with my configuration paths
# =phoenix= is just my wrapper script for easier access to nix/nixos commands
myPhoenixScript = ''
if [ "$1" = "sync" ]; then
if [ "$2" != "user" ]; then
pushd ''+myDotfilesDir+'';
sudo nixos-rebuild switch --flake .#;
popd;
fi
if [ "2" != "system" ]; then
pushd ''+myDotfilesDir+'';
home-manager switch --flake .#''+myName+'';
popd;
fi
elif [ "$1" = "update" ]; then
pushd ''+myDotfilesDir+'';
nix flake update;
popd;
fi
'';
in
{ {
# Home Manager needs a bit of information about you and the paths it should # Home Manager needs a bit of information about you and the paths it should
# manage. # manage.
@ -34,7 +11,8 @@ in
imports = [ imports = [
./wm/xmonad/xmonad.nix # My xmonad config ./wm/xmonad/xmonad.nix # My xmonad config
./shell/sh.nix # My zsh and bash config ./shell/sh.nix # My zsh and bash config
./app/git/git.nix # My git config ./bin/phoenix.nix # My nix command wrapper
./app/git/git.nix # My git config
./style/stylix.nix # Styling and themes for my apps ./style/stylix.nix # Styling and themes for my apps
]; ];
@ -56,7 +34,6 @@ in
feh feh
git git
xmobar xmobar
(pkgs.writeScriptBin "phoenix" myPhoenixScript)
# Office # Office
libreoffice-qt libreoffice-qt