functional nix flake
This commit is contained in:
parent
bfb62f3e47
commit
fab7136a1a
204
flake.lock
204
flake.lock
|
@ -1,5 +1,166 @@
|
|||
{
|
||||
"nodes": {
|
||||
"ameba-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1668496515,
|
||||
"narHash": "sha256-SZ2sBQeZgtPOYioH9eK5MveFtWVGPvgKMrqsCfjoRGM=",
|
||||
"owner": "crystal-ameba",
|
||||
"repo": "ameba",
|
||||
"rev": "cc687d028180203cb53390484871ffb8669b88c8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "crystal-ameba",
|
||||
"ref": "v1.3.1",
|
||||
"repo": "ameba",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"bdwgc-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1661523039,
|
||||
"narHash": "sha256-UYJQGeSykmfydGAmTlNJNyAPBasBkddOSoopBHiY7TI=",
|
||||
"owner": "ivmai",
|
||||
"repo": "bdwgc",
|
||||
"rev": "cd1fbc1dbfd2cc888436944dd2784f39820698d7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ivmai",
|
||||
"ref": "v8.2.2",
|
||||
"repo": "bdwgc",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"crystal-aarch64-darwin": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"narHash": "sha256-d5znjl8QaQ/dMNa4GtKS/K14PwjBgt8Md6AwSCKcyl4=",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/crystal-lang/crystal/releases/download/1.6.1/crystal-1.6.1-1-darwin-universal.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/crystal-lang/crystal/releases/download/1.6.1/crystal-1.6.1-1-darwin-universal.tar.gz"
|
||||
}
|
||||
},
|
||||
"crystal-flake": {
|
||||
"inputs": {
|
||||
"ameba-src": "ameba-src",
|
||||
"bdwgc-src": "bdwgc-src",
|
||||
"crystal-aarch64-darwin": "crystal-aarch64-darwin",
|
||||
"crystal-i686-linux": "crystal-i686-linux",
|
||||
"crystal-src": "crystal-src",
|
||||
"crystal-x86_64-darwin": "crystal-x86_64-darwin",
|
||||
"crystal-x86_64-linux": "crystal-x86_64-linux",
|
||||
"crystalline-src": "crystalline-src",
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1672548746,
|
||||
"narHash": "sha256-CUpInKhwsX/jQvqeyGPC7mHQV6VWjaCOEwE+fh1uPwI=",
|
||||
"owner": "manveru",
|
||||
"repo": "crystal-flake",
|
||||
"rev": "322876b36ae530b7648eb2692b9fa2c0f4e068b7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "manveru",
|
||||
"repo": "crystal-flake",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"crystal-i686-linux": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"narHash": "sha256-Hfs70OcJYh+HlGQEftthr1qj10yRCAjzlsqnlUrLdjg=",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/crystal-lang/crystal/releases/download/1.6.2/crystal-1.6.2-1-linux-x86_64.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/crystal-lang/crystal/releases/download/1.6.2/crystal-1.6.2-1-linux-x86_64.tar.gz"
|
||||
}
|
||||
},
|
||||
"crystal-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1667495929,
|
||||
"narHash": "sha256-WgU6Y8ww1IYyB0vd5tXwmWBEL5RiPjHA7YzPd21jlsY=",
|
||||
"owner": "crystal-lang",
|
||||
"repo": "crystal",
|
||||
"rev": "879691b2e3268ab290a2a0951bd1d6032f0d90f3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "crystal-lang",
|
||||
"ref": "1.6.2",
|
||||
"repo": "crystal",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"crystal-x86_64-darwin": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"narHash": "sha256-Hfs70OcJYh+HlGQEftthr1qj10yRCAjzlsqnlUrLdjg=",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/crystal-lang/crystal/releases/download/1.6.2/crystal-1.6.2-1-linux-x86_64.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/crystal-lang/crystal/releases/download/1.6.2/crystal-1.6.2-1-linux-x86_64.tar.gz"
|
||||
}
|
||||
},
|
||||
"crystal-x86_64-linux": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"narHash": "sha256-Hfs70OcJYh+HlGQEftthr1qj10yRCAjzlsqnlUrLdjg=",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/crystal-lang/crystal/releases/download/1.6.2/crystal-1.6.2-1-linux-x86_64.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/crystal-lang/crystal/releases/download/1.6.2/crystal-1.6.2-1-linux-x86_64.tar.gz"
|
||||
}
|
||||
},
|
||||
"crystalline-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1665222943,
|
||||
"narHash": "sha256-j/rQf+qn5ZjZhq3wG4WEKzG3YwRcnUEb4y36qXpiW7Q=",
|
||||
"owner": "elbywan",
|
||||
"repo": "crystalline",
|
||||
"rev": "41665a798659459ecd6e2cb1169d7faf1783e746",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "elbywan",
|
||||
"ref": "v0.7.0",
|
||||
"repo": "crystalline",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1672152762,
|
||||
"narHash": "sha256-U8iWWHgabN07zfbgedogMVWrEP1Zywyf3Yx3OYHSSgE=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "19e0f88324d90509141e192664ded98bb88ef9b2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
|
@ -17,24 +178,59 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1672350804,
|
||||
"narHash": "sha256-jo6zkiCabUBn3ObuKXHGqqORUMH27gYDIFFfLq5P4wg=",
|
||||
"lastModified": 1658406394,
|
||||
"narHash": "sha256-hgibXbbmxucpVJy9eOXKn7HxQtVkpeZ8euSnWl6c9Mk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "677ed08a50931e38382dbef01cba08a8f7eac8f6",
|
||||
"rev": "c93e5ab157b45adbb6165bd85a9d8f67e49ff31d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-22.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"dir": "lib",
|
||||
"lastModified": 1671359686,
|
||||
"narHash": "sha256-3MpC6yZo+Xn9cPordGz2/ii6IJpP2n8LE8e/ebUXLrs=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "04f574a1c0fde90b51bf68198e2297ca4e7cccf4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "lib",
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1672501226,
|
||||
"narHash": "sha256-jzR7tUl9VZU77RpXKjG8V7VT9PVoaK8FmJnb+eNTm3Q=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "5353b10bd9a05533a94cf2e5629cf18b0af089dc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-22.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"crystal-flake": "crystal-flake",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
12
flake.nix
12
flake.nix
|
@ -4,13 +4,15 @@
|
|||
|
||||
inputs = {
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
|
||||
crystal-flake.url = "github:manveru/crystal-flake";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
outputs = { self, nixpkgs, flake-utils, crystal-flake }:
|
||||
(with flake-utils.lib; eachSystem defaultSystems) (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
inherit (crystal-flake.packages.${system}) crystal shards;
|
||||
in
|
||||
rec {
|
||||
packages = flake-utils.lib.flattenTree rec {
|
||||
|
@ -24,9 +26,11 @@
|
|||
lockFile = ./shard.lock;
|
||||
shardsFile = ./shards.nix;
|
||||
|
||||
buildInputs = with pkgs; [ openssl ];
|
||||
buildInputs = with pkgs; [ openssl sqlite pkg-config ] ++ [ crystal ];
|
||||
|
||||
nativeBuildInputs = with pkgs; [ pkg-config ];
|
||||
nativeBuildInputs = with pkgs; [ openssl pkg-config ] ++ [ crystal ];
|
||||
|
||||
crystal = crystal;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
12
shards.nix
12
shards.nix
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
db = {
|
||||
url = "https://github.com/crystal-lang/crystal-db.git";
|
||||
rev = "v0.6.0";
|
||||
sha256 = "1gf6ylzcb8ywpy6m7w7d49xnvn6q636xb86f3vh292s1kml3vm99";
|
||||
rev = "v0.11.0";
|
||||
sha256 = "1ylfhpn64p72ywi39niqb179f61z08q4qd4hhjza05z18mdaghl3";
|
||||
};
|
||||
dotenv = {
|
||||
url = "https://github.com/gdotdesign/cr-dotenv.git";
|
||||
|
@ -11,13 +11,13 @@
|
|||
};
|
||||
migrate = {
|
||||
url = "https://github.com/oatmealine/migrate.cr.git";
|
||||
rev = "31af921c4a0ba1d42c4bff8047c5d91584082158";
|
||||
sha256 = "0hp8w0n6cqrxawmkm7rr5dq4bllx1al69f99ks3li8wrpmx590p4";
|
||||
rev = "a4a24df3d05d0481c76ccd42e45cc48fa3fc1e73";
|
||||
sha256 = "0mlq624badj6mhs396gvisanp2qgrnj4ycx4s33vmhsxv96h8vxv";
|
||||
};
|
||||
sqlite3 = {
|
||||
url = "https://github.com/crystal-lang/crystal-sqlite3.git";
|
||||
rev = "v0.13.0";
|
||||
sha256 = "0myd9vvz40wnwl5ij1n1sva63nnmdbfv6xka5fb4y7v77l512y7c";
|
||||
rev = "v0.19.0";
|
||||
sha256 = "1gaxd56cvh7gqyl5pmcxzi8nrnwcqpvplhxfzxj3fw4hk3l5kx4v";
|
||||
};
|
||||
time_format = {
|
||||
url = "https://github.com/vladfaust/time_format.cr.git";
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
require "./spec_helper"
|
||||
|
||||
describe Crystal::Gauntlet do
|
||||
# TODO: Write tests
|
||||
|
||||
it "works" do
|
||||
false.should eq(true)
|
||||
end
|
||||
end
|
|
@ -1,2 +0,0 @@
|
|||
require "spec"
|
||||
require "../src/crystal-gauntlet"
|
|
@ -19,12 +19,14 @@ require "./lib/songs"
|
|||
require "./lib/ids"
|
||||
require "./lib/level"
|
||||
|
||||
Dotenv.load
|
||||
if File.exists?(".env")
|
||||
Dotenv.load
|
||||
end
|
||||
|
||||
module CrystalGauntlet
|
||||
VERSION = "0.1.0"
|
||||
|
||||
CONFIG = TOML.parse(File.read("./config.toml"))
|
||||
CONFIG = File.exists?("./config.toml") ? TOML.parse(File.read("./config.toml")) : TOML.parse("") # todo: log warning?
|
||||
LOG = ::Log.for("crystal-gauntlet")
|
||||
|
||||
def config_get(key : String)
|
||||
|
@ -40,7 +42,7 @@ module CrystalGauntlet
|
|||
return this
|
||||
end
|
||||
|
||||
DATABASE = DB.open(ENV["DATABASE_URL"])
|
||||
DATABASE = DB.open(ENV["DATABASE_URL"]? || "sqlite3://./crystal-gauntlet.db")
|
||||
|
||||
@@endpoints = Hash(String, (HTTP::Server::Context -> String)).new
|
||||
|
||||
|
|
Loading…
Reference in New Issue