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

27
flake.lock generated Normal file
View File

@@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1669833724,
"narHash": "sha256-/HEZNyGbnQecrgJnfE8d0WC5c1xuPSD2LUpB6YXlg4c=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4d2b37a84fad1091b9de401eb450aae66f1a741e",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "refs/tags/22.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

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
'';
};
};
}