From bdabf307281e40e1451b0b57304b4526b207061c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Wed, 8 May 2024 09:47:57 +0200 Subject: [PATCH] Add repl --- flake.nix | 60 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/flake.nix b/flake.nix index dcae282..e29ce02 100644 --- a/flake.nix +++ b/flake.nix @@ -93,6 +93,37 @@ } ]; }; + flakeTools = { self }: flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + apps = { + disko = { + type = "app"; + program = "${disko.packages.${system}.default}/bin/disko"; + }; + nixos-generate-config = { + type = "app"; + program = "${pkgs.nixos-install-tools}/bin/nixos-generate-config"; + }; + nixos-install = { + type = "app"; + program = "${pkgs.nixos-install-tools}/bin/nixos-install"; + }; + nixos-rebuild = { + type = "app"; + program = "${pkgs.nixos-rebuild}/bin/nixos-rebuild"; + }; + repl = { + type = "app"; + program = "${pkgs.writeShellScript "vivarium-repl" '' + ${pkgs.nix}/bin/nix repl --expr 'let flake = builtins.getFlake "${self}"; in flake // flake.nixosConfigurations // rec { pkgs = flake.inputs.nixpkgs.legacyPackages.${system}; lib = pkgs.lib; }' + ''}"; + }; + }; + } + ); }; in { @@ -119,30 +150,5 @@ modules = [ ./pindakaas/sd.nix ]; }; nixOnDroidConfigurations.sprinkles = lib.nixOnDroidConfiguration { }; - } // (flake-utils.lib.eachDefaultSystem (system: - # Machine dependant outputs - let - pkgs = nixpkgs.legacyPackages.${system}; - in - { - apps = { - disko = { - type = "app"; - program = "${disko.packages.${system}.default}/bin/disko"; - }; - nixos-generate-config = { - type = "app"; - program = "${pkgs.nixos-install-tools}/bin/nixos-generate-config"; - }; - nixos-install = { - type = "app"; - program = "${pkgs.nixos-install-tools}/bin/nixos-install"; - }; - nixos-rebuild = { - type = "app"; - program = "${pkgs.nixos-rebuild}/bin/nixos-rebuild"; - }; - }; - } - )); -} + } // (lib.flakeTools { inherit self; }); + }