From 280e4f01562d02e2078c7e023001efab40f2f602 Mon Sep 17 00:00:00 2001 From: r17x Date: Sun, 3 Nov 2024 23:50:30 +0700 Subject: [PATCH] feat(nix-droid): using utility mkDroidConfiguration --- nix/default.nix | 2 -- nix/hosts/default.nix | 70 ++++++++++++++++++++++++++----------------- 2 files changed, 43 insertions(+), 29 deletions(-) diff --git a/nix/default.nix b/nix/default.nix index 124aadb..35d043f 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -93,8 +93,6 @@ inputs' system branches - nix - nixpkgs ; inputs = lib.mkForce inputs; }; diff --git a/nix/hosts/default.nix b/nix/hosts/default.nix index feddbcd..f38e9e2 100644 --- a/nix/hosts/default.nix +++ b/nix/hosts/default.nix @@ -86,6 +86,32 @@ let ); mkDarwinConfigurations = configurations: builtins.mapAttrs mkDarwin configurations; + + mkDroidConfiguration = + { + system, + modules ? [ ], + }: + withSystem system ( + ctx: + inputs.nix-on-droid.lib.nixOnDroidConfiguration { + inherit (ctx) pkgs; + modules = [ + { + nix = { + inherit (ctx.nix) + nixPath + registry + package + ; + extraOptions = '' + experimental-features = nix-command flakes pipe-operators + ''; + }; + } + ] ++ modules; + } + ); in { @@ -109,32 +135,22 @@ in eR17x = { }; }; - flake.nixOnDroidConfigurations.default = - let - stateVersion = "24.05"; - in - inputs.nix-on-droid.lib.nixOnDroidConfiguration { - pkgs = import inputs.nixpkgs { - system = "aarch64-linux"; - overlays = inputs.nixpkgs.lib.attrValues self.overlays; - }; - modules = [ - { - system.stateVersion = stateVersion; - nix.extraOptions = '' - experimental-features = nix-command flakes - ''; - home-manager.useGlobalPkgs = true; - home-manager.config = { - home.stateVersion = stateVersion; - imports = [ - self.homeManagerModules.r17-shell - self.homeManagerModules.r17-packages - ]; - }; - } - ]; - } + flake.nixOnDroidConfigurations.default = mkDroidConfiguration rec { + system = "aarch64-linux"; + modules = [ + { + system.stateVersion = "24.05"; + home-manager.backupFileExtension = "backup-before-nix"; + home-manager.useGlobalPkgs = true; + home-manager.config = { + home.stateVersion = "24.05"; + home.packages = [ self.packages.${system}.nvim ]; + imports = [ + self.homeManagerModules.r17-shell + ]; + }; + } + ]; + }; - ; }