add basic flake.nix

This commit is contained in:
LordGrimmauld 2024-03-29 10:35:40 +01:00
parent 686328eb71
commit 81f612ecbf
3 changed files with 156 additions and 0 deletions

26
flake.lock Normal file
View File

@ -0,0 +1,26 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1711655175,
"narHash": "sha256-1xiaYhC3ul4y+i3eicYxeERk8ZkrNjLkrFSb/UW36Zw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "64c81edb4b97a51c5bbc54c191763ac71a6517ee",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixpkgs-unstable",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

53
flake.nix Normal file
View File

@ -0,0 +1,53 @@
{
description = "rmenu: Another customizable Application-Launcher written in Rust";
inputs.nixpkgs.url = "nixpkgs/nixpkgs-unstable";
outputs = {
nixpkgs,
self,
...
}: let
systems = [
"x86_64-linux"
"aarch64-linux"
];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
in {
devShells = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
default = pkgs.mkShell {
packages = with pkgs; [
# base toolchain
pkg-config
cargo
# runtime deps
glib
gtk3
libsoup_3
networkmanager
webkitgtk_4_1
# nix utils
self.formatter.${pkgs.system}
nil
];
};
});
formatter = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
in pkgs.alejandra);
packages = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
rmenu-pkg = (pkgs.callPackage ./nix/package.nix {});
in {
rmenu = rmenu-pkg;
default = rmenu-pkg;
});
};
}

77
nix/package.nix Normal file
View File

@ -0,0 +1,77 @@
{ cargo
, fetchFromGitHub
, glib
, gtk3
, lib
, libsoup_3
, networkmanager
, pkg-config
, rustPlatform
, rustc
, stdenv
, webkitgtk_4_1
, wrapGAppsHook
}:
rustPlatform.buildRustPackage rec {
version = "1.1.0";
pname = "rmenu";
src = lib.cleanSource ../.;
# src = fetchFromGitHub {
# rev = "188f542"; # "v${version}";
# owner = "imgurbot12";
# repo = pname;
# hash = "sha256-IRwYxjyHdP6794pQjyyUmofO8uakMY22pqdFkJZ5Mdo=";
# };
strictDeps = true;
cargoLock = {
lockFile = ../Cargo.lock;
outputHashes = {
"gio-0.19.0" = "sha256-+PAQNJ9sTk8aKAhA/PLQWDCKDT/cQ+ukdbem7g1J+pU=";
"nm-0.4.0" = "sha256-53ipJU10ZhIKIF7PCw5Eo/e/reUK0qpyTyE7uIrCD88=";
};
};
nativeBuildInputs = [
pkg-config
wrapGAppsHook
];
buildInputs = [
glib
gtk3
libsoup_3
networkmanager
webkitgtk_4_1
];
postInstall = ''
mkdir $out/themes
mkdir $out/plugins
cp -vfr $src/themes/* $out/themes/.
cp -vfr $src/other-plugins/* $out/plugins/.
mv $out/bin/* $out/plugins # everything is a plugin by default
mv $out/plugins/rmenu $out/bin/rmenu
mv $out/plugins/rmenu-build $out/bin/rmenu-build
mkdir -p $out/etc/rmenu
cp -vf $src/rmenu/public/config.yaml $out/etc/rmenu/config.yaml
ln -sf $out/themes/dark.css $out/etc/rmenu/style.css
'';
doCheck = true;
meta = with lib; {
changelog = "https://github.com/imgurbot12/rmenu/commits/master/";
description = "Another customizable Application-Launcher written in Rust ";
homepage = "https://github.com/imgurbot12/rmenu";
mainProgram = "rmenu";
maintainers = [ maintainers.grimmauld ];
platforms = platforms.linux;
};
}