From c1c379848a19a31de8febb1385c7b9e4d2a474a3 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 15 Nov 2019 15:26:08 +0000 Subject: chore(nix): Move files around to conform to new read-tree layout Broadly speaking, the following things are included: * there is now a uniform `args` struct that is passed to all derivations, package headers have been changed appropriately * overrides are now loaded from a separate `override` folder just using read-tree.nix * third-party packages have moved into the `third_party` attribute set --- default.nix | 84 ++++++---------------- overrides/elmPackages.nix | 10 +++ overrides/kontemplate.nix | 14 ++++ overrides/lispPackages/default.nix | 8 +++ .../quicklisp-to-nix-output/cl-prevalence.nix | 27 +++++++ .../quicklisp-to-nix-output/s-sysdeps.nix | 25 +++++++ .../lispPackages/quicklisp-to-nix-output/s-xml.nix | 27 +++++++ overrides/lispPackages/quicklisp.nix | 26 +++++++ read-tree.nix | 4 +- services/gemma/default.nix | 31 ++++---- services/nixcon-demo/default.nix | 3 + services/tazblog/default.nix | 3 +- .../quicklisp-to-nix-output/cl-prevalence.nix | 27 ------- .../quicklisp-to-nix-output/s-sysdeps.nix | 25 ------- .../common_lisp/quicklisp-to-nix-output/s-xml.nix | 27 ------- third_party/common_lisp/quicklisp.nix | 29 -------- third_party/naersk.nix | 9 +++ third_party/nixery.nix | 2 +- third_party/ormolu.nix | 8 +++ third_party/terraform-gcp.nix | 3 + tools/bin/__dispatch.sh | 6 +- tools/blog_cli/default.nix | 4 +- tools/kms_pass/default.nix | 22 +++--- 23 files changed, 217 insertions(+), 207 deletions(-) create mode 100644 overrides/elmPackages.nix create mode 100644 overrides/kontemplate.nix create mode 100644 overrides/lispPackages/default.nix create mode 100644 overrides/lispPackages/quicklisp-to-nix-output/cl-prevalence.nix create mode 100644 overrides/lispPackages/quicklisp-to-nix-output/s-sysdeps.nix create mode 100644 overrides/lispPackages/quicklisp-to-nix-output/s-xml.nix create mode 100644 overrides/lispPackages/quicklisp.nix delete mode 100644 third_party/common_lisp/quicklisp-to-nix-output/cl-prevalence.nix delete mode 100644 third_party/common_lisp/quicklisp-to-nix-output/s-sysdeps.nix delete mode 100644 third_party/common_lisp/quicklisp-to-nix-output/s-xml.nix delete mode 100644 third_party/common_lisp/quicklisp.nix create mode 100644 third_party/naersk.nix create mode 100644 third_party/ormolu.nix create mode 100644 third_party/terraform-gcp.nix diff --git a/default.nix b/default.nix index 93e2d9fc54..789098667a 100644 --- a/default.nix +++ b/default.nix @@ -14,78 +14,34 @@ let url = "https://github.com/NixOS/nixpkgs-channels/archive/${stableCommit}.tar.gz"; sha256 = "0243qiivxl3z51biy4f5y5cy81x5bki5dazl9wqwgnmd373gpmxy"; }; + readTree = import ./read-tree.nix; - localPkgs = self: super: { - # Local projects should be added here: - tazjin = { - blog = self.callPackage ./services/tazblog {}; - blog_cli = self.callPackage ./tools/blog_cli {}; - gemma = self.callPackage ./services/gemma {}; - nixcon = self.naersk.buildPackage ./services/nixcon-demo {}; + localPkgs = self: super: + let config = { + pkgs = self; + upstream = super; - kms_pass = self.callPackage ./tools/kms_pass { + kms = { project = "tazjins-infrastructure"; region = "europe-north1"; keyring = "tazjins-keys"; key = "kontemplate-key"; }; }; - - # Third-party projects (either vendored or modified from nixpkgs) go here: - nixery = import ./third_party/nixery.nix { pkgs = self; }; - terraform-gcp = self.terraform_0_12.withPlugins(p: [ p.google p.google-beta ]); - ormolu = import (self.fetchFromGitHub { - owner = "tweag"; - repo = "ormolu"; - rev = "a7076c0f83e5c06ea9067b71171859fa2ba8afd9"; - sha256 = "1p4n2ja4ciw3qfskn65ggpy37mvgf2sslxqmqn8s8jjarnqcyfny"; - }) { pkgs = self; }; - naersk = self.callPackage (self.fetchFromGitHub { - owner = "nmattia"; - repo = "naersk"; - rev = "68c1c2b2b661913cdc5ecabea518dfdc4f449027"; - sha256 = "1ll310pl44kdbwfslzwvg2v7khf1y0xkg2j5wcfia4k7sj6bcl28"; - }) {}; - - # Gemma needs an older version of Elm to be built. Updating it to - # the newer version is a lot of effort. - elmPackages = (import (self.fetchFromGitHub { - owner = "NixOS"; - repo = "nixpkgs"; - rev = "14f9ee66e63077539252f8b4550049381a082518"; - sha256 = "1wn7nmb1cqfk2j91l3rwc6yhimfkzxprb8wknw5wi57yhq9m6lv1"; - }) {}).elmPackages; - - # Wrap kontemplate to inject the Cloud KMS version of 'pass' - kontemplate = - let master = super.kontemplate.overrideAttrs(_: { - src = self.fetchFromGitHub { - owner = "tazjin"; - repo = "kontemplate"; - rev = "v1.8.0"; - sha256 = "123mjmmm4hynraq1fpn3j5i0a1i87l265kkjraxxxbl0zacv74i1"; - }; - }); - in self.writeShellScriptBin "kontemplate" '' - export PATH="${self.tazjin.kms_pass}/bin:$PATH" - exec ${master}/bin/kontemplate $@ - ''; - - # One of Gemma's dependencies is missing in nixpkgs' Quicklisp - # package set, it is overlaid locally here. - lispPackages = import ./third_party/common_lisp/quicklisp.nix { - inherit (self) lib; - inherit (super) lispPackages; - }; - - # All projects that should be built by CI should be added here: - ciProjects = [ - self.kontemplate - self.nixery - self.ormolu - self.terraform-gcp - ] ++ filter (d: d ? meta.broken && !d.meta.broken) (attrValues self.tazjin); - }; + in { + services = readTree ./services config; + tools = readTree ./tools config; + third_party = readTree ./third_party config; + } // (readTree ./overrides config); + + # # All projects that should be built by CI should be added here: + # ciProjects = [ + # self.kontemplate + # self.nixery + # self.ormolu + # self.terraform-gcp + # ] ++ filter (d: d ? meta.broken && !d.meta.broken) (attrValues self.tazjin); + # }; in { ... } @ args: import stableSrc (args // { overlays = [ localPkgs ]; diff --git a/overrides/elmPackages.nix b/overrides/elmPackages.nix new file mode 100644 index 0000000000..3df44420a6 --- /dev/null +++ b/overrides/elmPackages.nix @@ -0,0 +1,10 @@ +# Gemma needs an older version of Elm to be built. Updating it to +# the newer version is a lot of effort. +{ pkgs, ... }: + +(import (pkgs.fetchFromGitHub { + owner = "NixOS"; + repo = "nixpkgs"; + rev = "14f9ee66e63077539252f8b4550049381a082518"; + sha256 = "1wn7nmb1cqfk2j91l3rwc6yhimfkzxprb8wknw5wi57yhq9m6lv1"; +}) {}).elmPackages diff --git a/overrides/kontemplate.nix b/overrides/kontemplate.nix new file mode 100644 index 0000000000..28381b0137 --- /dev/null +++ b/overrides/kontemplate.nix @@ -0,0 +1,14 @@ +{ pkgs, upstream, ... }: + +let master = upstream.kontemplate.overrideAttrs(_: { + src = pkgs.fetchFromGitHub { + owner = "tazjin"; + repo = "kontemplate"; + rev = "v1.8.0"; + sha256 = "123mjmmm4hynraq1fpn3j5i0a1i87l265kkjraxxxbl0zacv74i1"; + }; +}); +in pkgs.writeShellScriptBin "kontemplate" '' + export PATH="${pkgs.tools.kms_pass}/bin:$PATH" + exec ${master}/bin/kontemplate $@ +'' diff --git a/overrides/lispPackages/default.nix b/overrides/lispPackages/default.nix new file mode 100644 index 0000000000..da8f3c893a --- /dev/null +++ b/overrides/lispPackages/default.nix @@ -0,0 +1,8 @@ +# One of Gemma's dependencies is missing in nixpkgs' Quicklisp +# package set, it is overlaid locally here. +{ pkgs, upstream, ... }: + +import ./quicklisp.nix { + inherit (pkgs) lib; + inherit (upstream) lispPackages; +} diff --git a/overrides/lispPackages/quicklisp-to-nix-output/cl-prevalence.nix b/overrides/lispPackages/quicklisp-to-nix-output/cl-prevalence.nix new file mode 100644 index 0000000000..4e5e3ec5d6 --- /dev/null +++ b/overrides/lispPackages/quicklisp-to-nix-output/cl-prevalence.nix @@ -0,0 +1,27 @@ +args @ { fetchurl, ... }: +rec { + baseName = ''cl-prevalence''; + version = ''20130720-hg''; + + description = ''Common Lisp Prevalence Package''; + + deps = [ args."s-sysdeps" args."s-xml" ]; + + src = fetchurl { + url = ''http://beta.quicklisp.org/archive/cl-prevalence/2013-07-20/cl-prevalence-20130720-hg.tgz''; + sha256 = ''09pqbw6xcgy0242npiqw7sd8jwwjc0kz7m0sas48jjr0zgnnmi89''; + }; + + packageName = "cl-prevalence"; + + asdFilesToKeep = ["cl-prevalence.asd"]; + overrides = x: x; +} +/* (SYSTEM cl-prevalence DESCRIPTION Common Lisp Prevalence Package SHA256 + 09pqbw6xcgy0242npiqw7sd8jwwjc0kz7m0sas48jjr0zgnnmi89 URL + http://beta.quicklisp.org/archive/cl-prevalence/2013-07-20/cl-prevalence-20130720-hg.tgz + MD5 6176c34b8e1621b65906b1575d9fa20d NAME cl-prevalence FILENAME + cl-prevalence DEPS + ((NAME s-sysdeps FILENAME s-sysdeps) (NAME s-xml FILENAME s-xml)) + DEPENDENCIES (s-sysdeps s-xml) VERSION 20130720-hg SIBLINGS + (cl-prevalence-test) PARASITES NIL) */ diff --git a/overrides/lispPackages/quicklisp-to-nix-output/s-sysdeps.nix b/overrides/lispPackages/quicklisp-to-nix-output/s-sysdeps.nix new file mode 100644 index 0000000000..1c28ec6e2a --- /dev/null +++ b/overrides/lispPackages/quicklisp-to-nix-output/s-sysdeps.nix @@ -0,0 +1,25 @@ +args @ { fetchurl, ... }: +rec { + baseName = ''s-sysdeps''; + version = ''20130128-git''; + + description = ''An abstraction layer over platform dependent functionality''; + + deps = [ ]; + + src = fetchurl { + url = ''http://beta.quicklisp.org/archive/s-sysdeps/2013-01-28/s-sysdeps-20130128-git.tgz''; + sha256 = ''048q0mzypnm284bvv7036d4z7bv7rdcqks5l372s74kq279l2y00''; + }; + + packageName = "s-sysdeps"; + + asdFilesToKeep = ["s-sysdeps.asd"]; + overrides = x: x; +} +/* (SYSTEM s-sysdeps DESCRIPTION + An abstraction layer over platform dependent functionality SHA256 + 048q0mzypnm284bvv7036d4z7bv7rdcqks5l372s74kq279l2y00 URL + http://beta.quicklisp.org/archive/s-sysdeps/2013-01-28/s-sysdeps-20130128-git.tgz + MD5 2fe61fadafd62ef9597e17b4783889ef NAME s-sysdeps FILENAME s-sysdeps DEPS + NIL DEPENDENCIES NIL VERSION 20130128-git SIBLINGS NIL PARASITES NIL) */ diff --git a/overrides/lispPackages/quicklisp-to-nix-output/s-xml.nix b/overrides/lispPackages/quicklisp-to-nix-output/s-xml.nix new file mode 100644 index 0000000000..ec12dde522 --- /dev/null +++ b/overrides/lispPackages/quicklisp-to-nix-output/s-xml.nix @@ -0,0 +1,27 @@ +args @ { fetchurl, ... }: +rec { + baseName = ''s-xml''; + version = ''20150608-git''; + + parasites = [ "s-xml.examples" "s-xml.test" ]; + + description = ''Simple Common Lisp XML Parser''; + + deps = [ ]; + + src = fetchurl { + url = ''http://beta.quicklisp.org/archive/s-xml/2015-06-08/s-xml-20150608-git.tgz''; + sha256 = ''0cy36wqzasqma4maw9djq1vdwsp5hxq8svlbnhbv9sq9zzys5viq''; + }; + + packageName = "s-xml"; + + asdFilesToKeep = ["s-xml.asd"]; + overrides = x: x; +} +/* (SYSTEM s-xml DESCRIPTION Simple Common Lisp XML Parser SHA256 + 0cy36wqzasqma4maw9djq1vdwsp5hxq8svlbnhbv9sq9zzys5viq URL + http://beta.quicklisp.org/archive/s-xml/2015-06-08/s-xml-20150608-git.tgz + MD5 9c31c80f0661777c493fab683f776716 NAME s-xml FILENAME s-xml DEPS NIL + DEPENDENCIES NIL VERSION 20150608-git SIBLINGS NIL PARASITES + (s-xml.examples s-xml.test)) */ diff --git a/overrides/lispPackages/quicklisp.nix b/overrides/lispPackages/quicklisp.nix new file mode 100644 index 0000000000..1d23db762d --- /dev/null +++ b/overrides/lispPackages/quicklisp.nix @@ -0,0 +1,26 @@ +{ lib, lispPackages }: + +let inherit (lispPackages) buildLispPackage qlOverrides fetchurl; +in lispPackages // lib.fix(self: { + "s-xml" = buildLispPackage + ((f: x: (x // (f x))) + (qlOverrides."s-xml" or (x: {})) + (import ./quicklisp-to-nix-output/s-xml.nix { + inherit fetchurl; + })); + + "s-sysdeps" = buildLispPackage + ((f: x: (x // (f x))) + (qlOverrides."s-sysdeps" or (x: {})) + (import ./quicklisp-to-nix-output/s-sysdeps.nix { + inherit fetchurl; + })); + + "cl-prevalence" = buildLispPackage + ((f: x: (x // (f x))) + (qlOverrides."cl-prevalence" or (x: {})) + (import ./quicklisp-to-nix-output/cl-prevalence.nix { + inherit fetchurl; + inherit (self) s-sysdeps s-xml; + })); +}) diff --git a/read-tree.nix b/read-tree.nix index 00a2e738bd..d883d12c81 100644 --- a/read-tree.nix +++ b/read-tree.nix @@ -1,4 +1,4 @@ -path: self: super: +path: { pkgs, ... } @ args: let inherit (builtins) @@ -15,8 +15,6 @@ let toPath toString; - args = { pkgs = self; }; - zipAttrs = names: values: if (names == []) || (values == []) then [] diff --git a/services/gemma/default.nix b/services/gemma/default.nix index 409d8eef38..ea10a4c7d0 100644 --- a/services/gemma/default.nix +++ b/services/gemma/default.nix @@ -1,17 +1,20 @@ -{ stdenv, sbcl, lispPackages, elmPackages, makeWrapper, openssl }: - -let frontend = stdenv.mkDerivation { - name = "gemma-frontend"; - src = ./frontend; - buildInputs = [ elmPackages.elm ]; - - phases = [ "unpackPhase" "buildPhase" ]; - buildPhase = '' - mkdir .home && export HOME="$PWD/.home" - mkdir -p $out - elm-make --yes Main.elm --output $out/index.html - ''; -}; +{ pkgs, ... }: + +let + inherit (pkgs) stdenv sbcl lispPackages elmPackages makeWrapper openssl; + + frontend = stdenv.mkDerivation { + name = "gemma-frontend"; + src = ./frontend; + buildInputs = [ elmPackages.elm ]; + + phases = [ "unpackPhase" "buildPhase" ]; + buildPhase = '' + mkdir .home && export HOME="$PWD/.home" + mkdir -p $out + elm-make --yes Main.elm --output $out/index.html + ''; + }; in stdenv.mkDerivation rec { name = "gemma"; src = ./.; diff --git a/services/nixcon-demo/default.nix b/services/nixcon-demo/default.nix index e69de29bb2..0f4a330f7f 100644 --- a/services/nixcon-demo/default.nix +++ b/services/nixcon-demo/default.nix @@ -0,0 +1,3 @@ +{ pkgs, ... }: + +pkgs.third_party.naersk.buildPackage ./. {} diff --git a/services/tazblog/default.nix b/services/tazblog/default.nix index 5dc3bdaf3e..2e75c3c2dc 100644 --- a/services/tazblog/default.nix +++ b/services/tazblog/default.nix @@ -2,9 +2,10 @@ # # tazblog.nix was generated using cabal2nix. -{ writeShellScriptBin, haskell }: +{ pkgs, ... }: let + inherit (pkgs) writeShellScriptBin haskell; tazblog = haskell.packages.ghc865.callPackage ./tazblog.nix {}; wrapper = writeShellScriptBin "tazblog" '' export PORT=8000 diff --git a/third_party/common_lisp/quicklisp-to-nix-output/cl-prevalence.nix b/third_party/common_lisp/quicklisp-to-nix-output/cl-prevalence.nix deleted file mode 100644 index 4e5e3ec5d6..0000000000 --- a/third_party/common_lisp/quicklisp-to-nix-output/cl-prevalence.nix +++ /dev/null @@ -1,27 +0,0 @@ -args @ { fetchurl, ... }: -rec { - baseName = ''cl-prevalence''; - version = ''20130720-hg''; - - description = ''Common Lisp Prevalence Package''; - - deps = [ args."s-sysdeps" args."s-xml" ]; - - src = fetchurl { - url = ''http://beta.quicklisp.org/archive/cl-prevalence/2013-07-20/cl-prevalence-20130720-hg.tgz''; - sha256 = ''09pqbw6xcgy0242npiqw7sd8jwwjc0kz7m0sas48jjr0zgnnmi89''; - }; - - packageName = "cl-prevalence"; - - asdFilesToKeep = ["cl-prevalence.asd"]; - overrides = x: x; -} -/* (SYSTEM cl-prevalence DESCRIPTION Common Lisp Prevalence Package SHA256 - 09pqbw6xcgy0242npiqw7sd8jwwjc0kz7m0sas48jjr0zgnnmi89 URL - http://beta.quicklisp.org/archive/cl-prevalence/2013-07-20/cl-prevalence-20130720-hg.tgz - MD5 6176c34b8e1621b65906b1575d9fa20d NAME cl-prevalence FILENAME - cl-prevalence DEPS - ((NAME s-sysdeps FILENAME s-sysdeps) (NAME s-xml FILENAME s-xml)) - DEPENDENCIES (s-sysdeps s-xml) VERSION 20130720-hg SIBLINGS - (cl-prevalence-test) PARASITES NIL) */ diff --git a/third_party/common_lisp/quicklisp-to-nix-output/s-sysdeps.nix b/third_party/common_lisp/quicklisp-to-nix-output/s-sysdeps.nix deleted file mode 100644 index 1c28ec6e2a..0000000000 --- a/third_party/common_lisp/quicklisp-to-nix-output/s-sysdeps.nix +++ /dev/null @@ -1,25 +0,0 @@ -args @ { fetchurl, ... }: -rec { - baseName = ''s-sysdeps''; - version = ''20130128-git''; - - description = ''An abstraction layer over platform dependent functionality''; - - deps = [ ]; - - src = fetchurl { - url = ''http://beta.quicklisp.org/archive/s-sysdeps/2013-01-28/s-sysdeps-20130128-git.tgz''; - sha256 = ''048q0mzypnm284bvv7036d4z7bv7rdcqks5l372s74kq279l2y00''; - }; - - packageName = "s-sysdeps"; - - asdFilesToKeep = ["s-sysdeps.asd"]; - overrides = x: x; -} -/* (SYSTEM s-sysdeps DESCRIPTION - An abstraction layer over platform dependent functionality SHA256 - 048q0mzypnm284bvv7036d4z7bv7rdcqks5l372s74kq279l2y00 URL - http://beta.quicklisp.org/archive/s-sysdeps/2013-01-28/s-sysdeps-20130128-git.tgz - MD5 2fe61fadafd62ef9597e17b4783889ef NAME s-sysdeps FILENAME s-sysdeps DEPS - NIL DEPENDENCIES NIL VERSION 20130128-git SIBLINGS NIL PARASITES NIL) */ diff --git a/third_party/common_lisp/quicklisp-to-nix-output/s-xml.nix b/third_party/common_lisp/quicklisp-to-nix-output/s-xml.nix deleted file mode 100644 index ec12dde522..0000000000 --- a/third_party/common_lisp/quicklisp-to-nix-output/s-xml.nix +++ /dev/null @@ -1,27 +0,0 @@ -args @ { fetchurl, ... }: -rec { - baseName = ''s-xml''; - version = ''20150608-git''; - - parasites = [ "s-xml.examples" "s-xml.test" ]; - - description = ''Simple Common Lisp XML Parser''; - - deps = [ ]; - - src = fetchurl { - url = ''http://beta.quicklisp.org/archive/s-xml/2015-06-08/s-xml-20150608-git.tgz''; - sha256 = ''0cy36wqzasqma4maw9djq1vdwsp5hxq8svlbnhbv9sq9zzys5viq''; - }; - - packageName = "s-xml"; - - asdFilesToKeep = ["s-xml.asd"]; - overrides = x: x; -} -/* (SYSTEM s-xml DESCRIPTION Simple Common Lisp XML Parser SHA256 - 0cy36wqzasqma4maw9djq1vdwsp5hxq8svlbnhbv9sq9zzys5viq URL - http://beta.quicklisp.org/archive/s-xml/2015-06-08/s-xml-20150608-git.tgz - MD5 9c31c80f0661777c493fab683f776716 NAME s-xml FILENAME s-xml DEPS NIL - DEPENDENCIES NIL VERSION 20150608-git SIBLINGS NIL PARASITES - (s-xml.examples s-xml.test)) */ diff --git a/third_party/common_lisp/quicklisp.nix b/third_party/common_lisp/quicklisp.nix deleted file mode 100644 index a0040f1d6f..0000000000 --- a/third_party/common_lisp/quicklisp.nix +++ /dev/null @@ -1,29 +0,0 @@ -# Overlay over `pkgs.lispPackages` that adds additional packages which -# are missing from the imported Quicklisp package set in nixpkgs. - -{ lib, lispPackages }: - -let inherit (lispPackages) buildLispPackage qlOverrides fetchurl; -in lispPackages // lib.fix(self: { - "s-xml" = buildLispPackage - ((f: x: (x // (f x))) - (qlOverrides."s-xml" or (x: {})) - (import ./quicklisp-to-nix-output/s-xml.nix { - inherit fetchurl; - })); - - "s-sysdeps" = buildLispPackage - ((f: x: (x // (f x))) - (qlOverrides."s-sysdeps" or (x: {})) - (import ./quicklisp-to-nix-output/s-sysdeps.nix { - inherit fetchurl; - })); - - "cl-prevalence" = buildLispPackage - ((f: x: (x // (f x))) - (qlOverrides."cl-prevalence" or (x: {})) - (import ./quicklisp-to-nix-output/cl-prevalence.nix { - inherit fetchurl; - inherit (self) s-sysdeps s-xml; - })); -}) diff --git a/third_party/naersk.nix b/third_party/naersk.nix new file mode 100644 index 0000000000..c12c1abbbf --- /dev/null +++ b/third_party/naersk.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: + +let inherit (pkgs) callPackage fetchFromGitHub; +in callPackage (fetchFromGitHub { + owner = "nmattia"; + repo = "naersk"; + rev = "68c1c2b2b661913cdc5ecabea518dfdc4f449027"; + sha256 = "1ll310pl44kdbwfslzwvg2v7khf1y0xkg2j5wcfia4k7sj6bcl28"; +}) {} diff --git a/third_party/nixery.nix b/third_party/nixery.nix index cb10e0b913..f778e5da13 100644 --- a/third_party/nixery.nix +++ b/third_party/nixery.nix @@ -1,6 +1,6 @@ # Technically I suppose Nixery is not a third-party program, but it's # outside of this repository ... -{ pkgs }: +{ pkgs, ... }: let src = pkgs.fetchFromGitHub { owner = "google"; diff --git a/third_party/ormolu.nix b/third_party/ormolu.nix new file mode 100644 index 0000000000..3175e25ff1 --- /dev/null +++ b/third_party/ormolu.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: + +import (pkgs.fetchFromGitHub { + owner = "tweag"; + repo = "ormolu"; + rev = "a7076c0f83e5c06ea9067b71171859fa2ba8afd9"; + sha256 = "1p4n2ja4ciw3qfskn65ggpy37mvgf2sslxqmqn8s8jjarnqcyfny"; +}) { inherit pkgs; } diff --git a/third_party/terraform-gcp.nix b/third_party/terraform-gcp.nix new file mode 100644 index 0000000000..3332c12e41 --- /dev/null +++ b/third_party/terraform-gcp.nix @@ -0,0 +1,3 @@ +{ pkgs, ... }: + +pkgs.terraform_0_12.withPlugins(p: [ p.google p.google-beta ]) diff --git a/tools/bin/__dispatch.sh b/tools/bin/__dispatch.sh index 20848bd511..c22b0339fd 100755 --- a/tools/bin/__dispatch.sh +++ b/tools/bin/__dispatch.sh @@ -11,19 +11,19 @@ readonly TARGET_TOOL=$(basename $0) case "${TARGET_TOOL}" in terraform) - attr="terraform-gcp" + attr="third_party.terraform-gcp" ;; kontemplate) attr="kontemplate" ;; blog_cli) - attr="tazjin.blog_cli" + attr="tools.blog_cli" ;; stern) attr="stern" ;; pass) - attr="tazjin.kms_pass" + attr="tools.kms_pass" ;; *) echo "The tool '${TARGET_TOOL}' is currently not installed in this repository." diff --git a/tools/blog_cli/default.nix b/tools/blog_cli/default.nix index c755d273a2..8113c93360 100644 --- a/tools/blog_cli/default.nix +++ b/tools/blog_cli/default.nix @@ -1,6 +1,6 @@ -{ buildGoPackage }: +{ pkgs, ... }: -buildGoPackage { +pkgs.buildGoPackage { name = "blog_cli"; goPackagePath = "github.com/tazjin/personal/blog_cli"; src = ./.; diff --git a/tools/kms_pass/default.nix b/tools/kms_pass/default.nix index fbc17650a9..113db30224 100644 --- a/tools/kms_pass/default.nix +++ b/tools/kms_pass/default.nix @@ -6,10 +6,10 @@ # # Only the 'show' and 'insert' commands are supported. -{ google-cloud-sdk, tree, writeShellScriptBin -, project, region, keyring, key }: +{ pkgs, kms, ... }: -writeShellScriptBin "pass" '' +let inherit (pkgs) google-cloud-sdk tree writeShellScriptBin; +in writeShellScriptBin "pass" '' set -eo pipefail CMD="$1" @@ -34,20 +34,20 @@ writeShellScriptBin "pass" '' show) secret_check ${google-cloud-sdk}/bin/gcloud kms decrypt \ - --project ${project} \ - --location ${region} \ - --keyring ${keyring} \ - --key ${key} \ + --project ${kms.project} \ + --location ${kms.region} \ + --keyring ${kms.keyring} \ + --key ${kms.key} \ --ciphertext-file $SECRET_PATH \ --plaintext-file - ;; insert) secret_check ${google-cloud-sdk}/bin/gcloud kms encrypt \ - --project ${project} \ - --location ${region} \ - --keyring ${keyring} \ - --key ${key} \ + --project ${kms.project} \ + --location ${kms.region} \ + --keyring ${kms.keyring} \ + --key ${kms.key} \ --ciphertext-file $SECRET_PATH \ --plaintext-file - echo "Inserted secret '$SECRET'" -- cgit 1.4.1