-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clean flake
- Loading branch information
Showing
15 changed files
with
88 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ package day_1 | |
|
||
import ( | ||
"bufio" | ||
"main/utils" | ||
"aoc2022/utils" | ||
"strconv" | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ package day_2 | |
|
||
import ( | ||
"bufio" | ||
"main/utils" | ||
"aoc2022/utils" | ||
"strconv" | ||
"strings" | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ package day_3 | |
import ( | ||
"bufio" | ||
"fmt" | ||
"main/utils" | ||
"aoc2022/utils" | ||
"strconv" | ||
"strings" | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ package day_4 | |
|
||
import ( | ||
"bufio" | ||
"main/utils" | ||
"aoc2022/utils" | ||
"strconv" | ||
"strings" | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ package day_5 | |
|
||
import ( | ||
"bufio" | ||
"main/utils" | ||
"aoc2022/utils" | ||
"strconv" | ||
"strings" | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ package day_6 | |
|
||
import ( | ||
"bufio" | ||
"main/utils" | ||
"aoc2022/utils" | ||
"strconv" | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ package day_7 | |
|
||
import ( | ||
"bufio" | ||
"main/utils" | ||
"aoc2022/utils" | ||
"os" | ||
"strconv" | ||
"strings" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ package day_8 | |
|
||
import ( | ||
"bufio" | ||
"main/utils" | ||
"aoc2022/utils" | ||
"os" | ||
"strconv" | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ package day_9 | |
import ( | ||
"bufio" | ||
"fmt" | ||
"main/utils" | ||
"aoc2022/utils" | ||
"math" | ||
"strconv" | ||
"strings" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module main | ||
module aoc2022 | ||
|
||
go 1.19 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,59 @@ | ||
{ | ||
description = "Advent of code"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
utils.url = "github:numtide/flake-utils"; | ||
}; | ||
|
||
outputs = { self, nixpkgs, utils }: | ||
utils.lib.eachDefaultSystem (system: | ||
outputs = | ||
{ ... }@inputs: | ||
inputs.utils.lib.eachDefaultSystem ( | ||
system: | ||
let | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
aoc2022 = with pkgs; [ go ]; | ||
aoc2023 = rec { | ||
cc = pkgs.gcc12; | ||
deps = with pkgs; [ | ||
glibc | ||
gnumake | ||
criterion | ||
] ++ [ cc ]; | ||
shell = with pkgs; [ | ||
ltrace | ||
valgrind | ||
python311Packages.compiledb | ||
man-pages | ||
man-pages-posix | ||
gdb | ||
] ++ deps; | ||
}; | ||
pkgs = import inputs.nixpkgs { inherit system; }; | ||
inherit (pkgs) lib; | ||
in | ||
{ | ||
devShells.default = pkgs.mkShell { | ||
packages = aoc2022 ++ aoc2023.shell; | ||
rec { | ||
formatter = pkgs.nixfmt-rfc-style; | ||
|
||
devShells = { | ||
"2022" = pkgs.mkShell { | ||
inputsFrom = [ packages."2022" ]; | ||
}; | ||
|
||
"2023" = pkgs.mkShell { | ||
inputsFrom = [ packages."2023" ]; | ||
packages = | ||
with pkgs; | ||
lib.optionals stdenv.isLinux [ | ||
gdb | ||
ltrace | ||
valgrind | ||
]; | ||
}; | ||
}; | ||
|
||
formatter = pkgs.nixpkgs-fmt; | ||
packages = { | ||
aoc2022 = pkgs.buildGoModule rec { | ||
"2022" = pkgs.buildGoModule { | ||
name = "aoc2022"; | ||
version = "1.0.0"; | ||
src = ./2022; | ||
|
||
vendorHash = null; | ||
buildPhase = '' | ||
${pkgs.go}/bin/go build -o ${name} | ||
''; | ||
installPhase = '' | ||
mkdir -p $out/bin | ||
cp ${name} $out/bin/ | ||
''; | ||
}; | ||
|
||
aoc2023 = pkgs.stdenv.mkDerivation rec { | ||
"2023" = pkgs.gcc12Stdenv.mkDerivation { | ||
name = "aoc2023"; | ||
src = ./2023; | ||
|
||
makeFlags = [ "CC=${aoc2023.cc}/bin/gcc" ]; | ||
buildInputs = aoc2023.deps; | ||
buildInputs = with pkgs; [ criterion ]; | ||
|
||
hardeningDisable = [ "format" "fortify" ]; | ||
hardeningDisable = [ | ||
"format" | ||
"fortify" | ||
]; | ||
env.PREFIX = "${placeholder "out"}"; | ||
enableParallelBuilding = true; | ||
|
||
buildPhase = '' | ||
make ${name} | ||
''; | ||
|
||
installPhase = '' | ||
mkdir -p $out/bin | ||
cp ${name} $out/bin | ||
''; | ||
}; | ||
}; | ||
}); | ||
} | ||
); | ||
} |