-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
47 lines (47 loc) · 1.58 KB
/
flake.nix
File metadata and controls
47 lines (47 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
description = "A Nix-flake-based development environment";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs =
inputs:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forEachSupportedSystem =
f:
inputs.nixpkgs.lib.genAttrs supportedSystems (
system: f { pkgs = import inputs.nixpkgs { inherit system; }; }
);
in
{
devShells = forEachSupportedSystem (
{ pkgs }:
{
default = pkgs.mkShellNoCC {
# The Nix packages installed in the dev environment.
packages = with pkgs; [
opentofu # infrastructure as code
sops # simple tool for managing secrets
cocogitto # conventional commit toolkit
git-cliff # changelog generator
trivy # scan security issues
typos # check misspelling
prek # better pre-commit
];
# The shell script executed when the environment is activated.
shellHook = /* sh */ ''
# Print the last modified date of "flake.lock".
git log -1 --format="%cd" --date=format:"%Y-%m-%d" -- flake.lock |
awk '{printf "\"flake.lock\" last modified on: %s", $1}' &&
echo " ($((($(date +%s) - $(git log -1 --format="%ct" -- flake.lock)) / 86400)) days ago)"
# Install git hooks managed by prek.
prek install --quiet
'';
};
}
);
};
}