diff --git a/assets/pkg/nix/lidm.nix b/assets/pkg/nix/lidm.nix new file mode 100644 index 0000000..8c368ca --- /dev/null +++ b/assets/pkg/nix/lidm.nix @@ -0,0 +1,26 @@ +{ config, pkgs, ...}: pkgs.stdenv.mkDerivation rec { + pname = "lidm"; + version = config.version; + src = config.src; + + nativeBuildInputs = with pkgs; [ + gcc + gnumake + linux-pam + ]; + + makeFlags = [ + "DESTDIR=$(out)" + "PREFIX=" + ]; + + installPhase = '' + make install DESTDIR=$out PREFIX= + mkdir -p $out/etc/systemd/system/ + make install-service-systemd DESTDIR=$out PREFIX= + ''; + + fixupPhase = '' + rm -rf $out/etc + ''; +} diff --git a/flake.nix b/flake.nix index 6435871..96838e5 100644 --- a/flake.nix +++ b/flake.nix @@ -18,29 +18,10 @@ builtins.match "VERSION[[:blank:]]*=[[:space:]]*([^\n]*)\n.*" (builtins.readFile ./Makefile) ) 0; - lidm = ( - pkgs.stdenv.mkDerivation { - pname = name; - version = version; - - src = ./.; - - nativeBuildInputs = with pkgs; [ - gcc - gnumake - linux-pam - ]; - - makeFlags = [ - "DESTDIR=$(out)" - "PREFIX=" - ]; - - fixupPhase = '' - rm -rf $out/etc - ''; - } - ); + lidm = pkgs.callPackage assets/pkg/nix/lidm.nix { + inherit pkgs; + config = { inherit version; src = ./.; }; + }; in rec { defaultApp = flake-utils.lib.mkApp { drv = defaultPackage; };