From 25f3f500accfe8f2d83c433087e4d2e5bd243abf Mon Sep 17 00:00:00 2001 From: Emmet Date: Sat, 13 May 2023 20:48:39 -0500 Subject: [PATCH] Moved phoenix script to its own file --- user/bin/phoenix.nix | 29 +++++++++++++++++++++++++++++ user/home.nix | 27 ++------------------------- 2 files changed, 31 insertions(+), 25 deletions(-) create mode 100644 user/bin/phoenix.nix diff --git a/user/bin/phoenix.nix b/user/bin/phoenix.nix new file mode 100644 index 00000000..13229aed --- /dev/null +++ b/user/bin/phoenix.nix @@ -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) + ]; +} diff --git a/user/home.nix b/user/home.nix index 3756fc7c..5f549657 100644 --- a/user/home.nix +++ b/user/home.nix @@ -1,28 +1,5 @@ { 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 # manage. @@ -34,7 +11,8 @@ in imports = [ ./wm/xmonad/xmonad.nix # My xmonad 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 ]; @@ -56,7 +34,6 @@ in feh git xmobar - (pkgs.writeScriptBin "phoenix" myPhoenixScript) # Office libreoffice-qt