nixify the blog
This commit is contained in:
parent
a6da211197
commit
b992a8dd4e
6 changed files with 646 additions and 19 deletions
43
flake.nix
Normal file
43
flake.nix
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
description = "my internet happy place";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
ruby = pkgs.ruby_3_3;
|
||||
rubyEnv = pkgs.bundlerEnv {
|
||||
name = "muhh.lol";
|
||||
ruby = ruby;
|
||||
gemdir = ./.;
|
||||
};
|
||||
in {
|
||||
devShells.default = pkgs.mkShell {
|
||||
env = {
|
||||
};
|
||||
buildInputs = [
|
||||
ruby
|
||||
rubyEnv
|
||||
rubyEnv.wrappedRuby
|
||||
pkgs.bundler
|
||||
pkgs.bundix
|
||||
];
|
||||
shellHook = ''
|
||||
bundle config --local BUNDLE_FORCE_RUBY_PLATFORM true
|
||||
# Check if Gemfile has changed
|
||||
if [ "$(find . -name Gemfile -print0 | xargs -0 stat -c '%Y' | md5sum)" != "$(cat .gemfile.md5sum 2>/dev/null || true)" ]; then
|
||||
echo "Gemfile has changed, running bundle lock and bundix..."
|
||||
bundle lock
|
||||
nix run nixpkgs#bundix -- --ruby=${ruby}
|
||||
find . -name Gemfile -print0 | xargs -0 stat -c '%Y' | md5sum > .gemfile.md5sum
|
||||
fi
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue