Skip to content

Instantly share code, notes, and snippets.

@thomasjm
Last active July 27, 2020 23:31
Show Gist options
  • Save thomasjm/34359046fbb036453b0932dfa6830b8c to your computer and use it in GitHub Desktop.
Save thomasjm/34359046fbb036453b0932dfa6830b8c to your computer and use it in GitHub Desktop.
FROM ubuntu:20.04
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y sudo curl emacs git
RUN mkdir /nix
RUN chmod a+rwx /nix
RUN adduser user --home /home/user --disabled-password --gecos "" --shell /bin/bash
USER user
WORKDIR /home/user
RUN curl -L https://nixos.org/nix/install | sh
ENV NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
ENV NIX_PATH=/home/user/.nix-defexpr/channels
ENV NIX_PROFILES="/nix/var/nix/profiles/default /home/user/.nix-profile"
ENV PATH="/home/user/.nix-profile/bin:$PATH"
COPY nix_static.nix nix_static.nix
RUN nix-build nix_static.nix
let
nixpkgs = builtins.fetchGit {
url = "https://github.com/NixOS/nixpkgs.git";
rev = "a6133b7a396816e3e9248ee657f21e4245607e75"; # f1680774340d5443a1409c3421ced84ac1163ba9";
ref = "master";
};
config = {
nix = {
storeDir = "/nix_frozen/store";
stateDir = "/nix_frozen/var";
};
};
pkgs = import nixpkgs { inherit config; };
in
pkgs.pkgsStatic.nix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment