summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorMiran Bastaja <miran.bastaja04@gmail.com>2023-11-15 02:53:51 +0100
committerMiran Bastaja <miran.bastaja04@gmail.com>2023-11-15 13:57:29 +0100
commitff5fdcd170e6565f225c4d47caed14c2c8d73ca5 (patch)
treecec896a54ffa48927e6dc503bc9856f9bc772bd6 /flake.nix
Initial commit
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix67
1 files changed, 67 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..5d9c8ec
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,67 @@
+{
+ description = "My website hosting random thoughts";
+
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ devshell = {
+ url = "github:numtide/devshell";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ treefmt-nix = {
+ url = "github:numtide/treefmt-nix";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ pre-commit-hooks-nix = {
+ url = "github:cachix/pre-commit-hooks.nix";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ };
+
+ outputs = inputs@{ flake-parts, ... }:
+ flake-parts.lib.mkFlake { inherit inputs; } {
+ imports = [
+ inputs.devshell.flakeModule
+ inputs.treefmt-nix.flakeModule
+ inputs.pre-commit-hooks-nix.flakeModule
+ ];
+ systems = [ "x86_64-linux" ];
+ perSystem = { config, pkgs, ... }: {
+ packages = {
+ default = config.packages.website;
+ website = pkgs.stdenv.mkDerivation {
+ pname = "sorre-website";
+ version = "2023-11-15";
+ src = ./.;
+ nativeBuildInputs = [ pkgs.zola ];
+ buildPhase = "zola build";
+ installPhase = "cp -r public $out";
+ };
+ };
+
+ devshells.default = {
+ packages = builtins.attrValues config.treefmt.build.programs;
+ commands = with pkgs; [
+ { package = zola; }
+ ];
+ };
+
+ treefmt = {
+ projectRootFile = ./flake.nix;
+ programs = {
+ nixfmt.enable = true;
+ };
+ };
+
+ pre-commit = {
+ check.enable = true;
+ settings = {
+ settings = { treefmt.package = config.treefmt.build.wrapper; };
+ hooks = {
+ treefmt.enable = true;
+ deadnix.enable = true;
+ };
+ };
+ };
+ };
+ };
+}