diff --git a/flake.lock b/flake.lock index fd4dffe..64699f5 100644 --- a/flake.lock +++ b/flake.lock @@ -1,30 +1,12 @@ { "nodes": { - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1732238832, - "narHash": "sha256-sQxuJm8rHY20xq6Ah+GwIUkF95tWjGRd1X8xF+Pkk38=", + "lastModified": 1732617236, + "narHash": "sha256-PYkz6U0bSEaEB1al7O1XsqVNeSNS+s3NVclJw7YC43w=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8edf06bea5bcbee082df1b7369ff973b91618b8d", + "rev": "af51545ec9a44eadf3fe3547610a5cdd882bc34e", "type": "github" }, "original": { @@ -36,7 +18,6 @@ }, "root": { "inputs": { - "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", "rust-overlay": "rust-overlay" } @@ -48,11 +29,11 @@ ] }, "locked": { - "lastModified": 1732328983, - "narHash": "sha256-RHt12f/slrzDpSL7SSkydh8wUE4Nr4r23HlpWywed9E=", + "lastModified": 1732674798, + "narHash": "sha256-oM1gjCv9R4zxDFO3as9wqQ4FI3+pDA9MKZ72L7tTIII=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "ed8aa5b64f7d36d9338eb1d0a3bb60cf52069a72", + "rev": "1d569430326b0a7807ccffdb2a188b814091976c", "type": "github" }, "original": { @@ -60,21 +41,6 @@ "repo": "rust-overlay", "type": "github" } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 7d3f567..86d31f2 100644 --- a/flake.nix +++ b/flake.nix @@ -3,67 +3,68 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - flake-utils.url = "github:numtide/flake-utils"; rust-overlay = { url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { nixpkgs, flake-utils, rust-overlay, ... }: - flake-utils.lib.eachDefaultSystem (system: - let - overlays = [ (import rust-overlay) ]; - pkgs = import nixpkgs { inherit system overlays; }; - lib = nixpkgs.lib; - rust = pkgs.rust-bin; + outputs = { nixpkgs, rust-overlay, ... }: + let + lib = nixpkgs.lib; + systems = ["x86_64-linux"]; + forEachSystem = fn: lib.genAttrs systems (system: let + overlays = [ (import rust-overlay) ]; + pkgs = import nixpkgs { inherit system overlays; }; + rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; + in fn { inherit pkgs rustToolchain; } ); + in { + packages = forEachSystem ({ pkgs, rustToolchain }: let + rustPlatform = pkgs.makeRustPlatform { + cargo = rustToolchain; + rustc = rustToolchain; + }; - rustToolchain = rust.fromRustupToolchainFile ./rust-toolchain.toml; - rustNightlyToolchain = rust.selectLatestNightlyWith (t: t.minimal.override { - extensions = [ "rustfmt" ]; - }); - rustPlatform = pkgs.makeRustPlatform { - cargo = rustToolchain; - rustc = rustToolchain; + manifest = lib.importTOML ./Cargo.toml; + packageName = manifest.package.name; + packageVersion = manifest.package.version; + + package = rustPlatform.buildRustPackage { + nativeBuildInputs = [ rustToolchain ]; + + pname = packageName; + version = packageVersion; + src = lib.cleanSource ./.; + + verbose = true; + + cargoLock = { + lockFile = ./Cargo.lock; + allowBuiltinFetchGit = true; }; - buildTools = [ + meta = { + mainProgram = packageName; + }; + }; + in { + default = package; + ${packageName} = package; + }); + + devShells = forEachSystem ({ pkgs, rustToolchain }: let + rustNightlyToolchain = pkgs.rust-bin.selectLatestNightlyWith (t: t.minimal.override { + extensions = [ "rustfmt" ]; + }); + in { + default = pkgs.mkShell { + name = "projtool"; + + nativeBuildInputs = [ rustToolchain rustNightlyToolchain ]; - - manifest = lib.importTOML ./Cargo.toml; - packageName = manifest.package.name; - packageVersion = manifest.package.version; - - package = rustPlatform.buildRustPackage { - nativeBuildInputs = buildTools; - - pname = packageName; - version = packageVersion; - src = lib.cleanSource ./.; - - verbose = true; - - cargoLock = { - lockFile = ./Cargo.lock; - allowBuiltinFetchGit = true; - }; - - meta = { - mainProgram = packageName; - }; - }; - in { - packages = { - default = package; - ${packageName} = package; - }; - - devShells.default = pkgs.mkShell { - name = "projtool"; - - nativeBuildInputs = buildTools; - }; - }); + }; + }); + }; }