From 968bc2e532610c14b0e820081c1852df2c3a714d Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 18 Jul 2024 17:07:10 +0200 Subject: [PATCH] Add nix dev-shell --- .envrc | 1 + .gitignore | 3 +++ flake.lock | 26 ++++++++++++++++++++++++++ flake.nix | 29 +++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 .envrc create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..a5dbbcb --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake . diff --git a/.gitignore b/.gitignore index 08ee31f..4b53602 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,6 @@ TODO # Cheatsheet post used for debugging post pages content/posts/cheatsheet.md + +# Nix direnv +.direnv diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..b3a23cb --- /dev/null +++ b/flake.lock @@ -0,0 +1,26 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1721306924, + "narHash": "sha256-DKOCd7Gk+brIn/3fkL3UlIpK4wmXLfHKeTGsjzJ1jPA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a0812b380b9d17e9dd02b677e4052bf446b97cbe", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..85366e1 --- /dev/null +++ b/flake.nix @@ -0,0 +1,29 @@ +{ + description = "My personal website (itsdrike.com)"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; + }; + + outputs = {nixpkgs, ...}: let + inherit (nixpkgs) lib; + pkgsFor = system: import nixpkgs {inherit system;}; + + targetSystems = ["aarch64-linux" "x86_64-linux"]; + in { + devShells = lib.genAttrs targetSystems (system: let + pkgs = pkgsFor system; + in { + default = pkgs.mkShell { + packages = with pkgs; [ + bash + coreutils + hugo + nodePackages.npm + ]; + }; + }); + + formatter = lib.genAttrs targetSystems (system: nixpkgs.legacyPackages.${system}.alejandra); + }; +}