forked from clan/clan-core
devshell: remove dependency on clan-cli
This stops the devshell from being re-built constantly, when the source code changes. Based on a new feature in treefmt-nix: https://github.com/numtide/treefmt-nix/pull/208
This commit is contained in:
parent
337a2ea883
commit
c5b8948509
22
checks/devshell/flake-module.nix
Normal file
22
checks/devshell/flake-module.nix
Normal file
@ -0,0 +1,22 @@
|
||||
{ ... }:
|
||||
{
|
||||
perSystem =
|
||||
{ self', pkgs, ... }:
|
||||
{
|
||||
checks.devshell =
|
||||
pkgs.runCommand "check-devshell-not-depends-on-clan-cli"
|
||||
{
|
||||
exportReferencesGraph = [
|
||||
"graph"
|
||||
self'.devShells.default
|
||||
];
|
||||
}
|
||||
''
|
||||
if grep -q "${self'.packages.clan-cli}" ./graph; then
|
||||
echo "devshell depends on clan-cli, which is not allowed";
|
||||
exit 1;
|
||||
fi
|
||||
mkdir $out
|
||||
'';
|
||||
};
|
||||
}
|
@ -1,10 +1,11 @@
|
||||
{ self, ... }:
|
||||
{
|
||||
imports = [
|
||||
./impure/flake-module.nix
|
||||
./backups/flake-module.nix
|
||||
./installation/flake-module.nix
|
||||
./devshell/flake-module.nix
|
||||
./flash/flake-module.nix
|
||||
./impure/flake-module.nix
|
||||
./installation/flake-module.nix
|
||||
];
|
||||
perSystem =
|
||||
{
|
||||
|
@ -38,6 +38,7 @@
|
||||
];
|
||||
shellHook = ''
|
||||
echo -e "${ansiEscapes.green}switch to another dev-shell using: select-shell${ansiEscapes.reset}"
|
||||
export PROJECT_ROOT=$(git rev-parse --show-toplevel)
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
@ -115,11 +115,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1721458737,
|
||||
"narHash": "sha256-wNXLQ/ATs1S4Opg1PmuNoJ+Wamqj93rgZYV3Di7kxkg=",
|
||||
"lastModified": 1722699361,
|
||||
"narHash": "sha256-3GDJCoNj7PEwQaOqmNgcwoHM+Xy/fkgqeXC1y7UzV2U=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "888bfb10a9b091d9ed2f5f8064de8d488f7b7c97",
|
||||
"rev": "07741a9babd0754bf73fb47a6340d6289eabd1d6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -44,7 +44,6 @@
|
||||
"*.yml"
|
||||
];
|
||||
};
|
||||
|
||||
treefmt.programs.mypy.directories =
|
||||
{
|
||||
"pkgs/clan-cli" = {
|
||||
@ -53,8 +52,8 @@
|
||||
};
|
||||
"pkgs/clan-app" = {
|
||||
extraPythonPackages =
|
||||
# clan-app currently only exists on linux
|
||||
(self'.packages.clan-app.externalTestDeps or [ ]) ++ self'.packages.clan-cli.testDependencies;
|
||||
extraPythonPaths = [ "$PROJECT_ROOT/pkgs/clan-cli" ];
|
||||
modules = [ "clan_app" ];
|
||||
};
|
||||
}
|
||||
@ -63,8 +62,8 @@
|
||||
{
|
||||
"pkgs/clan-vm-manager" = {
|
||||
extraPythonPackages =
|
||||
# # clan-app currently only exists on linux
|
||||
self'.packages.clan-vm-manager.testDependencies;
|
||||
self'.packages.clan-vm-manager.externalTestDeps ++ self'.packages.clan-cli.testDependencies;
|
||||
extraPythonPaths = [ "$PROJECT_ROOT/pkgs/clan-cli" ];
|
||||
modules = [ "clan_vm_manager" ];
|
||||
};
|
||||
}
|
||||
|
@ -16,6 +16,10 @@ from clan_app.api import ImplFunc
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def remove_none(_list: list) -> list:
|
||||
return [i for i in _list if i is not None]
|
||||
|
||||
|
||||
# This implements the abstract function open_file with one argument, file_request,
|
||||
# which is a FileRequest object and returns a string or None.
|
||||
class open_file(
|
||||
@ -29,7 +33,7 @@ class open_file(
|
||||
try:
|
||||
gfile = file_dialog.open_finish(task)
|
||||
if gfile:
|
||||
selected_path = [gfile.get_path()]
|
||||
selected_path = remove_none([gfile.get_path()])
|
||||
self.returns(
|
||||
SuccessDataClass(
|
||||
op_key=op_key, data=selected_path, status="success"
|
||||
@ -44,7 +48,7 @@ class open_file(
|
||||
try:
|
||||
gfiles: Any = file_dialog.open_multiple_finish(task)
|
||||
if gfiles:
|
||||
selected_paths = [gfile.get_path() for gfile in gfiles]
|
||||
selected_paths = remove_none([gfile.get_path() for gfile in gfiles])
|
||||
self.returns(
|
||||
SuccessDataClass(
|
||||
op_key=op_key, data=selected_paths, status="success"
|
||||
@ -57,7 +61,7 @@ class open_file(
|
||||
try:
|
||||
gfile = file_dialog.select_folder_finish(task)
|
||||
if gfile:
|
||||
selected_path = [gfile.get_path()]
|
||||
selected_path = remove_none([gfile.get_path()])
|
||||
self.returns(
|
||||
SuccessDataClass(
|
||||
op_key=op_key, data=selected_path, status="success"
|
||||
@ -70,7 +74,7 @@ class open_file(
|
||||
try:
|
||||
gfile = file_dialog.save_finish(task)
|
||||
if gfile:
|
||||
selected_path = [gfile.get_path()]
|
||||
selected_path = remove_none([gfile.get_path()])
|
||||
self.returns(
|
||||
SuccessDataClass(
|
||||
op_key=op_key, data=selected_path, status="success"
|
||||
|
@ -65,6 +65,5 @@ mkShell {
|
||||
|
||||
export XDG_DATA_DIRS=${gtk4}/share/gsettings-schemas/gtk4-4.14.4:$XDG_DATA_DIRS
|
||||
export XDG_DATA_DIRS=${gsettings-desktop-schemas}/share/gsettings-schemas/gsettings-desktop-schemas-46.0:$XDG_DATA_DIRS
|
||||
|
||||
'';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user