commit ed1e7dbbd7260cb5350e622d5ff6d20621c904f8 Author: teutat3s Date: Tue Oct 31 23:11:45 2023 +0100 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b2be92b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result diff --git a/README.md b/README.md new file mode 100644 index 0000000..0cb957e --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# nix-flakes-node docker image + +How to build: +``` +docker load --input $(nix-build default.nix) +``` + +How to test: +``` +docker tag nix-flakes-node:ghyn1438kgxp09pxlpg6xakyw2fkjyhi nix-flakes-node:latest +docker run -it --rm nix-flakes-node:latest bash + +bash-5.2# node + +Welcome to Node.js v20.5.1. +Type ".help" for more information. +> +``` diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..26508f1 --- /dev/null +++ b/default.nix @@ -0,0 +1,34 @@ +{ pkgs ? import { } + +, pkgsLinux ? import { system = "x86_64-linux"; } + +}: +let + nixFlakesImage = pkgs.dockerTools.pullImage { + imageName = "docker.nix-community.org/nixpkgs/nix-flakes"; + imageDigest = "sha256:c564622ed14cccc8c5faa93d2540da29101200f41c442c824da83f54d4915a40"; + sha256 = "15zkpmcrzqplz3fyi5z3gbjag19k627lszdvl93i2rb3ajkbvch6"; + finalImageName = "docker.nix-community.org/nixpkgs/nix-flakes"; + finalImageTag = "latest"; + os = "linux"; + arch = "x86_64"; +}; +in + +pkgs.dockerTools.buildImage { + + name = "nix-flakes-node"; + + fromImage = nixFlakesImage; + fromImageTag = "latest"; + + copyToRoot = pkgs.buildEnv { + name = "image-root"; + paths = [ pkgsLinux.nodejs_20 ]; + pathsToLink = [ "/bin" ]; + }; + + config = { + Cmd = [ "/bin/bash" ]; + }; +}