I have a monorepo that would depends on some external dependencies. It works fine locally with flake, using devShell
, but for installing packages over CircleCI, how can I do that, if I am not using a NixOS docker image, but a machine image, which would be Ubuntu?
This is my simple flake, nothing fancy
{
description = "closesource repo flake";
inputs = {
nixpkgs = { url = "github:nixos/nixpkgs/nixos-unstable"; };
flake-utils = {
url = "github:numtide/flake-utils";
inputs = { nixpkgs.follows = "nixpkgs"; };
};
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = (import nixpkgs {
inherit system;
overlays = [];
});
in {
devShell = (({ pkgs, ... }:
pkgs.mkShell {
buildInputs = with pkgs; [ terraform ];
}) { inherit pkgs; });
});
}
I am using this orbs for installing Nix in CircleCI: CircleCI Developer Hub - eld/nix
My circleCI config:
# Conditional job example
# https://github.com/winston0410/closesource/blob/bd858c6de8ed72ea01ca3df0df6d48563bfee0d4/.circleci/config.yml
version: 2.1
orbs:
nx: nrwl/nx@1.4.0
node: circleci/node@5.0.2
nix: eld/nix@1.0.0
jobs:
test:
machine: true
resource_class: medium
steps:
- checkout
- node/install:
node-version: "16.15.1"
- node/install-packages
- nix/install
# Install packages from flake and try to do something great!
workflows:
default:
jobs:
- test