Skip to content

Instantly share code, notes, and snippets.

@danidiaz
Last active May 10, 2023 10:59
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 danidiaz/dad21332cc27dbe87d6307f5884dec94 to your computer and use it in GitHub Desktop.
Save danidiaz/dad21332cc27dbe87d6307f5884dec94 to your computer and use it in GitHub Desktop.
My first Nix flake
{
# https://nix.dev/anti-patterns/language#unquoted-urls
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
outputs = { self, nixpkgs, ... }@attrs:
# https://discourse.nixos.org/t/using-nixpkgs-legacypackages-system-vs-import/17462/5
# https://discourse.nixos.org/t/recommendations-for-use-of-flakes-input-follows/17413
let pkgs = nixpkgs.legacyPackages.aarch64-darwin;
in {
# https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-fmt.html
formatter.aarch64-darwin = nixpkgs.legacyPackages.aarch64-darwin.nixpkgs-fmt;
# https://blog.ysndr.de/posts/guides/2021-12-01-nix-shells/#development-environments
# is 'devShell' (singular) actually wrong?
# https://nixos.wiki/wiki/Flakes
# https://ryantm.github.io/nixpkgs/builders/special/mkshell/
devShells.aarch64-darwin.default = pkgs.mkShell {
buildInputs = [
pkgs.hello
pkgs.poppler_utils
];
shellHook = ''
echo 'Hi, just testing the shell hook.'
'';
};
# $ nix develop .#foo
devShells.aarch64-darwin.foo = pkgs.mkShell {
buildInputs = [
pkgs.hello
];
shellHook = ''
echo 'Hi, just testing the shell hook (foo version).'
echo 'Try using pdf2cairo!'
'';
};
};
nixConfig = {
# https://nixos.wiki/wiki/Flakes#Setting_the_bash_prompt_like_nix-shell
# bash-prompt-prefix = "[develop] ";
bash-prompt = "[develop] ";
};
}
{
# https://nix.dev/anti-patterns/language#unquoted-urls
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
outputs = { self, nixpkgs, ... }@attrs:
# https://discourse.nixos.org/t/using-nixpkgs-legacypackages-system-vs-import/17462/5
# https://discourse.nixos.org/t/recommendations-for-use-of-flakes-input-follows/17413
let pkgs = nixpkgs.legacyPackages.x86_64-linux;
in {
# https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-fmt.html
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
# https://blog.ysndr.de/posts/guides/2021-12-01-nix-shells/#development-environments
# is 'devShell' (singular) actually wrong?
# https://nixos.wiki/wiki/Flakes
# https://ryantm.github.io/nixpkgs/builders/special/mkshell/
devShells.x86_64-linux.default = pkgs.mkShell {
buildInputs = [
pkgs.hello
];
shellHook = ''
echo 'Hi, just testing the shell hook.'
'';
};
# $ nix develop .#foo
devShells.x86_64-linux.foo = pkgs.mkShell {
buildInputs = [
pkgs.hello
];
shellHook = ''
echo 'Hi, just testing the shell hook (foo version).'
'';
};
};
nixConfig = {
# https://nixos.wiki/wiki/Flakes#Setting_the_bash_prompt_like_nix-shell
bash-prompt-prefix = "[develop] ";
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment