Re:How Nix and NixOS get so close to perfect
by deltaonefour on Sunday April 24, 2022 @11:48AM
(#31145182)
You can. So long as the impurity is scoped to be local within a package. And the system itself only reads the output of your language to configure something. Example:
packageInstaller outputs a single package description, but you can also create something similar that easily outputs an entire configuration for the OS. You just need to keep mutation scoped within the language. The configuration that is outputted is immutable and whatever thing that's processing that configuration is not within user control.
Keep in mind that mutability and immutability share a certain isomorphism. Within the nix expression language you often do something similar to mutation just as any other functional language. For example:
listVersion3 = listVersion1 ++ AdditionalStuff
It's just that in functional languages you're forced to keep versions of each mutation.
Keep in mind that mutability and immutability share a certain isomorphism. Within the nix expression language you often do something similar to mutation just as any other functional language. For example:
It's just that in functional languages you're forced to keep versions of each mutation.