Learn flakes the fun way
This commit is contained in:
parent
72e86a7324
commit
dcf840dc6f
22
post.md
22
post.md
|
@ -152,7 +152,7 @@ index 99d6d52..81e98c9 100644
|
|||
devShells = pkgsFor (pkgs: {
|
||||
```
|
||||
|
||||
```bash
|
||||
```console
|
||||
$ docker load < $(nix build .#docker-image --print-out-paths)
|
||||
Loaded image: what-is-my-ip-docker:c9g6x30invdq1bjfah3w1aw5w52vkdfn
|
||||
$ docker run -it what-is-my-ip-docker:c9g6x30invdq1bjfah3w1aw5w52vkdfn
|
||||
|
@ -168,19 +168,6 @@ diff --git a/flake.nix b/flake.nix
|
|||
index 99d6d52..81e98c9 100644
|
||||
--- a/flake.nix
|
||||
+++ b/flake.nix
|
||||
@@ -10,6 +10,12 @@
|
||||
in {
|
||||
packages = pkgsFor (pkgs: {
|
||||
default = pkgs.callPackage ./what-is-my-ip.nix {};
|
||||
+ container = pkgs.dockerTools.buildImage {
|
||||
+ name = "what-is-my-ip-container";
|
||||
+ config = {
|
||||
+ Cmd = ["${self.outputs.packages.${pkgs.system}.default}/bin/what-is-my-ip"];
|
||||
+ };
|
||||
+ };
|
||||
});
|
||||
|
||||
devShells = pkgsFor (pkgs: {
|
||||
@@ -20,5 +26,27 @@
|
||||
'';
|
||||
};
|
||||
|
@ -219,13 +206,10 @@ $ ./result/bin/run-nixos-vm
|
|||
nixos login: alice
|
||||
Password:
|
||||
|
||||
[alice@nixos:~]$ which what-is-my-ip
|
||||
/etc/profiles/per-user/alice/bin/what-is-my-ip
|
||||
|
||||
[alice@nixos:~]$ readlink $(which what-is-my-ip)
|
||||
$ readlink $(which what-is-my-ip)
|
||||
/nix/store/lr6wlz2652r35rwzc79samg77l6iqmii-what-is-my-ip/bin/what-is-my-ip
|
||||
|
||||
[alice@nixos:~]$ what-is-my-ip
|
||||
$ what-is-my-ip
|
||||
24.5.113.148
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in a new issue