Skip to content

Commit 5493dd8

Browse files
committed
chore: Suggestions from review
- Filter out non-source files from llama-scripts flake derivation - Clean up unused closure - Remove scripts devShell
1 parent 665d143 commit 5493dd8

File tree

3 files changed

+32
-14
lines changed

3 files changed

+32
-14
lines changed

.devops/nix/devshells.nix

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22
perSystem =
33
{ config, lib, ... }:
44
{
5-
devShells = lib.concatMapAttrs (name: package: {
6-
${name} = package.passthru.shell;
7-
}) config.packages;
5+
devShells = lib.pipe (config.packages) [
6+
(lib.concatMapAttrs
7+
(name: package: {
8+
${name} = package.passthru.shell or null;
9+
}))
10+
(lib.filterAttrs (name: value: value != null))
11+
];
812
};
913
}
14+

.devops/nix/package.nix

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ let
7171
) ", accelerated with ${strings.concatStringsSep ", " suffices}";
7272

7373
executableSuffix = effectiveStdenv.hostPlatform.extensions.executable;
74-
mapToPythonPackages = ps: packages: map (package: ps.${package}) packages;
7574

7675
xcrunHost = runCommand "xcrunHost" { } ''
7776
mkdir -p $out/bin
@@ -125,14 +124,13 @@ effectiveStdenv.mkDerivation (finalAttrs: {
125124
filter =
126125
name: type:
127126
let
128-
noneOf = builtins.all (x: !x);
129-
baseName = baseNameOf name;
127+
any = builtins.any (x: x);
128+
baseName = builtins.baseNameOf name;
130129
in
131-
noneOf [
132-
(lib.hasSuffix ".nix" name) # Ignore *.nix files when computing outPaths
133-
(lib.hasSuffix ".md" name) # Ignore *.md changes whe computing outPaths
134-
(lib.hasPrefix "." baseName) # Skip hidden files and directories
135-
(baseName == "flake.lock")
130+
any [
131+
(lib.hasSuffix ".py" name)
132+
(baseName == "README.md")
133+
(baseName == "pyproject.toml")
136134
];
137135
src = lib.cleanSource ../../.;
138136
};

.devops/nix/python-scripts.nix

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,27 @@ in
2323

2424
buildPythonPackage ({
2525
pname = "llama-scripts";
26-
src = ../../.;
2726
version = "0.0.0";
2827
pyproject = true;
28+
29+
# NOTE: The files filtered out here are not visible in the build sandbox, neither
30+
# do they affect the output hash. They can be modified without triggering a rebuild.
31+
src = lib.cleanSourceWith {
32+
filter =
33+
name: type:
34+
let
35+
any = builtins.any (x: x);
36+
baseName = builtins.baseNameOf name;
37+
in
38+
any [
39+
(lib.hasSuffix ".py" name)
40+
(baseName == "README.md")
41+
(baseName == "pyproject.toml")
42+
];
43+
src = lib.cleanSource ../../.;
44+
};
2945
nativeBuildInputs = [ poetry-core ];
30-
projectDir = ../../.;
31-
propagatedBuildInputs = llama-python-deps;
46+
dependencies = llama-python-deps;
3247

3348
passthru = {
3449
shell = mkShell {

0 commit comments

Comments
 (0)