on master help sign in
Pass { pkgs, nur } to container.nix package functions
edf07f7iko
README.md+5−3
@@ -91,16 +91,18 @@ nix run github:ilyakooo0/nix-container#image -- docker-daemon:nix-container:late
91
91
92The image ships a curated tool set (`defaultPackages` in
92The image ships a curated tool set (`defaultPackages` in
93[`flake.nix`](./flake.nix)). To use your own set **without forking**, drop a
93[`flake.nix`](./flake.nix)). To use your own set **without forking**, drop a
94−`container.nix` in the directory you run `init` from — a `pkgs`-function
94+`container.nix` in the directory you run `init` from — a `{ pkgs, nur }`
95−returning the package list:
95+function returning the package list (`nur` is [NUR](https://github.com/nix-community/NUR),
96+for packages outside nixpkgs):
96
97
97```nix
98```nix
98# ./container.nix
99# ./container.nix
99−pkgs: with pkgs; [
100+{ pkgs, nur }: with pkgs; [
100 fish # the default cmd is /bin/fish, so include it (or change config.cmd)
101 fish # the default cmd is /bin/fish, so include it (or change config.cmd)
101 coreutils
102 coreutils
102 go
103 go
103 terraform
104 terraform
105+ nur.repos.charmbracelet.crush
104]
106]
105```
107```
106
108
flake.nix+15−9
@@ -111,10 +111,12 @@
111 '';
111 '';
112
112
113 # The curated tool set baked into the image. Drop a `container.nix`
113 # The curated tool set baked into the image. Drop a `container.nix`
114− # (`pkgs: [ ... ]`) next to where you run `c init` to replace this with
114+ # (`{ pkgs, nur }: [ ... ]`) next to where you run `c init` to replace
115− # your own list — see README.
115+ # this with your own list — see README.
116 defaultPackages =
116 defaultPackages =
117+ { pkgs, nur }:
117− pkgs: with pkgs; [
118+ with pkgs;
119+ [
118 bashInteractive
120 bashInteractive
119 fish
121 fish
120 openssh
122 openssh
@@ -124,7 +126,7 @@
124 zellij
126 zellij
125 micro
127 micro
126 helix
128 helix
127− nurPkgs.repos.charmbracelet.crush
129+ nur.repos.charmbracelet.crush
128
130
129 # LLM tools
131 # LLM tools
130 git
132 git
@@ -156,9 +158,10 @@
156 gcc # provides cc/gcc; pulls in binutils (ld) via its closure
158 gcc # provides cc/gcc; pulls in binutils (ld) via its closure
157 ];
159 ];
158
160
159− # Build the OCI image from a `pkgs: [ ... ]` package function. The fish
161+ # Build the OCI image from a `{ pkgs, nur }: [ ... ]` package function.
160− # prompt config is always added; the default `cmd` is /bin/fish, so a
162+ # The fish prompt config is always added; the default `cmd` is
161− # custom package set should include `fish` (or change `config.cmd`).
163+ # /bin/fish, so a custom package set should include `fish` (or change
164+ # `config.cmd`).
162 mkImage =
165 mkImage =
163 packages:
166 packages:
164 n2c.buildImage {
167 n2c.buildImage {
@@ -169,7 +172,10 @@
169 # A plain, single-process root filesystem. No NixOS, no systemd.
172 # A plain, single-process root filesystem. No NixOS, no systemd.
170 copyToRoot = pkgsLinux.buildEnv {
173 copyToRoot = pkgsLinux.buildEnv {
171 name = "root";
174 name = "root";
172− paths = packages pkgsLinux ++ [ fishRoot ];
175+ paths = packages {
176+ pkgs = pkgsLinux;
177+ nur = nurPkgs;
178+ } ++ [ fishRoot ];
173 pathsToLink = [
179 pathsToLink = [
174 "/bin"
180 "/bin"
175 "/root"
181 "/root"
@@ -222,7 +228,7 @@
222 lib = {
228 lib = {
223 inherit mkImage;
229 inherit mkImage;
224 # skopeo copy app (`skopeo copy nix:<image> "$@"`) for an image built
230 # skopeo copy app (`skopeo copy nix:<image> "$@"`) for an image built
225− # from a `pkgs: [ ... ]` function.
231+ # from a `{ pkgs, nur }: [ ... ]` function.
226 copyWith = packages: (mkImage packages).copyTo;
232 copyWith = packages: (mkImage packages).copyTo;
227 };
233 };
228 }
234 }