Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nix: build package from repository source #25

Merged
merged 4 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/user/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Add Ignis to your flake's inputs:

.. code-block:: nix

ignis.url = "github:linkfrg/ignis";
ignis.url = "git+https://github.com/linkfrg/ignis?submodules=1";

Then add the following to ``environment.systemPackages`` or ``home.packages``:

Expand Down
4 changes: 3 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
];

forAllSystems = nixpkgs.lib.genAttrs supportedSystems;

version = import ./nix/version.nix { inherit self; };
in
{
overlays.default = import ./overlay.nix;
overlays.default = import ./nix/overlay.nix { inherit version; };

packages = forAllSystems (system:
let
Expand Down
17 changes: 6 additions & 11 deletions ignis.nix → nix/ignis.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
{ pkgs, ... }:
{ pkgs, version ? "git", ... }:
let
inherit (pkgs.lib) concatStringsSep;
inherit (pkgs.lib) concatStringsSep;
in
pkgs.stdenv.mkDerivation {
inherit version;

pname = "ignis";
version = "0.2";

src = pkgs.fetchFromGitHub {
owner = "linkfrg";
repo = "ignis";
rev = "78846c57832c70fd971dbcd28ac5d8e70cd09840";
sha256 = "sha256-V70DT1Czyj/rbBAQIqfRVlQOyeuLjk1F6P8XOagDxNw=";
fetchSubmodules = true;
};
src = ./..;

nativeBuildInputs = [
pkgs.pkg-config
Expand Down Expand Up @@ -89,6 +84,6 @@ pkgs.stdenv.mkDerivation {
changelog = "https://github.com/linkfrg/ignis/releases/tag/v${version}";
license = licenses.gpl3;
maintainers = with maintainers; [ frdiener somokill ];
main_program = "ignis";
mainProgram = "ignis";
};
}
3 changes: 3 additions & 0 deletions nix/overlay.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{ version }: final: prev: {
ignis = prev.callPackage ./ignis.nix { inherit version; };
}
8 changes: 8 additions & 0 deletions nix/version.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ self }:

let
initPy = builtins.readFile ../ignis/__init__.py;
version = builtins.elemAt (builtins.match ".*__version__ = \"([^\"]*?)\".*" initPy) 0;
date = builtins.substring 0 8 (self.lastModifiedDate or "19700101");
in
"${version}+date=${date}_${self.shortRev or "dirty"}"
3 changes: 0 additions & 3 deletions overlay.nix

This file was deleted.