nix: Add shell.nix and flake (devShells only for now)

Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
Christoph Heiss 2023-05-16 22:39:49 +02:00
parent 867303da6e
commit 6e06a5081c
Signed by: c8h4
GPG key ID: 9C82009BEEDEA0FF
5 changed files with 98 additions and 0 deletions

1
.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
*.lock binary

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
public/
resources/
*.lock
!flake.lock

61
flake.lock Normal file
View file

@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1681346444,
"narHash": "sha256-JdT9kZ8iZD+Sc/y94jq4LjUw68gYJWXLzXXAgSt/iYs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1e0075620628ee4b367f9a2aae4ec14dcf304f69",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1e0075620628ee4b367f9a2aae4ec14dcf304f69",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

14
flake.nix Normal file
View file

@ -0,0 +1,14 @@
{
description = "c8h4.io website";
inputs = {
nixpkgs.url =
"github:NixOS/nixpkgs/1e0075620628ee4b367f9a2aae4ec14dcf304f69"; # 13-04-2023
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs { inherit system; };
in { devShells.default = import ./shell.nix { inherit pkgs; }; });
}

21
shell.nix Normal file
View file

@ -0,0 +1,21 @@
{ pkgs ? import (fetchGit {
name = "nixos-unstable";
url = "https://github.com/NixOS/nixpkgs";
ref = "refs/heads/master";
rev = "1e0075620628ee4b367f9a2aae4ec14dcf304f69"; # 13-04-2023
}) { } }:
pkgs.mkShell {
# Fix annoying "sh: warning: setlocale: LC_ALL: cannot change locale" warning
# https://stackoverflow.com/a/63123144
# https://gist.github.com/peti/2c818d6cb49b0b0f2fd7c300f8386bc3
# TODO: Fix this for `nix develop` too, this seems to only work for `nix-shell`
LOCALE_ARCHIVE_2_27 = "${pkgs.glibcLocales}/lib/locale/locale-archive";
nativeBuildInputs = with pkgs; [
deadnix
nixfmt
nodePackages.prettier
statix
];
}