uniworx.de/flake.nix
2023-05-11 16:22:25 +02:00

90 lines
1.9 KiB
Nix

{
inputs = {
nixpkgs = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
};
flake-parts = {
type = "github";
owner = "hercules-ci";
repo = "flake-parts";
};
pre-commit-hooks-nix = {
type = "github";
owner = "cachix";
repo = "pre-commit-hooks.nix";
};
};
outputs = inputs @ {
self,
nixpkgs,
flake-parts,
pre-commit-hooks-nix,
...
}:
flake-parts.lib.mkFlake
{inherit inputs;}
({...}: {
imports = [
pre-commit-hooks-nix.flakeModule
];
config = {
systems = ["x86_64-linux"];
perSystem = {
system,
config,
pkgs,
...
}: {
devShells.default = pkgs.mkShell {
packages = with pkgs; [
(pkgs.symlinkJoin {
inherit (stack) name;
paths = [stack];
nativeBuildInputs = [makeWrapper];
postBuild = ''
wrapProgram $out/bin/stack \
--add-flags "\
--nix \
--no-nix-pure \
--nix-shell-file=${pkgs.writeText "shell.nix" ''
{ ghc }:
with (import <nixpkgs> {});
haskell.lib.buildStackProject {
inherit ghc;
name = "uniworx-de";
buildInputs = [ zlib ];
}
''} \
--nix-path=nixpkgs=${nixpkgs} \
"
'';
})
yarn
gup
];
shellHook = ''
${config.pre-commit.installationScript}
'';
};
pre-commit = {
settings.hooks = {
alejandra.enable = true;
fourmolu.enable = true;
};
};
};
};
});
}