First template

This commit is contained in:
Samae 2023-12-23 15:21:15 +02:00
commit 3260f787a7
5 changed files with 82 additions and 0 deletions

8
aoc23/Main.hs Normal file
View file

@ -0,0 +1,8 @@
module Main where
import Day1
main :: IO ()
main = do
putStrLn "Hello"
putStrLn Day1.resultA

35
aoc23/flake.nix Normal file
View file

@ -0,0 +1,35 @@
{
description = "A Hello World for AoC";
inputs.nixpkgs.url = "nixpkgs";
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "x86_64-darwin" ];
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
nixpkgsFor = forAllSystems (system: import nixpkgs {
inherit system;
overlays = [ self.overlay ];
});
in
{
overlay = (final: prev: {
aoc23 = final.haskellPackages.callCabal2nix "aoc23" ./. {};
});
packages = forAllSystems (system: {
aoc23 = nixpkgsFor.${system}.aoc23;
});
defaultPackage = forAllSystems (system: self.packages.${system}.aoc23);
checks = self.packages;
devShell = forAllSystems (system: let haskellPackages = nixpkgsFor.${system}.haskellPackages;
in haskellPackages.shellFor {
packages = p: [self.packages.${system}.aoc23];
withHoogle = true;
buildInputs = with haskellPackages; [
haskell-language-server
ghcid
cabal-install
];
# Change the prompt to show that you are in a devShell
shellHook = "export PS1='\\e[1;34mdev > \\e[0m'";
});
};
}

18
aoc23/package.yaml Normal file
View file

@ -0,0 +1,18 @@
name: aoc23
ghc-options: -Wall -threaded
dependencies:
- base == 4.*
executables:
aoc23:
main: Main.hs
dependencies:
- aoc23
library:
source-dirs: src
exposed-modules:
- Day1

3
aoc23/src/Day1.hs Normal file
View file

@ -0,0 +1,3 @@
module Day1 where
resultA = "Day1 - part A"

18
flake.nix Normal file
View file

@ -0,0 +1,18 @@
{
description = "Samae's collection of flake templates";
outputs = { self }: {
templates = {
haskell-aoc = {
path = ./aoc23;
description = "A full-featured, small nix+haskell AoC template";
};
};
defaultTemplate = self.templates.haskell-aoc;
};
}