Skip to content

Commit

Permalink
refactor: (std) update format
Browse files Browse the repository at this point in the history
  • Loading branch information
GTrunSec committed Oct 30, 2023
1 parent 5d8d05c commit fa24d68
Show file tree
Hide file tree
Showing 38 changed files with 946 additions and 1,163 deletions.
19 changes: 18 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 28 additions & 12 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,27 +1,43 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs-julia.url = "github:NixOS/nixpkgs/?ref=refs/pull/225513/head";
call-flake.url = "github:divnix/call-flake";
};
outputs = inputs: let
std = inputs.call-flake ./nix/std;
outputs =
inputs:
let
std = inputs.call-flake ./nix/std;
eachSystem = inputs.nixpkgs.lib.genAttrs [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
in (eachSystem (system: std.${system})) // {
inherit (std) lib packages devShells overlays;
templates = {
devshell = {
description = "The devshell template which contains several Julia Packages";
path = ./templates/dev;
src = std.inputs.omnibus.inputs.flops.haumea.pops.default.setInit {
load = {
src = ./nix/src;
inputs = std.inputs // inputs;
};
};
jlrs = {
description = "The tempalte which contains jlrs development of Nix";
path = ./templates/jlrs;
in
(eachSystem (system: std.${system}))
// {
inherit (std)
lib
packages
devShells
overlays
;
templates = {
devshell = {
description = "The devshell template which contains several Julia Packages";
path = ./templates/dev;
};
jlrs = {
description = "The tempalte which contains jlrs development of Nix";
path = ./templates/jlrs;
};
};
};
};
}
6 changes: 1 addition & 5 deletions nix/std/cells/julia2nix/compiler/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
{
inputs,
cell,
}: {
}
{ inputs, cell }: { }
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
inputs,
cell,
}: let
{ inputs, cell }:
let
inherit (inputs) nixpkgs;
l = inputs.nixpkgs.lib // builtins;
inherit (nixpkgs) stdenv;
Expand All @@ -26,24 +24,36 @@
chmod +x $out/bin/*.jl
'';
package = cell.lib.julia-wrapped {
makeWrapperArgs = [
"--add-flags --compile=min"
];
makeWrapperArgs = [ "--add-flags --compile=min" ];
};
};
in {
configs =
let
inputs' = (inputs.omnibus.pops.flake.setSystem nixpkgs.system).inputs;
in
inputs.omnibus.pops.configs.addLoadExtender { load.inputs.inputs = inputs'; };
inherit (configs.layouts.default) treefmt lefthook conform;
in
{
inherit juliaFormatter;

# treefmt = std-data-collection.data.configs.treefmt {
# data.formatter.prettier = {
# excludes = ["Manifest.toml" "Project.toml" "generated.json" "julia2nix.toml"];
# };
# data.formatter.nix = {
# excludes = ["generated.nix"];
# };
# data.formatter.julia = l.mkIf stdenv.isLinux {
# command = "${juliaFormatter}/bin/format.jl";
# includes = ["*.jl"];
# };
# };
treefmt = treefmt // {
custom = {
data.formatter.prettier = {
excludes = [
"Manifest.toml"
"Project.toml"
"generated.json"
"julia2nix.toml"
];
};
data.formatter.nix = {
excludes = [ "generated.nix" ];
};
data.formatter.julia = l.mkIf stdenv.isLinux {
command = "${juliaFormatter}/bin/format.jl";
includes = [ "*.jl" ];
};
};
};
}
File renamed without changes.
7 changes: 3 additions & 4 deletions nix/std/cells/julia2nix/devshellProfiles/checks.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{ inputs, cell }:
{
inputs,
cell,
}: {
config,
lib,
pkgs,
...
}: {
}:
{
commands = [
{
name = "checks-GR";
Expand Down
7 changes: 3 additions & 4 deletions nix/std/cells/julia2nix/devshellProfiles/default.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{ inputs, cell }@args:
let
in
{
inputs,
cell,
} @ args: let
in {
packages = import ./packages.nix args;
checks = import ./checks.nix args;
dev = import ./dev.nix args;
Expand Down
9 changes: 4 additions & 5 deletions nix/std/cells/julia2nix/devshellProfiles/dev.nix
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
{ inputs, cell }:
{
inputs,
cell,
}: {
config,
lib,
pkgs,
...
}: {
}:
{
commands = lib.optionals pkgs.stdenv.buildPlatform.isLinux [
{
name = "jlfmt";
category = "dev";
help = "Julia formatter";
command = ''
${cell.nixago.juliaFormatter}/bin/format.jl "$@"
${cell.configs.juliaFormatter}/bin/format.jl "$@"
'';
}
];
Expand Down
23 changes: 12 additions & 11 deletions nix/std/cells/julia2nix/devshellProfiles/nightly.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{ inputs, cell }:
{
inputs,
cell,
}: {
config,
lib,
pkgs,
...
}: {
commands = lib.optionals (pkgs.system != "x86_64-darwin") [
# {
# name = "julia-nightly";
# command = "${cell.packages.julia_nightly-bin}/bin/julia";
# help = "julia nightly version";
# }
];
}:
{
commands =
lib.optionals (pkgs.system != "x86_64-darwin")
[
# {
# name = "julia-nightly";
# command = "${cell.packages.julia_nightly-bin}/bin/julia";
# help = "julia nightly version";
# }
];
}
18 changes: 9 additions & 9 deletions nix/std/cells/julia2nix/devshellProfiles/packages.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
{ inputs, cell }:
{
inputs,
cell,
}: {
config,
lib,
pkgs,
...
}: let
}:
let
inherit (cell) packages;
in {
in
{
commands =
[
]
[ ]
++ lib.optionals (pkgs.system == "x86_64-darwin") [
{
# FIXME: 1.8.0 init issue
Expand All @@ -37,8 +36,9 @@ in {
}
];

packages = with pkgs;
lib.optionals pkgs.stdenv.isLinux []
packages =
with pkgs;
lib.optionals pkgs.stdenv.isLinux [ ]
++ [
alejandra
nixUnstable
Expand Down
7 changes: 3 additions & 4 deletions nix/std/cells/julia2nix/devshellProfiles/update.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{ inputs, cell }:
{
inputs,
cell,
}: {
config,
lib,
pkgs,
...
}: {
}:
{
commands = [
{
name = "nvfetcher-update";
Expand Down
31 changes: 13 additions & 18 deletions nix/std/cells/julia2nix/devshells/default.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
inputs,
cell,
} @ args: let
{ inputs, cell }@args:
let
l = nixpkgs.lib // builtins;
inherit (std) lib;
inherit (inputs) nixpkgs std self;
in
l.mapAttrs (_: std.lib.dev.mkShell) {
default = {extraModulesPath, ...}: {
l.mapAttrs (_: std.lib.dev.mkShell) {
default =
{ extraModulesPath, ... }:
{
name = "Julia2Nix";

git.hooks = {
Expand All @@ -15,7 +16,9 @@ in
};

nixago = [
# cell.nixago.treefmt
(lib.dev.mkNixago std.lib.cfg.treefmt cell.configs.treefmt.default
cell.configs.treefmt.custom
)
];

imports =
Expand Down Expand Up @@ -65,15 +68,7 @@ in
}
];
};
packages = {pkgs, ...}: {
imports = [
cell.devshellProfiles.packages
];
};
packages = { pkgs, ... }: { imports = [ cell.devshellProfiles.packages ]; };

update = {...}: {
imports = [
cell.devshellProfiles.update
];
};
}
update = { ... }: { imports = [ cell.devshellProfiles.update ]; };
}
Loading

0 comments on commit fa24d68

Please sign in to comment.