8000 nix: housekeeping by NotAShelf · Pull Request #195 · anyrun-org/anyrun · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

nix: housekeeping #195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
"anyrun",
"anyrun-plugin",
Expand Down
22 changes: 11 additions & 11 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
# it is possible to streamline calling packages with a single function
# that takes name as an argument, and handles default inherits.
mkPlugin = name:
callPackage ./nix/plugins/default.nix {
callPackage ./nix/packages/plugin.nix {
inherit inputs lockFile;
inherit name;
};
Expand All @@ -44,8 +44,8 @@

# By default the anyrun package is built without any plugins
# as per the `dontBuildPlugins` arg.
anyrun = callPackage ./nix/default.nix {inherit inputs lockFile;};
anyrun-with-all-plugins = callPackage ./nix/default.nix {
anyrun = callPackage ./nix/packages/anyrun.nix {inherit inputs lockFile;};
anyrun-with-all-plugins = callPackage ./nix/packages/anyrun.nix {
inherit inputs lockFile;
dontBuildPlugins = false;
};
Expand All @@ -72,19 +72,19 @@
default = pkgs.mkShell {
inputsFrom = builtins.attrValues self'.packages;
packages = with pkgs; [
rustc # rust compiler
rustc
gcc
cargo # rust package manager
clippy # opinionated rust formatter
cargo
clippy
rustfmt
];
};

nix = pkgs.mkShellNoCC {
packages = with pkgs; [
alejandra # nix formatter
rustfmt # rust formatter
statix # lints and suggestions
deadnix # clean up unused nix code
alejandra # formatter
statix # linter
deadnix # dead-code finder
];
};
};
Expand All @@ -95,7 +95,7 @@

flake = {
homeManagerModules = {
anyrun = import ./nix/hm-module.nix self;
anyrun = import ./nix/modules/home-manager.nix self;
default = self.homeManagerModules.anyrun;
};
};
Expand Down
8 changes: 3 additions & 5 deletions nix/hm-module.nix → nix/modules/home-manager.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@ self: {
config,
pkgs,
lib,
hm,
...
}: let
cfg = config.programs.anyrun;

defaultPackage = self.packages.${pkgs.stdenv.hostPlatform.system}.default;

inherit (builtins) map toJSON toString substring stringLength;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.options) mkOption mkEnableOption literalExpression;
Expand All @@ -17,6 +12,9 @@ self: {
inherit (lib.strings) toLower toUpper replaceStrings;
inherit (lib.trivial) boolToString;
inherit (lib.types) nullOr package submodule int float listOf either str enum lines bool attrs;

defaultPackage = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
cfg = config.programs.anyrun;
in {
meta.maintainers = with lib.maintainers; [n3oney NotAShelf];

Expand Down
10 changes: 5 additions & 5 deletions nix/default.nix → nix/packages/anyrun.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}: let
inherit (builtins) fromTOML readFile;

cargoToml = fromTOML (readFile ../anyrun/Cargo.toml);
cargoToml = fromTOML (readFile ../../anyrun/Cargo.toml);
pname = cargoToml.package.name;
version = cargoToml.package.version;
in
Expand All @@ -39,8 +39,6 @@ in
inherit lockFile;
};

checkInputs = [cargo rustc];

nativeBuildInputs = [
pkg-config
makeWrapper
Expand All @@ -63,14 +61,16 @@ in
else [];

doCheck = true;
checkInputs = [cargo rustc];

copyLibs = true;

buildAndTestSubdir =
if dontBuildPlugins
then pname
else null;

CARGO_BUILD_INCREMENTAL = "false";
CARGO_BUILD_INCREMENTAL = 0;
RUST_BACKTRACE = "full";

postInstall = ''
Expand All @@ -82,7 +82,7 @@ in
meta = {
description = "A wayland native, highly customizable runner.";
homepage = "https://github.com/Kirottu/anyrun";
license = with lib.licenses; [gpl3];
license = [lib.licenses.gpl3];
mainProgram = "anyrun";
maintainers = with lib.maintainers; [NotAShelf n3oney];
};
Expand Down
11 changes: 9 additions & 2 deletions nix/plugins/default.nix → nix/packages/plugin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
gtk-layer-shell,
pkg-config,
librsvg,
cargo,
rustc,
# Generic args
name,
lockFile,
Expand Down Expand Up @@ -49,17 +51,22 @@ in
++ extraInputs;

doCheck = true;
checkInputs = [
cargo
rustc
];

copyLibs = true;
cargoBuildFlags = ["-p ${name}"];
buildAndTestSubdir = "plugins/${name}";

CARGO_BUILD_INCREMENTAL = "false";
CARGO_BUILD_INCREMENTAL = 0;
RUST_BACKTRACE = "full";

meta = {
description = "The ${name} plugin for Anyrun";
homepage = "https://github.com/Kirottu/anyrun";
license = with lib.licenses; [gpl3];
license = [lib.licenses.gpl3];
maintainers = with lib.maintainers; [NotAShelf n3oney];
};
}
Loading
0