Files
anyrun/flake.nix
NotAShelf 099e1a08fd nix: rewrite nix flake from ground up and introduce home-manager module (#44)
* rewrite nix flake and move default package

* revert: remove .envrc

* feat: create home-manager module

big W

* fix: properly parse null for config.plugins

* build plugins from template derivation

* build plugins from template derivation

* cache each plugin individually

* pass name and derivation to template derivation

* fix: rework the devShell

* fix: add missing flake-parts input

* feat: make anyrun not build plugins

it only builds plugins on the anyrun-with-all-plugins package

* chore: write documentation about HM module

* fix: specify pname for plugins

* nix: flake-parts follows nixpkgs

* nix: formatting via alejandra

---------

Co-authored-by: n3oney <neo@neoney.dev>
2023-06-21 18:49:10 +03:00

128 lines
3.5 KiB
Nix

{
description = "A wayland native, highly customizable runner.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
};
outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux" "aarch64-linux"];
perSystem = {
config,
self',
inputs',
pkgs,
system,
...
}: let
inherit (inputs.nixpkgs) lib;
inherit (lib) getExe;
in {
# provide the formatter for nix fmt
formatter = pkgs.alejandra;
devShells.default = pkgs.mkShell {
inputsFrom = builtins.attrValues self'.packages;
packages = with pkgs; [
alejandra # nix formatter
rustfmt # rust formatter
statix # lints and suggestions
deadnix # clean up unused nix code
rustc # rust compiler
gcc
cargo # rust package manager
clippy # opinionated rust formatter
];
};
packages = let
lockFile = ./Cargo.lock;
in rec {
anyrun = pkgs.callPackage ./nix/default.nix {inherit inputs lockFile;};
# alias nix build .# to anyrun
default = anyrun;
anyrun-with-all-plugins = pkgs.callPackage ./nix/default.nix {
inherit inputs lockFile;
dontBuildPlugins = false;
};
# expose each plugin as a package
applications = pkgs.callPackage ./nix/plugins/default.nix {
inherit inputs lockFile;
name = "applications";
};
dictionary = pkgs.callPackage ./nix/plugins/default.nix {
inherit inputs lockFile;
name = "dictionary";
};
kidex = pkgs.callPackage ./nix/plugins/default.nix {
inherit inputs lockFile;
name = "kidex";
};
randr = pkgs.callPackage ./nix/plugins/default.nix {
inherit inputs lockFile;
name = "randr";
};
rink = pkgs.callPackage ./nix/plugins/default.nix {
inherit inputs lockFile;
name = "rink";
};
shell = pkgs.callPackage ./nix/plugins/default.nix {
inherit inputs lockFile;
name = "shell";
};
stdin = pkgs.callPackage ./nix/plugins/default.nix {
inherit inputs lockFile;
name = "stdin";
};
symbols = pkgs.callPackage ./nix/plugins/default.nix {
inherit inputs lockFile;
name = "symbols";
};
translate = pkgs.callPackage ./nix/plugins/default.nix {
inherit inputs lockFile;
name = "translate";
};
};
checks = {
format =
pkgs.runCommand "check-format" {
buildInputs = with pkgs; [
rustfmt
cargo
];
} ''
${pkgs.rustfmt}/bin/cargo-fmt fmt --manifest-path ./anyrun/Cargo.toml -- --check
${getExe pkgs.alejandra} --check ./
touch $out # it worked!
'';
"anyrun-format-check" = self'.packages.anyrun;
};
};
flake = _: {
# TODO: Make a NixOS module
nixosModules.default = null;
homeManagerModules.default = import ./nix/hm-module.nix inputs.self;
};
};
}