fix(shell): rebuild command

Now takes a `module` paramater to indicate where the flake is stored
This commit is contained in:
reo101 2023-07-23 17:04:31 +03:00
parent 1dd4a1209b
commit 61fceefb4a
Signed by: reo101
GPG key ID: 675AA7EF13964ACB

View file

@ -35,6 +35,11 @@ in
type = types.bool; type = types.bool;
default = true; default = true;
}; };
flakePath = mkOption {
description = "Flake path (used for `rebuild` command)";
type = types.str;
default = "${config.xdg.configHome}/rix101";
};
extraConfig = mkOption { extraConfig = mkOption {
description = "Extra zsh config"; description = "Extra zsh config";
type = types.str; type = types.str;
@ -96,17 +101,16 @@ in
${ ${
let let
inherit (lib.strings) hasInfix; inherit (lib.strings) hasInfix;
flake_dir = builtins.toString ../../..;
in in
if hasInfix "nixos" pkgs.system then if hasInfix "nixos" pkgs.system then
"sudo nixos-rebuild --flake ${flake_dir}" "sudo --validate && sudo nixos-rebuild"
else if hasInfix "darwin" pkgs.system then else if hasInfix "darwin" pkgs.system then
"darwin-rebuild --flake ${flake_dir}" "darwin-rebuild"
else if "aarch64-linux" == pkgs.system then else if "aarch64-linux" == pkgs.system then
"nix-on-droid --flake ${flake_dir}" "nix-on-droid"
else else
"home-manager --flake ${flake_dir}" "home-manager"
} ''${1:-switch} |& nix run nixpkgs#nix-output-monitor } --flake ${cfg.flakePath} ''$''\{1:-switch''\} |& nix run nixpkgs#nix-output-monitor
} }
'' ''
(optionalString cfg.atuin '' (optionalString cfg.atuin ''