Preparing for AoC24

This commit is contained in:
Samae 2024-11-26 21:34:30 +02:00
commit 51c47c880c
6 changed files with 131 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
result*
*.cabal

12
Main.hs Normal file
View file

@ -0,0 +1,12 @@
{-# OPTIONS_GHC -Wno-unused-imports #-}
module Main where
import Day1
main :: IO ()
main = do
putStrLn "AoC 2024"
putStrLn "Day 1"
Day1.main

23
flake.lock Normal file
View file

@ -0,0 +1,23 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1,
"narHash": "sha256-y/MEyuJ5oBWrWAic/14LaIr/u5E0wRVzyYsouYY3W6w=",
"path": "/nix/store/zx63r1p2sg7w4vicnxlmh2assabvpzc7-c9wv7i0af6mysmy65x6nvyfw5izzxv4g-source",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

37
flake.nix Normal file
View file

@ -0,0 +1,37 @@
{
description = "A Hello World for AoC";
inputs.nixpkgs.url = "nixpkgs";
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "aarch64-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: {
aoc24 = final.haskellPackages.callCabal2nix "aoc24" ./. {};
});
packages = forAllSystems (system: {
aoc24 = nixpkgsFor.${system}.aoc24;
});
defaultPackage = forAllSystems (system: self.packages.${system}.aoc24);
checks = self.packages;
devShell = forAllSystems (system: let haskellPackages = nixpkgsFor.${system}.haskellPackages;
in haskellPackages.shellFor {
packages = p: [self.packages.${system}.aoc24];
withHoogle = true;
buildInputs = with haskellPackages; [
haskell-language-server
ghcid
cabal-install
];
# Change the prompt to show that you are in a devShell
shellHook = ''
hpack
'';
});
};
}

49
package.yaml Normal file
View file

@ -0,0 +1,49 @@
name: aoc24
ghc-options: -Wall -threaded #-prof -fprof-auto -rtsopts
default-extensions:
- OverloadedStrings
dependencies:
- base == 4.*
- attoparsec
- bytestring
- matrix
- vector
- containers
executables:
aoc24:
main: Main.hs
dependencies:
- aoc24
library:
source-dirs: src
exposed-modules:
- Day1
# - Day2
# - Day3
# - Day4
# - Day5
# - Day6
# - Day7
# - Day8
# - Day9
# - Day10
# - Day11
# - Day12
# - Day13
# - Day14
# - Day15
# - Day16
# - Day17
# - Day18
# - Day19
# - Day20
# - Day21
# - Day22
# - Day23
# - Day24
# - Day25

8
src/Day1.hs Normal file
View file

@ -0,0 +1,8 @@
{-# LANGUAGE OverloadedStrings #-}
module Day1 where
main :: IO ()
main = do
putStrLn "Part 1"
putStrLn "Part 2"