From 61fceefb4aa53da8c85e08a591694b562c09f1a9 Mon Sep 17 00:00:00 2001 From: reo101 Date: Sun, 23 Jul 2023 17:04:31 +0300 Subject: [PATCH] fix(shell): `rebuild` command Now takes a `module` paramater to indicate where the flake is stored --- modules/home-manager/reo101-shell/default.nix | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/modules/home-manager/reo101-shell/default.nix b/modules/home-manager/reo101-shell/default.nix index 895e912..32c253a 100644 --- a/modules/home-manager/reo101-shell/default.nix +++ b/modules/home-manager/reo101-shell/default.nix @@ -35,6 +35,11 @@ in type = types.bool; default = true; }; + flakePath = mkOption { + description = "Flake path (used for `rebuild` command)"; + type = types.str; + default = "${config.xdg.configHome}/rix101"; + }; extraConfig = mkOption { description = "Extra zsh config"; type = types.str; @@ -96,17 +101,16 @@ in ${ let inherit (lib.strings) hasInfix; - flake_dir = builtins.toString ../../..; in if hasInfix "nixos" pkgs.system then - "sudo nixos-rebuild --flake ${flake_dir}" + "sudo --validate && sudo nixos-rebuild" else if hasInfix "darwin" pkgs.system then - "darwin-rebuild --flake ${flake_dir}" + "darwin-rebuild" else if "aarch64-linux" == pkgs.system then - "nix-on-droid --flake ${flake_dir}" + "nix-on-droid" else - "home-manager --flake ${flake_dir}" - } ''${1:-switch} |& nix run nixpkgs#nix-output-monitor + "home-manager" + } --flake ${cfg.flakePath} ''$''\{1:-switch''\} |& nix run nixpkgs#nix-output-monitor } '' (optionalString cfg.atuin ''