mirror of
https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git
synced 2026-01-13 02:48:24 +01:00
Compare commits
16 Commits
gitea-show
...
e928a5e981
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e928a5e981 | ||
|
|
cf7f4c996f | ||
|
|
d59a3f6ec0 | ||
|
|
b730bdc34d | ||
|
|
f1f4da9ff6 | ||
|
|
cd40bd6178 | ||
|
|
41e7f09c8b | ||
|
|
30bedecd72 | ||
|
|
29ad65bfef | ||
|
|
b5a95eac90 | ||
|
|
b2adb38a8b | ||
|
|
3a707b00d3 | ||
| c83005983e | |||
|
|
4f28815018 | ||
|
|
bdaa765dbb | ||
| c0e551eb8b |
@@ -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;
|
||||||
|
|||||||
4
flake.lock
generated
4
flake.lock
generated
@@ -130,11 +130,11 @@
|
|||||||
"rev": "e4dafd06b3d7e9e6e07617766e9c3743134571b7",
|
"rev": "e4dafd06b3d7e9e6e07617766e9c3743134571b7",
|
||||||
"revCount": 7,
|
"revCount": 7,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.pvv.ntnu.no/oysteikt/nix-gitea-themes.git"
|
"url": "https://git.pvv.ntnu.no/Drift/nix-gitea-themes.git"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.pvv.ntnu.no/oysteikt/nix-gitea-themes.git"
|
"url": "https://git.pvv.ntnu.no/Drift/nix-gitea-themes.git"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
|
|||||||
19
flake.nix
19
flake.nix
@@ -20,7 +20,7 @@
|
|||||||
matrix-next.url = "github:dali99/nixos-matrix-modules/0.7.0";
|
matrix-next.url = "github:dali99/nixos-matrix-modules/0.7.0";
|
||||||
matrix-next.inputs.nixpkgs.follows = "nixpkgs";
|
matrix-next.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
nix-gitea-themes.url = "git+https://git.pvv.ntnu.no/oysteikt/nix-gitea-themes.git";
|
nix-gitea-themes.url = "git+https://git.pvv.ntnu.no/Drift/nix-gitea-themes.git";
|
||||||
nix-gitea-themes.inputs.nixpkgs.follows = "nixpkgs";
|
nix-gitea-themes.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
greg-ng.url = "git+https://git.pvv.ntnu.no/Grzegorz/greg-ng.git";
|
greg-ng.url = "git+https://git.pvv.ntnu.no/Grzegorz/greg-ng.git";
|
||||||
@@ -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 [ ];
|
||||||
@@ -86,6 +91,7 @@
|
|||||||
modules = [
|
modules = [
|
||||||
inputs.matrix-next.nixosModules.default
|
inputs.matrix-next.nixosModules.default
|
||||||
inputs.pvv-calendar-bot.nixosModules.default
|
inputs.pvv-calendar-bot.nixosModules.default
|
||||||
|
self.nixosModules.gickup
|
||||||
];
|
];
|
||||||
overlays = [
|
overlays = [
|
||||||
inputs.pvv-calendar-bot.overlays.x86_64-linux.default
|
inputs.pvv-calendar-bot.overlays.x86_64-linux.default
|
||||||
@@ -114,6 +120,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 = [
|
||||||
@@ -158,10 +165,20 @@
|
|||||||
snakeoil-certs = ./modules/snakeoil-certs.nix;
|
snakeoil-certs = ./modules/snakeoil-certs.nix;
|
||||||
snappymail = ./modules/snappymail.nix;
|
snappymail = ./modules/snappymail.nix;
|
||||||
robots-txt = ./modules/robots-txt.nix;
|
robots-txt = ./modules/robots-txt.nix;
|
||||||
|
gickup = ./modules/gickup.nix;
|
||||||
};
|
};
|
||||||
|
|
||||||
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 = {
|
||||||
|
|||||||
@@ -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"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
(fp /misc/metrics-exporters.nix)
|
(fp /misc/metrics-exporters.nix)
|
||||||
./services/nginx
|
./services/nginx
|
||||||
|
|
||||||
|
./services/calendar-bot.nix
|
||||||
|
./services/git-mirrors
|
||||||
./services/mysql.nix
|
./services/mysql.nix
|
||||||
./services/postgres.nix
|
./services/postgres.nix
|
||||||
./services/mysql.nix
|
|
||||||
./services/calendar-bot.nix
|
|
||||||
|
|
||||||
./services/matrix
|
./services/matrix
|
||||||
];
|
];
|
||||||
|
|||||||
49
hosts/bicep/services/git-mirrors/default.nix
Normal file
49
hosts/bicep/services/git-mirrors/default.nix
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
services.gickup = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
source = {
|
||||||
|
github = [{
|
||||||
|
# token_file = sops
|
||||||
|
include = [
|
||||||
|
"go-gitea/gitea"
|
||||||
|
"unmojang/FjordLauncher"
|
||||||
|
"unmojang/drasl"
|
||||||
|
"NixOS/nixpkgs"
|
||||||
|
"saltstack/salt"
|
||||||
|
"heimdal/heimdal"
|
||||||
|
"yushijinhun/authlib-injector"
|
||||||
|
"Git-Mediawiki/Git-Mediawiki"
|
||||||
|
];
|
||||||
|
wiki = true;
|
||||||
|
issues = true;
|
||||||
|
}];
|
||||||
|
gitlab = [{
|
||||||
|
include = [
|
||||||
|
"mx-puppet/discord/better-discord.js"
|
||||||
|
"mx-puppet/discord/matrix-discord-parser"
|
||||||
|
"mx-puppet/discord/discord-markdown"
|
||||||
|
"mx-puppet/discord/mx-puppet-discord"
|
||||||
|
"mx-puppet/mx-puppet-bridge"
|
||||||
|
];
|
||||||
|
}];
|
||||||
|
any = [
|
||||||
|
{
|
||||||
|
url = "https://sourceware.org/git/glibc.git";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
destination.local = [{
|
||||||
|
path = "/data/git-mirrors";
|
||||||
|
structured = true;
|
||||||
|
zip = true;
|
||||||
|
keep = 5;
|
||||||
|
bare = true;
|
||||||
|
lfs = true;
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -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";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
39
hosts/wenche/configuration.nix
Normal file
39
hosts/wenche/configuration.nix
Normal 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?
|
||||||
|
}
|
||||||
27
hosts/wenche/hardware-configuration.nix
Normal file
27
hosts/wenche/hardware-configuration.nix
Normal 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";
|
||||||
|
}
|
||||||
88
modules/gickup.nix
Normal file
88
modules/gickup.nix
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.services.gickup;
|
||||||
|
format = pkgs.formats.yaml { };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.services.gickup = {
|
||||||
|
enable = lib.mkEnableOption "gickup, a git repository mirroring service";
|
||||||
|
package = lib.mkPackageOption pkgs "gickup" { };
|
||||||
|
|
||||||
|
gitPackage = lib.mkPackageOption pkgs "git" { };
|
||||||
|
gitLfsPackage = lib.mkPackageOption pkgs "git-lfs" { };
|
||||||
|
|
||||||
|
settings = lib.mkOption {
|
||||||
|
type = lib.types.submodule {
|
||||||
|
freeformType = format.type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
users.users.gickup = {
|
||||||
|
isSystemUser = true;
|
||||||
|
group = "gickup";
|
||||||
|
home = "/var/lib/gickup";
|
||||||
|
};
|
||||||
|
|
||||||
|
users.groups.gickup = { };
|
||||||
|
|
||||||
|
systemd.services.gickup = {
|
||||||
|
description = "Gickup git repository mirroring service";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
after = [ "network.target" ];
|
||||||
|
|
||||||
|
path = [
|
||||||
|
cfg.gitPackage
|
||||||
|
cfg.gitLfsPackage
|
||||||
|
];
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = utils.escapeSystemdExecArgs [
|
||||||
|
(lib.getExe cfg.package)
|
||||||
|
(format.generate "gickup-settings.conf" cfg.settings)
|
||||||
|
];
|
||||||
|
|
||||||
|
StateDirectory = "gickup";
|
||||||
|
WorkingDirectory = "gickup";
|
||||||
|
RuntimeDirectory = "gickup";
|
||||||
|
RuntimeDirectoryMode = "0700";
|
||||||
|
|
||||||
|
# Hardening options
|
||||||
|
AmbientCapabilities = [];
|
||||||
|
LockPersonality = true;
|
||||||
|
NoNewPrivileges = true;
|
||||||
|
PrivateDevices = true;
|
||||||
|
PrivateMounts = true;
|
||||||
|
PrivateTmp = true;
|
||||||
|
PrivateUsers = true;
|
||||||
|
ProcSubset = "pid";
|
||||||
|
ProtectClock = true;
|
||||||
|
ProtectControlGroups = true;
|
||||||
|
ProtectHome = true;
|
||||||
|
ProtectHostname = true;
|
||||||
|
ProtectKernelLogs = true;
|
||||||
|
ProtectKernelModules = true;
|
||||||
|
ProtectKernelTunables = true;
|
||||||
|
ProtectProc = "invisible";
|
||||||
|
ProtectSystem = "strict";
|
||||||
|
RemoveIPC = true;
|
||||||
|
RestrictAddressFamilies = [
|
||||||
|
"AF_INET"
|
||||||
|
"AF_INET6"
|
||||||
|
];
|
||||||
|
RestrictNamespaces = true;
|
||||||
|
RestrictRealtime = true;
|
||||||
|
RestrictSUIDSGID = true;
|
||||||
|
SystemCallArchitectures = "native";
|
||||||
|
SystemCallFilter = [
|
||||||
|
"@system-service"
|
||||||
|
"~@resources"
|
||||||
|
"~@privileged"
|
||||||
|
];
|
||||||
|
UMask = "0002";
|
||||||
|
CapabilityBoundingSet = [];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
45
shells/cuda.nix
Normal file
45
shells/cuda.nix
Normal 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";
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -68,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 = {
|
||||||
|
|||||||
Reference in New Issue
Block a user