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
--- a/linien_client/deploy.py
+++ b/linien_client/deploy.py
--- a/linien-client/linien_client/deploy.py
+++ b/linien-client/linien_client/deploy.py
@@ -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
--- a/linien_server/cli.py
+++ b/linien_server/cli.py
--- a/linien-server/linien_server/cli.py
+++ b/linien-server/linien_server/cli.py
@@ -83,18 +83,9 @@ class LinienServerCLI:
else:
control = RedPitayaControlService(host=host)

112
flake.nix
View File

@ -15,11 +15,28 @@
fsbl-support = ./fast-servo/fsbl-support;
version = "2.1.0";
linien-src = pkgs.fetchFromGitHub {
owner = "linien-org";
repo = "linien";
rev = "v" + version;
sha256 = "sha256-j6oiP/usLfV5HZtKLcXQ5pHhhxRG05kP2FMwingiWm0=";
linien-src = pkgs.applyPatches {
name = "linien-src";
src = pkgs.fetchFromGitHub {
owner = "linien-org";
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 {
@ -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 {
pname = "linien-client";
inherit version;
@ -173,17 +246,12 @@
nativeBuildInputs = [ pkgs.python3Packages.setuptools ];
patches = [
./fast-servo/linien-client-ssh-port-change.patch
];
doInstallCheck = false;
doCheck = false;
propagatedBuildInputs = with pkgs.python3Packages; [
fabric
typing-extensions
linien-common
];
] ++ [ linien-common ];
pythonImportsCheck = [ "linien_client" ];
@ -234,9 +302,6 @@
pyproject = true;
sourceRoot = "${src.name}/linien-server";
patches = [
./fast-servo/linien-server-fast-servo.patch
];
postPatch = ''
cp ${fast-servo-gateware}/csrmap.py linien_server/csrmap.py
@ -250,8 +315,8 @@
fire
influxdb-client
pylpsd
linien-common
] ++ [
linien-common-armv7l
cma
pyrp3
];
@ -259,19 +324,7 @@
fast-servo-gateware = pkgs.stdenv.mkDerivation rec {
name = "fast-servo-gateware";
inherit (pkgs.python3Packages.linien-common) 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
];
src = linien-src;
nativeBuildInputs = [
(pkgs.python3.withPackages(ps: [
migen misoc
@ -586,9 +639,8 @@
devShell.x86_64-linux = pkgs.mkShell {
name = "nix-servo-dev_shell";
buildInputs = with pkgs.python3Packages; [
linien-common
matplotlib
] ++ [ linien-client linien-gui ];
] ++ [ linien-common linien-client linien-gui ];
};
packages.x86_64-linux = {