summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
Diffstat (limited to 'static')
-rw-r--r--static/Makefile18
-rw-r--r--static/default.nix82
2 files changed, 34 insertions, 66 deletions
diff --git a/static/Makefile b/static/Makefile
deleted file mode 100644
index 1956a35..0000000
--- a/static/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-build:
- nix-build -A build
-
-clean:
- rm -f result
- rm -rf _site
-
-dev:
- nix-shell -A dev
-
-shell:
- nix-shell -A shell
-
-lock:
- nix-shell -A depShell --run 'bundler lock; bundix; rm -rf .bundle vendor'
-
-update:
- nix-shell -A depShell --run 'bundler update; bundler lock; bundix; rm -rf .bundle vendor'
diff --git a/static/default.nix b/static/default.nix
index 74bd3bf..7c50dfa 100644
--- a/static/default.nix
+++ b/static/default.nix
@@ -1,53 +1,39 @@
-let
- utils = (import ../nix) {};
- pkgs = utils.pkgs;
- system = utils.system;
+{pkgs}: rec {
- jekyll_env = pkgs.bundlerEnv {
- name = "jekyll_env";
+ depInputs = [ pkgs.imagemagick pkgs.exiftool pkgs.bundler pkgs.bundix ];
+
+ depShell = pkgs.stdenv.mkDerivation {
+ name = "mediocre-blog-static-dep-shell";
+ buildInputs = depInputs;
+ };
+
+ jekyllEnv = pkgs.bundlerEnv {
+ name = "jekyllEnv";
ruby = pkgs.ruby;
gemdir = ./.;
};
- dep_inputs = [ pkgs.imagemagick pkgs.exiftool pkgs.bundler pkgs.bundix ];
- all_inputs = [ jekyll_env ] ++ dep_inputs;
-in
- {
- build = derivation {
- inherit jekyll_env system;
-
- name = "mediocre-blog-static";
- builder = "${pkgs.bash}/bin/bash";
- args = [
- (pkgs.writeTextFile {
- name = "mediocre-blog-static-buildsh";
- text = ''
- source ${pkgs.stdenv}/setup
- set -e
-
- mkdir -p "$out"
- $jekyll_env/bin/jekyll build -s "${./src}" -d "$out"
- '';
- executable = true;
- })
- ];
- };
-
- dev = pkgs.stdenv.mkDerivation {
- name = "mediocre-blog-static-dev";
- buildInputs = all_inputs;
- shellHook = ''
- exec ${jekyll_env}/bin/jekyll serve -s ./src -d ./_site -w -I -D -H 0.0.0.0 -P 4001
- '';
- };
-
- depShell = pkgs.stdenv.mkDerivation {
- name = "mediocre-blog-static-dep-shell";
- buildInputs = dep_inputs;
- };
-
- shell = pkgs.stdenv.mkDerivation {
- name = "mediocre-blog-static-shell";
- buildInputs = all_inputs;
- };
- }
+
+ build = pkgs.stdenv.mkDerivation {
+ name = "mediocre-blog-static";
+ src = ./src;
+ buildPhase = "${jekyllEnv}/bin/jekyll build";
+ installPhase = "mv _site $out";
+ };
+
+ serve = pkgs.writeScriptBin "static-serve" ''
+ #!/bin/sh
+ exec ${jekyllEnv}/bin/jekyll serve \
+ -s ./src \
+ -d ./_site \
+ -w -I -D \
+ -P 4001
+ '';
+
+ allInputs = depInputs ++ [ jekyllEnv serve ];
+
+ shell = pkgs.stdenv.mkDerivation {
+ name = "mediocre-blog-static-shell";
+ buildInputs = allInputs;
+ };
+}