Skip to content

Commit a707e3a

Browse files
feat: simplify nix flake
1 parent 78d32d9 commit a707e3a

18 files changed

Lines changed: 4826 additions & 4726 deletions

File tree

Cargo.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ resolver = "3"
1212
exclude = ["vendor/wasapi"]
1313

1414
[workspace.dependencies]
15-
chrono = { version = "0.4.45", default-features = false, features = ["clock", "std"] }
15+
chrono = { version = "0.4.45", default-features = false, features = [
16+
"clock",
17+
"std",
18+
] }
1619
crossbeam-channel = "0.5.15"
1720
gpui = "0.2.2"
1821
rusqlite = { version = "0.40.0", features = ["bundled", "chrono"] }
@@ -41,8 +44,8 @@ pedantic = { level = "deny", priority = -1 }
4144
# names). Kept at `warn` because two of its lints are environmental rather
4245
# than code issues and are opted out below.
4346
cargo = { level = "warn", priority = -1 }
44-
cargo_common_metadata = "allow" # every crate is `publish = false`
45-
multiple_crate_versions = "allow" # decided by the lockfile, not our code
47+
cargo_common_metadata = "allow" # every crate is `publish = false`
48+
multiple_crate_versions = "allow" # decided by the lockfile, not our code
4649

4750
# Restriction lints promoted to hard errors. Test code is exempted from the
4851
# panicking ones via .clippy.toml (allow-{unwrap,expect,panic}-in-tests).

apps/wisp-desktop/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[package]
22
name = "wisp-desktop"
3+
description = ""
34
edition.workspace = true
45
version.workspace = true
56
publish = false

apps/wisp-desktop/assets/make-icon.swift

Lines changed: 47 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,35 @@ import CoreGraphics
1414
import Foundation
1515

1616
guard CommandLine.arguments.count == 3 else {
17-
print("usage: make-icon <source> <output-1024.png>")
18-
exit(1)
17+
print("usage: make-icon <source> <output-1024.png>")
18+
exit(1)
1919
}
2020
let srcURL = URL(fileURLWithPath: CommandLine.arguments[1])
2121
let dstURL = URL(fileURLWithPath: CommandLine.arguments[2])
2222

2323
guard let srcImage = NSImage(contentsOf: srcURL),
24-
let srcCG = srcImage.cgImage(forProposedRect: nil, context: nil, hints: nil)
24+
let srcCG = srcImage.cgImage(forProposedRect: nil, context: nil, hints: nil)
2525
else {
26-
print("failed to load source image at \(srcURL.path)")
27-
exit(1)
26+
print("failed to load source image at \(srcURL.path)")
27+
exit(1)
2828
}
2929

3030
let srcW = srcCG.width
3131
let srcH = srcCG.height
3232
let side = min(srcW, srcH)
3333
let cropOriginX = (srcW - side) / 2
3434
let cropOriginY = (srcH - side) / 2
35-
guard let cropped = srcCG.cropping(to: CGRect(
36-
x: cropOriginX,
37-
y: cropOriginY,
38-
width: side,
39-
height: side
40-
)) else {
41-
print("crop failed")
42-
exit(1)
35+
guard
36+
let cropped = srcCG.cropping(
37+
to: CGRect(
38+
x: cropOriginX,
39+
y: cropOriginY,
40+
width: side,
41+
height: side
42+
))
43+
else {
44+
print("crop failed")
45+
exit(1)
4346
}
4447

4548
let canvas: CGFloat = 1024
@@ -49,33 +52,33 @@ let inset = (canvas - inner) / 2
4952
let cornerRadius = inner * 0.2237
5053

5154
guard let colorSpace = CGColorSpace(name: CGColorSpace.sRGB),
52-
let ctx = CGContext(
53-
data: nil,
54-
width: Int(canvas),
55-
height: Int(canvas),
56-
bitsPerComponent: 8,
57-
bytesPerRow: 0,
58-
space: colorSpace,
59-
bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue
60-
)
55+
let ctx = CGContext(
56+
data: nil,
57+
width: Int(canvas),
58+
height: Int(canvas),
59+
bitsPerComponent: 8,
60+
bytesPerRow: 0,
61+
space: colorSpace,
62+
bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue
63+
)
6164
else {
62-
print("CGContext init failed")
63-
exit(1)
65+
print("CGContext init failed")
66+
exit(1)
6467
}
6568

6669
// Drop shadow on the squircle itself.
6770
ctx.setShadow(
68-
offset: CGSize(width: 0, height: -8),
69-
blur: 24,
70-
color: CGColor(red: 0, green: 0, blue: 0, alpha: 0.45)
71+
offset: CGSize(width: 0, height: -8),
72+
blur: 24,
73+
color: CGColor(red: 0, green: 0, blue: 0, alpha: 0.45)
7174
)
7275

7376
let innerRect = CGRect(x: inset, y: inset, width: inner, height: inner)
7477
let path = CGPath(
75-
roundedRect: innerRect,
76-
cornerWidth: cornerRadius,
77-
cornerHeight: cornerRadius,
78-
transform: nil
78+
roundedRect: innerRect,
79+
cornerWidth: cornerRadius,
80+
cornerHeight: cornerRadius,
81+
transform: nil
7982
)
8083

8184
ctx.saveGState()
@@ -92,31 +95,32 @@ ctx.draw(cropped, in: innerRect)
9295
ctx.setShadow(offset: .zero, blur: 0, color: nil)
9396
let centre = CGPoint(x: innerRect.midX, y: innerRect.midY)
9497
let endRadius = inner * 0.72
95-
let colors = [
98+
let colors =
99+
[
96100
CGColor(red: 0, green: 0, blue: 0, alpha: 0.0),
97101
CGColor(red: 0, green: 0, blue: 0, alpha: 0.0),
98102
CGColor(red: 0, green: 0, blue: 0, alpha: 0.55),
99-
] as CFArray
103+
] as CFArray
100104
let locations: [CGFloat] = [0.0, 0.55, 1.0]
101105
if let gradient = CGGradient(colorsSpace: colorSpace, colors: colors, locations: locations) {
102-
ctx.drawRadialGradient(
103-
gradient,
104-
startCenter: centre, startRadius: 0,
105-
endCenter: centre, endRadius: endRadius,
106-
options: []
107-
)
106+
ctx.drawRadialGradient(
107+
gradient,
108+
startCenter: centre, startRadius: 0,
109+
endCenter: centre, endRadius: endRadius,
110+
options: []
111+
)
108112
}
109113

110114
ctx.restoreGState()
111115

112116
guard let outCG = ctx.makeImage() else {
113-
print("makeImage failed")
114-
exit(1)
117+
print("makeImage failed")
118+
exit(1)
115119
}
116120
let rep = NSBitmapImageRep(cgImage: outCG)
117121
guard let png = rep.representation(using: .png, properties: [:]) else {
118-
print("png encode failed")
119-
exit(1)
122+
print("png encode failed")
123+
exit(1)
120124
}
121125
try png.write(to: dstURL)
122126
print("wrote \(dstURL.path)")

apps/wisp-mcp/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[package]
22
name = "wisp-mcp"
3+
description = ""
34
edition.workspace = true
45
version.workspace = true
56
publish = false

crates/wisp-audiokit-sys/build.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,19 @@ fn main() {
6969
Ok(v) if !v.starts_with("/nix/store/") => v.into(),
7070
_ => detect_sdk_root(&developer_dir),
7171
};
72+
let swift_home =
73+
PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR is always set by cargo build scripts"));
7274

7375
let configure = |cmd: &mut Command| {
7476
cmd.current_dir(&swift_pkg)
7577
.env("DEVELOPER_DIR", &developer_dir)
76-
.env("SDKROOT", &sdk_root);
78+
.env("SDKROOT", &sdk_root)
79+
.env("HOME", &swift_home);
7780
};
7881

7982
// 1) Build the Swift package.
8083
let mut build_cmd = Command::new("swift");
81-
build_cmd.arg("build");
84+
build_cmd.args(["build", "--disable-sandbox"]);
8285
configure(&mut build_cmd);
8386
if is_release {
8487
build_cmd.args(["-c", "release"]);
@@ -90,7 +93,7 @@ fn main() {
9093

9194
// 2) Ask SwiftPM where it put the artifacts.
9295
let mut path_cmd = Command::new("swift");
93-
path_cmd.args(["build", "--show-bin-path"]);
96+
path_cmd.args(["build", "--disable-sandbox", "--show-bin-path"]);
9497
configure(&mut path_cmd);
9598
if is_release {
9699
path_cmd.args(["-c", "release"]);

flake.lock

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

0 commit comments

Comments
 (0)