Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
e489d9f812 |
|||
|
9b308d6b54 |
|||
|
4d21ca0e6f |
|||
|
459eac3fff |
|||
|
e9847f58c7 |
|||
|
8ead7e6eb0 |
|||
|
9c3419782b |
|||
|
27f6371c2c |
|||
|
0095d05e80 |
3 changed files with 53 additions and 87 deletions
33
flake.lock
generated
33
flake.lock
generated
|
|
@ -1,20 +1,5 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"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": {
|
"flake-utils": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
|
|
@ -35,23 +20,19 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1785747939,
|
"lastModified": 1786862985,
|
||||||
"narHash": "sha256-D740uKsMbgsfK2oaDenJLLPIZfq7W0/g4KN/Fls8eKs=",
|
"narHash": "sha256-kSR/jfpR4cE26YRZ8exQkoRbEA30vyWimajwZANYYaE=",
|
||||||
"owner": "nixos",
|
"rev": "e5bdc4a41d4c072fe1e3787eaa0320a384741d44",
|
||||||
"repo": "nixpkgs",
|
"type": "tarball",
|
||||||
"rev": "104240a772428cc2e20d8fd86c9ddbb886bbaff2",
|
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1055335.e5bdc4a41d4c/nixexprs.tar.zst?lastModified=1786862985&rev=e5bdc4a41d4c072fe1e3787eaa0320a384741d44"
|
||||||
"type": "github"
|
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nixos",
|
"type": "tarball",
|
||||||
"ref": "nixpkgs-unstable",
|
"url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst"
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"crane": "crane",
|
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
91
flake.nix
91
flake.nix
|
|
@ -1,8 +1,6 @@
|
||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst";
|
||||||
|
|
||||||
crane.url = "github:ipetkov/crane";
|
|
||||||
|
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
};
|
};
|
||||||
|
|
@ -14,7 +12,6 @@
|
||||||
let
|
let
|
||||||
pkgs = import inputs.nixpkgs { inherit system; };
|
pkgs = import inputs.nixpkgs { inherit system; };
|
||||||
lib = pkgs.lib;
|
lib = pkgs.lib;
|
||||||
craneLib = inputs.crane.mkLib pkgs;
|
|
||||||
|
|
||||||
cargoToml = fromTOML (builtins.readFile ./Cargo.toml);
|
cargoToml = fromTOML (builtins.readFile ./Cargo.toml);
|
||||||
name = cargoToml.package.name;
|
name = cargoToml.package.name;
|
||||||
|
|
@ -36,75 +33,61 @@
|
||||||
wayland
|
wayland
|
||||||
];
|
];
|
||||||
|
|
||||||
commonArgs = {
|
|
||||||
# all that's needed for artifacts and checks
|
|
||||||
nativeBuildInputs = with pkgs; [
|
|
||||||
# pkg-config
|
|
||||||
];
|
|
||||||
buildInputs = with pkgs; [
|
|
||||||
];
|
|
||||||
|
|
||||||
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 =
|
crate =
|
||||||
let
|
let
|
||||||
desktopItem = pkgs.makeDesktopItem {
|
desktopItem = pkgs.makeDesktopItem {
|
||||||
inherit name;
|
inherit name;
|
||||||
desktopName = name;
|
desktopName = name;
|
||||||
icon = name;
|
|
||||||
exec = name;
|
exec = name;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
craneLib.buildPackage (
|
pkgs.rustPlatform.buildRustPackage rec {
|
||||||
commonArgs
|
inherit name;
|
||||||
// {
|
|
||||||
inherit cargoArtifacts;
|
|
||||||
|
|
||||||
nativeBuildInputs = commonArgs.nativeBuildInputs ++ [
|
src = lib.sourceFilesBySuffices ./. [
|
||||||
pkgs.autoPatchelfHook
|
"Cargo.toml"
|
||||||
];
|
"Cargo.lock"
|
||||||
|
".rs"
|
||||||
|
];
|
||||||
|
cargoLock.lockFile = "${src}/Cargo.lock";
|
||||||
|
|
||||||
buildInputs = commonArgs.buildInputs ++ [
|
nativeBuildInputs = with pkgs; [
|
||||||
pkgs.libgcc
|
autoPatchelfHook
|
||||||
];
|
];
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
libgcc
|
||||||
|
];
|
||||||
|
|
||||||
runtimeDependencies = dlDeps;
|
runtimeDependencies = dlDeps;
|
||||||
|
|
||||||
doCheck = false;
|
postFixup = ''
|
||||||
|
cp -rs "${desktopItem}"/* "$out"
|
||||||
|
'';
|
||||||
|
|
||||||
postFixup = ''
|
doCheck = false;
|
||||||
mkdir -p "$out/share/applications"
|
|
||||||
ln -s "${desktopItem}"/share/applications/* "$out/share/applications/"
|
strictDeps = true;
|
||||||
'';
|
__structuredAttrs = true;
|
||||||
}
|
};
|
||||||
);
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
packages.default = crate;
|
packages.default = crate;
|
||||||
|
|
||||||
checks = {
|
devShells.default = pkgs.mkShell {
|
||||||
crate-clippy = craneLib.cargoClippy (
|
env.LD_LIBRARY_PATH = lib.makeLibraryPath dlDeps;
|
||||||
commonArgs
|
|
||||||
// {
|
|
||||||
inherit cargoArtifacts;
|
|
||||||
|
|
||||||
cargoClippyExtraArgs = "-- --deny warnings";
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
devShells.default = craneLib.devShell {
|
|
||||||
LD_LIBRARY_PATH = lib.makeLibraryPath dlDeps;
|
|
||||||
|
|
||||||
inputsFrom = [ crate ];
|
inputsFrom = [ crate ];
|
||||||
packages = [ pkgs.rust-analyzer ];
|
|
||||||
|
packages = with pkgs; [
|
||||||
|
rustc
|
||||||
|
cargo
|
||||||
|
clippy
|
||||||
|
rustfmt
|
||||||
|
rust-analyzer
|
||||||
|
];
|
||||||
|
|
||||||
|
strictDeps = true;
|
||||||
|
__structuredAttrs = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -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 {}
|
enum Message {}
|
||||||
|
|
||||||
|
|
@ -11,12 +13,12 @@ impl State {
|
||||||
fn update(&mut self, message: Message) -> Task<Message> {
|
fn update(&mut self, message: Message) -> Task<Message> {
|
||||||
Task::none()
|
Task::none()
|
||||||
}
|
}
|
||||||
fn view(&self) -> Element<'_, Message, Theme, Renderer> {
|
fn view(&self) -> Element<'_> {
|
||||||
widget::text("hiiiiiii").into()
|
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)
|
application(State::new, State::update, State::view)
|
||||||
.theme(theme::Theme::custom(
|
.theme(theme::Theme::custom(
|
||||||
"high-contrast-dark",
|
"high-contrast-dark",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue