Skip to content

Commit b981083

Browse files
committed
Set up day 3 in Perl
1 parent d7c424d commit b981083

File tree

7 files changed

+77
-0
lines changed

7 files changed

+77
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ My solutions to the [Advent of Code 2024](https://adventofcode.com/2024), writte
88

99
- [x] [**Day 01**](day01): [PowerShell](day01/src/day01.ps1)
1010
- [x] [**Day 02**](day02): [Nix](day02/src/day02.nix)
11+
- [ ] [**Day 03**](day03): [Perl](day03/src/day03.pl)
1112

1213
## Development
1314

day03/derivation.nix

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{ stdenv, perl }:
2+
stdenv.mkDerivation {
3+
name = "advent-of-code-2024-day03";
4+
src = ./src;
5+
6+
installPhase = ''
7+
mkdir -p $out/bin
8+
cp day03.pl $out/bin/day03
9+
'';
10+
}

day03/flake.lock

+27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

day03/flake.nix

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
description = "Advent of Code 2024 - Day 03 solution";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
6+
};
7+
8+
outputs = { self, nixpkgs }:
9+
let
10+
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
11+
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
12+
in {
13+
packages = forAllSystems (system:
14+
let
15+
pkgs = import nixpkgs { inherit system; };
16+
in {
17+
default = pkgs.callPackage ./derivation.nix {};
18+
}
19+
);
20+
21+
apps = forAllSystems (system: {
22+
default = {
23+
type = "app";
24+
program = "${self.packages.${system}.default}/bin/day03";
25+
};
26+
});
27+
};
28+
}

day03/resources/demo.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
xmul(2,4)%&mul[3,7]!@^do_not_mul(5,5)+mul(32,64]then(mul(11,8)mul(8,5))

day03/src/day03.pl

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env perl
2+
3+
print "Hello World\n";

paths.json

+7
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,12 @@
1414
},
1515
"path": "day02/src/day02.nix",
1616
"completed": true
17+
},
18+
{
19+
"lang": {
20+
"codemirror": "perl",
21+
"name": "Perl"
22+
},
23+
"path": "day03/src/day03.pl"
1724
}
1825
]

0 commit comments

Comments
 (0)