Skip to content

Instantly share code, notes, and snippets.

@notnmeyer
Last active April 12, 2024 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save notnmeyer/a89531e91904c74f09582005bdf700ec to your computer and use it in GitHub Desktop.
Save notnmeyer/a89531e91904c74f09582005bdf700ec to your computer and use it in GitHub Desktop.
nix flake template
#/usr/bin/env bash
echo '{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
};
outputs = {
systems,
nixpkgs,
...
} @ inputs: let
eachSystem = f:
nixpkgs.lib.genAttrs (import systems) (
system:
f nixpkgs.legacyPackages.${system}
);
in {
devShells = eachSystem (pkgs: {
default = pkgs.mkShell {
buildInputs = [
pkgs.nodejs_20
];
};
});
};
}' > flake.nix
echo ".direnv" >> .gitignore
echo "use flake" > .envrc
echo "Done! Add your packages to flake.nix and optionally run `direnv allow`."

curl -s https://gist.githubusercontent.com/notnmeyer/a89531e91904c74f09582005bdf700ec/raw/f32c459f485a16096645870f525d2da6055e8871/flake-template.sh | bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment