diff --git a/overview/content-types/config-item.nix b/overview/content-types/config-item.nix deleted file mode 100644 index bd05b68a7..000000000 --- a/overview/content-types/config-item.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - name, - config, - lib, - ... -}: -let - inherit (lib) mkOption types; -in -{ - options = { - name = mkOption { - type = types.str; - default = name; - }; - value = mkOption { - type = with types; either str (listOf str); - }; - }; -} diff --git a/overview/content-types/nix-config.nix b/overview/content-types/nix-config.nix deleted file mode 100644 index 726d1126c..000000000 --- a/overview/content-types/nix-config.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - name, - config, - lib, - ... -}: -let - inherit (lib) mkOption types; -in -{ - options = { - __toString = mkOption { - type = with types; functionTo str; - readOnly = true; - default = - self: - let - separator = "'$'\\n''"; - concatSettings = lib.concatStringsSep separator ( - lib.map (attrs: "${attrs.name} = ${toString attrs.value}") self.settings - ); - in - "NIX_CONFIG='${concatSettings}'"; - }; - settings = mkOption { - type = with types; listOf (submodule ./config-item.nix); - }; - }; -} diff --git a/overview/default.nix b/overview/default.nix index d7ee0eed8..3b6d20f7d 100644 --- a/overview/default.nix +++ b/overview/default.nix @@ -300,31 +300,26 @@ let } ]; }; - nix-config = eval { - imports = [ ./content-types/nix-config.nix ]; - settings = [ - { - name = "substituters"; - value = [ - "https://cache.nixos.org/" - "https://ngi.cachix.org/" - ]; - } - { - name = "trusted-public-keys"; - value = [ - "cache.nixos.org-1:6nchdd59x431o0gwypbmraurkbj16zpmqfgspcdshjy=" - "ngi.cachix.org-1:n+cal72roc3qqulxihpv+tw5t42whxmmhpragkrsrow=" - ]; - } - ]; - }; - set-nix-config = eval { - imports = [ ./content-types/commands.nix ]; - instructions.commands.bash.input = '' - export ${nix-config} - ''; - }; + set-nix-config = + let + from-yaml = + file: + with builtins; + fromJSON ( + # XXX(@fricklerhandwerk): IFD, sorry. I was there, Gandalf: https://github.com/NixOS/nix/pull/7340 + readFile (pkgs.runCommandNoCC "yaml.json" { } "${lib.getExe pkgs.yj} < ${file} > $out") + ); + workflow = from-yaml ../.github/workflows/test-demo.yaml; + nix-config = with lib; trim (elemAt workflow.jobs.test.steps 3).env.NIX_CONFIG; + in + eval { + imports = [ ./content-types/commands.nix ]; + instructions.commands.bash.input = '' + export NIX_CONFIG=" + ${nix-config} + " + ''; + }; in '' ${heading 2 "demo" (