From 7b4c3f90ad0bab25557aa49636269d26f28e2718 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 5 May 2023 10:29:26 +0200 Subject: [PATCH] Add Nix flake --- flake.lock | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 60 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..56c7362 --- /dev/null +++ b/flake.lock @@ -0,0 +1,85 @@ +{ + "nodes": { + "devshell": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1682700442, + "narHash": "sha256-qjaAAcCYgp1pBBG7mY9z95ODUBZMtUpf0Qp3Gt/Wha0=", + "owner": "numtide", + "repo": "devshell", + "rev": "fb6673fe9fe4409e3f43ca86968261e970918a83", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "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": 1683207485, + "narHash": "sha256-gs+PHt/y/XQB7S8+YyBLAM8LjgYpPZUVFQBwpFSmJro=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "cc45a3f8c98e1c33ca996e3504adefbf660a72d1", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "devshell": "devshell", + "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..2673771 --- /dev/null +++ b/flake.nix @@ -0,0 +1,60 @@ +{ + description = "Retrospace website development environment"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; + flake-utils.url = "github:numtide/flake-utils"; + devshell = { + url = "github:numtide/devshell"; + inputs = { + flake-utils.follows = "flake-utils"; + nixpkgs.follows = "nixpkgs"; + }; + }; + }; + + outputs = { self, nixpkgs, flake-utils, devshell }: + flake-utils.lib.eachDefaultSystem (system: { + devShell = + let + pkgs = import nixpkgs { + inherit system; + + overlays = [ devshell.overlays.default ]; + }; + in + pkgs.devshell.mkShell { + name = "Retrospace website development environment"; + packages = with pkgs; [ + (pkgs.ruby_3_1.withPackages + (ps: with ps; [ + bundler + jekyll + kramdown-parser-gfm + webrick + ]) + ) + nixpkgs-fmt + isort + ]; + env = [ ]; + commands = [ + { + name = "retrospace:lint"; + category = "Maintenance"; + help = "Lint all the files in project"; + command = '' + nixpkgs-fmt *.nix + ''; + } + { + name = "retrospace:deploy"; + help = "Deploy the website"; + command = '' + jekyll build && rsync -v -rz --checksum --delete ./_site/ endor:/var/www/retrospace.be + ''; + } + ]; + }; + }); +}