Fix icons not showing when using flake

This commit is contained in:
2024-06-04 22:12:54 +02:00
parent 367997839c
commit 41f79a992e
5 changed files with 55 additions and 34 deletions

View File

@ -12,17 +12,24 @@
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, crane, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
outputs =
{
self,
nixpkgs,
crane,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
craneLib = crane.mkLib pkgs;
dbMigrationsFilter = path: _type: builtins.match ".*sql$" path != null;
dbMigrationsOrCargoFilter = path: type:
(dbMigrationsFilter path type)
|| (craneLib.filterCargoSources path type);
dbMigrationsOrCargoFilter =
path: type: (dbMigrationsFilter path type) || (craneLib.filterCargoSources path type);
dbMigrations = pkgs.lib.cleanSourceWith {
src = craneLib.path ./db-migrations; # The original, unfiltered source
@ -36,7 +43,6 @@
src = craneLib.path ./.; # The original, unfiltered source
filter = dbMigrationsOrCargoFilter;
};
# src = craneLib.cleanCargoSource (craneLib.path ./.);
# Add icons.toml to $src when compiling dependencies (needed by relm4-icons)
# Add db-migrations to $src when compiling dependencies (needed by sqlx)
@ -46,25 +52,36 @@
cp -r --no-preserve=mode,ownership ${dbMigrations} --no-target-dir $out/db-migrations/
'';
nativeBuildInputs = with pkgs; [ pkg-config gtk4 ];
buildInputs = [
# Add additional build inputs here
] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
# Additional darwin specific inputs can be set here
pkgs.libiconv
nativeBuildInputs = with pkgs; [
pkg-config
gtk4
];
buildInputs =
[
# Add additional build inputs here
]
++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
# Additional darwin specific inputs can be set here
pkgs.libiconv
];
};
my-crate = craneLib.buildPackage (commonArgs // {
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
my-crate = craneLib.buildPackage (
commonArgs
// {
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
# Additional environment variables or build phases/hooks can be set
# here *without* rebuilding all dependency crates
# MY_CUSTOM_VAR = "some value";
});
in {
checks = { inherit my-crate; };
# Additional environment variables or build phases/hooks can be set
# here *without* rebuilding all dependency crates
# MY_CUSTOM_VAR = "some value";
}
);
in
{
checks = {
inherit my-crate;
};
packages.default = my-crate;
@ -78,12 +95,12 @@
# MY_CUSTOM_DEVELOPMENT_VAR = "something else";
# Extra inputs can be added here; cargo and rustc are provided by default.
packages = with pkgs;
[
# rustPackages.clippy
# rustfmt
# pre-commit
];
packages = with pkgs; [
# rustPackages.clippy
# rustfmt
# pre-commit
];
};
});
}
);
}