WEBVTT

00:00.000 --> 00:21.280
I will talk about this project I started the last summer, I had a soul sprint in Germany.

00:21.280 --> 00:28.000
So when I started to learn Nix, I read somewhere like Nix is like G-SIN but on steroids

00:28.000 --> 00:36.000
you have comments, you have variables, you have imports, you have functions, okay, a bit different

00:36.000 --> 00:44.000
but I was like, okay, but it's okay, I like this, I can write my configuration, it's a bit like a better G-SIN works fine for me

00:44.000 --> 00:52.000
but then can I manipulate it like G-SIN then, you know, I'm just making web apps, can I just generate my configuration from my Django app

00:52.000 --> 01:06.000
if I have this configuration, I want to change the time zone, the host name, can I just do like import G-SIN and then, you know, change the time zone, change the host name and then this and, you know, G-SIN

01:06.000 --> 01:21.000
apparently, no, so I was wondering how do people actually do this, look that's, you know, this but that opens all the pull requests to update packages, it does a lot of Nix code editing

01:21.000 --> 01:32.000
so I was like, okay, these people they know how to do this, I'll look at how they do it, so I looked at the search code, so they do line replacements from the old version to the new version

01:32.000 --> 01:49.000
which is not really, it's a bit less far than what I wanted to go, and also I find it quite risky because if you have two strings with the same old version in different parts of the code, it will just replace it naively as long as it's surrounded by quotes

01:49.000 --> 02:01.000
so I decided to tackle this issue a bit deeper, which took quite some time at the end, and I built this project called Nix Manipulator

02:01.000 --> 02:16.000
so imagine you have this configuration on the right, and you want to change, well for example, the time zone, you can import the from Nix Manipulator, import parts files

02:16.000 --> 02:36.000
then I will just parse file of my configuration, it's normally pretty printing, which doesn't work super well in PT Python, but it usually works quite well in other normal standard Python

02:36.000 --> 02:48.000
and then I have, so if I put this in a variable, it's a S, then I can do S dot, it's a function that has a notebook, so we're looking at the output of the function

02:48.000 --> 03:04.000
and then in the output we want to get, for example, the time zone, and we want to get the value behind it

03:05.000 --> 03:13.000
the expression out of it, and we have Europe that brush also, we can extract stuff directly from Nix code

03:13.000 --> 03:26.000
we can also extract, for example, the boot information, so if I put here boot, I can extract the boot just the boot information

03:26.000 --> 03:33.000
I can also nest it into my configuration, but I can also do changes, you know, I want to change the host name of this machine

03:33.000 --> 03:42.000
I added a few shortcuts, so I can do just, I don't have to do the whole dot output and so and I can do just networking

03:42.000 --> 03:48.000
and it will understand this should be in the output and then a host name

03:48.000 --> 04:02.000
so I have this equals a new machine as dot save and then I can just reload and I have new machine there

04:02.000 --> 04:11.000
so, part 5 just updated my Nix code and so we're starting to get somewhere

04:12.000 --> 04:20.000
I also did a few more functionalities, for example, here I have this package that Nix and a package manager

04:20.000 --> 04:31.000
but I want to automate package management and here is, I want to change the version of my package, but the version is defined here, not in here

04:31.000 --> 04:56.000
actually, so I have already, part 5 I can do s-src, dash version, you know, tag, equals 1 to 3

04:56.000 --> 05:07.000
and then s dot save, if I reload here, you will see it will have followed the reference and it goes to change it in this line

05:07.000 --> 05:12.000
because here I'm just using the identifier, so it does follow references

05:12.000 --> 05:24.000
I can also, for example, add things to list and also I did a, I see a line, so you can also access it using a CLI

05:24.000 --> 05:28.000
for example, you can set variables directly from the CLI

05:28.000 --> 05:36.000
as a conclusion, so we do nix to Python to nix, it's formats everything according to the RFC

05:36.000 --> 05:43.000
and part is it's, most of the packages are a few RFC exceptions in the nix packages that go some issues

05:43.000 --> 05:50.000
it's LGPL, so you can use it on all of your projects and the future the goals are easier, manipulation, more powerful

05:50.000 --> 05:57.000
and interface and following import, so you could actually go read stuff that is imported and you also go modify it

05:57.000 --> 06:02.000
and this is where you can find the repository, it's also on GitHub if you prefer this

