Merge pull request #195 from NotAShelf/master

nix: housekeeping
This commit is contained in:
raf
2024-10-31 20:28:09 +00:00
committed by GitHub
5 changed files with 29 additions and 23 deletions

View File

@@ -1,4 +1,5 @@
[workspace] [workspace]
resolver = "2"
members = [ members = [
"anyrun", "anyrun",
"anyrun-plugin", "anyrun-plugin",

View File

@@ -35,7 +35,7 @@
# it is possible to streamline calling packages with a single function # it is possible to streamline calling packages with a single function
# that takes name as an argument, and handles default inherits. # that takes name as an argument, and handles default inherits.
mkPlugin = name: mkPlugin = name:
callPackage ./nix/plugins/default.nix { callPackage ./nix/packages/plugin.nix {
inherit inputs lockFile; inherit inputs lockFile;
inherit name; inherit name;
}; };
@@ -44,8 +44,8 @@
# By default the anyrun package is built without any plugins # By default the anyrun package is built without any plugins
# as per the `dontBuildPlugins` arg. # as per the `dontBuildPlugins` arg.
anyrun = callPackage ./nix/default.nix {inherit inputs lockFile;}; anyrun = callPackage ./nix/packages/anyrun.nix {inherit inputs lockFile;};
anyrun-with-all-plugins = callPackage ./nix/default.nix { anyrun-with-all-plugins = callPackage ./nix/packages/anyrun.nix {
inherit inputs lockFile; inherit inputs lockFile;
dontBuildPlugins = false; dontBuildPlugins = false;
}; };
@@ -72,19 +72,19 @@
default = pkgs.mkShell { default = pkgs.mkShell {
inputsFrom = builtins.attrValues self'.packages; inputsFrom = builtins.attrValues self'.packages;
packages = with pkgs; [ packages = with pkgs; [
rustc # rust compiler rustc
gcc gcc
cargo # rust package manager cargo
clippy # opinionated rust formatter clippy
rustfmt
]; ];
}; };
nix = pkgs.mkShellNoCC { nix = pkgs.mkShellNoCC {
packages = with pkgs; [ packages = with pkgs; [
alejandra # nix formatter alejandra # formatter
rustfmt # rust formatter statix # linter
statix # lints and suggestions deadnix # dead-code finder
deadnix # clean up unused nix code
]; ];
}; };
}; };
@@ -95,7 +95,7 @@
flake = { flake = {
homeManagerModules = { homeManagerModules = {
anyrun = import ./nix/hm-module.nix self; anyrun = import ./nix/modules/home-manager.nix self;
default = self.homeManagerModules.anyrun; default = self.homeManagerModules.anyrun;
}; };
}; };

View File

@@ -2,13 +2,8 @@ self: {
config, config,
pkgs, pkgs,
lib, lib,
hm,
... ...
}: let }: let
cfg = config.programs.anyrun;
defaultPackage = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
inherit (builtins) map toJSON toString substring stringLength; inherit (builtins) map toJSON toString substring stringLength;
inherit (lib.modules) mkIf mkMerge; inherit (lib.modules) mkIf mkMerge;
inherit (lib.options) mkOption mkEnableOption literalExpression; inherit (lib.options) mkOption mkEnableOption literalExpression;
@@ -17,6 +12,9 @@ self: {
inherit (lib.strings) toLower toUpper replaceStrings; inherit (lib.strings) toLower toUpper replaceStrings;
inherit (lib.trivial) boolToString; inherit (lib.trivial) boolToString;
inherit (lib.types) nullOr package submodule int float listOf either str enum lines bool attrs; 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 { in {
meta.maintainers = with lib.maintainers; [n3oney NotAShelf]; meta.maintainers = with lib.maintainers; [n3oney NotAShelf];

View File

@@ -22,7 +22,7 @@
}: 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
@@ -39,8 +39,6 @@ in
inherit lockFile; inherit lockFile;
}; };
checkInputs = [cargo rustc];
nativeBuildInputs = [ nativeBuildInputs = [
pkg-config pkg-config
makeWrapper makeWrapper
@@ -63,6 +61,8 @@ in
else []; else [];
doCheck = true; doCheck = true;
checkInputs = [cargo rustc];
copyLibs = true; copyLibs = true;
buildAndTestSubdir = buildAndTestSubdir =
@@ -70,7 +70,7 @@ in
then pname then pname
else null; else null;
CARGO_BUILD_INCREMENTAL = "false"; CARGO_BUILD_INCREMENTAL = 0;
RUST_BACKTRACE = "full"; RUST_BACKTRACE = "full";
postInstall = '' postInstall = ''
@@ -82,7 +82,7 @@ in
meta = { meta = {
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 = [lib.licenses.gpl3];
mainProgram = "anyrun"; mainProgram = "anyrun";
maintainers = with lib.maintainers; [NotAShelf n3oney]; maintainers = with lib.maintainers; [NotAShelf n3oney];
}; };

View File

@@ -10,6 +10,8 @@
gtk-layer-shell, gtk-layer-shell,
pkg-config, pkg-config,
librsvg, librsvg,
cargo,
rustc,
# Generic args # Generic args
name, name,
lockFile, lockFile,
@@ -49,17 +51,22 @@ in
++ extraInputs; ++ extraInputs;
doCheck = true; doCheck = true;
checkInputs = [
cargo
rustc
];
copyLibs = true; copyLibs = true;
cargoBuildFlags = ["-p ${name}"]; cargoBuildFlags = ["-p ${name}"];
buildAndTestSubdir = "plugins/${name}"; buildAndTestSubdir = "plugins/${name}";
CARGO_BUILD_INCREMENTAL = "false"; CARGO_BUILD_INCREMENTAL = 0;
RUST_BACKTRACE = "full"; RUST_BACKTRACE = "full";
meta = { 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 lib.licenses; [gpl3]; license = [lib.licenses.gpl3];
maintainers = with lib.maintainers; [NotAShelf n3oney]; maintainers = with lib.maintainers; [NotAShelf n3oney];
}; };
} }