on master help sign in
Pass { pkgs, nur } to container.nix package functions
commitedf07f7b7aa131071091539bfaf7d4e0ba10fcc1 authoriko <mail@iko.soy> dateSat 27 Jun 2026, 21:08 (3 months ago) parent39dc9f7
2 files changed+20−12
README.md+5−3 flake.nix+15−9
README.md+5−3
@@ -91,16 +91,18 @@ nix run github:ilyakooo0/nix-container#image -- docker-daemon:nix-container:late
9191
9292The image ships a curated tool set (`defaultPackages` in
9393[`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
95−returning the package list:
94+`container.nix` in the directory you run `init` from — a `{ pkgs, nur }`
95+function returning the package list (`nur` is [NUR](https://github.com/nix-community/NUR),
96+for packages outside nixpkgs):
9697
9798```nix
9899# ./container.nix
99−pkgs: with pkgs; [
100+{ pkgs, nur }: with pkgs; [
100101 fish # the default cmd is /bin/fish, so include it (or change config.cmd)
101102 coreutils
102103 go
103104 terraform
105+ nur.repos.charmbracelet.crush
104106]
105107```
106108
flake.nix+15−9
@@ -111,10 +111,12 @@
111111 '';
112112
113113 # 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
115− # your own list — see README.
114+ # (`{ pkgs, nur }: [ ... ]`) next to where you run `c init` to replace
115+ # this with your own list — see README.
116116 defaultPackages =
117− pkgs: with pkgs; [
117+ { pkgs, nur }:
118+ with pkgs;
119+ [
118120 bashInteractive
119121 fish
120122 openssh
@@ -124,7 +126,7 @@
124126 zellij
125127 micro
126128 helix
127− nurPkgs.repos.charmbracelet.crush
129+ nur.repos.charmbracelet.crush
128130
129131 # LLM tools
130132 git
@@ -156,9 +158,10 @@
156158 gcc # provides cc/gcc; pulls in binutils (ld) via its closure
157159 ];
158160
159− # Build the OCI image from a `pkgs: [ ... ]` package function. The fish
160− # prompt config is always added; the default `cmd` is /bin/fish, so a
161− # custom package set should include `fish` (or change `config.cmd`).
161+ # Build the OCI image from a `{ pkgs, nur }: [ ... ]` package function.
162+ # The fish prompt config is always added; the default `cmd` is
163+ # /bin/fish, so a custom package set should include `fish` (or change
164+ # `config.cmd`).
162165 mkImage =
163166 packages:
164167 n2c.buildImage {
@@ -169,7 +172,10 @@
169172 # A plain, single-process root filesystem. No NixOS, no systemd.
170173 copyToRoot = pkgsLinux.buildEnv {
171174 name = "root";
172− paths = packages pkgsLinux ++ [ fishRoot ];
175+ paths = packages {
176+ pkgs = pkgsLinux;
177+ nur = nurPkgs;
178+ } ++ [ fishRoot ];
173179 pathsToLink = [
174180 "/bin"
175181 "/root"
@@ -222,7 +228,7 @@
222228 lib = {
223229 inherit mkImage;
224230 # skopeo copy app (`skopeo copy nix:<image> "$@"`) for an image built
225− # from a `pkgs: [ ... ]` function.
231+ # from a `{ pkgs, nur }: [ ... ]` function.
226232 copyWith = packages: (mkImage packages).copyTo;
227233 };
228234 }