Initial flake.nix

This commit is contained in:
2022-12-21 20:18:25 +00:00
parent 1c2042285f
commit 3078359df1
2 changed files with 84 additions and 0 deletions

57
flake.nix Normal file
View File

@@ -0,0 +1,57 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?ref=refs/tags/22.11";
};
outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = (import nixpkgs {
inherit system;
config = {
packageOverrides = pkgs: rec {
ruby = pkgs.ruby_3_1;
bundler = pkgs.bundler.override {
inherit ruby;
};
bundix = pkgs.bundix.override {
inherit bundler;
};
};
};
});
in {
devShells.${system} = {
default = pkgs.mkShell {
buildInputs = with pkgs; [
ruby_3_1 postgresql git redis curl nginx openssl coreutils ffmpeg gcc exiftool glib pkg-config
];
shellHook = ''
PS1="(deps) $PS1"
'';
};
bundix = pkgs.mkShell {
buildInputs = [ pkgs.bundix ];
shellHook = ''
PS1="(bundix) $PS1"
'';
};
};
packages.${system}.default =
let
gems = pkgs.bundlerEnv {
name = "danbooru";
rubt = pkgs.ruby;
gemdir = ./.;
};
in pkgs.stdenv.mkDerivation {
name = "danbooru";
src = ./.;
buildInputs = [ gems pkgs.ruby ];
installPhase = ''
mkdir -p $out
cp -r $src $out
'';
};
};
}