From a3b4bdbb84817087e2c76fbfa6f7576eb05325f0 Mon Sep 17 00:00:00 2001 From: Heitor Augusto Date: Sun, 7 Sep 2025 11:15:13 -0300 Subject: [PATCH] cosmic-initial-setup: init at 1.0.0-beta.1.1 --- .../disable-language-page.patch | 74 +++++++++++++ .../disable-timezone-page.patch | 64 +++++++++++ .../co/cosmic-initial-setup/package.nix | 102 ++++++++++++++++++ 3 files changed, 240 insertions(+) create mode 100644 pkgs/by-name/co/cosmic-initial-setup/disable-language-page.patch create mode 100644 pkgs/by-name/co/cosmic-initial-setup/disable-timezone-page.patch create mode 100644 pkgs/by-name/co/cosmic-initial-setup/package.nix diff --git a/pkgs/by-name/co/cosmic-initial-setup/disable-language-page.patch b/pkgs/by-name/co/cosmic-initial-setup/disable-language-page.patch new file mode 100644 index 000000000000..1276c39cd0ce --- /dev/null +++ b/pkgs/by-name/co/cosmic-initial-setup/disable-language-page.patch @@ -0,0 +1,74 @@ +diff --git a/src/main.rs b/src/main.rs +index a0e8f2e..07cf8b9 100644 +--- a/src/main.rs ++++ b/src/main.rs +@@ -194,19 +194,19 @@ impl Application for App { + } + } + +- page::Message::Language(message) => { +- if let Some(page) = +- self.pages.get_mut(&TypeId::of::()) +- { +- return page +- .as_any() +- .downcast_mut::() +- .unwrap() +- .update(message) +- .map(Message::PageMessage) +- .map(cosmic::Action::App); +- } +- } ++ // page::Message::Language(message) => { ++ // if let Some(page) = ++ // self.pages.get_mut(&TypeId::of::()) ++ // { ++ // return page ++ // .as_any() ++ // .downcast_mut::() ++ // .unwrap() ++ // .update(message) ++ // .map(Message::PageMessage) ++ // .map(cosmic::Action::App); ++ // } ++ // } + + page::Message::Layout(message) => { + if let Some(page) = self.pages.get_mut(&TypeId::of::()) +diff --git a/src/page/mod.rs b/src/page/mod.rs +index 389728c..937a1b3 100644 +--- a/src/page/mod.rs ++++ b/src/page/mod.rs +@@ -4,7 +4,7 @@ use std::any::{Any, TypeId}; + + pub mod appearance; + pub mod keyboard; +-pub mod language; ++// pub mod language; + pub mod launcher; + pub mod layout; + pub mod location; +@@ -34,10 +34,10 @@ pub fn pages(mode: AppMode) -> IndexMap> { + if let AppMode::NewInstall { create_user } = mode { + pages.insert(TypeId::of::(), Box::new(wifi::Page::default())); + +- pages.insert( +- TypeId::of::(), +- Box::new(language::Page::new()), +- ); ++ // pages.insert( ++ // TypeId::of::(), ++ // Box::new(language::Page::new()), ++ // ); + + pages.insert( + TypeId::of::(), +@@ -95,7 +95,7 @@ pub fn pages(mode: AppMode) -> IndexMap> { + pub enum Message { + Appearance(appearance::Message), + Keyboard(keyboard::Message), +- Language(language::Message), ++ // Language(language::Message), + Layout(layout::Message), + Location(location::Message), + SetTheme(cosmic::Theme), diff --git a/pkgs/by-name/co/cosmic-initial-setup/disable-timezone-page.patch b/pkgs/by-name/co/cosmic-initial-setup/disable-timezone-page.patch new file mode 100644 index 000000000000..5af92f16d5bb --- /dev/null +++ b/pkgs/by-name/co/cosmic-initial-setup/disable-timezone-page.patch @@ -0,0 +1,64 @@ +diff --git a/src/main.rs b/src/main.rs +index a0e8f2e..b6ff8dc 100644 +--- a/src/main.rs ++++ b/src/main.rs +@@ -221,7 +221,7 @@ impl Application for App { + } + } + +- page::Message::Location(message) => { ++ /* page::Message::Location(message) => { + if let Some(page) = + self.pages.get_mut(&TypeId::of::()) + { +@@ -233,7 +233,7 @@ impl Application for App { + .map(Message::PageMessage) + .map(cosmic::Action::App); + } +- } ++ } */ + + page::Message::User(message) => { + if let Some(page) = self.pages.get_mut(&TypeId::of::()) { +diff --git a/src/page/mod.rs b/src/page/mod.rs +index 389728c..38ced5e 100644 +--- a/src/page/mod.rs ++++ b/src/page/mod.rs +@@ -7,7 +7,7 @@ pub mod keyboard; + pub mod language; + pub mod launcher; + pub mod layout; +-pub mod location; ++// pub mod location; + pub mod new_apps; + pub mod new_shortcuts; + pub mod user; +@@ -48,10 +48,10 @@ pub fn pages(mode: AppMode) -> IndexMap> { + pages.insert(TypeId::of::(), Box::new(user::Page::default())); + } + +- pages.insert( ++ /* pages.insert( + TypeId::of::(), + Box::new(location::Page::new()), +- ); ++ ); */ + } + + pages.insert( +@@ -97,7 +97,7 @@ pub enum Message { + Keyboard(keyboard::Message), + Language(language::Message), + Layout(layout::Message), +- Location(location::Message), ++ // Location(location::Message), + SetTheme(cosmic::Theme), + User(user::Message), + Welcome(welcome::Message), +@@ -150,4 +150,4 @@ pub trait Page { + fn view(&self) -> Element<'_, Message> { + widget::text::body("TODO").into() + } +-} ++} +\ No newline at end of file diff --git a/pkgs/by-name/co/cosmic-initial-setup/package.nix b/pkgs/by-name/co/cosmic-initial-setup/package.nix new file mode 100644 index 000000000000..08aad02cf6b4 --- /dev/null +++ b/pkgs/by-name/co/cosmic-initial-setup/package.nix @@ -0,0 +1,102 @@ +{ + lib, + stdenv, + rustPlatform, + fetchFromGitHub, + just, + libcosmicAppHook, + libinput, + openssl, + udev, + nixosTests, + nix-update-script, +}: +rustPlatform.buildRustPackage (finalAttrs: { + pname = "cosmic-initial-setup"; + version = "1.0.0-beta.1.1"; + + src = fetchFromGitHub { + owner = "pop-os"; + repo = "cosmic-initial-setup"; + tag = "epoch-${finalAttrs.version}"; + hash = "sha256-kjJqGNcIlnzEsfA4eQ9D23ZGgRcmWQyWheAlwpjfALA="; + }; + + cargoHash = "sha256-orwK9gcFXK4/+sfwRubcz0PP6YAFqsENRHnlSLttLxM="; + + # cargo-auditable fails during the build when compiling the `crabtime::function` + # procedural macro. It panics because the `--out-dir` flag is not passed to + # the rustc wrapper. + # + # Reported this issue upstream in: + # https://github.com/rust-secure-code/cargo-auditable/issues/225 + auditable = false; + + nativeBuildInputs = [ + libcosmicAppHook + just + ]; + + buildInputs = [ + libinput + openssl + udev + ]; + + # These are not needed for NixOS + patches = [ + ./disable-language-page.patch + ./disable-timezone-page.patch + ]; + + postPatch = '' + # Installs in $out/etc/xdg/autostart instead of /etc/xdg/autostart + substituteInPlace justfile \ + --replace-fail \ + "autostart-dst := rootdir / 'etc' / 'xdg' / 'autostart' / desktop-entry" \ + "autostart-dst := prefix / 'etc' / 'xdg' / 'autostart' / desktop-entry" + ''; + + dontUseJustBuild = true; + dontUseJustCheck = true; + + justFlags = [ + "--set" + "prefix" + (placeholder "out") + "--set" + "cargo-target-dir" + "target/${stdenv.hostPlatform.rust.cargoShortTarget}" + ]; + + env.DISABLE_IF_EXISTS = "/iso/nix-store.squashfs"; + + passthru = { + tests = { + inherit (nixosTests) + cosmic + cosmic-autologin + cosmic-noxwayland + cosmic-autologin-noxwayland + ; + }; + + updateScript = nix-update-script { + extraArgs = [ + "--version" + "unstable" + "--version-regex" + "epoch-(.*)" + ]; + }; + }; + + meta = { + description = "COSMIC Initial Setup"; + homepage = "https://github.com/pop-os/cosmic-initial-setup"; + license = lib.licenses.gpl3Only; + mainProgram = "cosmic-initial-setup"; + platforms = lib.platforms.linux; + teams = [ lib.teams.cosmic ]; + }; +})