wip
This commit is contained in:
parent
57d071645f
commit
5ab269f05c
18
flake.lock
18
flake.lock
|
@ -1,5 +1,22 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"harmonia": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1680542005,
|
||||||
|
"narHash": "sha256-fT9CJ/WAH5ESU4Ja062U/qNWDmhEfHI1XctnFjgBJ+A=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "harmonia",
|
||||||
|
"rev": "849a845c327ffb8fcc3322176479f6909f7a51a1",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"ref": "master",
|
||||||
|
"repo": "harmonia",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1681389457,
|
"lastModified": 1681389457,
|
||||||
|
@ -16,6 +33,7 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"harmonia": "harmonia",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
19
flake.nix
19
flake.nix
|
@ -1,14 +1,29 @@
|
||||||
{
|
{
|
||||||
description = "Kefla POC";
|
description = "Kefla POC";
|
||||||
|
|
||||||
outputs = { self, nixpkgs }:
|
inputs = {
|
||||||
|
harmonia = {
|
||||||
|
type = "github";
|
||||||
|
owner = "nix-community";
|
||||||
|
repo = "harmonia";
|
||||||
|
ref = "master";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, ... }@inputs:
|
||||||
let
|
let
|
||||||
kefla = import ./kefla nixpkgs;
|
kefla = import ./kefla inputs;
|
||||||
in {
|
in {
|
||||||
packages = kefla {
|
packages = kefla {
|
||||||
|
# available on all achs
|
||||||
package-all = ./package-all.nix;
|
package-all = ./package-all.nix;
|
||||||
|
# Darwin-only
|
||||||
package-darwin = ./package-darwin.nix;
|
package-darwin = ./package-darwin.nix;
|
||||||
|
# Linux
|
||||||
package-linux = ./package-linux.nix;
|
package-linux = ./package-linux.nix;
|
||||||
|
# Uses meta
|
||||||
|
package-flake-meta = ./package-flake-meta.nix;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
nixpkgs:
|
inputs:
|
||||||
let
|
let
|
||||||
dummyPkgs = import nixpkgs { system = "x86_64-linux"; };
|
dummyPkgs = import inputs.nixpkgs { system = "x86_64-linux"; };
|
||||||
lib = dummyPkgs.lib;
|
lib = dummyPkgs.lib;
|
||||||
in rec {
|
in rec {
|
||||||
# Collects all the supported for drv leveraging the meta.platforms
|
# Collects all the supported systems for drv leveraging the
|
||||||
# Nixpkgs attribute.
|
# meta.platforms Nixpkgs attribute.
|
||||||
#
|
#
|
||||||
# We callPackage the derivation with a dummy Nixpkgs x86_64
|
# We callPackage the derivation with a dummy Nixpkgs x86_64
|
||||||
# instance, regardless of the underlying arch. It doesn't matter
|
# instance, regardless of the underlying arch. It doesn't matter
|
||||||
|
@ -37,16 +37,16 @@ in rec {
|
||||||
let
|
let
|
||||||
injectPlatformCallPackage = { attrs, platform }:
|
injectPlatformCallPackage = { attrs, platform }:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs { system = platform; };
|
pkgs = import inputs.nixpkgs { system = platform; };
|
||||||
callPackage = pkgs.lib.callPackageWith pkgs;
|
callPackage = pkgs.lib.callPackageWith (pkgs // { flakeMeta.inputs = inputs;} );
|
||||||
in builtins.mapAttrs (_name: value: callPackage value {}) attrs;
|
in builtins.mapAttrs (_name: value: callPackage value {}) attrs;
|
||||||
in builtins.mapAttrs (name: value:
|
in builtins.mapAttrs (name: value:
|
||||||
injectPlatformCallPackage { attrs = value; platform = name; }) packages;
|
injectPlatformCallPackage { attrs = value; platform = name; }) packages;
|
||||||
|
|
||||||
#
|
|
||||||
|
|
||||||
kefla = packagesOutput:
|
kefla = packagesOutput:
|
||||||
let
|
let
|
||||||
|
# We first generate the packages output like in its final form. We
|
||||||
|
# just lack the callPackage on the derivation path.
|
||||||
packagesWithoutCallPackage = lib.foldlAttrs
|
packagesWithoutCallPackage = lib.foldlAttrs
|
||||||
(acc: name: path:
|
(acc: name: path:
|
||||||
let
|
let
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
{ lib
|
||||||
|
, stdenv
|
||||||
|
, fetchurl
|
||||||
|
, flakeMeta
|
||||||
|
}:
|
||||||
|
|
||||||
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
|
pname = "hello";
|
||||||
|
version = "2.12.1";
|
||||||
|
|
||||||
|
src = fetchurl {
|
||||||
|
url = "mirror://gnu/hello/hello-${finalAttrs.version}.tar.gz";
|
||||||
|
sha256 = "sha256-jZkUKv2SV28wsM18tCqNxoCZmLxdYH2Idh9RLibH2yA=";
|
||||||
|
};
|
||||||
|
|
||||||
|
doCheck = true;
|
||||||
|
|
||||||
|
nativeBuildInputs = [ flakeMeta.inputs.harmonia ];
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "A program that produces a familiar, friendly greeting";
|
||||||
|
longDescription = ''
|
||||||
|
GNU Hello is a program that prints "Hello, world!" when you run it.
|
||||||
|
It is fully customizable.
|
||||||
|
'';
|
||||||
|
homepage = "https://www.gnu.org/software/hello/manual/";
|
||||||
|
changelog = "https://git.savannah.gnu.org/cgit/hello.git/plain/NEWS?h=v${finalAttrs.version}";
|
||||||
|
license = licenses.gpl3Plus;
|
||||||
|
maintainers = [ maintainers.eelco ];
|
||||||
|
platforms = platforms.all;
|
||||||
|
};
|
||||||
|
})
|
Loading…
Reference in New Issue