flake.nix and default.nix

This commit is contained in:
Mitchell Hashimoto 2022-08-22 17:50:25 -07:00
parent 5fc48d57ca
commit a7f900d90f
No known key found for this signature in database
GPG key ID: 523D5DC389D273BC
2 changed files with 22 additions and 31 deletions

View file

@ -4,38 +4,29 @@
let
inherit (pkgs) lib;
releases = builtins.fromJSON (lib.strings.fileContents ./sources.json);
installPhase = ''
mkdir -p $out/{doc,bin,lib}
[ -d docs ] && cp -r docs/* $out/doc
[ -d doc ] && cp -r doc/* $out/doc
cp -r lib/* $out/lib
cp zig $out/bin/zig
'';
mkDerivation = { url, version, sha256 }: pkgs.stdenv.mkDerivation {
inherit version;
pname = "zig";
src = pkgs.fetchurl { inherit url sha256; };
dontConfigure = true;
dontBuild = true;
dontFixup = true;
installPhase = ''
mkdir -p $out/{doc,bin,lib}
[ -d docs ] && cp -r docs/* $out/doc
[ -d doc ] && cp -r doc/* $out/doc
cp -r lib/* $out/lib
cp zig $out/bin/zig
'';
};
in lib.attrsets.mapAttrs (k: v:
if k == "master" then
lib.attrsets.mapAttrs (k: v:
(pkgs.stdenv.mkDerivation {
pname = "zig";
inherit (v.${system}) version;
src = pkgs.fetchurl {
inherit (v.${system}) url sha256;
};
dontConfigure = true;
dontBuild = true;
dontFixup = true;
installPhase = installPhase;
}))
v
lib.attrsets.mapAttrs (k: v: (mkDerivation {
inherit (v.${system}) version url sha256;
})) v
else
pkgs.stdenv.mkDerivation {
pname = "zig";
inherit (v.${system}) version;
src = pkgs.fetchurl {
inherit (v.${system}) url sha256;
};
dontConfigure = true;
dontBuild = true;
dontFixup = true;
installPhase = installPhase;
mkDerivation {
inherit (v.${system}) version url sha256;
})
releases

View file

@ -14,7 +14,7 @@
let pkgs = nixpkgs.legacyPackages.${system};
in rec {
packages = import ./default.nix { inherit system pkgs; };
defaultPackage = packages."0.7.1";
defaultPackage = packages."0.9.1";
apps.zig = flake-utils.lib.mkApp { drv = defaultPackage; };
defaultApp = apps.zig;
});