Skip to content

Commit

Permalink
chore: format nix code based on rfc166
Browse files Browse the repository at this point in the history
  • Loading branch information
Conni2461 committed May 15, 2024
1 parent 8dc2ca7 commit 9ac8c20
Show file tree
Hide file tree
Showing 25 changed files with 948 additions and 763 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ jobs:
run: "nix-shell -p deadnix --run 'deadnix .'"
- name: statix
run: "nix-shell -p statix --run 'statix check'"
- name: nixfmt
run: "nix-shell -p treefmt nixfmt-rfc-style --run 'treefmt --no-cache --fail-on-change'"
3 changes: 3 additions & 0 deletions .treefmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[formatter.nix]
command = "nixfmt"
includes = ["*.nix"]
263 changes: 139 additions & 124 deletions configuration-light.nix
Original file line number Diff line number Diff line change
@@ -1,64 +1,75 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
{
nixpkgs.overlays = lib.mkBefore (import ./precice-packages);
nixpkgs.config = {
allowUnfree = true;
};
home-manager.users.precice = { pkgs, ... }: {
home.stateVersion = "22.11";
home.file = {
"keyboard-settings" = {
source = "${pkgs.xfce.xfce4-settings.out}/share/applications/xfce-keyboard-settings.desktop";
target = "Desktop/xfce-keyboard-settings.desktop";
};
"precice-desktop-item" = {
source = "${pkgs.makeDesktopItem {
name = "get-started";
desktopName = "Get started";
type = "Link";
url = "https://precice.org/installation-vm.html";
icon = "text-html";
}}/share/applications/get-started.desktop";
target = "Desktop/get-started.desktop";
executable = true;
};
# TODO: precice examples verlinken auf dem desktop
"terminator" = {
source = "${pkgs.terminator}/share/applications/terminator.desktop";
target = "Desktop/terminator.desktop";
};
"terminator-config" = {
text = ''
[profiles]
[[default]]
use_system_font = False
'';
target = ".config/terminator/config";
};
# TODO: fix this
# "vagrant-shared" = {
# source = "/vagrant/";
# target = "Desktop/shared";
# };
# XXX: Untested as the default VM ist too small
"run-vs-code" = {
source = "${pkgs.makeDesktopItem {
name = "run-vs-code";
desktopName = "VS Code";
type = "Application";
exec = pkgs.writeScript "run-vs-code" ''
echo "Downloading and starting vscode, please leave this terminal open..."
nix-shell ${./vscode.nix} --run code 2> /dev/null
home-manager.users.precice =
{ pkgs, ... }:
{
home.stateVersion = "22.11";
home.file = {
"keyboard-settings" = {
source = "${pkgs.xfce.xfce4-settings.out}/share/applications/xfce-keyboard-settings.desktop";
target = "Desktop/xfce-keyboard-settings.desktop";
};
"precice-desktop-item" = {
source = "${
pkgs.makeDesktopItem {
name = "get-started";
desktopName = "Get started";
type = "Link";
url = "https://precice.org/installation-vm.html";
icon = "text-html";
}
}/share/applications/get-started.desktop";
target = "Desktop/get-started.desktop";
executable = true;
};
# TODO: precice examples verlinken auf dem desktop
"terminator" = {
source = "${pkgs.terminator}/share/applications/terminator.desktop";
target = "Desktop/terminator.desktop";
};
"terminator-config" = {
text = ''
[profiles]
[[default]]
use_system_font = False
'';
terminal = true;
icon = "text-html";
}}/share/applications/run-vs-code.desktop";
target = "Desktop/run-vs-code.desktop";
executable = true;
target = ".config/terminator/config";
};
# TODO: fix this
# "vagrant-shared" = {
# source = "/vagrant/";
# target = "Desktop/shared";
# };
# XXX: Untested as the default VM ist too small
"run-vs-code" = {
source = "${
pkgs.makeDesktopItem {
name = "run-vs-code";
desktopName = "VS Code";
type = "Application";
exec = pkgs.writeScript "run-vs-code" ''
echo "Downloading and starting vscode, please leave this terminal open..."
nix-shell ${./vscode.nix} --run code 2> /dev/null
'';
terminal = true;
icon = "text-html";
}
}/share/applications/run-vs-code.desktop";
target = "Desktop/run-vs-code.desktop";
executable = true;
};
};
programs.bash.enable = true;
};
programs.bash.enable = true;
};

networking.hostName = "precice-vm";
networking.networkmanager.enable = true;
Expand Down Expand Up @@ -88,22 +99,24 @@

# This is all needed to make resizing work inside the VirtualBox VM
virtualisation.virtualbox.guest.enable = true;
systemd.user.services = let
vbox-client = desc: flags: {
description = "VirtualBox Guest: ${desc}";
systemd.user.services =
let
vbox-client = desc: flags: {
description = "VirtualBox Guest: ${desc}";

wantedBy = [ "graphical-session.target" ];
requires = [ "dev-vboxguest.device" ];
after = [ "dev-vboxguest.device" ];
wantedBy = [ "graphical-session.target" ];
requires = [ "dev-vboxguest.device" ];
after = [ "dev-vboxguest.device" ];

unitConfig.ConditionVirtualization = "oracle";
unitConfig.ConditionVirtualization = "oracle";

serviceConfig.ExecStart = "${config.boot.kernelPackages.virtualboxGuestAdditions}/bin/VBoxClient -fv ${flags}";
serviceConfig.ExecStart = "${config.boot.kernelPackages.virtualboxGuestAdditions}/bin/VBoxClient -fv ${flags}";
};
in
{
virtualbox-resize = vbox-client "Resize" "--vmsvga";
virtualbox-clipboard = vbox-client "Clipboard" "--clipboard";
};
in {
virtualbox-resize = vbox-client "Resize" "--vmsvga";
virtualbox-clipboard = vbox-client "Clipboard" "--clipboard";
};

fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
Expand Down Expand Up @@ -132,65 +145,67 @@
${pkgs.git}/bin/git clone https://github.com/precice/tutorials ~/tutorials
fi
'';
systemPackages = with pkgs; let
precice-python-packages = python3.withPackages (ps: [
ps.ipython

# nutils
ps.matplotlib
nutils

ps.virtualenv
ps.pyprecice
ps.pandas
]);
preciceToPNG = writeShellScriptBin "preciceToPNG" "cat \"\${1:-precice-config.xml}\" | ${precice-config-visualizer}/bin/precice-config-visualizer | ${graphviz}/bin/dot -Tpng > precice-config.png";
preciceToPDF = writeShellScriptBin "preciceToPDF" "cat \"\${1:-precice-config.xml}\" | ${precice-config-visualizer}/bin/precice-config-visualizer | ${graphviz}/bin/dot -Tpdf > precice-config.pdf";
preciceToSVG = writeShellScriptBin "preciceToSVG" "cat \"\${1:-precice-config.xml}\" | ${precice-config-visualizer}/bin/precice-config-visualizer | ${graphviz}/bin/dot -Tsvg > precice-config.svg";
in
[
# Basic applications
# baobab
# catfish
# firefox
# mate.atril
terminator
tree

# Devel applications
git
cmakeWithGui
gnumake
gcc
nano
neovim
gnome.gedit
precice-python-packages
gnuplot

# Precice
precice
precice-config-visualizer

# precice-dealii-adapter builds too slow
precice-calculix-adapter
# precice-fenics-adapter needs hdf5 which is insecure
# precice-aste needs recompilation of vtk
precice-su2 #not needed
# precice-openfoam-adapter too slow
# openfoam too slow
# precice-aster too many dependencies, thus slow
# precice-dune too slow

# From the .alias file in the VM repo
preciceToPNG
preciceToPDF
preciceToSVG

# Additional packages
paraview
wget
];
systemPackages =
with pkgs;
let
precice-python-packages = python3.withPackages (ps: [
ps.ipython

# nutils
ps.matplotlib
nutils

ps.virtualenv
ps.pyprecice
ps.pandas
]);
preciceToPNG = writeShellScriptBin "preciceToPNG" "cat \"\${1:-precice-config.xml}\" | ${precice-config-visualizer}/bin/precice-config-visualizer | ${graphviz}/bin/dot -Tpng > precice-config.png";
preciceToPDF = writeShellScriptBin "preciceToPDF" "cat \"\${1:-precice-config.xml}\" | ${precice-config-visualizer}/bin/precice-config-visualizer | ${graphviz}/bin/dot -Tpdf > precice-config.pdf";
preciceToSVG = writeShellScriptBin "preciceToSVG" "cat \"\${1:-precice-config.xml}\" | ${precice-config-visualizer}/bin/precice-config-visualizer | ${graphviz}/bin/dot -Tsvg > precice-config.svg";
in
[
# Basic applications
# baobab
# catfish
# firefox
# mate.atril
terminator
tree

# Devel applications
git
cmakeWithGui
gnumake
gcc
nano
neovim
gnome.gedit
precice-python-packages
gnuplot

# Precice
precice
precice-config-visualizer

# precice-dealii-adapter builds too slow
precice-calculix-adapter
# precice-fenics-adapter needs hdf5 which is insecure
# precice-aste needs recompilation of vtk
precice-su2 # not needed
# precice-openfoam-adapter too slow
# openfoam too slow
# precice-aster too many dependencies, thus slow
# precice-dune too slow

# From the .alias file in the VM repo
preciceToPNG
preciceToPDF
preciceToSVG

# Additional packages
paraview
wget
];
};

# TODO: Somehow make sure `pip3 uninstall -y fenics-ufl` is solved https://github.com/precice/vm/issues/4
Expand Down
Loading

0 comments on commit 9ac8c20

Please sign in to comment.