nix: use flake

This commit is contained in:
DashieTM 2024-05-20 21:23:58 +02:00
parent 84660083f9
commit 397c48ae43
8 changed files with 266 additions and 20 deletions

58
nix/default.nix Normal file
View file

@ -0,0 +1,58 @@
{ rustPlatform
, rust-bin
, pulseaudio
, dbus
, gdk-pixbuf
, gnome
, pkg-config
, wrapGAppsHook4
, gtk4
, libadwaita
, lib
, lockFile
, ...
}:
let
cargoToml = builtins.fromTOML (builtins.readFile ../Cargo.toml);
in
rustPlatform.buildRustPackage rec {
pname = cargoToml.package.name;
version = cargoToml.package.version;
src = ../.;
buildInputs = [
gtk4
libadwaita
pulseaudio
dbus
gdk-pixbuf
gnome.adwaita-icon-theme
];
cargoLock = {
inherit lockFile;
};
nativeBuildInputs = [
pkg-config
wrapGAppsHook4
(rust-bin.selectLatestNightlyWith
(toolchain: toolchain.default))
];
copyLibs = true;
postInstall = ''
install -D --mode=444 $src/${pname}.desktop $out/share/applications/${pname}.desktop
install -D --mode=444 $src/src/resources/icons/ReSet.svg $out/share/pixmaps/ReSet.svg
'';
meta = with lib; {
description = "A wip universal Linux settings application.";
homepage = "https://github.com/Xetibo/ReSet";
changelog = "https://github.com/Xetibo/ReSet/releases/tag/${version}";
license = licenses.gpl3;
maintainers = with maintainers; [ DashieTM ];
mainProgram = "reset";
};
}

30
nix/hm.nix Normal file
View file

@ -0,0 +1,30 @@
self: { config
, pkgs
, lib
, hm
, ...
}:
let
cfg = config.programs.reset;
defaultPackage = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
in
{
meta.maintainers = with lib.maintainers; [ DashieTM ];
options.programs.reset = with lib; {
enable = mkEnableOption "reset";
package = mkOption {
type = with types; nullOr package;
default = defaultPackage;
defaultText = lib.literalExpression ''
reset.packages.''${pkgs.stdenv.hostPlatform.system}.default
'';
description = mdDoc ''
Package to run
'';
};
};
config = lib.mkIf cfg.enable {
home.packages = lib.optional (cfg.package != null) cfg.package;
};
}