From 0095d05e803b795ccbdf2c3c37c993810dbdfb1a Mon Sep 17 00:00:00 2001 From: electria Date: Mon, 3 Aug 2026 12:18:59 -0700 Subject: [PATCH 01/14] iced-template: replace crane --- flake.lock | 16 ---------------- flake.nix | 36 ++++++++++++------------------------ 2 files changed, 12 insertions(+), 40 deletions(-) diff --git a/flake.lock b/flake.lock index ff69fb5..e328700 100644 --- a/flake.lock +++ b/flake.lock @@ -1,20 +1,5 @@ { "nodes": { - "crane": { - "locked": { - "lastModified": 1785782307, - "narHash": "sha256-MPaRdVkf6zZP5fCPxYCi8Dr4pZzgmXzg8T9nVEbp3Mw=", - "owner": "ipetkov", - "repo": "crane", - "rev": "2c71e194474d13de031d729b729c968ddbe3507f", - "type": "github" - }, - "original": { - "owner": "ipetkov", - "repo": "crane", - "type": "github" - } - }, "flake-utils": { "inputs": { "systems": "systems" @@ -51,7 +36,6 @@ }, "root": { "inputs": { - "crane": "crane", "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } diff --git a/flake.nix b/flake.nix index 827d996..5633e8c 100644 --- a/flake.nix +++ b/flake.nix @@ -2,8 +2,6 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; - crane.url = "github:ipetkov/crane"; - flake-utils.url = "github:numtide/flake-utils"; }; @@ -14,7 +12,6 @@ let pkgs = import inputs.nixpkgs { inherit system; }; lib = pkgs.lib; - craneLib = inputs.crane.mkLib pkgs; cargoToml = fromTOML (builtins.readFile ./Cargo.toml); name = cargoToml.package.name; @@ -47,12 +44,6 @@ src = ./.; }; - # Build *just* the cargo dependencies, - # to reuse them for build and test derivations. - cargoArtifacts = craneLib.buildDepsOnly commonArgs; - - # Build the actual crate itself, - # reusing the dependency artifacts from above. crate = let desktopItem = pkgs.makeDesktopItem { @@ -62,10 +53,11 @@ exec = name; }; in - craneLib.buildPackage ( + pkgs.rustPlatform.buildRustPackage ( commonArgs // { - inherit cargoArtifacts; + inherit name; + cargoLock.lockFile = ./Cargo.lock; nativeBuildInputs = commonArgs.nativeBuildInputs ++ [ pkgs.autoPatchelfHook @@ -89,22 +81,18 @@ { packages.default = crate; - checks = { - crate-clippy = craneLib.cargoClippy ( - commonArgs - // { - inherit cargoArtifacts; - - cargoClippyExtraArgs = "-- --deny warnings"; - } - ); - }; - - devShells.default = craneLib.devShell { + devShells.default = pkgs.mkShell { LD_LIBRARY_PATH = lib.makeLibraryPath dlDeps; inputsFrom = [ crate ]; - packages = [ pkgs.rust-analyzer ]; + + packages = with pkgs; [ + rustc + cargo + clippy + rustfmt + rust-analyzer + ]; }; } ); From 6d7c1bf7fdbb15f76312f670315c9193cb1112d1 Mon Sep 17 00:00:00 2001 From: electria Date: Sun, 16 Aug 2026 14:26:32 -0700 Subject: [PATCH 02/14] iced-template: factor out Element, explicit Error the type alias Element is quite useful for defining subfunctions for view and it also helps to not pull unnecessary things into scope --- src/app/mod.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/mod.rs b/src/app/mod.rs index 7b9c9ca..db11f02 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -1,4 +1,6 @@ -use iced::{Color, Element, Renderer, Task, Theme, application, theme, widget}; +use iced::{Color, Task, application, theme, widget}; + +type Element<'a> = iced::Element<'a, Message, iced::Theme, iced::Renderer>; enum Message {} @@ -11,12 +13,12 @@ impl State { fn update(&mut self, message: Message) -> Task { Task::none() } - fn view(&self) -> Element<'_, Message, Theme, Renderer> { + fn view(&self) -> Element<'_> { widget::text("hiiiiiii").into() } } -pub fn run() -> Result<(), impl std::error::Error> { +pub fn run() -> Result<(), iced::Error> { application(State::new, State::update, State::view) .theme(theme::Theme::custom( "high-contrast-dark", From 49294a02e087e1dcdeb8b96904d23d175741d3bf Mon Sep 17 00:00:00 2001 From: electria Date: Sun, 16 Aug 2026 21:17:36 -0700 Subject: [PATCH 03/14] iced-template: remove nonexistent icon --- flake.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/flake.nix b/flake.nix index 827d996..b78cb98 100644 --- a/flake.nix +++ b/flake.nix @@ -58,7 +58,6 @@ desktopItem = pkgs.makeDesktopItem { inherit name; desktopName = name; - icon = name; exec = name; }; in From a5c5fae8d70b43dff2dd3f7718100f70d4ed302f Mon Sep 17 00:00:00 2001 From: electria Date: Mon, 17 Aug 2026 10:42:08 -0700 Subject: [PATCH 04/14] iced-template: use more efficient nixpkgs input --- flake.lock | 17 +++++++---------- flake.nix | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/flake.lock b/flake.lock index ff69fb5..0251326 100644 --- a/flake.lock +++ b/flake.lock @@ -35,18 +35,15 @@ }, "nixpkgs": { "locked": { - "lastModified": 1785747939, - "narHash": "sha256-D740uKsMbgsfK2oaDenJLLPIZfq7W0/g4KN/Fls8eKs=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "104240a772428cc2e20d8fd86c9ddbb886bbaff2", - "type": "github" + "lastModified": 1786862985, + "narHash": "sha256-kSR/jfpR4cE26YRZ8exQkoRbEA30vyWimajwZANYYaE=", + "rev": "e5bdc4a41d4c072fe1e3787eaa0320a384741d44", + "type": "tarball", + "url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1055335.e5bdc4a41d4c/nixexprs.tar.zst?lastModified=1786862985&rev=e5bdc4a41d4c072fe1e3787eaa0320a384741d44" }, "original": { - "owner": "nixos", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" + "type": "tarball", + "url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst" } }, "root": { diff --git a/flake.nix b/flake.nix index b78cb98..344cbdf 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst"; crane.url = "github:ipetkov/crane"; From 27f6371c2c33eec86a3ab1b2819f736c2a21b2e4 Mon Sep 17 00:00:00 2001 From: electria Date: Sun, 16 Aug 2026 14:26:32 -0700 Subject: [PATCH 05/14] iced-template: factor out Element, explicit Error the type alias Element is quite useful for defining subfunctions for view and it also helps to not pull unnecessary things into scope --- src/app/mod.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/mod.rs b/src/app/mod.rs index 7b9c9ca..db11f02 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -1,4 +1,6 @@ -use iced::{Color, Element, Renderer, Task, Theme, application, theme, widget}; +use iced::{Color, Task, application, theme, widget}; + +type Element<'a> = iced::Element<'a, Message, iced::Theme, iced::Renderer>; enum Message {} @@ -11,12 +13,12 @@ impl State { fn update(&mut self, message: Message) -> Task { Task::none() } - fn view(&self) -> Element<'_, Message, Theme, Renderer> { + fn view(&self) -> Element<'_> { widget::text("hiiiiiii").into() } } -pub fn run() -> Result<(), impl std::error::Error> { +pub fn run() -> Result<(), iced::Error> { application(State::new, State::update, State::view) .theme(theme::Theme::custom( "high-contrast-dark", From 9c3419782be4b5a64edccddbcbceeaa41d058089 Mon Sep 17 00:00:00 2001 From: electria Date: Sun, 16 Aug 2026 21:17:36 -0700 Subject: [PATCH 06/14] iced-template: remove nonexistent icon --- flake.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/flake.nix b/flake.nix index 5633e8c..220a03c 100644 --- a/flake.nix +++ b/flake.nix @@ -49,7 +49,6 @@ desktopItem = pkgs.makeDesktopItem { inherit name; desktopName = name; - icon = name; exec = name; }; in From 8ead7e6eb0a40a1c7ef4f66d07240e94dec1773f Mon Sep 17 00:00:00 2001 From: electria Date: Mon, 17 Aug 2026 10:42:08 -0700 Subject: [PATCH 07/14] iced-template: use more efficient nixpkgs input --- flake.lock | 17 +++++++---------- flake.nix | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/flake.lock b/flake.lock index e328700..e29f5a4 100644 --- a/flake.lock +++ b/flake.lock @@ -20,18 +20,15 @@ }, "nixpkgs": { "locked": { - "lastModified": 1785747939, - "narHash": "sha256-D740uKsMbgsfK2oaDenJLLPIZfq7W0/g4KN/Fls8eKs=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "104240a772428cc2e20d8fd86c9ddbb886bbaff2", - "type": "github" + "lastModified": 1786862985, + "narHash": "sha256-kSR/jfpR4cE26YRZ8exQkoRbEA30vyWimajwZANYYaE=", + "rev": "e5bdc4a41d4c072fe1e3787eaa0320a384741d44", + "type": "tarball", + "url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1055335.e5bdc4a41d4c/nixexprs.tar.zst?lastModified=1786862985&rev=e5bdc4a41d4c072fe1e3787eaa0320a384741d44" }, "original": { - "owner": "nixos", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" + "type": "tarball", + "url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst" } }, "root": { diff --git a/flake.nix b/flake.nix index 220a03c..785a77e 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst"; flake-utils.url = "github:numtide/flake-utils"; }; From e9847f58c7232b648fb187dddaece432fe42e920 Mon Sep 17 00:00:00 2001 From: electria Date: Sat, 22 Aug 2026 17:42:04 -0700 Subject: [PATCH 08/14] iced-template: use strictDeps and __structuredAttrs --- flake.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 785a77e..a0d008a 100644 --- a/flake.nix +++ b/flake.nix @@ -41,6 +41,9 @@ buildInputs = with pkgs; [ ]; + strictDeps = true; + __structuredAttrs = true; + src = ./.; }; @@ -81,7 +84,7 @@ packages.default = crate; devShells.default = pkgs.mkShell { - LD_LIBRARY_PATH = lib.makeLibraryPath dlDeps; + env.LD_LIBRARY_PATH = lib.makeLibraryPath dlDeps; inputsFrom = [ crate ]; @@ -92,6 +95,9 @@ rustfmt rust-analyzer ]; + + strictDeps = true; + __structuredAttrs = true; }; } ); From 0b0f452edc51a5abe05df8bce589ecf0ace2bc62 Mon Sep 17 00:00:00 2001 From: electria Date: Sat, 22 Aug 2026 17:42:04 -0700 Subject: [PATCH 09/14] iced-template: use strictDeps and __structuredAttrs --- flake.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 344cbdf..e136cb7 100644 --- a/flake.nix +++ b/flake.nix @@ -44,6 +44,9 @@ buildInputs = with pkgs; [ ]; + strictDeps = true; + __structuredAttrs = true; + src = ./.; }; @@ -100,10 +103,13 @@ }; devShells.default = craneLib.devShell { - LD_LIBRARY_PATH = lib.makeLibraryPath dlDeps; + env.LD_LIBRARY_PATH = lib.makeLibraryPath dlDeps; inputsFrom = [ crate ]; packages = [ pkgs.rust-analyzer ]; + + strictDeps = true; + __structuredAttrs = true; }; } ); From 459eac3fff43462c93aebb4e17e4f4a782e6dbf3 Mon Sep 17 00:00:00 2001 From: electria Date: Sat, 22 Aug 2026 17:48:32 -0700 Subject: [PATCH 10/14] iced-template: filter source files (to reduce rebuilds) crane does something similar automatically --- flake.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index a0d008a..ae87721 100644 --- a/flake.nix +++ b/flake.nix @@ -44,7 +44,11 @@ strictDeps = true; __structuredAttrs = true; - src = ./.; + src = lib.sourceFilesBySuffices ./. [ + "Cargo.toml" + "Cargo.lock" + ".rs" + ]; }; crate = From 4d21ca0e6fb8d9060a3a5933c31ec0eab7090956 Mon Sep 17 00:00:00 2001 From: electria Date: Sat, 22 Aug 2026 17:49:45 -0700 Subject: [PATCH 11/14] iced-template: avoid duplicating Cargo.lock in nix store --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index ae87721..c3bd57d 100644 --- a/flake.nix +++ b/flake.nix @@ -63,7 +63,7 @@ commonArgs // { inherit name; - cargoLock.lockFile = ./Cargo.lock; + cargoLock.lockFile = "${commonArgs.src}/Cargo.lock"; nativeBuildInputs = commonArgs.nativeBuildInputs ++ [ pkgs.autoPatchelfHook From 9b308d6b548c70c40fc645beb675d3c310e83026 Mon Sep 17 00:00:00 2001 From: electria Date: Sat, 22 Aug 2026 17:56:48 -0700 Subject: [PATCH 12/14] iced-template: remove commonArgs these are mostly useful for crane, and were only acting as unnecessary complexity here --- flake.nix | 61 ++++++++++++++++++++++--------------------------------- 1 file changed, 24 insertions(+), 37 deletions(-) diff --git a/flake.nix b/flake.nix index c3bd57d..5a2cc89 100644 --- a/flake.nix +++ b/flake.nix @@ -33,24 +33,6 @@ wayland ]; - commonArgs = { - # all that's needed for artifacts and checks - nativeBuildInputs = with pkgs; [ - # pkg-config - ]; - buildInputs = with pkgs; [ - ]; - - strictDeps = true; - __structuredAttrs = true; - - src = lib.sourceFilesBySuffices ./. [ - "Cargo.toml" - "Cargo.lock" - ".rs" - ]; - }; - crate = let desktopItem = pkgs.makeDesktopItem { @@ -59,30 +41,35 @@ exec = name; }; in - pkgs.rustPlatform.buildRustPackage ( - commonArgs - // { - inherit name; - cargoLock.lockFile = "${commonArgs.src}/Cargo.lock"; + pkgs.rustPlatform.buildRustPackage rec { + inherit name; - nativeBuildInputs = commonArgs.nativeBuildInputs ++ [ - pkgs.autoPatchelfHook - ]; + src = lib.sourceFilesBySuffices ./. [ + "Cargo.toml" + "Cargo.lock" + ".rs" + ]; + cargoLock.lockFile = "${src}/Cargo.lock"; - buildInputs = commonArgs.buildInputs ++ [ - pkgs.libgcc - ]; + nativeBuildInputs = with pkgs; [ + autoPatchelfHook + ]; + buildInputs = with pkgs; [ + libgcc + ]; - runtimeDependencies = dlDeps; + runtimeDependencies = dlDeps; - doCheck = false; + postFixup = '' + mkdir -p "$out/share/applications" + ln -s "${desktopItem}"/share/applications/* "$out/share/applications/" + ''; - postFixup = '' - mkdir -p "$out/share/applications" - ln -s "${desktopItem}"/share/applications/* "$out/share/applications/" - ''; - } - ); + doCheck = false; + + strictDeps = true; + __structuredAttrs = true; + }; in { packages.default = crate; From 082f5097968987bc8ab0003cc850b9b90d8f5dd0 Mon Sep 17 00:00:00 2001 From: electria Date: Fri, 28 Aug 2026 21:49:59 -0700 Subject: [PATCH 13/14] iced-template: generalize desktopItem linking --- flake.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index e136cb7..a56f390 100644 --- a/flake.nix +++ b/flake.nix @@ -82,8 +82,7 @@ doCheck = false; postFixup = '' - mkdir -p "$out/share/applications" - ln -s "${desktopItem}"/share/applications/* "$out/share/applications/" + cp -rs "${desktopItem}"/* "$out" ''; } ); From e489d9f812a7f3f4174113bc93c2ad4ac7cc90b3 Mon Sep 17 00:00:00 2001 From: electria Date: Fri, 28 Aug 2026 21:49:59 -0700 Subject: [PATCH 14/14] iced-template: generalize desktopItem linking --- flake.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 5a2cc89..f3263d0 100644 --- a/flake.nix +++ b/flake.nix @@ -61,8 +61,7 @@ runtimeDependencies = dlDeps; postFixup = '' - mkdir -p "$out/share/applications" - ln -s "${desktopItem}"/share/applications/* "$out/share/applications/" + cp -rs "${desktopItem}"/* "$out" ''; doCheck = false;