on master help sign in
Rename per-project package file to container.nix
3ca3816iko
README.md+2−2
@@ -91,11 +91,11 @@ 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−`nix-container.nix` in the directory you run `init` from — a `pkgs`-function
94+`container.nix` in the directory you run `init` from — a `pkgs`-function
95returning the package list:
95returning the package list:
96
96
97```nix
97```nix
98−# ./nix-container.nix
98+# ./container.nix
99pkgs: with pkgs; [
99pkgs: with pkgs; [
100 fish # the default cmd is /bin/fish, so include it (or change config.cmd)
100 fish # the default cmd is /bin/fish, so include it (or change config.cmd)
101 coreutils
101 coreutils
c+3−3
@@ -1,7 +1,7 @@
1#!/usr/bin/env fish
1#!/usr/bin/env fish
2# Manage a container named after the current directory.
2# Manage a container named after the current directory.
3# c init [extra create args] build + load the image, then create the container
3# c init [extra create args] build + load the image, then create the container
4−# (uses ./nix-container.nix for packages if present)
4+# (uses ./container.nix for packages if present)
5# c start start it and attach
5# c start start it and attach
6
6
7set -l name (path basename $PWD)
7set -l name (path basename $PWD)
@@ -15,9 +15,9 @@ switch $argv[1]
15 set -l archive $tmp/image.tar.gz
15 set -l archive $tmp/image.tar.gz
16 set -l rc 0
16 set -l rc 0
17
17
18− if test -e nix-container.nix
18+ if test -e container.nix
19 # Per-project package set: build an image with exactly these packages.
19 # Per-project package set: build an image with exactly these packages.
20− set -lx NIX_CONTAINER_PKGS (path resolve nix-container.nix)
20+ set -lx NIX_CONTAINER_PKGS (path resolve container.nix)
21 set -l expr "(builtins.getFlake \"$flake\").lib.\${builtins.currentSystem}.copyWith (import (/. + builtins.getEnv \"NIX_CONTAINER_PKGS\"))"
21 set -l expr "(builtins.getFlake \"$flake\").lib.\${builtins.currentSystem}.copyWith (import (/. + builtins.getEnv \"NIX_CONTAINER_PKGS\"))"
22 set -l copyer (nix build --impure --no-link --print-out-paths --expr "$expr")
22 set -l copyer (nix build --impure --no-link --print-out-paths --expr "$expr")
23 set rc $status
23 set rc $status
flake.nix+3−3
@@ -110,7 +110,7 @@
110 cp ${fishConfig} "$out/root/.config/fish/config.fish"
110 cp ${fishConfig} "$out/root/.config/fish/config.fish"
111 '';
111 '';
112
112
113− # The curated tool set baked into the image. Drop a `nix-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: [ ... ]`) next to where you run `c init` to replace this with
115 # your own list — see README.
115 # your own list — see README.
116 defaultPackages =
116 defaultPackages =
@@ -216,9 +216,9 @@
216 };
216 };
217
217
218 # Build helpers. `c init` uses `copyWith` to honour a per-project
218 # Build helpers. `c init` uses `copyWith` to honour a per-project
219− # `nix-container.nix`:
219+ # `container.nix`:
220 # (builtins.getFlake "github:…/nix-container")
220 # (builtins.getFlake "github:…/nix-container")
221− # .lib.<system>.copyWith (import ./nix-container.nix)
221+ # .lib.<system>.copyWith (import ./container.nix)
222 lib = {
222 lib = {
223 inherit mkImage;
223 inherit mkImage;
224 # skopeo copy app (`skopeo copy nix:<image> "$@"`) for an image built
224 # skopeo copy app (`skopeo copy nix:<image> "$@"`) for an image built