Skip to content

Instantly share code, notes, and snippets.

@reyman
Last active November 23, 2021 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reyman/5a968af6f5260e1412edf7c0075bb10e to your computer and use it in GitHub Desktop.
Save reyman/5a968af6f5260e1412edf7c0075bb10e to your computer and use it in GitHub Desktop.
{
description = "PandocProject";
inputs.haskellNix.url = "github:input-output-hk/haskell.nix";
inputs.nixpkgs.follows = "haskellNix/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils, haskellNix }:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
overlays = [ haskellNix.overlay
(final: prev: {
# This overlay adds our project to pkgs
pandocProject = final.haskell-nix.cabalProject {
cabalProjectFreeze = null;
cabalProject = null;
cabalProjectLocal = null;
compiler-nix-name = "ghc8104";
name = "pandocProject";
src = final.fetchFromGitHub {
name = "pandoc";
owner = "jgm";
repo = "pandoc";
rev = "d05460d00d7c9af3b4913f1760ea385a7d855d84";
sha256 = "1a3kwag6j13b42zhzxiwlzabsc6c9jppiwv9j8gbnf2k1yb84kdm";
};
pkg-def-extras = with final.haskell.lib; [];
};
})
];
pkgs = import nixpkgs { inherit system overlays; };
flake = pkgs.pandocProject.flake {};
in flake // {
# Built by `nix build .`
inherit overlays;
defaultPackage = flake.packages."pandoc:exe:pandoc";
});
}
{
description = "MixedFlake";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.wiki-python.url = "git+https://gitlab.huma-num.fr/gt-notebook/wiki.git?ref=main";
inputs.wiki-pandoc.url = "git+https://gitlab.huma-num.fr/gt-notebook/nix/pandoc-2-14-02.git?ref=main";
outputs = { self, nixpkgs, flake-utils, wiki-python, wiki-pandoc }:
let
my-overlay = nixpkgs.lib.composeManyExtensions [
wiki-python.overlay
wiki-pandoc.overlays
];
pkgsForSystem = system:
(import nixpkgs) {
inherit system;
overlays = [
my-overlay
];
};
in (flake-utils.lib.eachSystem ["x86_64-linux"] (system: rec {
pkgs = pkgsForSystem system;
legacyPackages = pkgs;
packages = flake-utils.lib.flattenTree {
inherit (legacyPackages)
wikiApp;
};
defaultPackage = legacyPackages;
/*
devShell = legacyPackages.mkShell {
packages = [
packages.pandocProject
packages.wikiApp
];
};*/
/*apps = { pandocProject }: {
pandoc = flake-utils.lib.mkApp { drv = pandocProject; };
defaultApp = flake-utils.lib.mkApp { drv = pandocProject; };
};*/
}));
}
{
description = "Application packaged using poetry2nix";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs";
poetry.url = "github:nix-community/poetry2nix";
};
outputs = inputs@{ self, nixpkgs, flake-utils, poetry }:
let overlay = final: prev: ({
wikiApp = final.poetry2nix.mkPoetryApplication {
projectDir = ./.;
python = prev.python39;
propagatedBuildInputs = [
prev.graphviz
prev.bash
prev.wget
prev.findutils
];
};
} //
(poetry.overlay final prev));
in
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
pkgs = import nixpkgs { inherit system; overlays = [ overlay]; };
in {
defaultPackage = pkgs.wikiApp;
}) // {
inherit overlay;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment