1 00:00:00,000 --> 00:00:05,200 Talk is about building secure reproducible data infrastructure with Nix and NixOS. 2 00:00:05,800 --> 00:00:12,080 So building data infrastructure is still surprisingly... I'm close to the mic. 3 00:00:12,080 --> 00:00:19,140 Building data infrastructure is still surprisingly, to you I assume, manual. 4 00:00:19,460 --> 00:00:26,660 Us data engineers, we stitch together storage and catalogs and query engines with one-off scripts. 5 00:00:26,660 --> 00:00:37,580 And when we try to move that stack across environments, say from dev to a colo, to an air gap lab, things break a lot. 6 00:00:37,680 --> 00:00:47,220 So with Nix and NixOS, it's possible to define everything as code and run the same stack and all its dependencies anywhere in a reproducible way. 7 00:00:47,540 --> 00:00:49,880 So that's the premise behind this talk. 8 00:00:49,880 --> 00:00:59,260 And before we define what a lake house, a data lake house, not real estate here, is, I want to talk about what it isn't. 9 00:00:59,420 --> 00:01:07,960 So traditional data warehouses, databases, they're optimized for reliability and performance, but they're really rigid. 10 00:01:07,960 --> 00:01:10,500 So they require a lot of upfront data modeling. 11 00:01:10,500 --> 00:01:13,460 They rely on ETL pipelines to load data. 12 00:01:13,460 --> 00:01:23,440 They typically only scale vertically, which becomes really expensive and really complex when you have a large volume of data, which everybody wants to have. 13 00:01:23,440 --> 00:01:27,300 So data lake houses took the opposite approach. 14 00:01:27,300 --> 00:01:30,300 So this was born in the era of Hadoop. 15 00:01:30,300 --> 00:01:37,060 These are store-everything-first data tools. 16 00:01:37,520 --> 00:01:39,160 They worry about structure later. 17 00:01:39,160 --> 00:01:44,140 Store-it-first, just the E of the ETL, put it all in, figure it out later. 18 00:01:44,440 --> 00:01:46,160 They scale horizontally. 19 00:01:46,460 --> 00:01:52,460 They're great for collecting a bunch of stuff all at once, but they're messy, they're disorganized. 20 00:01:52,460 --> 00:01:56,720 It's really hard to actually extract any information or value from. 21 00:01:57,040 --> 00:02:02,640 The combination, the game changer, is the two combined. 22 00:02:02,640 --> 00:02:11,100 So a data lake house brings all of the benefits from both types of data storage. 23 00:02:11,100 --> 00:02:24,900 It's built on object storage like a data lake, but it layers on transactional guarantees, ACID transactions, metadata management, all the things you expect from a warehouse. 24 00:02:25,200 --> 00:02:30,120 And the critical layer of this is the open table formats. 25 00:02:30,740 --> 00:02:33,480 And I'll explain what those are. 26 00:02:33,820 --> 00:02:40,020 But these support features like time travel and version control, these are things that make a data lake house functional. 27 00:02:40,220 --> 00:02:43,100 So I told you what it wasn't. 28 00:02:43,860 --> 00:02:45,300 So what is it? 29 00:02:45,300 --> 00:02:50,100 There's three main minimal components for a data lake house. 30 00:02:50,420 --> 00:02:52,360 The first is object storage. 31 00:02:52,780 --> 00:02:57,780 To work for large amounts of data, that object storage has to be optimized for scale and throughput. 32 00:02:57,780 --> 00:03:02,220 It has to be able to store structured, unstructured, semi-structured, all kinds of data. 33 00:03:02,220 --> 00:03:05,560 Anything from parquet to logs to models. 34 00:03:05,680 --> 00:03:07,500 And then on top of that is open table format. 35 00:03:07,500 --> 00:03:11,300 So this is where I tell you what I told you in the last slide, but more in detail. 36 00:03:11,420 --> 00:03:15,640 So this is Apache Iceberg, Apache Hudi, Delta Lake. 37 00:03:15,720 --> 00:03:22,620 The OTFs are what introduces transactional semantics into object storage. 38 00:03:22,620 --> 00:03:32,220 What takes the data lake, the database, and puts it in the data lake, making a data lake house. 39 00:03:32,700 --> 00:03:36,680 So it tracks data files, schema changes. 40 00:03:37,460 --> 00:03:43,020 This gives us really cool things like time travel, partition pruning, consistent multi-rider support. 41 00:03:43,020 --> 00:03:48,040 It's what makes it worthwhile as a data infrastructure. 42 00:03:48,600 --> 00:03:51,040 And the last part is compute. 43 00:03:51,730 --> 00:03:57,420 This is your query engine, and this could be something like Trino, or Dremio, or DuckDB. 44 00:03:57,660 --> 00:04:04,540 Depending on whether or not you need distributed execution, or BI dashboards, or fast local analytics. 45 00:04:04,660 --> 00:04:09,220 And the beauty of this architecture, the whole point of it, is that you can swap and drop. 46 00:04:09,220 --> 00:04:12,400 So your compute can be anything, or it can be many things. 47 00:04:13,160 --> 00:04:20,060 But together, all of these three things is the minimal requirement for a data lake house. 48 00:04:21,460 --> 00:04:27,500 But if you're actually going to do it, if you're actually going to make a data lake house, you also need a catalog. 49 00:04:27,820 --> 00:04:32,680 So catalogs, anything but futzing around, need a catalog. 50 00:04:32,680 --> 00:04:37,540 So Iceberg Catalog is where your actual metadata gets managed. 51 00:04:37,980 --> 00:04:45,660 It maps logical table names to metadata, so every time you write to a table, Iceberg will generate a new snapshot. 52 00:04:45,660 --> 00:04:58,580 And this snapshot references a manifest list, which naturally points to manifest, which then points to the actual data files that are in Parquet. 53 00:04:58,580 --> 00:05:00,560 So it's a metadata tree. 54 00:05:00,840 --> 00:05:06,520 So the catalog stores the latest snapshot ID, the schema versions, the partition specs, the table properties. 55 00:05:06,520 --> 00:05:09,720 It's the GitHead pointer for your data. 56 00:05:10,580 --> 00:05:19,480 So you can use a catalog for a snapshot-based query, so you can select all the data as it existed in this specific point in time. 57 00:05:19,480 --> 00:05:25,720 You can do rollbacks, so if you mess up your data, which happens a lot, you can just roll back to the point when it was good. 58 00:05:25,800 --> 00:05:34,780 You can do branching, so you can do a Git-like... it turns your data lake house into a Git-like system. 59 00:05:34,780 --> 00:05:45,740 So you can do branching, so you can have dev and prod, you can have, this is my fudsing around space, this is Daniel who always drops all his tables space, so on and so forth. 60 00:05:45,740 --> 00:05:53,200 You can do auditability, so metadata is appended... auditability... so metadata is append-only. 61 00:05:53,200 --> 00:05:55,000 Object storage is immutable. 62 00:05:55,100 --> 00:06:01,140 So you get a full history of all the changes that you have ever made, if you want to. 63 00:06:01,740 --> 00:06:16,060 Decide what your snapshot retention will be, but that means you can... it's really important for fields where auditability is an important feature for enterprise data. 64 00:06:16,060 --> 00:06:19,320 Then you... so there's a couple... that's what it does. 65 00:06:19,320 --> 00:06:23,220 There's like three or four really good ones. 66 00:06:23,220 --> 00:06:24,800 They are open source. 67 00:06:24,800 --> 00:06:31,940 It's Nessie Polaris, which is donated to the Apache Foundation by Snowflake. 68 00:06:32,180 --> 00:06:35,620 It's designed to be embedded, which is kind of a neat feature. 69 00:06:35,780 --> 00:06:41,000 Gravitino is really neat, because it works past and forward. 70 00:06:41,000 --> 00:06:48,300 So it works with things like Hive and stuff like that, but also with Delta Lake, Apache Iceberg. 71 00:06:48,300 --> 00:06:53,020 So you can go front, and you can go back, and it can go all around, and it's also an Apache project. 72 00:06:53,020 --> 00:06:54,180 Great. 73 00:06:54,900 --> 00:07:00,620 If you're bridging legacy and modern, this is your guy for catalog. 74 00:07:01,200 --> 00:07:12,600 So all three support REST APIs, which makes it really easy to plug into engines that I was talking about, those query engines like Trino and Spark and Dremio, and also, of course, object storage that also relies on REST. 75 00:07:12,600 --> 00:07:16,520 This whole stack is based on REST API. 76 00:07:16,520 --> 00:07:19,920 So, Nessie, you probably spent all that time explaining what it is. 77 00:07:19,920 --> 00:07:24,060 You're probably asking yourself, but why would I do that? 78 00:07:24,280 --> 00:07:33,460 So this is a diagram showing where the lake house sits in an entire AI infrastructure. 79 00:07:33,460 --> 00:07:42,060 So the center, data lake house, this is where everything lands, tabular data, training sets, vector embeddings, models, sensor logs. 80 00:07:42,060 --> 00:07:43,680 And I'm not trying to just repeat buzzwords. 81 00:07:43,680 --> 00:07:46,280 I'm just trying to explain why you'd want to build one, right? 82 00:07:46,600 --> 00:07:52,300 Your application data, it's your storage, it's your retrieval layer, it's everything. 83 00:07:52,920 --> 00:07:55,080 It's the heart of your stack. 84 00:07:55,080 --> 00:08:00,180 And then on the left, it's like your hugging face. 85 00:08:00,420 --> 00:08:06,160 It's where you manage your models, data sets, your collaborative spaces, all that stuff. 86 00:08:06,520 --> 00:08:09,460 It's where you can store and share and reuse models. 87 00:08:09,460 --> 00:08:12,180 And on the right, you have your ML op stack. 88 00:08:12,180 --> 00:08:23,480 So this is the AI lifecycle and action and data moves back and forth from this space as you make and create features, as you make and recreate models. 89 00:08:24,440 --> 00:08:26,380 And then you have a vector database. 90 00:08:26,380 --> 00:08:29,400 So those are the cool things like LanceDB and PineconeDB. 91 00:08:29,520 --> 00:08:34,280 And those are optimized for fast similarity search and powers rack. 92 00:08:34,280 --> 00:08:39,140 And all of this is querying object storage directly without migration. 93 00:08:39,140 --> 00:08:42,020 So you can't have, it's the minimum file requirement. 94 00:08:42,020 --> 00:08:47,140 If you want any of that stuff, you want all that stuff, you have to have a data lake out. 95 00:08:48,280 --> 00:08:57,740 Okay, so and then of course, at the foundation, you have Nix, which declaratively defines and deploys the whole, all of it, right? 96 00:08:58,080 --> 00:09:05,360 From infrastructure to services, to pipelines, to security, to, you know, the whole networking, everything. 97 00:09:05,360 --> 00:09:09,340 Soup to nuts, that's where it is, ideally, you know. 98 00:09:09,500 --> 00:09:19,000 Okay, so what, you're probably asking me right now, so what if I already have Docker or Podman or Kubernetes? 99 00:09:19,000 --> 00:09:21,660 Because I feel like I'm not tall enough for this, sorry. 100 00:09:22,220 --> 00:09:24,680 I don't think it's an either or situation. 101 00:09:24,720 --> 00:09:28,920 You know, you can integrate Nix with two existing workloads. 102 00:09:28,920 --> 00:09:37,880 So in fact, you might need to do that because not everything is a Nix OS package yet, which is why you lovely people are here supporting the community. 103 00:09:38,600 --> 00:09:47,480 But, you know, many teams, data teams, particularly, that's what I know about, we use Docker for deploying services and running analytics jobs already. 104 00:09:47,480 --> 00:09:51,520 So Nix can slot into those workflows and actually make it better. 105 00:09:51,580 --> 00:10:01,960 I've heard it said that Nix is a better Docker compose than Docker, but I'll leave that to your interpretation. 106 00:10:02,620 --> 00:10:07,820 But you can use Nix to build container images reproducibly, and there's a couple of different ways to do that. 107 00:10:07,820 --> 00:10:14,780 You can use docker-tools.build-image, and it lets you define the container and all of its dependencies entirely in Nix. 108 00:10:14,780 --> 00:10:20,000 Or you can use Nix 2 container to build OCI images and push them to a registry. 109 00:10:20,860 --> 00:10:28,540 But either way, you get fully versioned deterministic containers that behave in the same way in dev, in CI, in prod. 110 00:10:28,540 --> 00:10:32,600 And this makes Nix a great tool, even in container-heavy environments. 111 00:10:32,600 --> 00:10:36,420 And you can use this to lock down builds and remove guesswork from your Docker pipeline. 112 00:10:36,420 --> 00:10:40,420 So you can have it all. 113 00:10:41,840 --> 00:10:44,980 So but where does Nix actually fit in? 114 00:10:44,980 --> 00:10:51,240 So at its core, I mean, you might be familiar, but for those who aren't, Nix is a package manager. 115 00:10:51,240 --> 00:10:56,200 It builds software and systems with declarative specifications. 116 00:10:56,200 --> 00:11:01,080 So that means if your inputs don't change, your outputs don't either. 117 00:11:01,080 --> 00:11:02,240 Not ever. 118 00:11:02,260 --> 00:11:07,740 So it should work wherever you put it. 119 00:11:07,740 --> 00:11:21,220 So with Nix OS, that extends to an operating system, and you define your full system configuration of the file, things like services, user, firewall, rules, TLS, certs, file systems. 120 00:11:21,740 --> 00:11:25,080 Nix OS builds those all. 121 00:11:25,080 --> 00:11:28,100 So this is a real declarative infrastructure. 122 00:11:28,240 --> 00:11:37,340 There's no provisioning script, no bash, glue, no step 14 install, JDK once again, over and over again. 123 00:11:38,220 --> 00:11:47,520 It's the same configuration builds your entire stack on your laptop, on your rack, on an edge box, wherever you want to put it. 124 00:11:47,520 --> 00:11:53,720 It's portable, reproducible, version-controlled, and that's exactly what we want. 125 00:11:54,480 --> 00:12:11,180 When we're designing critical infrastructure like data infrastructure, I'm giving this talk in part because I feel like data infrastructure is being left behind out of when we talk about critical infrastructure, but it is, as I said, in the heart of this stack. 126 00:12:11,180 --> 00:12:16,200 So do protect your data. 127 00:12:16,200 --> 00:12:24,420 So this is how, essentially, we move from fragile, one-off setups to infrastructure that you can deploy like software. 128 00:12:24,420 --> 00:12:33,020 Okay, so a flake house, flake house is data lake, lake house on Nix, right? 129 00:12:33,020 --> 00:12:38,980 So what do you exactly do you want to define in a Nix flake? 130 00:12:38,980 --> 00:12:44,740 So you want MinIO, which is, or whatever, your on-prem object storage software. 131 00:12:44,740 --> 00:12:55,200 You need Iceberg, that's your open table format, that's where all the cool stuff about data lake house, time travel, evolution, partition, you need it. 132 00:12:55,960 --> 00:13:02,880 A catalog like Nessie or Gravitino or Polaris, so you get version control on your data. 133 00:13:03,140 --> 00:13:13,460 Chino, Spark, DuckDB for compute, TLS, IAM, network policies, you need systemd to manage the whole thing. 134 00:13:13,460 --> 00:13:18,460 So the stack is entirely in Nix, or it could be. 135 00:13:18,460 --> 00:13:28,060 This is somewhat aspirational, which we will get into why or how the aspiration begins or becomes, right? 136 00:13:29,480 --> 00:13:38,260 All right, so, and then once the stack is defined in a flake, once your flake house is defined in a flake, we can deploy it anywhere. 137 00:13:38,260 --> 00:13:43,180 So it can go, like I said, on a laptop, in dev, edge, wherever. 138 00:13:43,460 --> 00:13:52,300 The point is, there's no manual tweaks, no drifts, no reconfiguring, just deploys like code. 139 00:13:52,980 --> 00:13:56,920 So this approach gives some really clear advantages. 140 00:13:57,980 --> 00:14:12,840 Obviously, security and control, so all your services, object storage, your catalog, your query engine, they should all deploy behind your trust boundary if you deploy it on-prem. 141 00:14:13,600 --> 00:14:19,240 You have all your access control is defined for everything, every place you try to deploy this. 142 00:14:19,240 --> 00:14:24,720 This means you know what's running, who can talk to what, and how it was built. 143 00:14:25,180 --> 00:14:27,800 The operational simplicity is another point. 144 00:14:27,800 --> 00:14:39,160 So Nix OS modules make deployment and update consistent across environments, which is really important, especially since so many in data, when so much is done locally. 145 00:14:40,140 --> 00:14:44,520 You know, data exploration, feature selection is often done on a laptop. 146 00:14:45,800 --> 00:14:54,980 But it needs to be extrapolated to a full data set, your full production system, and this can do that. 147 00:14:55,580 --> 00:14:59,120 It makes automation safer and onboarding safer. 148 00:14:59,940 --> 00:15:02,460 And then the third is scale and portability. 149 00:15:02,760 --> 00:15:13,820 Like I was saying, you can deploy it from your laptop to your colo, and there's no drifts, it's reproducible. 150 00:15:13,820 --> 00:15:19,560 It's scaling out becomes a matter of just replicating known good systems. 151 00:15:19,560 --> 00:15:26,640 So it makes your data infrastructure predictable, testable, easier to move. 152 00:15:32,460 --> 00:15:36,860 But there's some challenges with this approach. 153 00:15:36,860 --> 00:15:53,080 So the primary problem is that, or challenge, is that key components like Iceberg, Apache Iceberg, Nessie, Polaris, the catalogs, and Iceberg itself aren't available as Nix packages yet. 154 00:15:53,080 --> 00:16:04,680 So there's no official modules or system services for these components, which means you'd have to wrap them as binaries or run them as containers, or Docker, or whatever. 155 00:16:04,680 --> 00:16:10,040 But that breaks the full declarative integration, which is the cool part of what I was talking about. 156 00:16:10,040 --> 00:16:13,720 So , you know, a little, a tiny bummer. 157 00:16:14,480 --> 00:16:17,100 And then service orchestration. 158 00:16:17,100 --> 00:16:25,040 So there's really not a great way to express service dependencies across components. 159 00:16:25,040 --> 00:16:37,180 So, for example, ensuring that, you know, MinIO is online before the catalog initializes, or that Trino doesn't start before the Iceberg tables are reachable. 160 00:16:37,180 --> 00:16:43,780 It has to look manually scripted, so it's not... 161 00:16:43,780 --> 00:16:59,780 And then, you know, defining the networking policy, defining encrypted communication across access control is possible, you can do it, but it's still a little fragile, especially with self-search. 162 00:17:00,880 --> 00:17:05,640 It's a little, it's a little, it's a little pain point. 163 00:17:05,640 --> 00:17:15,860 And then at secret management, so in object storage and MinIO and anything that's S3, you saw the whole stack, it's all S3, like, compatible. 164 00:17:15,860 --> 00:17:33,940 And the problem is that, or challenge, is that there's a tool called SOPS Nix that helps with integrating services that expect secrets as environmental bars like S3 compatible. 165 00:17:34,940 --> 00:17:35,980 Anything? 166 00:17:36,440 --> 00:17:44,160 But these, it's a little inconsistent, so it would be cool if it was, like, you know, more, less friction. 167 00:17:44,640 --> 00:18:05,580 So the, you know, the foundation, as we saw, the benefits are really clear, but, you know, there's room to grow, and I think primarily the room to grow, the where to grow is to have modules, modules for Nessie, Polaris, Gravitino, and Apache Iceberg. 168 00:18:05,680 --> 00:18:08,100 And those are really foundational elements. 169 00:18:08,100 --> 00:18:09,580 You got two out of the three of the stack. 170 00:18:09,580 --> 00:18:12,100 Remember the three components of a data lake house? 171 00:18:12,280 --> 00:18:15,640 Object storage, open table format, and query engine. 172 00:18:15,640 --> 00:18:26,020 Well, you got query engines, because you got Spark, and you got Trino, and you got object storage, because you have MinIO, but you're, you know, it's that middle bit. 173 00:18:26,540 --> 00:18:28,880 It's a little, you know. 174 00:18:29,760 --> 00:18:36,900 So if you care about data infrastructure, or you just want to expand what Nix can do, you know, this is your moment. 175 00:18:39,400 --> 00:18:44,200 And, you know, sort of the idea that building data infrastructure is still really fragile. 176 00:18:44,200 --> 00:18:56,360 You know, it's stitched together with scripts and tribal knowledge, and it's just tuned for one environment, so it makes it really hard to move without breaking. 177 00:18:57,060 --> 00:19:09,980 So this is a really great alternative that Nix and NixOS offer to treat data infrastructure like code, where you can define your whole stack declaratively, version it, run it anywhere. 178 00:19:11,580 --> 00:19:18,180 And so if you're working on anything like this or want to, you know, let's talk. 179 00:19:20,120 --> 00:19:20,780 Thank you.