From 1db9752ad8b648b5a0cf9db51b6c2d3ce4ce0934 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/hosts/default.nix | 62 ++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/nix/hosts/default.nix b/nix/hosts/default.nix index feddbcd..488211d 100644 --- a/nix/hosts/default.nix +++ b/nix/hosts/default.nix @@ -2,6 +2,8 @@ self, withSystem, inputs, + nixpkgs, + nix, ... }: @@ -86,6 +88,24 @@ let ); mkDarwinConfigurations = configurations: builtins.mapAttrs mkDarwin configurations; + + mkDroidConfiguration = + { + system, + modules ? [ ], + }: + withSystem system ( + ctx: + inputs.nix-on-droid.lib.nixOnDroidConfiguration { + inherit (ctx) pkgs; + modules = [ + { + inherit (ctx) nix; + nixpkgs = removeAttrs ctx.nixpkgs [ "hostPlatform" ]; + } + ] ++ modules; + } + ); in { @@ -109,32 +129,20 @@ 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 { + system = "aarch64-linux"; + modules = [ + { + system.stateVersion = "24.05"; + home-manager.useGlobalPkgs = true; + home-manager.config = { + home.stateVersion = "24.05"; + imports = [ + self.homeManagerModules.r17-shell + ]; + }; + } + ]; + }; - ; }