diff --git a/blog/default.nix b/blog/default.nix index 6085fec..ce8a93e 100644 --- a/blog/default.nix +++ b/blog/default.nix @@ -1,15 +1,12 @@ -{ stdenv, lib, hugo, fetchgit, pkgs, nodejs, ruby }: +{ blog-source, blog-source-localized, stdenv, lib, hugo, fetchgit, pkgs, nodejs, ruby }: let url = "https://dev.danilafe.com/Web-Projects/blog-static.git"; requiredPackages = import ./required-packages.nix { inherit pkgs nodejs; }; website = settings: stdenv.mkDerivation { name = "blog-static"; - version = settings.rev; - src = fetchgit { - inherit url; - inherit (settings) rev sha256; - }; + version = settings.source.rev; + src = settings.source; urlSub = let regexEscape = lib.escape [ "/" "(" ")" "[" "]" "+" "*" "\\" ]; @@ -35,13 +32,13 @@ let in { english = website { - inherit rev sha256; + source = blog-source; path = "."; drafts = false; }; drafts = { english = website { - inherit rev sha256; + source = blog-source; path = "."; drafts = true; replaceUrl = { @@ -50,8 +47,7 @@ in }; }; russian = website { - rev = localizationRev; - sha256 = localizationSha256; + source = blog-source-localized; path = "ru"; drafts = true; replaceUrl = { diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..411f716 --- /dev/null +++ b/flake.nix @@ -0,0 +1,49 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + blog-source = { + flake = false; + url = "https://dev.danilafe.com/Web-Projects/blog-static.git"; + type = "git"; + submodules = true; + }; + blog-source-localized = { + flake = false; + url = "https://dev.danilafe.com/Web-Projects/blog-static.git"; + ref = "localization"; + type = "git"; + submodules = true; + }; + pegasus-source = { + url = "github:DanilaFe/pegasus"; + flake = false; + }; + pupper-bot-source = { + url = "git+https://dev.danilafe.com/Crystal-Bots/joann-pupper-bot"; + flake = false; + }; + }; + + outputs = { self, pupper-bot-source, pegasus-source, blog-source, blog-source-localized, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem + (system: + let + pkgs = import nixpkgs { inherit system; }; + pegasus = pkgs.callPackage ./pegasus/default.nix { + inherit pegasus-source; + }; + blog = pkgs.callPackage ./blog/default.nix { + inherit blog-source blog-source-localized; + }; + in + { + packages = { + inherit pegasus; + blogEnglish = blog.english; + blogEnglishDrafts = blog.drafts.english; + blogRussianDrafts = blog.drafts.russian; + }; + } + ); +} diff --git a/pegasus/default.nix b/pegasus/default.nix index d51264e..8a297d6 100644 --- a/pegasus/default.nix +++ b/pegasus/default.nix @@ -1,18 +1,12 @@ -{ stdenv, crystal, fetchFromGitHub }: - -let - version = "0489d47b191ecf8501787355b948801506e7c70f"; - src = fetchFromGitHub { - owner = "DanilaFe"; - repo = "pegasus"; - rev = version; - sha256 = "097m7l16byis07xlg97wn5hdsz9k6c3h1ybzd2i7xhkj24kx230s"; - }; -in +{ pegasus-source, stdenv, crystal, fetchFromGitHub }: crystal.buildCrystalPackage { pname = "pegasus"; - inherit version; - inherit src; + src = pegasus-source; + version = pegasus-source.rev; + format = "crystal"; + + # Programs don't do so well when running --help + installCheckPhase = ""; crystalBinaries.pegasus.src = "src/pegasus.cr"; crystalBinaries.pegasus-dot.src = "src/tools/dot/pegasus_dot.cr";