Skynet *nix, Nix and Nixos 2023-10-08 Brendan *nix Skynet runs on a flavor of Linux called NixOS Normal linux commands apply (basic primer) 2 / 32 *nix Skynet runs on a flavor of Linux called NixOS Normal linux commands apply (basic primer) • cd - change directory
3 / 32 *nix Skynet runs on a flavor of Linux called NixOS Normal linux commands apply (basic primer) • cd - change directory
• mkdir - make directory
4 / 32 *nix Skynet runs on a flavor of Linux called NixOS Normal linux commands apply (basic primer) • cd - change directory
• mkdir - make directory
• ls - list directory
5 / 32 *nix Skynet runs on a flavor of Linux called NixOS Normal linux commands apply (basic primer) • cd - change directory
• mkdir - make directory
• ls - list directory
• touch {filename} - create file named {filename}
6 / 32 *nix Skynet runs on a flavor of Linux called NixOS Normal linux commands apply (basic primer) • cd - change directory
• mkdir - make directory
• ls - list directory
• touch {filename} - create file named {filename}
• nano {filename} - edit {filename}
7 / 32 *nix Skynet runs on a flavor of Linux called NixOS Normal linux commands apply (basic primer) • cd - change directory
• mkdir - make directory
• ls - list directory
• touch {filename} - create file named {filename}
• nano {filename} - edit {filename}
• history - view history of previous commands
8 / 32 *nix Skynet runs on a flavor of Linux called NixOS Normal linux commands apply (basic primer) • cd - change directory
• mkdir - make directory
• ls - list directory
• touch {filename} - create file named {filename}
• nano {filename} - edit {filename}
• history - view history of previous commands
• grep "{query}" {filename/path} - find {query} in a file
9 / 32 *nix Skynet runs on a flavor of Linux called NixOS Normal linux commands apply (basic primer) • cd - change directory
• mkdir - make directory
• ls - list directory
• touch {filename} - create file named {filename}
• nano {filename} - edit {filename}
• history - view history of previous commands
• grep "{query}" {filename/path} - find {query} in a file
There is also piping where: The output of one command is piped into another command Often called Unix philosophy
(https://en.wikipedia.org/wiki/Unix_philosophy)
10 / 32 *nix Skynet runs on a flavor of Linux called NixOS Normal linux commands apply (basic primer) • cd - change directory
• mkdir - make directory
• ls - list directory
• touch {filename} - create file named {filename}
• nano {filename} - edit {filename}
• history - view history of previous commands
• grep "{query}" {filename/path} - find {query} in a file
There is also piping where: The output of one command is piped into another command Often called Unix philosophy
(https://en.wikipedia.org/wiki/Unix_philosophy)
Can make really powerful programs from smaller simple programs: 11 / 32 *nix Skynet runs on a flavor of Linux called NixOS Normal linux commands apply (basic primer) • cd - change directory
• mkdir - make directory
• ls - list directory
• touch {filename} - create file named {filename}
• nano {filename} - edit {filename}
• history - view history of previous commands
• grep "{query}" {filename/path} - find {query} in a file
There is also piping where: The output of one command is piped into another command Often called Unix philosophy
(https://en.wikipedia.org/wiki/Unix_philosophy)
Can make really powerful programs from smaller simple programs: history | grep "nano" - search the history for any mention of nano
12 / 32 Nix Nix is a (lazy) functional language a = 1 # int
b = 1.001 # float
c = /path/to/thing # path
d = "42" # string
e = true # boolean
13 / 32 Nix Nix is a (lazy) functional language Has functions
a = 1 # int double = x: x*2
b = 1.001 # float mul = a: b: a*b
c = /path/to/thing # path double 2
d = "42" # string mul 2 3
e = true # boolean
14 / 32 Nix Nix is a (lazy) functional language Has functions
a = 1 # int double = x: x*2
b = 1.001 # float mul = a: b: a*b
c = /path/to/thing # path double 2
d = "42" # string mul 2 3
e = true # boolean
Can access objects s = { foo = "bar"; biz = "baz"; }
s.foo # bar
s.biz # baz
15 / 32 Nix Nix is a (lazy) functional language Has functions
a = 1 # int double = x: x*2
b = 1.001 # float mul = a: b: a*b
c = /path/to/thing # path double 2
d = "42" # string mul 2 3
e = true # boolean
Can access objects s = { foo = "bar"; biz = "baz"; }
s.foo # bar
s.biz # baz
Info: 1. Offical guide (https://nix.dev/tutorials/first-steps)
2. Nix Pills (https://nixos.org/guides/nix-pills)
16 / 32 NixOS Some crazy person saw Nix and thought "I want to make an OS with that" 17 / 32 NixOS Some crazy person saw Nix and thought "I want to make an OS with that" In essence a giant function is created with an OS as the output 18 / 32 NixOS Some crazy person saw Nix and thought "I want to make an OS with that" In essence a giant function is created with an OS as the output This does have quite a few advantages: 19 / 32 NixOS Some crazy person saw Nix and thought "I want to make an OS with that" In essence a giant function is created with an OS as the output This does have quite a few advantages: 20 / 32 NixOS Some crazy person saw Nix and thought "I want to make an OS with that" In essence a giant function is created with an OS as the output This does have quite a few advantages: • Config as Code 21 / 32 NixOS Some crazy person saw Nix and thought "I want to make an OS with that" In essence a giant function is created with an OS as the output This does have quite a few advantages: • Config as Code • Deterministic 22 / 32 NixOS Some crazy person saw Nix and thought "I want to make an OS with that" In essence a giant function is created with an OS as the output This does have quite a few advantages: • Config as Code • Deterministic • Reproducible 23 / 32 NixOS Some crazy person saw Nix and thought "I want to make an OS with that" In essence a giant function is created with an OS as the output This does have quite a few advantages: • Config as Code • Deterministic • Reproducible Skynet 2.0 had its config spread across different servers. Making it hard to get a good overview. 24 / 32 NixOS Some crazy person saw Nix and thought "I want to make an OS with that" In essence a giant function is created with an OS as the output This does have quite a few advantages: • Config as Code • Deterministic • Reproducible Skynet 2.0 had its config spread across different servers. Making it hard to get a good overview. Skynet 3.0 is fully source controlled on forgejo.skynet.ie (
https://forgejo.skynet.ie/Skynet/nixos)
25 / 32 NixOS Some crazy person saw Nix and thought "I want to make an OS with that" In essence a giant function is created with an OS as the output This does have quite a few advantages: • Config as Code • Deterministic • Reproducible Skynet 2.0 had its config spread across different servers. Making it hard to get a good overview. Skynet 3.0 is fully source controlled on forgejo.skynet.ie (
https://forgejo.skynet.ie/Skynet/nixos)
• Deterministic and Reproducible go hand in hand. 26 / 32 NixOS Some crazy person saw Nix and thought "I want to make an OS with that" In essence a giant function is created with an OS as the output This does have quite a few advantages: • Config as Code • Deterministic • Reproducible Skynet 2.0 had its config spread across different servers. Making it hard to get a good overview. Skynet 3.0 is fully source controlled on forgejo.skynet.ie (
https://forgejo.skynet.ie/Skynet/nixos)
• Deterministic and Reproducible go hand in hand. • Deterministic means that for the same inputs you get the same output. 27 / 32 NixOS Some crazy person saw Nix and thought "I want to make an OS with that" In essence a giant function is created with an OS as the output This does have quite a few advantages: • Config as Code • Deterministic • Reproducible Skynet 2.0 had its config spread across different servers. Making it hard to get a good overview. Skynet 3.0 is fully source controlled on forgejo.skynet.ie (
https://forgejo.skynet.ie/Skynet/nixos)
• Deterministic and Reproducible go hand in hand. • Deterministic means that for the same inputs you get the same output. • Reproducible is that you are able to create the same output from the source code. 28 / 32 NixOS Some crazy person saw Nix and thought "I want to make an OS with that" In essence a giant function is created with an OS as the output This does have quite a few advantages: • Config as Code • Deterministic • Reproducible Skynet 2.0 had its config spread across different servers. Making it hard to get a good overview. Skynet 3.0 is fully source controlled on forgejo.skynet.ie (
https://forgejo.skynet.ie/Skynet/nixos)
• Deterministic and Reproducible go hand in hand. • Deterministic means that for the same inputs you get the same output. • Reproducible is that you are able to create the same output from the source code. 29 / 32 Nix* - How we use it In virtually every repo we have a flake set up. 30 / 32 Nix* - How we use it In virtually every repo we have a flake set up. This gives us a lockfile so our dependencies for that project dont get out of sync
for different users. 31 / 32 Nix* - How we use it In virtually every repo we have a flake set up. This gives us a lockfile so our dependencies for that project dont get out of sync
for different users. Additionally most have a devshell configured.
This allows any user with nix installed to run nix develop and they get dropped into
a shell with all the tools they need for that repo. 32 / 32