1

reformat using alejandra

This commit is contained in:
2023-01-18 14:00:02 +01:00
parent 3ad68f24d6
commit eb44696de3
43 changed files with 1283 additions and 1095 deletions

152
env/c_cxx.nix vendored
View File

@ -5,80 +5,84 @@
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.devshell.url = "github:numtide/devshell";
outputs = { self, nixpkgs, flake-utils, devshell }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true; # For clion
overlays = [ devshell.overlay ];
};
outputs = {
self,
nixpkgs,
flake-utils,
devshell,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true; # For clion
overlays = [devshell.overlay];
};
# NOTE: Usual 64 bit compilers that don't collide
bintools = pkgs.wrapBintoolsWith {
bintools = pkgs.bintools.bintools;
libc = pkgs.glibc;
};
gcc12 = pkgs.hiPrio (pkgs.wrapCCWith {
cc = pkgs.gcc12.cc;
libc = pkgs.glibc;
bintools = bintools;
});
clang14 = pkgs.wrapCCWith {
cc = pkgs.clang_14.cc;
libc = pkgs.glibc;
bintools = bintools;
};
# NOTE: Multilib compilers that don't collide
bintools_multi = pkgs.wrapBintoolsWith {
bintools = pkgs.bintools.bintools; # Get the unwrapped bintools from the wrapper
libc = pkgs.glibc_multi;
};
gcc12_multi = pkgs.hiPrio (pkgs.wrapCCWith {
cc = pkgs.gcc12.cc; # Get the unwrapped gcc from the wrapper
libc = pkgs.glibc_multi;
bintools = bintools_multi;
});
clang14_multi = pkgs.wrapCCWith {
cc = pkgs.clang_14.cc;
libc = pkgs.glibc_multi;
bintools = bintools_multi;
};
in {
# devShell = pkgs.devshell.mkShell ...
devShell = pkgs.devshell.mkShell {
name = "";
packages = with pkgs; [
# Compilers
bintools
gcc12
clang14
# bintools_multi
# gcc12_multi
# clang14_multi
# Native buildinputs
gnumake
cmake
nasm
# Development
jetbrains.clion
bear # To generate compilation database
gdb
cling # To try out my bullshit implementations
# doxygen # Generate docs + graphs
];
commands = [
{
name = "ide";
help = "Run clion for project";
command = "clion &>/dev/null ./ &";
}
];
};
# NOTE: Usual 64 bit compilers that don't collide
bintools = pkgs.wrapBintoolsWith {
bintools = pkgs.bintools.bintools;
libc = pkgs.glibc;
};
gcc12 = pkgs.hiPrio (pkgs.wrapCCWith {
cc = pkgs.gcc12.cc;
libc = pkgs.glibc;
bintools = bintools;
});
clang14 = pkgs.wrapCCWith {
cc = pkgs.clang_14.cc;
libc = pkgs.glibc;
bintools = bintools;
};
# NOTE: Multilib compilers that don't collide
bintools_multi = pkgs.wrapBintoolsWith {
bintools = pkgs.bintools.bintools; # Get the unwrapped bintools from the wrapper
libc = pkgs.glibc_multi;
};
gcc12_multi = pkgs.hiPrio (pkgs.wrapCCWith {
cc = pkgs.gcc12.cc; # Get the unwrapped gcc from the wrapper
libc = pkgs.glibc_multi;
bintools = bintools_multi;
});
clang14_multi = pkgs.wrapCCWith {
cc = pkgs.clang_14.cc;
libc = pkgs.glibc_multi;
bintools = bintools_multi;
};
in {
# devShell = pkgs.devshell.mkShell ...
devShell = pkgs.devshell.mkShell {
name = "";
packages = with pkgs; [
# Compilers
bintools
gcc12
clang14
# bintools_multi
# gcc12_multi
# clang14_multi
# Native buildinputs
gnumake
cmake
nasm
# Development
jetbrains.clion
bear # To generate compilation database
gdb
cling # To try out my bullshit implementations
# doxygen # Generate docs + graphs
];
commands = [
{
name = "ide";
help = "Run clion for project";
command = "clion &>/dev/null ./ &";
}
];
};
});
}

55
env/python.nix vendored
View File

@ -5,37 +5,42 @@
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.devshell.url = "github:numtide/devshell";
outputs = { self, nixpkgs, flake-utils, devshell }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [ devshell.overlay ];
};
outputs = {
self,
nixpkgs,
flake-utils,
devshell,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [devshell.overlay];
};
myPython = pkgs.python310.withPackages (p: with p; [
myPython = pkgs.python310.withPackages (p:
with p; [
rich
numpy
scipy
matplotlib
]);
in {
devShell = pkgs.devshell.mkShell {
name = "";
in {
devShell = pkgs.devshell.mkShell {
name = "";
packages = with pkgs; [
myPython
];
packages = with pkgs; [
myPython
];
# Use $1 for positional args
commands = [
# {
# name = "";
# help = "";
# command = "";
# }
];
};
});
# Use $1 for positional args
commands = [
# {
# name = "";
# help = "";
# command = "";
# }
];
};
});
}

101
env/python_pytorch.nix vendored
View File

@ -5,39 +5,44 @@
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.devshell.url = "github:numtide/devshell";
outputs = { self, nixpkgs, flake-utils, devshell }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [ devshell.overlay ];
outputs = {
self,
nixpkgs,
flake-utils,
devshell,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [devshell.overlay];
};
# TODO: Originally it was nixpkgs.fetchurl but that didn't work, pkgs.fetchurl did...
# Determine the difference between nixpkgs and pkgs
# NOTE: These packages have to be updated manually!
# Taken from: https://github.com/gbtb/nix-stable-diffusion/blob/master/flake.nix
# Overlay: https://nixos.wiki/wiki/Overlays
# FetchURL: https://ryantm.github.io/nixpkgs/builders/fetchers/
torch-rocm = pkgs.hiPrio (pkgs.python310Packages.torch-bin.overrideAttrs (old: {
src = pkgs.fetchurl {
name = "torch-1.12.1+rocm5.1.1-cp310-cp310-linux_x86_64.whl";
url = "https://download.pytorch.org/whl/rocm5.1.1/torch-1.12.1%2Brocm5.1.1-cp310-cp310-linux_x86_64.whl";
hash = "sha256-kNShDx88BZjRQhWgnsaJAT8hXnStVMU1ugPNMEJcgnA=";
};
}));
torchvision-rocm = pkgs.hiPrio (pkgs.python310Packages.torchvision-bin.overrideAttrs (old: {
src = pkgs.fetchurl {
name = "torchvision-0.13.1+rocm5.1.1-cp310-cp310-linux_x86_64.whl";
url = "https://download.pytorch.org/whl/rocm5.1.1/torchvision-0.13.1%2Brocm5.1.1-cp310-cp310-linux_x86_64.whl";
hash = "sha256-mYk4+XNXU6rjpgWfKUDq+5fH/HNPQ5wkEtAgJUDN/Jg=";
};
}));
# TODO: Originally it was nixpkgs.fetchurl but that didn't work, pkgs.fetchurl did...
# Determine the difference between nixpkgs and pkgs
# NOTE: These packages have to be updated manually!
# Taken from: https://github.com/gbtb/nix-stable-diffusion/blob/master/flake.nix
# Overlay: https://nixos.wiki/wiki/Overlays
# FetchURL: https://ryantm.github.io/nixpkgs/builders/fetchers/
torch-rocm = pkgs.hiPrio (pkgs.python310Packages.torch-bin.overrideAttrs (old: {
src = pkgs.fetchurl {
name = "torch-1.12.1+rocm5.1.1-cp310-cp310-linux_x86_64.whl";
url = "https://download.pytorch.org/whl/rocm5.1.1/torch-1.12.1%2Brocm5.1.1-cp310-cp310-linux_x86_64.whl";
hash = "sha256-kNShDx88BZjRQhWgnsaJAT8hXnStVMU1ugPNMEJcgnA=";
};
}));
torchvision-rocm = pkgs.hiPrio (pkgs.python310Packages.torchvision-bin.overrideAttrs (old: {
src = pkgs.fetchurl {
name = "torchvision-0.13.1+rocm5.1.1-cp310-cp310-linux_x86_64.whl";
url = "https://download.pytorch.org/whl/rocm5.1.1/torchvision-0.13.1%2Brocm5.1.1-cp310-cp310-linux_x86_64.whl";
hash = "sha256-mYk4+XNXU6rjpgWfKUDq+5fH/HNPQ5wkEtAgJUDN/Jg=";
};
}));
myPython = pkgs.python310.withPackages (p: with p; [
myPython = pkgs.python310.withPackages (p:
with p; [
# Basic
rich
@ -48,23 +53,23 @@
matplotlib
nltk
]);
in {
devShell = pkgs.devshell.mkShell {
name = "Machine Learning Environment";
in {
devShell = pkgs.devshell.mkShell {
name = "Machine Learning Environment";
packages = with pkgs; [
myPython
nodePackages.pyright # LSP
];
packages = with pkgs; [
myPython
nodePackages.pyright # LSP
];
# Use $1 for positional args
commands = [
# {
# name = "";
# help = "";
# command = "";
# }
];
};
});
# Use $1 for positional args
commands = [
# {
# name = "";
# help = "";
# command = "";
# }
];
};
});
}

93
env/rust.nix vendored
View File

@ -6,54 +6,59 @@
inputs.devshell.url = "github:numtide/devshell";
inputs.rust-overlay.url = "github:oxalica/rust-overlay";
outputs = { self, nixpkgs, flake-utils, devshell, rust-overlay }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true; # For clion
overlays = [
devshell.overlay
rust-overlay.overlays.default
];
};
outputs = {
self,
nixpkgs,
flake-utils,
devshell,
rust-overlay,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true; # For clion
overlays = [
devshell.overlay
rust-overlay.overlays.default
];
};
# Includes cargo, rustc, rustfmt
rust-stable = pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" ]; # Include the rust stdlib source for intellij
};
in {
devShell = pkgs.devshell.mkShell {
name = "Rust development shell";
# Includes cargo, rustc, rustfmt
rust-stable = pkgs.rust-bin.stable.latest.default.override {
extensions = ["rust-src"]; # Include the rust stdlib source for intellij
};
in {
devShell = pkgs.devshell.mkShell {
name = "Rust development shell";
packages = with pkgs; [
rust-stable
rust-analyzer
packages = with pkgs; [
rust-stable
rust-analyzer
jetbrains.clion
];
jetbrains.clion
];
env = [
# Allow for intellij to find the stdlib
# {
# name = "RUST_SRC_PATH";
# value = "${rust-stable}/lib/rustlib/src/rust/library";
# }
env = [
# Allow for intellij to find the stdlib
# {
# name = "RUST_SRC_PATH";
# value = "${rust-stable}/lib/rustlib/src/rust/library";
# }
# Use this if the rust binary needs additional libraries
# {
# name = "LD_LIBRARY_PATH";
# value = "${pkgs.xorg.libX11}/lib:${pkgs.xorg.libXcursor}/lib:${pkgs.xorg.libXrandr}/lib:${pkgs.xorg.libXi}/lib:${pkgs.libGL}/lib";
# }
];
# Use this if the rust binary needs additional libraries
# {
# name = "LD_LIBRARY_PATH";
# value = "${pkgs.xorg.libX11}/lib:${pkgs.xorg.libXcursor}/lib:${pkgs.xorg.libXrandr}/lib:${pkgs.xorg.libXi}/lib:${pkgs.libGL}/lib";
# }
];
commands = [
{
name = "ide";
help = "Run clion for project";
command = "clion &>/dev/null ./ &";
}
];
};
});
commands = [
{
name = "ide";
help = "Run clion for project";
command = "clion &>/dev/null ./ &";
}
];
};
});
}