From e6d6ca1177f2d26c356cc568466499d5475a8506 Mon Sep 17 00:00:00 2001 From: Nicolas Hiillos Date: Wed, 27 Sep 2023 18:37:55 +0300 Subject: [PATCH] Fix linuxcnc-ethercat --- flake.lock | 70 +++++++++++++++++++++++++- flake.nix | 7 ++- packages/linuxcnc-ethercat/default.nix | 14 +++--- 3 files changed, 82 insertions(+), 9 deletions(-) diff --git a/flake.lock b/flake.lock index 94b784e..a58c9f5 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,24 @@ { "nodes": { + "etherlab": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1692255291, + "narHash": "sha256-JB3M8OvT5QXqbAjVSGOWKm+X7SCxsk7sbAPVQNdlMJo=", + "ref": "refs/heads/master", + "rev": "ec418a9f2fb9094be93f2d6870113a388cd62a06", + "revCount": 7, + "type": "git", + "url": "https://git.dripco.eu/nic/etherlab-nix" + }, + "original": { + "type": "git", + "url": "https://git.dripco.eu/nic/etherlab-nix" + } + }, "flake-compat": { "flake": false, "locked": { @@ -16,7 +35,40 @@ "type": "github" } }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "nixpkgs": { + "locked": { + "lastModified": 1692025715, + "narHash": "sha256-tsRiiopGT7HA8d/cuk5xYBRXgdnnvD+JhUGUe3x7vmY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "09a137528c3aea3780720d19f99cd706f52c3823", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-23.05", + "type": "indirect" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1653845079, "narHash": "sha256-7ghaQZ+7JXLI9FgNH8+RQHAt3/ubT92j8NtjZleP6t4=", @@ -33,8 +85,24 @@ }, "root": { "inputs": { + "etherlab": "etherlab", "flake-compat": "flake-compat", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs_2" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 6112088..7702598 100644 --- a/flake.nix +++ b/flake.nix @@ -2,14 +2,17 @@ inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; flake-compat = { url = "github:edolstra/flake-compat"; flake = false; }; + + etherlab.url = "git+https://git.dripco.eu/nic/etherlab-nix"; }; - outputs = { self, nixpkgs, flake-compat }@inputs: + outputs = { self, nixpkgs, flake-compat, etherlab }@inputs: let + etherlab-pkgs = system: etherlab.packages.${system}; systems = nixpkgs.lib.platforms.linux; lib = nixpkgs.lib; packagePaths = lib.mapAttrs (n: v: "${./packages}/${n}") (lib.filterAttrs (n: v: v == "directory" && (builtins.readDir "${./packages}/${n}") ? "default.nix") (builtins.readDir ./packages)); in rec { - packages = lib.genAttrs systems (system: lib.mapAttrs (n: v: lib.callPackageWith ((lib.recursiveUpdate packages.${system} nixpkgs.legacyPackages.${system}) // { inherit inputs; inherit system; }) v {}) packagePaths); + packages = lib.genAttrs systems (system: lib.mapAttrs (n: v: lib.callPackageWith ((lib.recursiveUpdate packages.${system} nixpkgs.legacyPackages.${system}) // { inherit inputs; inherit system; etherlab = (etherlab-pkgs system); }) v {}) packagePaths); legacyPackages = packages; overlay = final: prev: (lib.mapAttrs (n: v: prev.callPackage v { }) packagePaths); nixosModules = { linuxcnc = import ./modules/linuxcnc.nix; }; diff --git a/packages/linuxcnc-ethercat/default.nix b/packages/linuxcnc-ethercat/default.nix index ce8229a..7ef8a7e 100644 --- a/packages/linuxcnc-ethercat/default.nix +++ b/packages/linuxcnc-ethercat/default.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, stdenv, linuxcnc, fetchGit }: +{ config, lib, pkgs, stdenv, linuxcnc, etherlab }: stdenv.mkDerivation rec { enableParalellBuilding = true; @@ -7,15 +7,17 @@ stdenv.mkDerivation rec { version = "5ad53da25b"; name = "${pname}-${version}"; - src = fetchGit { + src = pkgs.fetchgit { url = "https://git.dripco.eu/nic/linuxcnc-ethercat.git"; - ref = "master"; rev = "5ad53da25bdb5633e39ae1b9b8bfa9e5acb10674"; - #ref = "refs/tags/1.9"; - #sha256 = lib.fakeSha256; + sha256 = "SjFkcNl/4AlsMeIw5Hg9Kp5mIIV9KFUYodXV6lAi3/A="; }; - buildInputs = [ linuxcnc ]; + nativeBuildInputs = with pkgs; [ which expat ]; + + buildInputs = [ linuxcnc etherlab.ethercat ]; + + installFlags = [ "DESTDIR=${placeholder "out"}" ]; meta = with lib; { description = "LinuxCNC ethercat interop";