From 241245413e3b813453369de33b64efff9a6f2c05 Mon Sep 17 00:00:00 2001 From: Daniel Firth <dan.firth@homotopic.tech> Date: Wed, 30 Nov 2022 11:50:12 +0000 Subject: [PATCH] nixpkgs-fmt dhall format --- .gitlab-ci.dhall | 10 ++---- flake.nix | 84 ++++++++++++++++++++++++------------------------ overlay.nix | 2 +- 3 files changed, 46 insertions(+), 50 deletions(-) diff --git a/.gitlab-ci.dhall b/.gitlab-ci.dhall index 5fb297f7..4156ddc5 100644 --- a/.gitlab-ci.dhall +++ b/.gitlab-ci.dhall @@ -12,19 +12,15 @@ let toStep = λ(id : Text) → λ(prefix : Text) → λ(x : Text) → - { mapKey = id - , mapValue.script = [ "nix build -L .#${prefix}.${x}" ] - } + { mapKey = id, mapValue.script = [ "nix build -L .#${prefix}.${x}" ] } let input = Prelude.Map.keys Text H.HaskellPackage.Type ./manifest.dhall let packages = Prelude.List.map - (Text) + Text (H.Attr Step) - ( λ(x : Text) → - toStep "Package ${x}" "packages.x86_64-linux" x - ) + (λ(x : Text) → toStep "Package ${x}" "packages.x86_64-linux" x) (input : List Text) in packages diff --git a/flake.nix b/flake.nix index 4ee71aec..3eb59c77 100644 --- a/flake.nix +++ b/flake.nix @@ -20,60 +20,60 @@ , ... }: flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: - let - pkgs = nixpkgs.legacyPackages.${system}; - in - with pkgs.lib; - with pkgs.writers; - let + let + pkgs = nixpkgs.legacyPackages.${system}; + in + with pkgs.lib; + with pkgs.writers; + let - horizon-gen-nix-app = get-flake horizon-gen-nix; + horizon-gen-nix-app = get-flake horizon-gen-nix; - haskellLib = pkgs.haskell.lib.compose; + haskellLib = pkgs.haskell.lib.compose; - legacyPackages = pkgs.callPackage (nixpkgs + /pkgs/development/haskell-modules) { - buildHaskellPackages = pkgs.haskell.packages.ghc942; - compilerConfig = pkgs.callPackage ./configuration-ghc-9.4.x.nix { inherit haskellLib; }; - configurationCommon = import ./configuration.nix; - configurationNix = { pkgs, haskellLib }: self: super: { }; - ghc = pkgs.haskell.compiler.ghc942; - inherit haskellLib; - initialPackages = import ./overlay.nix; - nonHackagePackages = self: super: { }; - }; - - packages = filterAttrs - (n: v: v != null - && builtins.typeOf v == "set" - && pkgs.lib.hasAttr "type" v - && v.type == "derivation" - && v.meta.broken == false) - legacyPackages; + legacyPackages = pkgs.callPackage (nixpkgs + /pkgs/development/haskell-modules) { + buildHaskellPackages = pkgs.haskell.packages.ghc942; + compilerConfig = pkgs.callPackage ./configuration-ghc-9.4.x.nix { inherit haskellLib; }; + configurationCommon = import ./configuration.nix; + configurationNix = { pkgs, haskellLib }: self: super: { }; + ghc = pkgs.haskell.compiler.ghc942; + inherit haskellLib; + initialPackages = import ./overlay.nix; + nonHackagePackages = self: super: { }; + }; - horizon-gen-gitlab-ci = writeBashBin "gen-gitlab-ci" "${pkgs.dhall-json}/bin/dhall-to-yaml --file .gitlab-ci.dhall"; + packages = filterAttrs + (n: v: v != null + && builtins.typeOf v == "set" + && pkgs.lib.hasAttr "type" v + && v.type == "derivation" + && v.meta.broken == false) + legacyPackages; - in - { + horizon-gen-gitlab-ci = writeBashBin "gen-gitlab-ci" "${pkgs.dhall-json}/bin/dhall-to-yaml --file .gitlab-ci.dhall"; - apps = { + in + { - horizon-gen-nix = horizon-gen-nix-app.outputs.apps.${system}.horizon-gen-nix; + apps = { - horizon-gen-gitlab-ci = { - type = "app"; - program = "${horizon-gen-gitlab-ci}/bin/gen-gitlab-ci"; - }; + horizon-gen-nix = horizon-gen-nix-app.outputs.apps.${system}.horizon-gen-nix; + horizon-gen-gitlab-ci = { + type = "app"; + program = "${horizon-gen-gitlab-ci}/bin/gen-gitlab-ci"; }; - checks = { - dhall-format = lint-utils.outputs.linters.${system}.dhall-format ./.; - nixpkgs-fmt = lint-utils.outputs.linters.${system}.nixpkgs-fmt ./.; - }; + }; + + checks = { + dhall-format = lint-utils.outputs.linters.${system}.dhall-format ./.; + nixpkgs-fmt = lint-utils.outputs.linters.${system}.nixpkgs-fmt ./.; + }; - inherit legacyPackages; + inherit legacyPackages; - inherit packages; + inherit packages; - }); + }); } diff --git a/overlay.nix b/overlay.nix index 981d54a4..61b0323e 100644 --- a/overlay.nix +++ b/overlay.nix @@ -1,4 +1,4 @@ -{pkgs, lib, callPackage, ...}: +{ pkgs, lib, callPackage, ... }: self: with pkgs.haskell.lib; { Cabal = self.callPackage (./pkgs/Cabal.nix) { }; -- GitLab