Muck about with flakes

It's not looking good. I still don't really understand what I'm doing.
This commit is contained in:
Savanni D'Gerinel 2023-03-18 20:14:21 -04:00
parent 9984fdd950
commit cc24655842
8 changed files with 191 additions and 212 deletions

View File

@ -1,6 +1,75 @@
{ {
"nodes": { "nodes": {
"crane": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1678152261,
"narHash": "sha256-cPRDxwygVMleiSEGELrvAiq9vYAN4c3KK/K4UEO13vU=",
"owner": "ipetkov",
"repo": "crane",
"rev": "5291dd0aa7a52d607fc952763ef60714e4c881d4",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"locked": {
"lastModified": 1676283394,
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1678901627,
"narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_3": {
"locked": { "locked": {
"lastModified": 1659877975, "lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
@ -17,11 +86,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1675918889, "lastModified": 1678872516,
"narHash": "sha256-hy7re4F9AEQqwZxubct7jBRos6md26bmxnCjxf5utJA=", "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "49efda9011e8cdcd6c1aad30384cb1dc230c82fe", "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -48,11 +117,11 @@
}, },
"oxalica": { "oxalica": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs_2"
}, },
"locked": { "locked": {
"narHash": "sha256-0eO3S+2gLODqDoloufeC99PfQ5mthuN9JADzqFXid1Y=", "narHash": "sha256-0E/zReDMCVEV24OCISKEw0ofPkW8ZSlLwD/XDwSOFFI=",
"type": "tarball", "type": "tarball",
"url": "https://github.com/oxalica/rust-overlay/archive/master.tar.gz" "url": "https://github.com/oxalica/rust-overlay/archive/master.tar.gz"
}, },
@ -63,18 +132,45 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"crane": "crane",
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"oxalica": "oxalica", "oxalica": "oxalica",
"unstable": "unstable" "unstable": "unstable"
} }
}, },
"rust-overlay": {
"inputs": {
"flake-utils": [
"crane",
"flake-utils"
],
"nixpkgs": [
"crane",
"nixpkgs"
]
},
"locked": {
"lastModified": 1677812689,
"narHash": "sha256-EakqhgRnjVeYJv5+BJx/NZ7/eFTMBxc4AhICUNquhUg=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "e53e8853aa7b0688bc270e9e6a681d22e01cf299",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"unstable": { "unstable": {
"locked": { "locked": {
"lastModified": 1675942811, "lastModified": 1678898370,
"narHash": "sha256-/v4Z9mJmADTpXrdIlAjFa1e+gkpIIROR670UVDQFwIw=", "narHash": "sha256-xTICr1j+uat5hk9FyuPOFGxpWHdJRibwZC+ATi0RbtE=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "724bfc0892363087709bd3a5a1666296759154b1", "rev": "ac718d02867a84b42522a0ece52d841188208f2c",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -2,22 +2,33 @@
description = "Lumenescent Dreams Tools"; description = "Lumenescent Dreams Tools";
inputs = { inputs = {
crane.inputs.nixpkgs.follows = "nixpkgs";
crane.url = "github:ipetkov/crane";
nixpkgs.url = "nixpkgs/nixos-22.11"; nixpkgs.url = "nixpkgs/nixos-22.11";
unstable.url = "nixpkgs/nixos-unstable";
oxalica.url = "https://github.com/oxalica/rust-overlay/archive/master.tar.gz"; oxalica.url = "https://github.com/oxalica/rust-overlay/archive/master.tar.gz";
unstable.url = "nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = { self, nixpkgs, unstable, oxalica }: outputs = inputs@{ self, nixpkgs, unstable, oxalica, crane, flake-utils, ... }:
let flake-utils.lib.eachDefaultSystem (system:
version = builtins.string 0 8 self.lastModifiedDate; let
supportedSystems = [ "x86_64-linux" ]; version = builtins.string 0 8 self.lastModifiedDate;
in pkgs = import nixpkgs { inherit system; };
craneLib = crane.lib.${system};
projects = {
glimmer = import ./glimmer/rust { inherit inputs system; };
};
in
{ {
devShell."x86_64-linux" = packages.glimmer = projects.glimmer.package;
devShells.default =
let let
rust_overlay = import oxalica; rust_overlay = import oxalica;
pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ rust_overlay ]; }; pkgs = import nixpkgs { inherit system; overlays = [ rust_overlay ]; };
pkgs-unstable = import unstable { system = "x86_64-linux"; overlays = [ rust_overlay ]; }; pkgs-unstable = import unstable { inherit system; overlays = [ rust_overlay ]; };
rust = pkgs.rust-bin.stable."1.65.0".default.override { rust = pkgs.rust-bin.stable."1.65.0".default.override {
extensions = [ "rust-src" ]; extensions = [ "rust-src" ];
}; };
@ -44,5 +55,7 @@
]; ];
LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib"; LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib";
}; };
};
checks = projects.glimmer.checks;
});
} }

View File

@ -272,6 +272,15 @@ dependencies = [
"system-deps", "system-deps",
] ]
[[package]]
name = "glimmer"
version = "0.1.0"
dependencies = [
"glib",
"glib-build-tools",
"gtk4",
]
[[package]] [[package]]
name = "gobject-sys" name = "gobject-sys"
version = "0.16.3" version = "0.16.3"
@ -539,15 +548,6 @@ dependencies = [
"proc-macro2", "proc-macro2",
] ]
[[package]]
name = "rust"
version = "0.1.0"
dependencies = [
"glib",
"glib-build-tools",
"gtk4",
]
[[package]] [[package]]
name = "rustc_version" name = "rustc_version"
version = "0.4.0" version = "0.4.0"

View File

@ -1,5 +1,5 @@
[package] [package]
name = "rust" name = "glimmer"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"

49
glimmer/rust/default.nix Normal file
View File

@ -0,0 +1,49 @@
{ inputs, system }:
let
pkgs = import inputs.unstable { inherit system; };
craneLib = inputs.crane.lib.${system};
src = ./.;
cargoArtifacts = craneLib.buildDepsOnly {
name = "glimmer-deps";
inherit src;
nativeBuildInputs = [
pkgs.pkg-config
pkgs.glib
pkgs.gtk4
];
};
glimmer-clippy = craneLib.cargoClippy {
name = "glimmer-clippy";
inherit cargoArtifacts src;
cargoClippyExtraArgs = "-- --deny warnings";
};
glimmer = craneLib.vendorCargoDeps {
name = "glimmer";
inherit cargoArtifacts src;
nativeBuildInputs = [
pkgs.pkg-config
pkgs.glib
pkgs.gtk4
];
};
in
{
package = glimmer;
/*
devShells.default = pkgs.mkShell {
inputsFrom = builtins.attrValues self.checks.${system};
nativeBuildInputs = with pkgs; [
cargo
rustc
];
};
*/
checks = {
inherit glimmer glimmer-clippy;
};
}

View File

@ -1,123 +0,0 @@
{
"nodes": {
"crane": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1678152261,
"narHash": "sha256-cPRDxwygVMleiSEGELrvAiq9vYAN4c3KK/K4UEO13vU=",
"owner": "ipetkov",
"repo": "crane",
"rev": "5291dd0aa7a52d607fc952763ef60714e4c881d4",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1676283394,
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1678901627,
"narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1678875422,
"narHash": "sha256-T3o6NcQPwXjxJMn2shz86Chch4ljXgZn746c2caGxd8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "126f49a01de5b7e35a43fd43f891ecf6d3a51459",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"crane": "crane",
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": [
"crane",
"flake-utils"
],
"nixpkgs": [
"crane",
"nixpkgs"
]
},
"locked": {
"lastModified": 1677812689,
"narHash": "sha256-EakqhgRnjVeYJv5+BJx/NZ7/eFTMBxc4AhICUNquhUg=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "e53e8853aa7b0688bc270e9e6a681d22e01cf299",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View File

@ -1,57 +0,0 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
crane.url = "github:ipetkov/crane";
crane.inputs.nixpkgs.follows = "nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, crane, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
craneLib = crane.lib.${system};
src = ./.;
cargoArtifacts = craneLib.buildDepsOnly {
name = "glimmer-deps";
inherit src;
nativeBuildInputs = [
pkgs.pkg-config
pkgs.glib
pkgs.gtk4
];
};
glimmer-clippy = craneLib.cargoClippy {
name = "glimmer-clippy";
inherit cargoArtifacts src;
cargoClippyExtraArgs = "-- --deny warnings";
};
glimmer = craneLib.buildPackage {
name = "glimmer";
inherit cargoArtifacts src;
nativeBuildInputs = [
pkgs.pkg-config
pkgs.glib
pkgs.gtk4
];
};
in
{
packages.default = glimmer;
devShells.default = pkgs.mkShell {
inputsFrom = builtins.attrValues self.checks.${system};
nativeBuildInputs = with pkgs; [
cargo
rustc
];
};
checks = {
inherit glimmer glimmer-clippy;
};
});
}

View File

@ -2,7 +2,7 @@ use glib::Object;
use gtk::{prelude::*, subclass::prelude::*}; use gtk::{prelude::*, subclass::prelude::*};
pub struct Card<C> { pub struct Card<C> {
children: Vec<C>, pub children: Vec<C>,
} }
#[derive(Default)] #[derive(Default)]
@ -31,9 +31,10 @@ impl CardElement {
} }
} }
struct TextField { #[derive(Clone, Debug)]
placeholder: String, pub struct TextField {
text: String, pub placeholder: String,
pub text: String,
} }
#[derive(Default)] #[derive(Default)]