Merge pull request #189 from NotAShelf/nix-cleanup
nix: clean up; generalize
This commit is contained in:
3
.github/workflows/cargo-build.yml
vendored
3
.github/workflows/cargo-build.yml
vendored
@@ -21,8 +21,7 @@ jobs:
|
|||||||
- uses: cachix/install-nix-action@v26
|
- uses: cachix/install-nix-action@v26
|
||||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||||
|
|
||||||
- name: Install dependencies
|
- uses: nicknovitski/nix-develop@v1
|
||||||
run: nix develop -i
|
|
||||||
|
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: actions-rs/toolchain@v1
|
||||||
name: Install rust toolchain
|
name: Install rust toolchain
|
||||||
|
48
flake.nix
48
flake.nix
@@ -28,30 +28,6 @@
|
|||||||
}: let
|
}: let
|
||||||
inherit (pkgs) callPackage;
|
inherit (pkgs) callPackage;
|
||||||
in {
|
in {
|
||||||
# provide the formatter for nix fmt
|
|
||||||
formatter = pkgs.alejandra;
|
|
||||||
|
|
||||||
devShells = {
|
|
||||||
default = pkgs.mkShell {
|
|
||||||
inputsFrom = builtins.attrValues self'.packages;
|
|
||||||
packages = with pkgs; [
|
|
||||||
rustc # rust compiler
|
|
||||||
gcc
|
|
||||||
cargo # rust package manager
|
|
||||||
clippy # opinionated rust formatter
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
nix = pkgs.mkShellNoCC {
|
|
||||||
packages = with pkgs; [
|
|
||||||
alejandra # nix formatter
|
|
||||||
rustfmt # rust formatter
|
|
||||||
statix # lints and suggestions
|
|
||||||
deadnix # clean up unused nix code
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
packages = let
|
packages = let
|
||||||
lockFile = ./Cargo.lock;
|
lockFile = ./Cargo.lock;
|
||||||
|
|
||||||
@@ -91,6 +67,30 @@
|
|||||||
|
|
||||||
# Set up an overlay from packages exposed by this flake
|
# Set up an overlay from packages exposed by this flake
|
||||||
overlayAttrs = config.packages;
|
overlayAttrs = config.packages;
|
||||||
|
|
||||||
|
devShells = {
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
inputsFrom = builtins.attrValues self'.packages;
|
||||||
|
packages = with pkgs; [
|
||||||
|
rustc # rust compiler
|
||||||
|
gcc
|
||||||
|
cargo # rust package manager
|
||||||
|
clippy # opinionated rust formatter
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
nix = pkgs.mkShellNoCC {
|
||||||
|
packages = with pkgs; [
|
||||||
|
alejandra # nix formatter
|
||||||
|
rustfmt # rust formatter
|
||||||
|
statix # lints and suggestions
|
||||||
|
deadnix # clean up unused nix code
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# provide the formatter for nix fmt
|
||||||
|
formatter = pkgs.alejandra;
|
||||||
};
|
};
|
||||||
|
|
||||||
flake = {
|
flake = {
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
|
inputs,
|
||||||
lib,
|
lib,
|
||||||
makeWrapper,
|
|
||||||
lockFile,
|
|
||||||
# Dependencies for Anyrun
|
# Dependencies for Anyrun
|
||||||
|
makeWrapper,
|
||||||
glib,
|
glib,
|
||||||
rustPlatform,
|
rustPlatform,
|
||||||
atk,
|
atk,
|
||||||
@@ -17,25 +17,23 @@
|
|||||||
# derivation. By default, we should not build
|
# derivation. By default, we should not build
|
||||||
# any of the plugins.
|
# any of the plugins.
|
||||||
dontBuildPlugins ? true,
|
dontBuildPlugins ? true,
|
||||||
|
lockFile,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) fromTOML readFile;
|
inherit (builtins) fromTOML readFile;
|
||||||
|
|
||||||
cargoToml = fromTOML (readFile ../anyrun/Cargo.toml);
|
cargoToml = fromTOML (readFile ../anyrun/Cargo.toml);
|
||||||
pname = cargoToml.package.name;
|
pname = cargoToml.package.name;
|
||||||
version = cargoToml.package.version;
|
version = cargoToml.package.version;
|
||||||
in
|
in
|
||||||
rustPlatform.buildRustPackage {
|
rustPlatform.buildRustPackage {
|
||||||
inherit pname version;
|
inherit pname version;
|
||||||
src = ../.;
|
src = builtins.path {
|
||||||
|
path = lib.sources.cleanSource inputs.self;
|
||||||
|
name = "${pname}-${version}";
|
||||||
|
};
|
||||||
|
|
||||||
buildInputs = [
|
strictDeps = true;
|
||||||
pkg-config
|
|
||||||
glib
|
|
||||||
atk
|
|
||||||
gtk3
|
|
||||||
librsvg
|
|
||||||
gtk-layer-shell
|
|
||||||
];
|
|
||||||
|
|
||||||
cargoLock = {
|
cargoLock = {
|
||||||
inherit lockFile;
|
inherit lockFile;
|
||||||
@@ -51,20 +49,30 @@ in
|
|||||||
cargo
|
cargo
|
||||||
];
|
];
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
glib
|
||||||
|
atk
|
||||||
|
gtk3
|
||||||
|
librsvg
|
||||||
|
gtk-layer-shell
|
||||||
|
];
|
||||||
|
|
||||||
cargoBuildFlags =
|
cargoBuildFlags =
|
||||||
if dontBuildPlugins
|
if dontBuildPlugins
|
||||||
then ["-p ${pname}"]
|
then ["-p ${pname}"]
|
||||||
else [];
|
else [];
|
||||||
|
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
CARGO_BUILD_INCREMENTAL = "false";
|
|
||||||
RUST_BACKTRACE = "full";
|
|
||||||
copyLibs = true;
|
copyLibs = true;
|
||||||
|
|
||||||
buildAndTestSubdir =
|
buildAndTestSubdir =
|
||||||
if dontBuildPlugins
|
if dontBuildPlugins
|
||||||
then pname
|
then pname
|
||||||
else null;
|
else null;
|
||||||
|
|
||||||
|
CARGO_BUILD_INCREMENTAL = "false";
|
||||||
|
RUST_BACKTRACE = "full";
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
wrapProgram $out/bin/anyrun \
|
wrapProgram $out/bin/anyrun \
|
||||||
--set GDK_PIXBUF_MODULE_FILE "$(echo ${librsvg.out}/lib/gdk-pixbuf-2.0/*/loaders.cache)" \
|
--set GDK_PIXBUF_MODULE_FILE "$(echo ${librsvg.out}/lib/gdk-pixbuf-2.0/*/loaders.cache)" \
|
||||||
@@ -75,18 +83,7 @@ in
|
|||||||
description = "A wayland native, highly customizable runner.";
|
description = "A wayland native, highly customizable runner.";
|
||||||
homepage = "https://github.com/Kirottu/anyrun";
|
homepage = "https://github.com/Kirottu/anyrun";
|
||||||
license = with lib.licenses; [gpl3];
|
license = with lib.licenses; [gpl3];
|
||||||
maintainers = [
|
|
||||||
{
|
|
||||||
email = "neo@neoney.dev";
|
|
||||||
github = "n3oney";
|
|
||||||
githubId = 30625554;
|
|
||||||
name = "Michał Minarowski";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
email = "raf@notashelf.dev";
|
|
||||||
github = "NotAShelf";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
mainProgram = "anyrun";
|
mainProgram = "anyrun";
|
||||||
|
maintainers = with lib.maintainers; [NotAShelf n3oney];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
{
|
{
|
||||||
|
inputs,
|
||||||
lib,
|
lib,
|
||||||
|
# Common dependencies for the plugin
|
||||||
glib,
|
glib,
|
||||||
makeWrapper,
|
makeWrapper,
|
||||||
rustPlatform,
|
rustPlatform,
|
||||||
@@ -8,45 +10,56 @@
|
|||||||
gtk-layer-shell,
|
gtk-layer-shell,
|
||||||
pkg-config,
|
pkg-config,
|
||||||
librsvg,
|
librsvg,
|
||||||
inputs,
|
# Generic args
|
||||||
name,
|
name,
|
||||||
lockFile,
|
lockFile,
|
||||||
|
extraInputs ? [], # allow appending buildInputs
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
cargoToml = builtins.fromTOML (builtins.readFile ../../plugins/${name}/Cargo.toml);
|
cargoToml = builtins.fromTOML (builtins.readFile ../../plugins/${name}/Cargo.toml);
|
||||||
|
pname = cargoToml.package.name;
|
||||||
|
version = cargoToml.package.version;
|
||||||
in
|
in
|
||||||
rustPlatform.buildRustPackage {
|
rustPlatform.buildRustPackage {
|
||||||
pname = cargoToml.package.name;
|
inherit pname version;
|
||||||
version = cargoToml.package.version;
|
|
||||||
|
|
||||||
src = "${inputs.self}";
|
src = builtins.path {
|
||||||
|
path = lib.sources.cleanSource inputs.self;
|
||||||
|
name = "${pname}-${version}";
|
||||||
|
};
|
||||||
cargoLock = {
|
cargoLock = {
|
||||||
inherit lockFile;
|
inherit lockFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [
|
strictDeps = true;
|
||||||
glib
|
|
||||||
atk
|
|
||||||
gtk3
|
|
||||||
librsvg
|
|
||||||
gtk-layer-shell
|
|
||||||
];
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
pkg-config
|
pkg-config
|
||||||
makeWrapper
|
makeWrapper
|
||||||
];
|
];
|
||||||
|
|
||||||
|
buildInputs =
|
||||||
|
[
|
||||||
|
glib
|
||||||
|
atk
|
||||||
|
gtk3
|
||||||
|
librsvg
|
||||||
|
gtk-layer-shell
|
||||||
|
]
|
||||||
|
++ extraInputs;
|
||||||
|
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
CARGO_BUILD_INCREMENTAL = "false";
|
|
||||||
RUST_BACKTRACE = "full";
|
|
||||||
copyLibs = true;
|
copyLibs = true;
|
||||||
cargoBuildFlags = ["-p ${name}"];
|
cargoBuildFlags = ["-p ${name}"];
|
||||||
buildAndTestSubdir = "plugins/${name}";
|
buildAndTestSubdir = "plugins/${name}";
|
||||||
|
|
||||||
meta = with lib; {
|
CARGO_BUILD_INCREMENTAL = "false";
|
||||||
|
RUST_BACKTRACE = "full";
|
||||||
|
|
||||||
|
meta = {
|
||||||
description = "The ${name} plugin for Anyrun";
|
description = "The ${name} plugin for Anyrun";
|
||||||
homepage = "https://github.com/Kirottu/anyrun";
|
homepage = "https://github.com/Kirottu/anyrun";
|
||||||
license = with licenses; [gpl3];
|
license = with lib.licenses; [gpl3];
|
||||||
|
maintainers = with lib.maintainers; [NotAShelf n3oney];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user