Skip to content

Commit

Permalink
Merge branch 'main' into monotonic-clock
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicegginton authored Sep 1, 2024
2 parents 2cbf1f9 + 91f6ff3 commit 6580255
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ let package = Package(
],
targets: [
.target(name: "Nanoseconds"),
.testTarget(name: "NanosecondsTests", dependencies: ["Nanoseconds"])
.testTarget(name: "NanosecondsTests", dependencies: ["Nanoseconds"]),
.target(name: "Example", dependencies: ["Nanoseconds"])
]
)
8 changes: 8 additions & 0 deletions Sources/Example/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Foundation
import Nanoseconds

let start = Now()
sleep(1)
let end = Now()
let duration = end - start
print(duration)
18 changes: 8 additions & 10 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,22 @@
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";

outputs =
{ self
, nixpkgs
, flake-utils
,
}:
outputs = { nixpkgs, flake-utils, ... }:

with flake-utils.lib;
with flake-utils.lib;

eachDefaultSystem (system:
eachDefaultSystem (system:

let
pkgs = import nixpkgs { inherit system; };
pkgs = import nixpkgs {
inherit system;
overlays = [ (final: _: { nanoseconds = final.callPackage ./. { }; }) ];
};
in

{
formatter = pkgs.nixpkgs-fmt;
packages.default = pkgs.callPackage ./default.nix { };
packages.default = pkgs.nanoseconds;
devShells.default = pkgs.callPackage ./shell.nix { };
});
}
8 changes: 2 additions & 6 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
pkgs.mkShell.override { inherit (swift) stdenv; }

{
buildInputs = with pkgs; [
swift
swiftPackages.Foundation
swiftpm
swiftpm2nix
];
inputsFrom = [ pkgs.nanoseconds ];
packages = [ pkgs.swiftpm2nix ];
}

0 comments on commit 6580255

Please sign in to comment.