1
0
Fork 0

refactor: flake.parts!

This commit is contained in:
Daniel Kempkens 2023-05-11 01:04:05 +02:00
parent 7e5b7accfb
commit be35fad15d
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
16 changed files with 91 additions and 87 deletions

View file

@ -27,24 +27,6 @@ jobs:
- run: nix build '.#rimgo'
- run: nix build '.#website-docs-nifoc-pw'
build-x86_64-darwin:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- uses: cachix/cachix-action@v12
with:
name: nifoc
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix build '.#cliclick'
- run: nix build '.#fennel-ls'
- run: nix build '.#liblpeg-darwin'
- run: nix build '.#neovim-nightly'
- run: nix build '.#phantomjs'
- run: nix build '.#q'
build-arm64-linux:
runs-on: buildjet-2vcpu-ubuntu-2204-arm
steps:

View file

@ -1,5 +1,23 @@
{
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1683560683,
"narHash": "sha256-XAygPMN5Xnk/W2c1aW0jyEa6lfMDZWlQgiNtmHXytPc=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "006c75898cf814ef9497252b022e91c946ba8e17",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1667395993,
@ -54,8 +72,27 @@
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1682879489,
"narHash": "sha256-sASwo8gBt7JDnOOstnps90K1wxmVfyhsTPPNTGBPjjg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "da45bf6ec7bbcc5d1e14d3795c025199f28e0de0",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"neovim-flake": "neovim-flake",
"nixpkgs": "nixpkgs"
}

View file

@ -3,31 +3,55 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
neovim-flake = {
url = "github:neovim/neovim?dir=contrib";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ self, nixpkgs, ... }: {
packages = nixpkgs.lib.genAttrs
[
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"aarch64-darwin"
"x86_64-darwin"
"aarch64-linux"
"x86_64-linux"
]
(system: import ./packages.nix {
inherit system;
inherit (nixpkgs) lib;
"aarch64-linux"
];
pkgs = nixpkgs.legacyPackages.${system};
imports = [
flake-parts.flakeModules.easyOverlay
];
otherPkgs = {
neovim = inputs.neovim-flake.packages.${system};
};
});
perSystem = { inputs', system, config, pkgs, lib, ... }: {
packages =
let
darwinPackages =
if lib.hasSuffix "darwin" system then rec {
agilebits-op = import ./packages/agilebits-op.nix { inherit pkgs lib; };
cliclick = import ./packages/cliclick.nix { inherit pkgs lib; };
liblpeg = import ./packages/liblpeg-darwin.nix { inherit pkgs; };
neovim-nightly = import ./packages/neovim-nightly.nix { inherit (inputs'.neovim-flake.packages) neovim; inherit liblpeg lib; };
phantomjs = import ./packages/phantomjs.nix { inherit pkgs lib; };
} else {
neovim-nightly = import ./packages/neovim-nightly.nix { inherit (inputs'.neovim-flake.packages) neovim; inherit lib; };
};
in
{
anonymous-overflow = import ./packages/anonymous-overflow.nix { inherit pkgs lib; };
fennel-ls = import ./packages/fennel-ls.nix { inherit pkgs lib; };
nitter-unstable = import ./packages/nitter-unstable.nix { inherit pkgs lib; };
q = import ./packages/q.nix { inherit pkgs lib; };
rimgo = import ./packages/rimgo.nix { inherit pkgs lib; };
website-docs-nifoc-pw = import ./packages/website-docs-nifoc-pw.nix { inherit pkgs; };
} // darwinPackages;
overlay = import ./overlay.nix;
};
overlayAttrs = config.packages;
};
flake = {
overlay = inputs.self.overlays.default;
};
};
}

View file

@ -1,19 +0,0 @@
_: super:
let
custom = super.callPackage ./packages.nix { };
in
{
inherit (custom) agilebits-op;
inherit (custom) anonymous-overflow;
inherit (custom) cliclick;
inherit (custom) fennel-ls;
inherit (custom) nitter-unstable;
inherit (custom) phantomjs;
inherit (custom) q;
inherit (custom) rimgo;
inherit (custom) website-docs-nifoc-pw;
inherit (custom) liblpeg-darwin;
inherit (custom) neovim-nightly;
}

View file

@ -1,16 +0,0 @@
{ system, lib, pkgs, otherPkgs }:
rec {
agilebits-op = import ./packages/agilebits-op.nix { inherit system lib pkgs; };
anonymous-overflow = import ./packages/anonymous-overflow.nix { inherit system lib pkgs; };
cliclick = import ./packages/cliclick.nix { inherit system lib pkgs; };
fennel-ls = import ./packages/fennel-ls.nix { inherit system lib pkgs; };
nitter-unstable = import ./packages/nitter-unstable.nix { inherit system lib pkgs; };
phantomjs = import ./packages/phantomjs.nix { inherit system lib pkgs; };
q = import ./packages/q.nix { inherit system lib pkgs; };
rimgo = import ./packages/rimgo.nix { inherit system lib pkgs; };
website-docs-nifoc-pw = import ./packages/website-docs-nifoc-pw.nix { inherit system lib pkgs; };
liblpeg-darwin = import ./packages/liblpeg-darwin.nix { inherit system lib pkgs; };
neovim-nightly = import ./packages/neovim-nightly.nix { inherit system lib pkgs otherPkgs liblpeg-darwin; };
}

View file

@ -1,4 +1,4 @@
{ system, lib, pkgs }:
{ pkgs, lib }:
pkgs.stdenv.mkDerivation rec {
pname = "agilebits-op";

View file

@ -1,4 +1,4 @@
{ system, lib, pkgs }:
{ pkgs, lib }:
pkgs.buildGoModule rec {
pname = "anonymous-overflow";

View file

@ -1,4 +1,4 @@
{ system, lib, pkgs }:
{ pkgs, lib }:
pkgs.stdenv.mkDerivation rec {
pname = "cliclick";

View file

@ -1,4 +1,4 @@
{ system, lib, pkgs }:
{ pkgs, lib }:
pkgs.stdenv.mkDerivation rec {
pname = "fennel-ls";

View file

@ -1,4 +1,4 @@
{ system, lib, pkgs }:
{ pkgs }:
pkgs.stdenv.mkDerivation {
pname = "liblpeg";

View file

@ -1,12 +1,8 @@
{ pkgs, otherPkgs, lib, liblpeg-darwin, ... }:
{ neovim, liblpeg ? null, lib, ... }:
let
inherit (pkgs.stdenv) isDarwin;
inherit (lib) optionals;
in
otherPkgs.neovim.neovim.overrideAttrs (oa: {
nativeBuildInputs = oa.nativeBuildInputs ++ optionals isDarwin [
liblpeg-darwin
neovim.overrideAttrs (oa: {
nativeBuildInputs = oa.nativeBuildInputs ++ lib.optionals (liblpeg != null) [
liblpeg
];
patches = builtins.filter

View file

@ -1,4 +1,4 @@
{ system, lib, pkgs }:
{ pkgs, lib }:
let
nimPackages = pkgs.nimPackages;

View file

@ -1,4 +1,4 @@
{ system, lib, pkgs }:
{ pkgs, lib }:
pkgs.stdenv.mkDerivation rec {
pname = "phantomjs";

View file

@ -1,4 +1,4 @@
{ system, lib, pkgs }:
{ pkgs, lib }:
pkgs.buildGoModule rec {
pname = "q";

View file

@ -1,4 +1,4 @@
{ system, lib, pkgs }:
{ pkgs, lib }:
pkgs.buildGoModule rec {
pname = "rimgo";

View file

@ -1,6 +1,6 @@
{ system, lib, pkgs }:
{ pkgs }:
pkgs.stdenv.mkDerivation rec {
pkgs.stdenv.mkDerivation {
pname = "website-docs-nifoc-pw";
version = "2021-08-30";