diff --git a/.envrc b/.envrc deleted file mode 100644 index 3550a30f2de389e537ee40ca5e64a77dc185c79b..0000000000000000000000000000000000000000 --- a/.envrc +++ /dev/null @@ -1 +0,0 @@ -use flake diff --git a/01/.vscode/launch.json b/day01/.vscode/launch.json similarity index 100% rename from 01/.vscode/launch.json rename to day01/.vscode/launch.json diff --git a/01/Cargo.lock b/day01/Cargo.lock similarity index 100% rename from 01/Cargo.lock rename to day01/Cargo.lock diff --git a/01/Cargo.toml b/day01/Cargo.toml similarity index 100% rename from 01/Cargo.toml rename to day01/Cargo.toml diff --git a/01/data.txt b/day01/data.txt similarity index 100% rename from 01/data.txt rename to day01/data.txt diff --git a/day01/flake.lock b/day01/flake.lock new file mode 100644 index 0000000000000000000000000000000000000000..1846e2c6369346f2783c86c5d7b03dd8bac23d2b --- /dev/null +++ b/day01/flake.lock @@ -0,0 +1,83 @@ +{ + "nodes": { + "naersk": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1698420672, + "narHash": "sha256-/TdeHMPRjjdJub7p7+w55vyABrsJlt5QkznPYy55vKA=", + "owner": "nix-community", + "repo": "naersk", + "rev": "aeb58d5e8faead8980a807c840232697982d47b9", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "master", + "repo": "naersk", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1701268161, + "narHash": "sha256-hL4jGGwMHHmyx6G9wi6IrYa8RLkoEtzCb4zWITH1B40=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "67be70a859530f6f7c358568eaa6ab0d84b36b01", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "naersk": "naersk", + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/day01/flake.nix b/day01/flake.nix new file mode 100644 index 0000000000000000000000000000000000000000..70189f0356a98da5c89c7e72a40b9ab6ff0edd88 --- /dev/null +++ b/day01/flake.nix @@ -0,0 +1,29 @@ +{ + description = "AoC 2023 - day 01"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; + naersk = { + url = "github:nix-community/naersk/master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, utils, naersk }: + utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + naerskBuildPackage = (conf: + (pkgs.callPackage naersk { }).buildPackage ({ src = ./.; } // conf) + ); + in + { + defaultPackage = naerskBuildPackage { }; + + devShell = with pkgs; mkShell { + buildInputs = buildInputs ++ [ cargo rustc rustfmt ]; + RUST_SRC_PATH = rustPlatform.rustLibSrc; + }; + }); +} diff --git a/day01/result b/day01/result new file mode 120000 index 0000000000000000000000000000000000000000..f48266c4ed877aeffb724afca92e5c267f9da2dd --- /dev/null +++ b/day01/result @@ -0,0 +1 @@ +/nix/store/cbbfxpl8bq6vpnb98mfq9qgfg1phr3nz-aoc-0.1.0 \ No newline at end of file diff --git a/01/src/main.rs b/day01/src/main.rs similarity index 100% rename from 01/src/main.rs rename to day01/src/main.rs diff --git a/flake.lock b/flake.lock index 1846e2c6369346f2783c86c5d7b03dd8bac23d2b..3c57e549381befb8425c2bca9981124551673777 100644 --- a/flake.lock +++ b/flake.lock @@ -1,6 +1,47 @@ { "nodes": { + "day01": { + "inputs": { + "naersk": "naersk", + "nixpkgs": [ + "nixpkgs" + ], + "utils": "utils" + }, + "locked": { + "lastModified": 1, + "narHash": "sha256-Skcd0y3BZ27ycrNGxmHcMyGRPat8mYU0IXM1Lc/174I=", + "path": "/nix/store/lylqmpv4yipaapna82jpnmsxd7r4m82q-source/day01", + "type": "path" + }, + "original": { + "path": "/nix/store/lylqmpv4yipaapna82jpnmsxd7r4m82q-source/day01", + "type": "path" + } + }, "naersk": { + "inputs": { + "nixpkgs": [ + "day01", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1698420672, + "narHash": "sha256-/TdeHMPRjjdJub7p7+w55vyABrsJlt5QkznPYy55vKA=", + "owner": "nix-community", + "repo": "naersk", + "rev": "aeb58d5e8faead8980a807c840232697982d47b9", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "master", + "repo": "naersk", + "type": "github" + } + }, + "naersk_2": { "inputs": { "nixpkgs": [ "nixpkgs" @@ -39,9 +80,10 @@ }, "root": { "inputs": { - "naersk": "naersk", + "day01": "day01", + "naersk": "naersk_2", "nixpkgs": "nixpkgs", - "utils": "utils" + "utils": "utils_2" } }, "systems": { @@ -59,6 +101,21 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "utils": { "inputs": { "systems": "systems" @@ -76,6 +133,24 @@ "repo": "flake-utils", "type": "github" } + }, + "utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 3632c44b795f5fea7e3ed3a6f39f2192ed75e00d..aa76ced47193636b7d44a5e6cab7ea493a667fae 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,10 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; + day01 = { + url = "./day01"; + inputs.nixpkgs.follows = "nixpkgs"; + }; naersk = { url = "github:nix-community/naersk/master"; inputs.nixpkgs.follows = "nixpkgs"; @@ -10,27 +14,12 @@ utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs, utils, naersk }: + outputs = { self, nixpkgs, utils, naersk, day01 }: utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; - buildInputs = with pkgs; [ perl ]; - - naerskBuildPackage = (conf: ( - (pkgs.callPackage naersk { }).buildPackage ( - { - src = ./.; - inherit buildInputs; - } // conf - ) - )); in { - packages."01" = naerskBuildPackage { src = ./01/.; }; - - devShell = with pkgs; mkShell { - buildInputs = buildInputs ++ [ cargo rustc rustfmt rustPackages.clippy ]; - RUST_SRC_PATH = rustPlatform.rustLibSrc; - }; + packages.day01 = day01.defaultPackage.${system}; }); } diff --git a/result b/result new file mode 120000 index 0000000000000000000000000000000000000000..81f84c0ade76ceabb4c60ac8fa923ea0139f241e --- /dev/null +++ b/result @@ -0,0 +1 @@ +/nix/store/bmsr9z02zcchqqij4ai42b327qg32zyv-aoc-0.1.0 \ No newline at end of file