commit 51c47c880c533e5a0242e7a78e82c13eb14ea135 Author: Samae Date: Tue Nov 26 21:34:30 2024 +0200 Preparing for AoC24 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bc6bbb0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +result* +*.cabal diff --git a/Main.hs b/Main.hs new file mode 100644 index 0000000..b506db6 --- /dev/null +++ b/Main.hs @@ -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 + diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e3bdb55 --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..682417c --- /dev/null +++ b/flake.nix @@ -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 + ''; + }); + }; +} diff --git a/package.yaml b/package.yaml new file mode 100644 index 0000000..22a3da7 --- /dev/null +++ b/package.yaml @@ -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 diff --git a/src/Day1.hs b/src/Day1.hs new file mode 100644 index 0000000..558c85f --- /dev/null +++ b/src/Day1.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Day1 where + +main :: IO () +main = do + putStrLn "Part 1" + putStrLn "Part 2"