Skip to content

Commit

Permalink
Merge pull request #161 from NotAShelf/nix
Browse files Browse the repository at this point in the history
nix: minor cleanup
  • Loading branch information
NotAShelf authored Jun 3, 2024
2 parents 5d2610e + 8d431d7 commit de2b05b
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 77 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/cachix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: DeterminateSystems/nix-installer-action@main
- uses: cachix/install-nix-action@v26
- uses: DeterminateSystems/magic-nix-cache-action@main

- uses: cachix/cachix-action@v12
with:
authToken: ${{ secrets.CACHIX_TOKEN }}
extraPullNames: nix-community
name: anyrun

- name: Set default git branch (to reduce log spam)
run: git config --global init.defaultBranch main

- name: Build anyrun from the defined matrix
run: nix build .#${{ matrix.package }} --print-build-logs
run: nix build .#${{ matrix.package }} --print-build-logs --extra-substituters "https://anyrun.cachix.org"
30 changes: 23 additions & 7 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

97 changes: 32 additions & 65 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default-linux";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
Expand All @@ -12,18 +13,15 @@
outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake {inherit inputs;} {
imports = [flake-parts.flakeModules.easyOverlay];
systems = ["x86_64-linux" "aarch64-linux"];
systems = import inputs.systems;

perSystem = {
config,
self',
inputs',
config,
pkgs,
system,
...
}: let
inherit (inputs.nixpkgs) lib;
inherit (lib) getExe;
inherit (pkgs) callPackage;
in {
# provide the formatter for nix fmt
formatter = pkgs.alejandra;
Expand All @@ -45,78 +43,47 @@

packages = let
lockFile = ./Cargo.lock;
in rec {
anyrun = pkgs.callPackage ./nix/default.nix {inherit inputs lockFile;};
# alias nix build .# to anyrun
default = anyrun;

# Since all plugin derivations are called with the exact same arguments
# 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 {
inherit inputs lockFile;
inherit name;
};
in {
default = self'.packages.anyrun;
anyrun = callPackage ./nix/default.nix {inherit inputs lockFile;};

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";
};

websearch = pkgs.callPackage ./nix/plugins/default.nix {
inherit inputs lockFile;
name = "websearch";
};
# Expose each plugin as a separate package. This uses the mkPlugin function
# to call the same derivation with same default inherits and the name of the
# plugin every time.
applications = mkPlugin "applications";
dictionary = mkPlugin "dictionary";
kidex = mkPlugin "kidex";
randr = mkPlugin "randr";
rink = mkPlugin "rink";
shell = mkPlugin "shell";
stdin = mkPlugin "stdin";
symbols = mkPlugin "symbols";
translate = mkPlugin "translate";
websearch = mkPlugin "websearch";
};

# Set up an overlay from packages exposed by this flake
overlayAttrs = config.packages;
};

flake = _: rec {
nixosModules.home-manager = homeManagerModules.default;

homeManagerModules = rec {
flake = {self, ...}: {
homeManagerModules = {
anyrun = import ./nix/hm-module.nix inputs.self;
default = anyrun;
default = self.homeManagerModules.anyrun;
};
};
};
Expand Down
4 changes: 2 additions & 2 deletions nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ in
--prefix ANYRUN_PLUGINS : $out/lib
'';

meta = with lib; {
meta = {
description = "A wayland native, highly customizable runner.";
homepage = "https://github.com/Kirottu/anyrun";
license = with licenses; [gpl3];
license = with lib.licenses; [gpl3];
maintainers = [
{
email = "[email protected]";
Expand Down

0 comments on commit de2b05b

Please sign in to comment.