From 1bd76ea8e1da8d5ea2658bf5f44db35e8a56a122 Mon Sep 17 00:00:00 2001 From: Marty Sluijtman Date: Thu, 30 Nov 2023 16:24:19 +0100 Subject: [PATCH] Derivation in seperate file --- default.nix | 28 ++++++++++++++++++++++++++++ flake.lock | 6 +++--- flake.nix | 27 ++------------------------- 3 files changed, 33 insertions(+), 28 deletions(-) create mode 100644 default.nix diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..6a9fa03 --- /dev/null +++ b/default.nix @@ -0,0 +1,28 @@ +{ pkgs +, scdoc +, xclip +, stdenvNoCC +, ... +}: +stdenvNoCC.mkDerivation rec { + pname = "irs"; + version = "0.3"; + src = ./src; + nativeBuildInputs = with pkgs; [ + scdoc + ]; + + buildPhase = '' + for page in $(find manpages -type f); do + scdoc < $page > $(basename $page .scd) + done + ''; + + installPhase = '' + mkdir -p $out/{share/man/man1,bin,share/zsh/site-functions} + cp bin/* $out/bin/ + cp completions/* $out/share/zsh/site-functions/ + cp *.1 $out/share/man/man1/ + ''; + +} diff --git a/flake.lock b/flake.lock index 07e3f56..b074c74 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1697655685, - "narHash": "sha256-79Kuv+QdgsVc+rkibuAgWHnh8IXrLBTOKg5nM0Qvux0=", + "lastModified": 1701053011, + "narHash": "sha256-8QQ7rFbKFqgKgLoaXVJRh7Ik5LtI3pyBBCfOnNOGkF0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "80c1aab725151632ddc2a20caeb914e76dd0673c", + "rev": "5b528f99f73c4fad127118a8c1126b5e003b01a9", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index c2971df..2a2aaed 100644 --- a/flake.nix +++ b/flake.nix @@ -7,31 +7,8 @@ flake-utils.lib.eachDefaultSystem ( system: let pkgs = import nixpkgs { inherit system; }; in{ - packages = rec { - default = pkgs.stdenvNoCC.mkDerivation rec { - pname = "irs"; - version = "0.2"; - - src = ./src; - - buildInputs = with pkgs; [ - coreutils - scdoc - ]; - - buildPhase = '' - for page in $(find manpages -type f); do - scdoc < $page > $(basename $page .scd) - done - ''; - - installPhase = '' - mkdir -p $out/{share/man/man1,bin,share/zsh/site-functions} - cp bin/* $out/bin/ - cp completions/* $out/share/zsh/site-functions/ - cp *.1 $out/share/man/man1/ - ''; - }; + packages = { + default = pkgs.callPackage ./default.nix {}; }; }); }