From e7abbd089179529f3dde3b35ce17de430ba6ea13 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Sat, 25 May 2024 01:22:30 +0200 Subject: [PATCH] refactor: use nix flake instead venv --- .envrc | 1 + .gitignore | 4 ++-- .gitmodules | 3 --- flake.lock | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++ plugins | 1 - 6 files changed, 128 insertions(+), 6 deletions(-) create mode 100644 .envrc create mode 100644 flake.lock create mode 100644 flake.nix delete mode 160000 plugins diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index 2febe43..90fdf0c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ output -.venv -venv-install cache __pycache__ +.direnv +plugins diff --git a/.gitmodules b/.gitmodules index 3b89742..1cb184c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ [submodule "theme"] path = theme url = https://git.epha.se/ephase/attila_pelican_theme.git -[submodule "plugins"] - path = plugins - url = https://github.com/getpelican/pelican-plugins diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ff193d9 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1716361217, + "narHash": "sha256-mzZDr00WUiUXVm1ujBVv6A0qRd8okaITyUp4ezYRgc4=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "46397778ef1f73414b03ed553a3368f0e7e33c2f", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..4073ebe --- /dev/null +++ b/flake.nix @@ -0,0 +1,64 @@ +{ + description = "Development shell for Personal blog"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; + flake-utils = { + url = "github:numtide/flake-utils"; + }; + }; + + outputs = { nixpkgs , flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + }; + pelicanplugins-neighbors = ( with pkgs; stdenv.mkDerivation { + pname = "pelicanplugins-neighbors"; + version = "1.2.0"; + src = pkgs.fetchFromGitHub { + owner = "pelican-plugins"; + repo = "neighbors"; + rev = "60649ac6f3494d01a37b9c6d3d455f9dc2502d55"; + hash = "sha256-c6etuRqve9xj6NhGRAim2A0ae8xv6mI/yez+suQuZ8U="; + }; + installPhase = '' + cp -r $src/pelican/plugins/neighbors $out + ''; + }); + pelicanplugins-md_include = ( with pkgs; stdenv.mkDerivation { + pname = "pelicanplugins-md_include"; + version = "1.0.4"; + src = pkgs.fetchFromGitHub { + owner = "pelican-plugins"; + repo = "markdown-include"; + rev = "df0b3e55c45471283ca62d6e157b61a8caa35e37"; + hash = "sha256-y0dIvyEYLbYqkm+6yJOUYI3apzEMJ/N/JUwWTqjdsNg="; + }; + installPhase = '' + cp -r $src/pelican/plugins/md_include $out + ''; + }); + in { + devShells = { + default = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + lefthook + go-task + convco + typos + shellcheck + shfmt + python3 + python3Packages.pelican + python3Packages.markdown-include + ]; + shellHook = '' + mkdir -p plugins + ln -snf "${pelicanplugins-neighbors}" "plugins/neighbors" + ln -snf "${pelicanplugins-md_include}" "plugins/md_include" + ''; + }; + }; + }); +} diff --git a/plugins b/plugins deleted file mode 160000 index aef91ac..0000000 --- a/plugins +++ /dev/null @@ -1 +0,0 @@ -Subproject commit aef91ac09a57ab61518a35b4b11fe711ee74e5e2