Skip to content

Commit

Permalink
refac(cross): fluidattacks#1378 deprecate internal builtins
Browse files Browse the repository at this point in the history
- Deprecate calculateCvss3
- Deprecate chunks
- Deprecate escapeShellArg
- Deprecate escapeShellArgs
- Deprecate filterAttrs
- Deprecate flatten
- Deprecate fromToml
- Deprecate makeDerivationParallel
- Deprecate makeNomadEnvironment
- Deprecate sortAscii
- Deprecate sortAsciiCaseless
- Adapt source code
- Remove documentation
- Remove CI jobs

Signed-off-by: Daniel Salazar <[email protected]>
  • Loading branch information
dsalaza4 committed Dec 13, 2024
1 parent 208c374 commit 9fb257a
Show file tree
Hide file tree
Showing 20 changed files with 12 additions and 359 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -308,22 +308,6 @@ jobs:
- name: /testLicense
run: nix-env -if . && m . /testLicense

linux_tests_calculateCvss3:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- uses: docker://docker.io/nixos/nix@sha256:c3db4c484f6b1ee6c9bb8ca90307cfbeca8ef88156840911356a677eeaff4845
name: /tests/calculateCvss3
with:
args: sh -c "chown -R root:root /github/workspace && nix-env -if . && m . /tests/calculateCvss3"
macos_tests_calculateCvss3:
runs-on: macos-latest
steps:
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- uses: cachix/install-nix-action@6ed004b9ccb68dbc28e7c85bee15fa93dbd214ac
- name: /tests/calculateCvss3
run: nix-env -if . && m . /tests/calculateCvss3

linux_tests_makeSearchPaths:
runs-on: ubuntu-latest
steps:
Expand Down
20 changes: 0 additions & 20 deletions .github/workflows/prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -456,26 +456,6 @@ jobs:
- name: /testLicense
run: nix-env -if . && m . /testLicense

linux_tests_calculateCvss3:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- uses: docker://docker.io/nixos/nix@sha256:c3db4c484f6b1ee6c9bb8ca90307cfbeca8ef88156840911356a677eeaff4845
name: /tests/calculateCvss3
with:
args: sh -c "chown -R root:root /github/workspace && nix-env -if . && m . /tests/calculateCvss3"
env:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
macos_tests_calculateCvss3:
runs-on: macos-latest
steps:
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
- uses: cachix/install-nix-action@6ed004b9ccb68dbc28e7c85bee15fa93dbd214ac
- name: /tests/calculateCvss3
run: nix-env -if . && m . /tests/calculateCvss3
env:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}

linux_tests_makeSearchPaths:
runs-on: ubuntu-latest
steps:
Expand Down
55 changes: 0 additions & 55 deletions docs/src/api/extensions/format-conversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,61 +54,6 @@ Example:
[INFO] Tickets is: 3
```

## fromToml

Convert a TOML formatted string
to a Nix expression.

Types:

- fromToml (`function str -> anything`):
- (`str`):
TOML formatted string to convert.

Example:

=== "main.nix"

```nix
# /path/to/my/project/makes/example/main.nix
{
fromToml,
makeDerivation,
...
}:
let
data = fromToml ''
[example]
name = "John"
lastName = "Doe"
tickets = 3
'';
in
makeDerivation {
env = {
envName = data.example.name;
envLastName = data.example.lastName;
envTickets = data.example.tickets;
};
builder = ''
info "Name is: $envName"
info "Last name is: $envLastName"
info "Tickets is: $envTickets"
'';
name = "example";
}
```

=== "Invocation"

```bash
$ m . /example

[INFO] Name is: John
[INFO] Last name is: Doe
[INFO] Tickets is: 3
```

## fromYaml

Convert a YAML formatted string
Expand Down
87 changes: 0 additions & 87 deletions docs/src/api/extensions/others.md
Original file line number Diff line number Diff line change
@@ -1,90 +1,3 @@
## calculateCvss3

Calculate [CVSS3](https://www.first.org/cvss/v3.0/specification-document)
score and severity for a
[CVSS3 Vector String](https://www.first.org/cvss/v3.0/specification-document#Vector-String).

Types:

- calculateCvss3 (`function str -> package`):
- (`str`):
CVSS3 Vector String
to calculate.

Example:

=== "main.nix"

```nix
# /path/to/my/project/makes/example/main.nix
{
makeScript,
calculateCvss3,
...
}:
makeScript {
replace = {
__argCalculate__ = calculateCvss3
"CVSS:3.0/S:C/C:H/I:H/A:N/AV:P/AC:H/PR:H/UI:R/E:H/RL:O/RC:R/CR:H/IR:X/AR:X/MAC:H/MPR:X/MUI:X/MC:L/MA:X";
};
entrypoint = ''
cat "__argCalculate__"
'';
name = "example";
}
```

=== "Invocation"

```bash
$ m . /example

{"score": {"base": 6.5, "temporal": 6.0, "environmental": 5.3}, "severity": {"base": "Medium", "temporal": "Medium", "environmental": "Medium"}}
```

## chunks

Split a given list into N chunks
for workload distributed parallelization.

Types:

- chunks (`function list, ints.positive -> listOf (listOf Any)`):
- (`list`):
List to split into chunks.
- (`ints.positive`):
Number of chunks to create from list.

Example:

=== "main.nix"

```nix
{
chunks,
inputs,
makeDerivation,
makeDerivationParallel,
...
}: let
numbers = [0 1 2 3 4 5 6 7 8 9];
myChunks = chunks numbers 3; # [[0 1 2 3] [4 5 6] [7 8 9]]

buildNumber = n: makeDerivation {
name = "build-number-${n}";
env.envNumber = n;
builder = ''
echo "$envNumber"
touch "$out"
'';
};
in
makeDerivationParallel {
dependencies = builtins.map buildNumber (inputs.nixpkgs.lib.lists.elemAt myChunks 0);
name = "build-numbers-0";
}
```

## libGit

A small template for doing git kung-fu.
Expand Down
5 changes: 0 additions & 5 deletions makes/tests/calculateCvss3/main.nix

This file was deleted.

32 changes: 0 additions & 32 deletions makes/utils/makePythonLock/update.sh

This file was deleted.

13 changes: 0 additions & 13 deletions src/args/agnostic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,22 @@ let
attrsMapToList = __nixpkgs__.lib.mapAttrsToList;
attrsMerge = builtins.foldl' __nixpkgs__.lib.recursiveUpdate { };
attrsOptional = __nixpkgs__.lib.optionalAttrs;
calculateCvss3 = import ./calculate-cvss-3/default.nix self;
chunks = import ./chunks/default.nix self;
computeOnAwsBatch = import ./compute-on-aws-batch/default.nix self;
deployContainer = import ./deploy-container/default.nix self;
deployContainerManifest =
import ./deploy-container-manifest/default.nix self;
deployTerraform = import ./deploy-terraform/default.nix self;
inherit (__nixpkgs__.lib.strings) escapeShellArg;
inherit (__nixpkgs__.lib.strings) escapeShellArgs;
inherit (__nixpkgs__.lib) fakeSha256;
fetchArchive = import ./fetch-archive/default.nix self;
fetchNixpkgs = import ./fetch-nixpkgs/default.nix self;
fetchRubyGem = import ./fetch-rubygem/default.nix self;
fetchUrl = import ./fetch-url/default.nix self;
inherit (__nixpkgs__.lib) filterAttrs;
inherit (__nixpkgs__.lib.lists) flatten;
formatBash = import ./format-bash/default.nix self;
formatNix = import ./format-nix/default.nix self;
formatTerraform = import ./format-terraform/default.nix self;
formatYaml = import ./format-yaml/default.nix self;
fromJson = builtins.fromJSON;
fromJsonFile = path: builtins.fromJSON (builtins.readFile path);
fromToml = builtins.fromTOML;
fromYaml = import ./from-yaml/default.nix self;
fromYamlFile = path: self.fromYaml (builtins.readFile path);
gitlabCi = import ./gitlab-ci/default.nix;
Expand All @@ -64,13 +57,10 @@ let
inherit (__nixpkgs__.lib.filesystem) listFilesRecursive;
makeContainerImage = import ./make-container-image/default.nix self;
makeDerivation = import ./make-derivation/default.nix self;
makeDerivationParallel =
import ./make-derivation-parallel/default.nix self;
makeDynamoDb = import ./make-dynamodb/default.nix self;
makeEnvVars = import ./make-env-vars/default.nix self;
makeEnvVarsForTerraform =
import ./make-env-vars-for-terraform/default.nix self;
makeNomadEnvironment = import ./make-nomad-environment/default.nix self;
makePythonEnvironment = import ./make-python-environment/default.nix self;
makePythonPoetryEnvironment =
import ./make-python-poetry-environment/default.nix self;
Expand Down Expand Up @@ -106,9 +96,6 @@ let
patchShebangs = import ./patch-shebangs/default.nix self;
pythonOverrideUtils = import ./python-override-utils/default.nix;
inherit (__nixpkgs__.lib) removePrefix;
sortAscii = builtins.sort (a: b: a < b);
sortAsciiCaseless = builtins.sort
(a: b: __nixpkgs__.lib.toLower a < __nixpkgs__.lib.toLower b);
stringCapitalize = import ./string-capitalize/default.nix self;
sublist = import ./sublist/default.nix self;
testLicense = import ./test-license/default.nix self;
Expand Down
7 changes: 0 additions & 7 deletions src/args/calculate-cvss-3/builder.sh

This file was deleted.

39 changes: 0 additions & 39 deletions src/args/calculate-cvss-3/cvss.py

This file was deleted.

18 changes: 0 additions & 18 deletions src/args/calculate-cvss-3/default.nix

This file was deleted.

17 changes: 0 additions & 17 deletions src/args/calculate-cvss-3/poetry.lock

This file was deleted.

15 changes: 0 additions & 15 deletions src/args/calculate-cvss-3/pyproject.toml

This file was deleted.

Loading

0 comments on commit 9fb257a

Please sign in to comment.