Reorganize flake.nix

- No functional change
This commit is contained in:
linuswck 2024-12-20 15:37:04 +08:00
parent e05f31b70c
commit 372aac6a44
3 changed files with 89 additions and 37 deletions

View File

@ -1,7 +1,7 @@
diff --git a/linien_client/deploy.py b/linien_client/deploy.py diff --git a/linien-client/linien_client/deploy.py b/linien-client/linien_client/deploy.py
index df6683f..7355cc3 100644 index df6683f..7355cc3 100644
--- a/linien_client/deploy.py --- a/linien-client/linien_client/deploy.py
+++ b/linien_client/deploy.py +++ b/linien-client/linien_client/deploy.py
@@ -34,7 +34,7 @@ logger.setLevel(logging.DEBUG) @@ -34,7 +34,7 @@ logger.setLevel(logging.DEBUG)

View File

@ -1,7 +1,7 @@
diff --git a/linien_server/cli.py b/linien_server/cli.py diff --git a/linien-server/linien_server/cli.py b/linien-server/linien_server/cli.py
index 98539b2..7781c74 100644 index 98539b2..7781c74 100644
--- a/linien_server/cli.py --- a/linien-server/linien_server/cli.py
+++ b/linien_server/cli.py +++ b/linien-server/linien_server/cli.py
@@ -83,18 +83,9 @@ class LinienServerCLI: @@ -83,18 +83,9 @@ class LinienServerCLI:
else: else:
control = RedPitayaControlService(host=host) control = RedPitayaControlService(host=host)

114
flake.nix
View File

@ -15,11 +15,28 @@
fsbl-support = ./fast-servo/fsbl-support; fsbl-support = ./fast-servo/fsbl-support;
version = "2.1.0"; version = "2.1.0";
linien-src = pkgs.fetchFromGitHub { linien-src = pkgs.applyPatches {
owner = "linien-org"; name = "linien-src";
repo = "linien"; src = pkgs.fetchFromGitHub {
rev = "v" + version; owner = "linien-org";
sha256 = "sha256-j6oiP/usLfV5HZtKLcXQ5pHhhxRG05kP2FMwingiWm0="; repo = "linien";
rev = "v" + version;
sha256 = "sha256-j6oiP/usLfV5HZtKLcXQ5pHhhxRG05kP2FMwingiWm0=";
};
prePatch = ''
mkdir -p fast_servo/gateware
cp -r ${./fast-servo/linien-gateware}/. fast_servo/gateware
'';
patches = [
./fast-servo/linien-client-ssh-port-change.patch
./fast-servo/linien-server-fast-servo.patch
./fast-servo/linien-gateware-fast-servo.patch
./fast-servo/autolock_pipeline.patch
./fast-servo/iir_pipeline.patch
./fast-servo/linien_module_pipeline.patch
./fast-servo/pid_pipeline.patch
./fast-servo/pid_err_sig_pipeline.patch
];
}; };
patched-not-os = pkgs.applyPatches { patched-not-os = pkgs.applyPatches {
@ -158,6 +175,62 @@
]; ];
}; };
linien-common = pkgs.python3Packages.buildPythonPackage rec {
pname = "linien-common";
inherit version;
pyproject = true;
src = linien-src;
sourceRoot = "${src.name}/linien-common";
preBuild = ''
export HOME=$(mktemp -d)
'';
nativeBuildInputs = [ pkgs.python3Packages.setuptools ];
pythonRelaxDeps = [ "importlib-metadata" ];
propagatedBuildInputs = with pkgs.python3Packages; [
importlib-metadata
numpy
rpyc
scipy
appdirs
];
pythonImportsCheck = [ "linien_common" ];
};
linien-common-armv7l = pkgs-armv7l.python3Packages.buildPythonPackage rec {
pname = "linien-common-armv7l";
inherit version;
pyproject = true;
src = linien-src;
sourceRoot = "${src.name}/linien-common";
preBuild = ''
export HOME=$(mktemp -d)
'';
nativeBuildInputs = [ pkgs-armv7l.python3Packages.setuptools ];
pythonRelaxDeps = [ "importlib-metadata" ];
propagatedBuildInputs = with pkgs-armv7l.python3Packages; [
importlib-metadata
numpy
rpyc
scipy
appdirs
];
pythonImportsCheck = [ "linien_common" ];
};
linien-client = pkgs.python3Packages.buildPythonPackage rec { linien-client = pkgs.python3Packages.buildPythonPackage rec {
pname = "linien-client"; pname = "linien-client";
inherit version; inherit version;
@ -173,17 +246,12 @@
nativeBuildInputs = [ pkgs.python3Packages.setuptools ]; nativeBuildInputs = [ pkgs.python3Packages.setuptools ];
patches = [
./fast-servo/linien-client-ssh-port-change.patch
];
doInstallCheck = false; doInstallCheck = false;
doCheck = false; doCheck = false;
propagatedBuildInputs = with pkgs.python3Packages; [ propagatedBuildInputs = with pkgs.python3Packages; [
fabric fabric
typing-extensions typing-extensions
linien-common ] ++ [ linien-common ];
];
pythonImportsCheck = [ "linien_client" ]; pythonImportsCheck = [ "linien_client" ];
@ -234,9 +302,6 @@
pyproject = true; pyproject = true;
sourceRoot = "${src.name}/linien-server"; sourceRoot = "${src.name}/linien-server";
patches = [
./fast-servo/linien-server-fast-servo.patch
];
postPatch = '' postPatch = ''
cp ${fast-servo-gateware}/csrmap.py linien_server/csrmap.py cp ${fast-servo-gateware}/csrmap.py linien_server/csrmap.py
@ -250,8 +315,8 @@
fire fire
influxdb-client influxdb-client
pylpsd pylpsd
linien-common
] ++ [ ] ++ [
linien-common-armv7l
cma cma
pyrp3 pyrp3
]; ];
@ -259,19 +324,7 @@
fast-servo-gateware = pkgs.stdenv.mkDerivation rec { fast-servo-gateware = pkgs.stdenv.mkDerivation rec {
name = "fast-servo-gateware"; name = "fast-servo-gateware";
inherit (pkgs.python3Packages.linien-common) src; src = linien-src;
prePatch = ''
mkdir -p fast_servo/gateware
cp -r ${./fast-servo/linien-gateware}/. fast_servo/gateware
'';
patches = [
fast-servo/linien-gateware-fast-servo.patch
fast-servo/autolock_pipeline.patch
fast-servo/iir_pipeline.patch
fast-servo/linien_module_pipeline.patch
fast-servo/pid_pipeline.patch
fast-servo/pid_err_sig_pipeline.patch
];
nativeBuildInputs = [ nativeBuildInputs = [
(pkgs.python3.withPackages(ps: [ (pkgs.python3.withPackages(ps: [
migen misoc migen misoc
@ -585,10 +638,9 @@
in rec { in rec {
devShell.x86_64-linux = pkgs.mkShell { devShell.x86_64-linux = pkgs.mkShell {
name = "nix-servo-dev_shell"; name = "nix-servo-dev_shell";
buildInputs = with pkgs.python3Packages; [ buildInputs = with pkgs.python3Packages; [
linien-common
matplotlib matplotlib
] ++ [ linien-client linien-gui ]; ] ++ [ linien-common linien-client linien-gui ];
}; };
packages.x86_64-linux = { packages.x86_64-linux = {