more examples

This commit is contained in:
Cole Mickens 2020-10-25 15:00:44 -07:00
parent 8ade367d84
commit a023634d9b
No known key found for this signature in database
GPG key ID: B475C2955744A019

View file

@ -47,7 +47,39 @@ These three examples, for me, are all the same source, but accessed in different
## overview ## overview
The `./check.sh` script proves they give the same exact system toplevel outputs: Let's prove that we can build the same config with and without flakes:
* Using `nixos-rebuild`:
```
# with flakes
unset NIX_PATH
nixos-rebuild build --flake .#mysystem
readlink -f ./result
/nix/store/gg1jhmzqndqa0rfnwfdbnzrn8f74ckr6-nixos-system-mysystem-21.03pre-git
# without flakes
export NIX_PATH=nixpkgs=https://github.com/nixos/nixpkgs/archive/007126eef72271480cb7670e19e501a1ad2c1ff2.tar.gz:nixos-config=/home/cole/code/nixos-flake-example/configuration.nix
nixos-rebuild build
readlink -f ./result
/nix/store/gg1jhmzqndqa0rfnwfdbnzrn8f74ckr6-nixos-system-mysystem-21.03pre-git
```
* Using `nix build`:
```
# with flakes
unset NIX_PATH
nix build '.#nixosConfigurations.mysystem.config.system.build.toplevel
readlink -f ./result
/nix/store/gg1jhmzqndqa0rfnwfdbnzrn8f74ckr6-nixos-system-mysystem-21.03pre-git
# without flakes
export NIX_PATH=nixpkgs=https://github.com/nixos/nixpkgs/archive/007126eef72271480cb7670e19e501a1ad2c1ff2.tar.gz:nixos-config=/home/cole/code/nixos-flake-example/configuration.nix
nix-build '<nixos/nixpkgs>' -A config.system.build.toplevel
readlink -f ./result
/nix/store/gg1jhmzqndqa0rfnwfdbnzrn8f74ckr6-nixos-system-mysystem-21.03pre-git
```
* The `./check.sh` script automates this process:
```console ```console
cole@slynux ~/code/nixos-flake-example master* 7s cole@slynux ~/code/nixos-flake-example master* 7s
@ -74,6 +106,5 @@ warning: Git tree '/home/cole/code/nixos-flake-example' is dirty
flake: /nix/store/gg1jhmzqndqa0rfnwfdbnzrn8f74ckr6-nixos-system-mysystem-21.03pre-git flake: /nix/store/gg1jhmzqndqa0rfnwfdbnzrn8f74ckr6-nixos-system-mysystem-21.03pre-git
clssc: /nix/store/gg1jhmzqndqa0rfnwfdbnzrn8f74ckr6-nixos-system-mysystem-21.03pre-git clssc: /nix/store/gg1jhmzqndqa0rfnwfdbnzrn8f74ckr6-nixos-system-mysystem-21.03pre-git
``` ```