Skip to content

Commit

Permalink
Merge pull request #1333 from rohaquinlop/issue-1332
Browse files Browse the repository at this point in the history
feat(back): #1332 use nixfmt
  • Loading branch information
rohaquinlop authored Jun 4, 2024
2 parents 7e7f2ca + d90c9bd commit 7e4ac2b
Show file tree
Hide file tree
Showing 172 changed files with 1,897 additions and 3,649 deletions.
25 changes: 11 additions & 14 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
{system ? builtins.currentSystem}: let
agnostic = import ./src/args/agnostic.nix {inherit system;};
{ system ? builtins.currentSystem }:
let
agnostic = import ./src/args/agnostic.nix { inherit system; };

args =
agnostic
// {
outputs."/cli/env/runtime" =
import ./makes/cli/env/runtime/main.nix args;
outputs."/cli/env/runtime/pypi" =
import ./makes/cli/env/runtime/pypi/main.nix args;
projectPath = import ./src/args/project-path args;
projectSrc = ./.;
};
in
import ./makes/main.nix args
args = agnostic // {
outputs."/cli/env/runtime" = import ./makes/cli/env/runtime/main.nix args;
outputs."/cli/env/runtime/pypi" =
import ./makes/cli/env/runtime/pypi/main.nix args;
projectPath = import ./src/args/project-path args;
projectSrc = ./.;
};
in import ./makes/main.nix args
22 changes: 11 additions & 11 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@

inputs.nixpkgs.url = "github:nix-community/nixpkgs.lib";

outputs = {nixpkgs, ...} @ inputs: let
makeOutputsForSystem = system: {
apps.${system}.default = {
program = "${inputs.self.packages.${system}.default}/bin/m";
type = "app";
};
outputs = { nixpkgs, ... }@inputs:
let
makeOutputsForSystem = system: {
apps.${system}.default = {
program = "${inputs.self.packages.${system}.default}/bin/m";
type = "app";
};

lib.${system} = import ./src/args/agnostic.nix {inherit system;};
lib.${system} = import ./src/args/agnostic.nix { inherit system; };

packages.${system}.default = import ./default.nix {inherit system;};
};
in
builtins.foldl' nixpkgs.lib.recursiveUpdate {}
packages.${system}.default = import ./default.nix { inherit system; };
};
in builtins.foldl' nixpkgs.lib.recursiveUpdate { }
(builtins.map makeOutputsForSystem [
"aarch64-darwin"
"aarch64-linux"
Expand Down
4 changes: 1 addition & 3 deletions makes.lock.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
{
makesSrc = ./.;
}
{ makesSrc = ./.; }
126 changes: 39 additions & 87 deletions makes.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
{
fetchNixpkgs,
fetchUrl,
outputs,
projectPath,
__nixpkgs__,
...
}: {
{ fetchNixpkgs, fetchUrl, outputs, projectPath, __nixpkgs__, ... }: {
projectIdentifier = "makes-repo";
cache = {
readNixos = true;
extra = {
makes = {
enable = true;
pubKey = "makes.cachix.org-1:zO7UjWLTRR8Vfzkgsu1PESjmb6ymy1e4OE9YfMmCQR4=";
pubKey =
"makes.cachix.org-1:zO7UjWLTRR8Vfzkgsu1PESjmb6ymy1e4OE9YfMmCQR4=";
token = "CACHIX_AUTH_TOKEN";
type = "cachix";
url = "https://makes.cachix.org";
Expand Down Expand Up @@ -81,15 +75,10 @@
};
};
dev = {
example = {
bin = [__nixpkgs__.hello];
};
example = { bin = [ __nixpkgs__.hello ]; };
makes = {
bin = [
__nixpkgs__.just
__nixpkgs__.reuse
];
source = [outputs."/cli/env/runtime"];
bin = [ __nixpkgs__.just __nixpkgs__.reuse ];
source = [ outputs."/cli/env/runtime" ];
};
};
envVars = {
Expand All @@ -100,36 +89,28 @@
VAR_NAME = "test";
};
};
envVarsForTerraform = {
example = {
VAR_NAME = "test";
};
};
extendingMakesDirs = ["/makes"];
envVarsForTerraform = { example = { VAR_NAME = "test"; }; };
extendingMakesDirs = [ "/makes" ];
formatBash = {
enable = true;
targets = ["/"];
targets = [ "/" ];
};
formatJavaScript = {
enable = true;
targets = ["/"];
targets = [ "/" ];
};
formatNix = {
enable = true;
targets = ["/"];
};
formatPython = {
default = {
targets = ["/"];
};
targets = [ "/" ];
};
formatPython = { default = { targets = [ "/" ]; }; };
formatTerraform = {
enable = true;
targets = ["/"];
targets = [ "/" ];
};
formatYaml = {
enable = true;
targets = ["/"];
targets = [ "/" ];
};
helloWorld = {
enable = true;
Expand All @@ -143,29 +124,26 @@
};
lintBash = {
enable = true;
targets = ["/"];
targets = [ "/" ];
};
lintGitCommitMsg = {
enable = true;
branch = "main";
parser = "/test/lint-commit-msg/lint-git-commit-msg-parser.js";
config = "/test/lint-commit-msg/lint-git-commit-msg-config.js";
};
lintGitMailMap = {
enable = true;
};
lintGitMailMap = { enable = true; };
lintMarkdown = {
all = {
config = "/test/lint-markdown/config.rb";
targets = ["/"];
targets = [ "/" ];
};
};
lintNix = {
enable = true;
targets = ["/"];
targets = [ "/" ];
};
lintPython = let
searchPaths.source = [outputs."/cli/env/runtime"];
lintPython = let searchPaths.source = [ outputs."/cli/env/runtime" ];
in {
dirsOfModules = {
makes = {
Expand Down Expand Up @@ -194,16 +172,12 @@
};
};
};
lintWithLizard = {
all = ["/"];
};
lintWithLizard = { all = [ "/" ]; };
lintWithAjv = {
"test" = {
schema = "/test/lint-with-ajv/schema.json";
targets = [
"/test/lint-with-ajv/data.json"
"/test/lint-with-ajv/data.yaml"
];
targets =
[ "/test/lint-with-ajv/data.json" "/test/lint-with-ajv/data.yaml" ];
};
};
pipelines = {
Expand All @@ -212,48 +186,36 @@
jobs = [
{
output = "/lintNix";
args = [];
args = [ ];
}
{
output = "/helloWorld";
args = ["1" "2" "3"];
args = [ "1" "2" "3" ];
}
];
};
};
secretsForGpgFromEnv = {
example = ["PGP_PUBLIC" "PGP_PRIVATE"];
};
secretsForGpgFromEnv = { example = [ "PGP_PUBLIC" "PGP_PRIVATE" ]; };
secretsForEnvFromSops = {
example = {
manifest = "/makes/tests/secretsForGpgFromEnv/secrets.yaml";
vars = ["secret"];
vars = [ "secret" ];
};
};
secretsForTerraformFromEnv = {
example = {
test = "VAR_NAME";
};
};
securePythonWithBandit = {
cli.target = "/src/cli/main";
};
secretsForTerraformFromEnv = { example = { test = "VAR_NAME"; }; };
securePythonWithBandit = { cli.target = "/src/cli/main"; };
taintTerraform = {
modules = {
module = {
resources = ["null_resource.example"];
resources = [ "null_resource.example" ];
src = "/test/terraform/module";
version = "1.0";
};
};
};
testLicense = {
enable = true;
};
testLicense = { enable = true; };
testPython = {
example = {
src = "/test/test-python";
};
example = { src = "/test/test-python"; };
cliMain = {
extraFlags = [
"--cov=main"
Expand All @@ -262,16 +224,9 @@
"--capture=no"
];
searchPaths = {
bin = [
__nixpkgs__.git
];
pythonPackage = [
(projectPath "/src/cli/main")
];
source = [
outputs."/cli/env/test"
outputs."/cli/env/runtime"
];
bin = [ __nixpkgs__.git ];
pythonPackage = [ (projectPath "/src/cli/main") ];
source = [ outputs."/cli/env/test" outputs."/cli/env/runtime" ];
};
src = "/src/cli";
};
Expand All @@ -280,13 +235,12 @@
modules = {
default = {
dangerfile = fetchUrl {
url = "https://gitlab.com/fluidattacks/universe/-/raw/7012ee63b6ba5ffebfc82425deb4390cb1d4a1ca/common/test/mr/src/dangerfile.ts";
url =
"https://gitlab.com/fluidattacks/universe/-/raw/7012ee63b6ba5ffebfc82425deb4390cb1d4a1ca/common/test/mr/src/dangerfile.ts";
sha256 = "sha256-OegMHRXwgkRItyxW5SZfcQr21VRIINKhC5mlYa/Rphw=";
};
extraArgs = [
"--config"
(builtins.toJSON {tests = ["onlyOneCommit"];})
];
extraArgs =
[ "--config" (builtins.toJSON { tests = [ "onlyOneCommit" ]; }) ];
};
};
};
Expand All @@ -302,7 +256,5 @@
};
};
};
lintClojure = {
test = ["/test"];
};
lintClojure = { test = [ "/test" ]; };
}
11 changes: 2 additions & 9 deletions makes/cli/env/runtime/main.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
__nixpkgs__,
makeSearchPaths,
outputs,
...
}:
{ __nixpkgs__, makeSearchPaths, outputs, ... }:
makeSearchPaths {
bin = [
__nixpkgs__.cachix
Expand All @@ -14,7 +9,5 @@ makeSearchPaths {
__nixpkgs__.nixVersions.nix_2_15
__nixpkgs__.openssh
];
source = [
outputs."/cli/env/runtime/pypi"
];
source = [ outputs."/cli/env/runtime/pypi" ];
}
2 changes: 1 addition & 1 deletion makes/cli/env/runtime/pypi/main.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{makePythonEnvironment, ...}:
{ makePythonEnvironment, ... }:
makePythonEnvironment {
pythonProjectDir = ./.;
pythonVersion = "3.11";
Expand Down
2 changes: 1 addition & 1 deletion makes/cli/env/test/main.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{makePythonEnvironment, ...}:
{ makePythonEnvironment, ... }:
makePythonEnvironment {
pythonProjectDir = ./.;
pythonVersion = "3.12";
Expand Down
14 changes: 5 additions & 9 deletions makes/container-image/main.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
outputs,
__nixpkgs__,
...
}:
{ outputs, __nixpkgs__, ... }:
__nixpkgs__.dockerTools.buildImage {
config = {
Env = [
Expand Down Expand Up @@ -36,23 +32,23 @@ __nixpkgs__.dockerTools.buildImage {
__nixpkgs__.nixVersions.nix_2_15

# Add /usr/bin/env pointing to /bin/env
(__nixpkgs__.runCommand "user-bin-env" {} ''
(__nixpkgs__.runCommand "user-bin-env" { } ''
mkdir -p $out/usr/bin
ln -s $(command -v env) $out/usr/bin/env
'')

# Create home directories
(__nixpkgs__.runCommand "home" {} ''
(__nixpkgs__.runCommand "home" { } ''
mkdir -p $out/home/makes
mkdir -p $out/home/root
'')
# Create empty temporary directories
(__nixpkgs__.runCommand "tmp" {} ''
(__nixpkgs__.runCommand "tmp" { } ''
mkdir -p $out/tmp
mkdir -p $out/var/tmp
'')
# Create the working directory
(__nixpkgs__.runCommand "working-directory" {} ''
(__nixpkgs__.runCommand "working-directory" { } ''
mkdir -p $out/working-dir
'')

Expand Down
8 changes: 2 additions & 6 deletions makes/docs/deploy/main.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
makeScript,
outputs,
...
}:
{ makeScript, outputs, ... }:
makeScript {
name = "docs-deploy";
entrypoint = ./entrypoint.sh;
searchPaths.source = [outputs."/docs/runtime"];
searchPaths.source = [ outputs."/docs/runtime" ];
}
Loading

0 comments on commit 7e4ac2b

Please sign in to comment.