Skip to content

Commit a5642ce

Browse files
committed
Stub out day 25 in Swift
1 parent d1858ce commit a5642ce

File tree

10 files changed

+88
-2
lines changed

10 files changed

+88
-2
lines changed

.github/workflows/run.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
matrix:
1313
os: ['ubuntu-latest', 'macos-latest']
14-
day: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24']
14+
day: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25']
1515
exclude:
1616
# TODO: Investigate why building Zig on macOS fails
1717
# https://github.com/fwcd/advent-of-code-2024/actions/runs/12202208638/job/34042374507

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ My solutions to the [Advent of Code 2024](https://adventofcode.com/2024), writte
3030
- [x] [**Day 22**](day22): [Dart](day22/src/day22.dart)
3131
- [x] [**Day 23**](day23): [Go](day23/src/day23.go)
3232
- [x] [**Day 24**](day24): [Crystal](day24/src/day24.cr)
33+
- [ ] [**Day 25**](day25): [Swift](day25/src/day25.swift)
3334

3435
## Development
3536

day25/derivation.nix

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{ swift, swiftPackages }:
2+
swiftPackages.stdenv.mkDerivation {
3+
name = "advent-of-code-2024-day25";
4+
src = ./src;
5+
6+
nativeBuildInputs = [
7+
swift
8+
swiftPackages.Foundation
9+
];
10+
11+
buildPhase = ''
12+
mkdir -p out
13+
14+
# Explicitly set the target since swiftc seems to otherwise use an older
15+
# macOS version that doesn't support all of the regex stuff.
16+
target="$(swiftc --version 2>/dev/null | grep Target | sed 's/Target: //g' | sed "s/-pc-linux-/-unknown-linux-/g")"
17+
swiftc -target "$target" -o out/day25 day25.swift
18+
'';
19+
20+
installPhase = ''
21+
mkdir -p $out/bin
22+
cp out/day25 $out/bin
23+
'';
24+
}

day25/flake.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

day25/flake.nix

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
description = "Advent of Code 2024 - Day 25 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/day25";
25+
};
26+
});
27+
};
28+
}

day25/resources/demo.txt

Whitespace-only changes.

day25/resources/input.txt

Whitespace-only changes.

day25/src/day25.swift

Whitespace-only changes.

paths.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,5 +191,12 @@
191191
},
192192
"path": "day24/src/day24.cr",
193193
"completed": true
194+
},
195+
{
196+
"lang": {
197+
"codemirror": "swift",
198+
"name": "Swift"
199+
},
200+
"path": "day25/src/day25.swift"
194201
}
195202
]

planned-languages.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
Swift
21
Ruby
32
F#

0 commit comments

Comments
 (0)