This repository has been archived on 2024-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
fradrive-old/flake.nix
2024-01-17 10:34:15 +01:00

142 lines
4.6 KiB
Nix

# SPDX-FileCopyrightText: 2022-2024 Sarah Vaupel <sarah.vaupel@uniworx.de>, Gregor Kleen <gregor@kleen.consulting>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{
inputs = {
haskell-nix = {
url = "github:input-output-hk/haskell.nix";
};
nixpkgs = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
ref = "23.11";
};
flake-utils = {
type = "github";
owner = "numtide";
repo = "flake-utils";
ref = "main";
};
encoding = {
url = "git+https://gitlab.uniworx.de/haskell/encoding.git?ref=uni2work";
flake = false;
};
memcached-binary = {
url = "git+https://gitlab.uniworx.de/haskell/memcached-binary.git?ref=uni2work";
flake = false;
};
conduit-resumablesink = {
url = "git+https://gitlab.uniworx.de/haskell/conduit-resumablesink.git?ref=uni2work";
flake = false;
};
HaskellNet-SSL = {
url = "git+https://gitlab.uniworx.de/haskell/HaskellNet-SSL.git?ref=uni2work";
flake = false;
};
ldap-client = {
url = "git+https://gitlab.uniworx.de/haskell/ldap-client.git?ref=uni2work";
flake = false;
};
serversession = {
url = "git+https://gitlab.uniworx.de/haskell/serversession.git?ref=uni2work";
flake = false;
};
xss-sanitize = {
url = "git+https://gitlab.uniworx.de/haskell/xss-sanitize.git?ref=uni2work";
flake = false;
};
colonnade = {
url = "git+https://gitlab.uniworx.de/haskell/colonnade.git?ref=uni2work";
flake = false;
};
minio-hs = {
url = "git+https://gitlab.uniworx.de/haskell/minio-hs.git?ref=uni2work";
flake = false;
};
cryptoids = {
url = "git+https://gitlab.uniworx.de/haskell/cryptoids.git?ref=uni2work";
flake = false;
};
zip-stream = {
url = "git+https://gitlab.uniworx.de/haskell/zip-stream.git?ref=uni2work";
flake = false;
};
yesod = {
url = "git+https://gitlab.uniworx.de/haskell/yesod.git?ref=uni2work";
flake = false;
};
cryptonite = {
url = "git+https://gitlab.uniworx.de/haskell/cryptonite.git?ref=uni2work";
flake = false;
};
esqueleto = {
url = "git+https://gitlab.uniworx.de/haskell/esqueleto.git?ref=uni2work";
flake = false;
};
};
outputs = inputs@{ self, nixpkgs, flake-utils, haskell-nix, ... }: flake-utils.lib.eachSystem ["x86_64-linux"]
(system:
let frontendSource = pkgs.lib.sourceByRegex ./. [
"^(assets|frontend)(/.*)?$"
"^config(/(favicon\.json|robots\.txt))?$"
"^(webpack|postcss)\.config\.js$"
"^karma\.conf\.js$"
"^(package|jsconfig|\.eslintrc)\.json$"
"^\.babelrc$"
];
backendSource = pkgs.lib.sourceByRegex ./. [
"^(\.hlint|package|stack-flake)\.yaml$"
"^stack\.yaml\.lock$"
"^config(/(archive-types|mimetypes|personalised-sheet-files-collate|settings\.yml|submission-blacklist|test-settings\.yml|video-types|wordlist\.txt))?$"
"^routes$"
"^(assets|app|hlint|load|messages|models|src|templates|test|testdata)(/.*)?$"
];
pkgs = import nixpkgs {
inherit system overlays;
config.allowUnfree = true;
};
overlays = [
(final: prev: let
pkgs = import nixpkgs { inherit system; };
in {
inherit (pkgs) gup dockerTools nodejs_21 glibcLocalesUtf8 tzdata exiftools chromium minio minio-client skopeo; inherit (pkgs.stdenv) fetchurlBoot make;
stack = pkgs.symlinkJoin {
inherit (pkgs.stack) name;
paths = [pkgs.stack];
nativeBuildInputs = [pkgs.makeWrapper];
postBuild = ''
wrapProgram $out/bin/stack \
--prefix PATH : "${prev.lib.makeBinPath [pkgs.nix]}" \
--add-flags "\
--nix \
--no-nix-pure \
--nix-shell-file=${./stack.nix} \
--nix-path=nixpkgs=${nixpkgs} \
"
'';
};
})
haskell-nix.overlay
];
inherit (pkgs.lib) recursiveUpdate;
in {
packages = pkgs;
devShell = import ./shell.nix { pkgs = self.legacyPackages.${system}; nixpkgsPath = nixpkgs; };
legacyPackages = pkgs.lib.foldr (overlay: acc: acc // recursiveUpdate (overlay self.legacyPackages.${system} pkgs) pkgs) {} overlays;
}
);
}