Compare commits

..

12 Commits

Author SHA1 Message Date
Felix Albrigtsen
f1f4da9ff6 Merge pull request 'Init wenche' (!94) from init-wenche into main
Reviewed-on: https://git.pvv.ntnu.no/Drift/pvv-nixos-config/pulls/94
Reviewed-by: Oystein Kristoffer Tveit <oysteikt@pvv.ntnu.no>
2025-03-29 22:15:02 +01:00
Felix Albrigtsen
cd40bd6178 Wenche: add swapfile 2025-03-29 22:08:44 +01:00
h7x4
41e7f09c8b kommode/gitea: take a dump weekly 2025-03-23 17:08:58 +01:00
h7x4
30bedecd72 kommode/gitea: increase timeouts 2025-03-23 00:39:06 +01:00
h7x4
29ad65bfef kommode/gitea: fix eval 2025-03-23 00:36:24 +01:00
h7x4
b5a95eac90 bekkalokk/website/sp: trust all domain variants 2025-03-19 01:49:12 +01:00
Oystein Kristoffer Tveit
b2adb38a8b Merge pull request 'base: source ~/.bashrc' (!100) from bashrc into main
Reviewed-on: https://git.pvv.ntnu.no/Drift/pvv-nixos-config/pulls/100
Reviewed-by: Oystein Kristoffer Tveit <oysteikt@pvv.ntnu.no>
2025-03-19 01:40:56 +01:00
Peder Bergebakken Sundt
3a707b00d3 base: source ~/.bashrc
Now by default we source .bashrc and .profile unless the user has actually read the manual.
Tested in vm
2025-03-18 22:57:18 +01:00
c83005983e shells/cuda: Reformat, replace shellhook with env attr 2025-03-15 23:37:53 +01:00
Felix Albrigtsen
4f28815018 wenche: Fix nvidia driver. flake: add shells/cuda. 2025-02-22 19:45:26 +01:00
Felix Albrigtsen
bdaa765dbb wenche: start adding NVIDIA support 2025-02-19 23:28:42 +01:00
c0e551eb8b wenche: init new host 2025-02-19 22:48:28 +01:00
10 changed files with 162 additions and 27 deletions

View File

@@ -50,6 +50,18 @@
kitty.terminfo kitty.terminfo
]; ];
# .bash_profile already works, but lets also use .bashrc like literally every other distro
# https://man.archlinux.org/man/core/bash/bash.1.en#INVOCATION
# home-manager usually handles this for you: https://github.com/nix-community/home-manager/blob/22a36aa709de7dd42b562a433b9cefecf104a6ee/modules/programs/bash.nix#L203-L209
# btw, programs.bash.shellInit just goes into environment.shellInit which in turn goes into /etc/profile, spooky shit
programs.bash.shellInit = ''
if [ -n "''${BASH_VERSION:-}" ]; then
if [[ ! -f ~/.bash_profile && ! -f ~/.bash_login ]]; then
[[ -f ~/.bashrc ]] && . ~/.bashrc
fi
fi
'';
programs.zsh.enable = true; programs.zsh.enable = true;
security.lockKernelModules = true; security.lockKernelModules = true;

View File

@@ -71,6 +71,11 @@
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg)
[
"nvidia-x11"
"nvidia-settings"
];
overlays = [ overlays = [
# Global overlays go here # Global overlays go here
] ++ config.overlays or [ ]; ] ++ config.overlays or [ ];
@@ -114,6 +119,7 @@
ildkule = stableNixosConfig "ildkule" { }; ildkule = stableNixosConfig "ildkule" { };
#ildkule-unstable = unstableNixosConfig "ildkule" { }; #ildkule-unstable = unstableNixosConfig "ildkule" { };
shark = stableNixosConfig "shark" { }; shark = stableNixosConfig "shark" { };
wenche = stableNixosConfig "wenche" { };
kommode = stableNixosConfig "kommode" { kommode = stableNixosConfig "kommode" {
overlays = [ overlays = [
@@ -162,6 +168,15 @@
devShells = forAllSystems (system: { devShells = forAllSystems (system: {
default = nixpkgs.legacyPackages.${system}.callPackage ./shell.nix { }; default = nixpkgs.legacyPackages.${system}.callPackage ./shell.nix { };
cuda = let
cuda-pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
cudaSupport = true;
};
};
in cuda-pkgs.callPackage ./shells/cuda.nix { };
}); });
packages = { packages = {

View File

@@ -67,7 +67,12 @@ in {
ADMIN_NAME = "PVV Drift"; ADMIN_NAME = "PVV Drift";
ADMIN_EMAIL = "drift@pvv.ntnu.no"; ADMIN_EMAIL = "drift@pvv.ntnu.no";
ADMIN_PASSWORD = includeFromSops "simplesamlphp/admin_password"; ADMIN_PASSWORD = includeFromSops "simplesamlphp/admin_password";
TRUSTED_DOMAINS = [ cfg.domainName ]; TRUSTED_DOMAINS = [
"www.pvv.ntnu.no"
"pvv.ntnu.no"
"www.pvv.org"
"pvv.org"
];
}; };
}; };
}; };

View File

@@ -49,6 +49,10 @@ in {
START_LFS_SERVER = true; START_LFS_SERVER = true;
LANDING_PAGE = "explore"; LANDING_PAGE = "explore";
}; };
"git.timeout" = {
MIGRATE = 3600;
MIRROR = 1800;
};
mailer = { mailer = {
ENABLED = true; ENABLED = true;
FROM = "gitea@pvv.ntnu.no"; FROM = "gitea@pvv.ntnu.no";
@@ -136,6 +140,7 @@ in {
dump = { dump = {
enable = true; enable = true;
interval = "weekly";
type = "tar.gz"; type = "tar.gz";
}; };
}; };

View File

@@ -0,0 +1,39 @@
{ config, fp, pkgs, values, lib, ... }:
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
(fp /base)
(fp /misc/metrics-exporters.nix)
(fp /misc/builder.nix)
];
sops.defaultSopsFile = fp /secrets/wenche/wenche.yaml;
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
sops.age.generateKey = true;
boot.loader.grub.device = "/dev/sda";
networking.hostName = "wenche"; # Define your hostname.
systemd.network.networks."30-ens18" = values.defaultNetworkConfig // {
matchConfig.Name = "ens18";
address = with values.hosts.wenche; [ (ipv4 + "/25") (ipv6 + "/64") ];
};
hardware.graphics.enable = true;
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
modesetting.enable = true;
open = false;
package = config.boot.kernelPackages.nvidiaPackages.production;
};
# List packages installed in system profile
environment.systemPackages = with pkgs; [
];
system.stateVersion = "24.11"; # Did you read the comment?
}

View File

@@ -0,0 +1,27 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "nvidia" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/4e8ecdd2-d453-4fff-b952-f06da00f3b85";
fsType = "ext4";
};
swapDevices = [ {
device = "/var/lib/swapfile";
size = 16*1024;
} ];
networking.useDHCP = lib.mkDefault false;
# networking.interfaces.ens18.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

View File

@@ -1,4 +1,4 @@
{config, lib, pkgs, values, ...}: {config, lib, pkgs, ...}:
let let
grg = config.services.greg-ng; grg = config.services.greg-ng;
grgw = config.services.grzegorz-webui; grgw = config.services.grzegorz-webui;
@@ -37,12 +37,8 @@ in {
"${machine}.pvv.org" "${machine}.pvv.org"
]; ];
extraConfig = '' extraConfig = ''
# pvv allow 129.241.210.128/25;
allow ${values.ipv4-space} allow 2001:700:300:1900::/64;
allow ${values.ipv6-space}
# ntnu
allow ${values.ntnu.ipv4-space}
allow ${values.ntnu.ipv6-space}
deny all; deny all;
''; '';
}; };
@@ -55,12 +51,8 @@ in {
"${machine}-backend.pvv.org" "${machine}-backend.pvv.org"
]; ];
extraConfig = '' extraConfig = ''
# pvv allow 129.241.210.128/25;
allow ${values.ipv4-space} allow 2001:700:300:1900::/64;
allow ${values.ipv6-space}
# ntnu
allow ${values.ntnu.ipv4-space}
allow ${values.ntnu.ipv6-space}
deny all; deny all;
''; '';
@@ -78,12 +70,8 @@ in {
"${machine}-old.pvv.org" "${machine}-old.pvv.org"
]; ];
extraConfig = '' extraConfig = ''
# pvv allow 129.241.210.128/25;
allow ${values.ipv4-space} allow 2001:700:300:1900::/64;
allow ${values.ipv6-space}
# ntnu
allow ${values.ntnu.ipv4-space}
allow ${values.ntnu.ipv6-space}
deny all; deny all;
''; '';

45
shells/cuda.nix Normal file
View File

@@ -0,0 +1,45 @@
# nix develop .#cuda
# Copied from https://nixos.wiki/wiki/CUDA
{ pkgs }:
pkgs.mkShell {
name = "cuda-env-shell";
buildInputs = with pkgs; [
autoconf
binutils
curl
freeglut
git
gitRepo
gnumake
gnupg
gperf
libGL
libGLU
m4
ncurses5
procps
stdenv.cc
unzip
util-linux
xorg.libX11
xorg.libXext
xorg.libXi
xorg.libXmu
xorg.libXrandr
xorg.libXv
zlib
cudatoolkit
linuxPackages.nvidia_x11
# Other applications, like
hashcat
];
env = {
CUDA_PATH = pkgs.cudatoolkit;
EXTRA_LDFLAGS = "-L/lib -L${pkgs.linuxPackages.nvidia_x11}/lib";
EXTRA_CCFLAGS = "-I/usr/include";
};
}

View File

@@ -1,13 +1,8 @@
# Feel free to change the structure of this file # Feel free to change the structure of this file
let let
ntnu-ipv4 = suffix: "129.241.${toString suffix}"; pvv-ipv4 = suffix: "129.241.210.${toString suffix}";
ntnu-ipv6 = suffix: "2001:700:300:${toString suffix}"; pvv-ipv6 = suffix: "2001:700:300:1900::${toString suffix}";
pvv-ipv4 = suffix: ntnu-ipv4 "210.${toString suffix}";
pvv-ipv6 = suffix: ntnu-ipv6 "1900::${toString suffix}";
in rec { in rec {
ntnu.ipv4-space = ntnu-ipv4 "0.0/16"; # https://ipinfo.io/ips/129.241.0.0/16
ntnu.ipv6-space = ntnu-ipv6 ":/48"; # https://ipinfo.io/2001:700:300::
ipv4-space = pvv-ipv4 "128/25"; ipv4-space = pvv-ipv4 "128/25";
ipv6-space = pvv-ipv6 "/64"; ipv6-space = pvv-ipv6 "/64";
@@ -73,6 +68,10 @@ in rec {
ipv4 = pvv-ipv4 234; ipv4 = pvv-ipv4 234;
ipv6 = pvv-ipv6 234; ipv6 = pvv-ipv6 234;
}; };
wenche = {
ipv4 = pvv-ipv4 240;
ipv6 = pvv-ipv6 240;
};
}; };
defaultNetworkConfig = { defaultNetworkConfig = {