Bridging the stepping stones: using pieces of NixOS without full - - PowerPoint PPT Presentation

bridging the stepping stones using pieces of nixos
SMART_READER_LITE
LIVE PREVIEW

Bridging the stepping stones: using pieces of NixOS without full - - PowerPoint PPT Presentation

Bridging the stepping stones: using pieces of NixOS without full commitment Michael Raskin 7c6f434c (TU Munich) 17.10.2020 Michael Raskin 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 1 / 17 Do you have to use (and do


slide-1
SLIDE 1

Bridging the stepping stones: using pieces of NixOS without full commitment

Michael Raskin · 7c6f434c

(TU Munich)

17.10.2020

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 1 / 17

slide-2
SLIDE 2

Do you have to use… (and do you care)

…Nix package manager yes, and doubling software installation space use is minor …Nixpkgs most likely, and it’s at most a few GiBs of clones/stdenv …NixOS maybe, and it’s most a change to every habit about managing OS

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 2 / 17

slide-3
SLIDE 3

Do you have to use… (and do you care)

…Nix package manager yes, and doubling software installation space use is minor …Nixpkgs most likely, and it’s at most a few GiBs of clones/stdenv …NixOS maybe, and it’s most a change to every habit about managing OS

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 2 / 17

slide-4
SLIDE 4

Do you have to use… (and do you care)

…Nix package manager yes, and doubling software installation space use is minor …Nixpkgs most likely, and it’s at most a few GiBs of clones/stdenv …NixOS maybe, and it’s most a change to every habit about managing OS

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 2 / 17

slide-5
SLIDE 5

NixOS: enticing features

NixOS has a ton of nice sides https://nixos.org/ list of NixOS features boils down to: your system is Nix package …and you have Nix around unless early boot broken, boots to consistent state declarative confjg

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 3 / 17

slide-6
SLIDE 6

NixOS: enticing features

NixOS has a ton of nice sides https://nixos.org/ list of NixOS features boils down to: your system is Nix package …and you have Nix around unless early boot broken, boots to consistent state declarative confjg

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 3 / 17

slide-7
SLIDE 7

NixOS: enticing features

NixOS has a ton of nice sides https://nixos.org/ list of NixOS features boils down to: your system is Nix package …and you have Nix around unless early boot broken, boots to consistent state declarative confjg

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 3 / 17

slide-8
SLIDE 8

NixOS: enticing features

NixOS has a ton of nice sides https://nixos.org/ list of NixOS features boils down to: your system is Nix package …and you have Nix around unless early boot broken, boots to consistent state declarative confjg

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 3 / 17

slide-9
SLIDE 9

NixOS: control your expectations

So I can safely experiment with… init systems? OS kernels? service overrides like with packages in Nixpkgs? …and no more complicated interactions between choices?

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 4 / 17

slide-10
SLIDE 10

NixOS: control your expectations

So I can safely experiment with… init systems? OS kernels? service overrides like with packages in Nixpkgs? …and no more complicated interactions between choices?

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 4 / 17

slide-11
SLIDE 11

NixOS: control your expectations

So I can safely experiment with… init systems? OS kernels? service overrides like with packages in Nixpkgs? …and no more complicated interactions between choices? …not exactly

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 4 / 17

slide-12
SLIDE 12

What NixOS hardcodes

NixOS hardcodes: Linux systemd confjguration via module system global namespace and lots of moving parts …modules are less overridable than packages how your setup core is described

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 5 / 17

slide-13
SLIDE 13

What NixOS hardcodes

NixOS hardcodes: Linux systemd confjguration via module system global namespace and lots of moving parts …modules are less overridable than packages how your setup core is described

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 5 / 17

slide-14
SLIDE 14

What NixOS hardcodes

NixOS hardcodes: Linux systemd confjguration via module system global namespace and lots of moving parts …modules are less overridable than packages how your setup core is described

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 5 / 17

slide-15
SLIDE 15

What NixOS hardcodes

NixOS hardcodes: Linux systemd confjguration via module system global namespace and lots of moving parts …modules are less overridable than packages how your setup core is described

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 5 / 17

slide-16
SLIDE 16

What NixOS hardcoding implies

Trapped inside are less opinionated things: daemon confjg generator daemon start fmag knowledge …duplicated by nix-darwin home-manager nix-processmgmt

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 6 / 17

slide-17
SLIDE 17

What NixOS hardcoding implies

Trapped inside are less opinionated things: daemon confjg generator daemon start fmag knowledge …duplicated by nix-darwin home-manager nix-processmgmt

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 6 / 17

slide-18
SLIDE 18

Is code really trapped?

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 7 / 17

slide-19
SLIDE 19

Is code really trapped?

#invoke What do you want to invoke? Law of headlines You hear the answer:

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 7 / 17

slide-20
SLIDE 20

Is code really trapped?

#invoke What do you want to invoke? Law of headlines You hear the answer: «… not exactly»

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 7 / 17

slide-21
SLIDE 21

Is code really trapped?

Not completely Strategy: evaluate NixOS with confjguration talking only of the service grab the parts you care about contents of fjles for etc NixOS systemd unit generation can export Exec* to script — thanks for that! That’s what I use on my system for CUPS and Xorg

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 8 / 17

slide-22
SLIDE 22

Is code really trapped?

Not completely Strategy: evaluate NixOS with confjguration talking only of the service grab the parts you care about contents of fjles for etc NixOS systemd unit generation can export Exec* to script — thanks for that! That’s what I use on my system for CUPS and Xorg

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 8 / 17

slide-23
SLIDE 23

Is code really trapped?

Not completely Strategy: evaluate NixOS with confjguration talking only of the service grab the parts you care about contents of fjles for etc NixOS systemd unit generation can export Exec* to script — thanks for that! That’s what I use on my system for CUPS and Xorg

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 8 / 17

slide-24
SLIDE 24

Is code really trapped?

Not completely Strategy: evaluate NixOS with confjguration talking only of the service grab the parts you care about contents of fjles for etc NixOS systemd unit generation can export Exec* to script — thanks for that! That’s what I use on my system for CUPS and Xorg

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 8 / 17

slide-25
SLIDE 25

Current functionality in LangOS

serviceScript: service name, confjg → script etcSelectTarget: fjlename, confjg → store path etcSelectPrefix: path prefjx, confjg → attrSet of store paths https://github.com/7c6f434c/lang-os/blob/master/use-from-nixos.nix

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 9 / 17

slide-26
SLIDE 26

Current functionality in LangOS

serviceScript: service name, confjg → script etcSelectTarget: fjlename, confjg → store path etcSelectPrefix: path prefjx, confjg → attrSet of store paths https://github.com/7c6f434c/lang-os/blob/master/use-from-nixos.nix

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 9 / 17

slide-27
SLIDE 27

Implications — and limitations

NixOS real value is a large database of confjg generators Many services already reusable (if you know how) But: pay attention: some arguments live in difgerent branches some services too complicated for working runner script might want to get the parts and assemble carefully some confjgs do not got to /etc, do not get option name,

  • nly referenced inside service

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 10 / 17

slide-28
SLIDE 28

Implications — and limitations

NixOS real value is a large database of confjg generators Many services already reusable (if you know how) But: pay attention: some arguments live in difgerent branches some services too complicated for working runner script might want to get the parts and assemble carefully some confjgs do not got to /etc, do not get option name,

  • nly referenced inside service

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 10 / 17

slide-29
SLIDE 29

Implications — and limitations

NixOS real value is a large database of confjg generators Many services already reusable (if you know how) But: pay attention: some arguments live in difgerent branches some services too complicated for working runner script might want to get the parts and assemble carefully some confjgs do not got to /etc, do not get option name,

  • nly referenced inside service

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 10 / 17

slide-30
SLIDE 30

Implications — and limitations

NixOS real value is a large database of confjg generators Many services already reusable (if you know how) But: pay attention: some arguments live in difgerent branches some services too complicated for working runner script might want to get the parts and assemble carefully some confjgs do not got to /etc, do not get option name,

  • nly referenced inside service

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 10 / 17

slide-31
SLIDE 31

System structuring

Use of services without NixOS bootscripts feasible… …but what if not the module system? Mimic Nixpkgs overlays makeExtensible small core system Core system adapts by reading from self Override in overlays whatever you confjgure Few let instances, everything inspectable and modifjable!

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 11 / 17

slide-32
SLIDE 32

System structuring

Use of services without NixOS bootscripts feasible… …but what if not the module system? Mimic Nixpkgs overlays makeExtensible small core system Core system adapts by reading from self Override in overlays whatever you confjgure Few let instances, everything inspectable and modifjable!

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 11 / 17

slide-33
SLIDE 33

System structuring

Use of services without NixOS bootscripts feasible… …but what if not the module system? Mimic Nixpkgs overlays makeExtensible small core system Core system adapts by reading from self Override in overlays whatever you confjgure Few let instances, everything inspectable and modifjable!

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 11 / 17

slide-34
SLIDE 34

System structuring

Use of services without NixOS bootscripts feasible… …but what if not the module system? Mimic Nixpkgs overlays makeExtensible small core system Core system adapts by reading from self Override in overlays whatever you confjgure Few let instances, everything inspectable and modifjable!

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 11 / 17

slide-35
SLIDE 35

System structuring

But what if not the module system? …can we make it not matter? Services as packages with parameters Rich passthru Can request and inspect other service It’s user’s choice how to make sure things match Module system still the default as well-defjned layer

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 12 / 17

slide-36
SLIDE 36

System structuring

But what if not the module system? …can we make it not matter? Services as packages with parameters Rich passthru Can request and inspect other service It’s user’s choice how to make sure things match Module system still the default as well-defjned layer

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 12 / 17

slide-37
SLIDE 37

System structuring

But what if not the module system? …can we make it not matter? Services as packages with parameters Rich passthru Can request and inspect other service It’s user’s choice how to make sure things match Module system still the default as well-defjned layer

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 12 / 17

slide-38
SLIDE 38

System structuring

But what if not the module system? …can we make it not matter? Services as packages with parameters Rich passthru Can request and inspect other service It’s user’s choice how to make sure things match Module system still the default as well-defjned layer

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 12 / 17

slide-39
SLIDE 39

NixOS and bootloader

NixOS confjgures bootloader from system generations Assumes NixOS format of entry Needs knowledge of Xen etc. …that’s why I am too lazy to dual-boot with NixOS

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 13 / 17

slide-40
SLIDE 40

NixOS and bootloader

NixOS confjgures bootloader from system generations Assumes NixOS format of entry Needs knowledge of Xen etc. …that’s why I am too lazy to dual-boot with NixOS

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 13 / 17

slide-41
SLIDE 41

NixOS and bootloader

NixOS confjgures bootloader from system generations Assumes NixOS format of entry Needs knowledge of Xen etc. …that’s why I am too lazy to dual-boot with NixOS

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 13 / 17

slide-42
SLIDE 42

NixOS and bootloader

NixOS confjgures bootloader from system generations Assumes NixOS format of entry Needs knowledge of Xen etc. …that’s why I am too lazy to dual-boot with NixOS

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 13 / 17

slide-43
SLIDE 43

Dream

NixOS services as Nixpkgs-like packages Argument overrides and overlays for confjguration Module system as one of the ways to connect things Multiple independent options for core, sharing the service DB NixOS bootloader generator collecting bootloader confjg snippets Each system instance provides snippets for supported loaders Fail unless forced if booted-system does not support new loader? Also, support for atomic /etc switch in NixOS

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 14 / 17

slide-44
SLIDE 44

Dream

NixOS services as Nixpkgs-like packages Argument overrides and overlays for confjguration Module system as one of the ways to connect things Multiple independent options for core, sharing the service DB NixOS bootloader generator collecting bootloader confjg snippets Each system instance provides snippets for supported loaders Fail unless forced if booted-system does not support new loader? Also, support for atomic /etc switch in NixOS

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 14 / 17

slide-45
SLIDE 45

Dream

NixOS services as Nixpkgs-like packages Argument overrides and overlays for confjguration Module system as one of the ways to connect things Multiple independent options for core, sharing the service DB NixOS bootloader generator collecting bootloader confjg snippets Each system instance provides snippets for supported loaders Fail unless forced if booted-system does not support new loader? Also, support for atomic /etc switch in NixOS

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 14 / 17

slide-46
SLIDE 46

Dream

NixOS services as Nixpkgs-like packages Argument overrides and overlays for confjguration Module system as one of the ways to connect things Multiple independent options for core, sharing the service DB NixOS bootloader generator collecting bootloader confjg snippets Each system instance provides snippets for supported loaders Fail unless forced if booted-system does not support new loader? Also, support for atomic /etc switch in NixOS

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 14 / 17

slide-47
SLIDE 47

Why did I bother?

VTs not owned by systemd custom tricks around Xorg launch physical presence check for eg. power-ofg command Integrated nsjail wrappers Nobody runs browsers outside containers nowadays, right? Only hand-picked things have sound access My on-boot mounts are easier (to me) to describe in shell than in Nix Full versions of everything in initramfs Nice strace-able scripts for services right there

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 15 / 17

slide-48
SLIDE 48

Why did I bother?

VTs not owned by systemd custom tricks around Xorg launch physical presence check for eg. power-ofg command Integrated nsjail wrappers Nobody runs browsers outside containers nowadays, right? Only hand-picked things have sound access My on-boot mounts are easier (to me) to describe in shell than in Nix Full versions of everything in initramfs Nice strace-able scripts for services right there

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 15 / 17

slide-49
SLIDE 49

Why did I bother?

VTs not owned by systemd custom tricks around Xorg launch physical presence check for eg. power-ofg command Integrated nsjail wrappers Nobody runs browsers outside containers nowadays, right? Only hand-picked things have sound access My on-boot mounts are easier (to me) to describe in shell than in Nix Full versions of everything in initramfs Nice strace-able scripts for services right there

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 15 / 17

slide-50
SLIDE 50

Why did I bother?

VTs not owned by systemd custom tricks around Xorg launch physical presence check for eg. power-ofg command Integrated nsjail wrappers Nobody runs browsers outside containers nowadays, right? Only hand-picked things have sound access My on-boot mounts are easier (to me) to describe in shell than in Nix Full versions of everything in initramfs Nice strace-able scripts for services right there

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 15 / 17

slide-51
SLIDE 51

Why did I bother?

VTs not owned by systemd custom tricks around Xorg launch physical presence check for eg. power-ofg command Integrated nsjail wrappers Nobody runs browsers outside containers nowadays, right? Only hand-picked things have sound access My on-boot mounts are easier (to me) to describe in shell than in Nix Full versions of everything in initramfs Nice strace-able scripts for services right there

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 15 / 17

slide-52
SLIDE 52

What you can take?

Wrappers for NixOS piece extraction https://github.com/7c6f434c/lang-os/blob/master/use-from-nixos.nix Wrappers to run things in isolated DBus sessions https://github.com/7c6f434c/lang-os/blob/master/bus-wrappers.nix Firefox empty profjle builder https://github.com/7c6f434c/lang-os/blob/master/firefox-profile.nix Wrapper to use TTF fonts in Linux console https://github.com/7c6f434c/lang-os/blob/master/ttf-to-psf.nix

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 16 / 17

slide-53
SLIDE 53

What you can take?

Wrappers for NixOS piece extraction https://github.com/7c6f434c/lang-os/blob/master/use-from-nixos.nix Wrappers to run things in isolated DBus sessions https://github.com/7c6f434c/lang-os/blob/master/bus-wrappers.nix Firefox empty profjle builder https://github.com/7c6f434c/lang-os/blob/master/firefox-profile.nix Wrapper to use TTF fonts in Linux console https://github.com/7c6f434c/lang-os/blob/master/ttf-to-psf.nix

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 16 / 17

slide-54
SLIDE 54

What you can take?

Wrappers for NixOS piece extraction https://github.com/7c6f434c/lang-os/blob/master/use-from-nixos.nix Wrappers to run things in isolated DBus sessions https://github.com/7c6f434c/lang-os/blob/master/bus-wrappers.nix Firefox empty profjle builder https://github.com/7c6f434c/lang-os/blob/master/firefox-profile.nix Wrapper to use TTF fonts in Linux console https://github.com/7c6f434c/lang-os/blob/master/ttf-to-psf.nix

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 16 / 17

slide-55
SLIDE 55

What you can take?

Wrappers for NixOS piece extraction https://github.com/7c6f434c/lang-os/blob/master/use-from-nixos.nix Wrappers to run things in isolated DBus sessions https://github.com/7c6f434c/lang-os/blob/master/bus-wrappers.nix Firefox empty profjle builder https://github.com/7c6f434c/lang-os/blob/master/firefox-profile.nix Wrapper to use TTF fonts in Linux console https://github.com/7c6f434c/lang-os/blob/master/ttf-to-psf.nix

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 16 / 17

slide-56
SLIDE 56

Thanks for you attention! Questions?

Michael Raskin · 7c6f434c (TUM) NixOS pieces without commitment 17.10.2020 17 / 17