From d0e95ba2c00f6a87087823338543b4c9cba3f10b Mon Sep 17 00:00:00 2001 From: seth Date: Sat, 19 Aug 2023 21:18:10 -0400 Subject: start using flake-parts & hercules-ci --- flake.nix | 95 +++++++++++++++++++++++---------------------------------------- 1 file changed, 35 insertions(+), 60 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index b1c1b53..89b7ec2 100644 --- a/flake.nix +++ b/flake.nix @@ -3,84 +3,59 @@ nixConfig = { extra-substituters = [ + "https://getchoo.cachix.org" "https://cache.garnix.io" ]; extra-trusted-public-keys = [ + "getchoo.cachix.org-1:ftdbAUJVNaFonM0obRGgR5+nUmdLMM+AOvDOSx0z5tE=" "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" ]; }; inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; + flake-compat = { url = "github:edolstra/flake-compat"; flake = false; }; - }; - - outputs = { - self, - nixpkgs, - ... - }: let - systems = [ - "x86_64-linux" - "x86_64-darwin" - "aarch64-linux" - "aarch64-darwin" - ]; - - inherit (nixpkgs) lib; - - forAllSystems = lib.genAttrs systems; - nixpkgsFor = forAllSystems (system: - import nixpkgs { - inherit system; - overlays = [self.overlays.default]; - }); - forEachSystem = fn: - forAllSystems (system: - fn { - inherit system; - pkgs = nixpkgsFor.${system}; - }); - in { - flakeModules = { - default = import ./modules/flake; - homeConfigurations = import ./modules/flake/homeConfigurations.nix; - homeManagerModules = import ./modules/flake/homeManagerModules.nix; - hydraJobs = import ./modules/flake/hydraJobs.nix; + effects = { + url = "github:hercules-ci/hercules-ci-effects"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.hercules-ci-agent.follows = "hercules-ci-agent"; }; - formatter = forEachSystem (p: p.pkgs.alejandra); - - packages = forEachSystem ( - { - pkgs, - system, - }: let - p = let - packages = import ./pkgs pkgs; - in - lib.filterAttrs (_: v: - builtins.elem system (v.meta.platforms or []) && !(v.meta.broken or false)) - packages; - in - p // {default = p.treefetch;} - ); + parts = { + url = "github:hercules-ci/flake-parts"; + inputs.nixpkgs-lib.follows = "nixpkgs"; + }; - overlays.default = final: _: import ./pkgs final; + hercules-ci-agent = { + url = "github:hercules-ci/hercules-ci-agent"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-parts.follows = "parts"; + }; + }; - templates = let - # string -> string -> {} - mkTemplate = name: description: { - path = "${self}/templates/${name}"; - inherit description; + outputs = {parts, ...} @ inputs: + parts.lib.mkFlake {inherit inputs;} { + imports = [ + ./pkgs + ./modules + ./templates + ./ci.nix + ]; + + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + + perSystem = {pkgs, ...}: { + formatter = pkgs.alejandra; }; - in { - basic = mkTemplate "basic" "minimal boilerplate for my flakes"; - full = mkTemplate "full" "big template for complex flakes (using flake-parts)"; }; - }; } -- cgit v1.2.3