commit everything

This commit is contained in:
sinavir 2024-09-24 12:33:51 +02:00
parent 0054c74806
commit 823b5c8206
55 changed files with 831 additions and 354 deletions

View file

@ -6,37 +6,49 @@ let
inherit (defaultNixpkgs) lib;
revision = node: (builtins.fromJSON (builtins.readFile ./npins/sources.json)).pins.${pkgsVersion node}.revision;
revision =
node:
(builtins.fromJSON (builtins.readFile ./npins/sources.json)).pins.${pkgsVersion node}.revision;
mkNode = node: {
${node} = {
${node} =
{
name,
nodes,
...
}: {
imports = [./machines/${node}/_configuration.nix] ++ lib.attrByPath [ "imports" ] [] metadata.nodes.${node};
}:
{
imports = [
./machines/${node}/_configuration.nix
] ++ lib.attrByPath [ "imports" ] [ ] metadata.nodes.${node};
inherit (metadata.nodes.${node}) deployment;
nix.nixPath =
builtins.map (n: "${n}=${sources.${n}}") (builtins.attrNames sources)
++ ["nixpkgs=${mkNixpkgsPath name}"];
nix.nixPath = builtins.map (n: "${n}=${sources.${n}}") (builtins.attrNames sources) ++ [
"nixpkgs=${mkNixpkgsPath name}"
];
system.nixos.tags = [
(revision node)
];
};
};
pkgsVersion = node: lib.attrByPath [ node "nixpkgs" ] "nixos-unstable" metadata.nodes;
pkgsVersion =
node:
lib.attrByPath [
node
"nixpkgs"
] "nixos-unstable" metadata.nodes;
mkNixpkgsPath = node: sources.${pkgsVersion node};
mkNixpkgs = node: {
${node} =
importNixpkgsPath
(lib.attrByPath [ "arch" ] "x86_64-linux" metadata.nodes.${node})
(mkNixpkgsPath node);
${node} = importNixpkgsPath (lib.attrByPath [ "arch" ] "x86_64-linux" metadata.nodes.${node}) (
mkNixpkgsPath node
);
};
importNixpkgsPath = arch: p: import p {
importNixpkgsPath =
arch: p:
import p {
config.allowUnfree = true;
overlays = import ./pkgs/overlays.nix;
system = arch;
@ -48,7 +60,9 @@ let
in
{
meta = {
specialArgs = {inherit metadata;};
specialArgs = {
inherit metadata;
};
nixpkgs = defaultNixpkgs;
nodeNixpkgs = concatAttrs (builtins.map mkNixpkgs nodes);
specialArgs = {

View file

@ -5,8 +5,7 @@
{ config, pkgs, ... }:
{
imports =
[
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
./aarch64.nix
@ -43,4 +42,3 @@
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "20.09"; # Did you read the comment?
}

View file

@ -1,6 +1,5 @@
{ pkgs, ... }:
{
# Enable sound.
sound.enable = true;
hardware.pulseaudio.enable = true;
}

View file

@ -1,4 +1,6 @@
{ pkgs, ... }: {
imports = [
{ pkgs, ... }:
{
imports =
[
];
}

View file

@ -6,7 +6,10 @@ let
in
{
networking = {
nameservers = [ "127.0.0.1" "::1" ];
nameservers = [
"127.0.0.1"
"::1"
];
};
services.dnscrypt-proxy2 = {
@ -17,9 +20,13 @@ in
forwarding_rules = ./forwarding.txt;
query_log = if debugDNS then {
query_log =
if debugDNS then
{
file = "/dev/stdout";
} else {};
}
else
{ };
sources.public-resolvers = {
urls = [

View file

@ -1,36 +1,49 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
{
imports =
[
imports = [
<nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "usbhid" "sd_mod" "sr_mod" ];
boot.initrd.availableKernelModules = [
"ehci_pci"
"ahci"
"usbhid"
"sd_mod"
"sr_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
# boot.kernelParams = [ "nomodeset" ];
fileSystems."/" =
{
fileSystems."/" = {
device = "/dev/disk/by-label/nixos-root";
fsType = "btrfs";
options = [ "ssd" "noatime" "ssd_spread" "discard" "space_cache" ];
options = [
"ssd"
"noatime"
"ssd_spread"
"discard"
"space_cache"
];
};
fileSystems."/boot" =
{
fileSystems."/boot" = {
device = "/dev/disk/by-label/BOOT";
fsType = "vfat";
};
swapDevices =
[{ device = "/dev/disk/by-label/SWAP"; }];
swapDevices = [ { device = "/dev/disk/by-label/SWAP"; } ];
nix.maxJobs = lib.mkDefault 4;
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";

View file

@ -1,4 +1,5 @@
{ pkgs, ... }: {
{ pkgs, ... }:
{
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
systemd.targets = {
sleep.enable = false;
suspend.enable = false;

View file

@ -1,4 +1,5 @@
{ pkgs, ... }: {
{ pkgs, ... }:
{
# Upgrades
system.autoUpgrade = {
enable = true;
@ -12,8 +13,10 @@
# Auto-GC and store optimizations
nix = {
trustedUsers = [ "root" "hackens" ];
package = pkgs.nixUnstable;
trustedUsers = [
"root"
"hackens"
];
gc = {
automatic = true;
dates = "weekly";

View file

@ -11,7 +11,12 @@ in
{
users.users.hackens = {
isNormalUser = true;
extraGroups = [ "wheel" "dialout" "audio" "video" ];
extraGroups = [
"wheel"
"dialout"
"audio"
"video"
];
openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDcKULx/AgnqBsgwRX2BfV8waq6JXIkvZHhu9Y8paofM8awq6Om56BZoA7AV45YOcJxO/eFDOxSegXXmt22s4WjIf8I049aMdsW54BNpFpC/h18cMzm5ylKVGHl1ier/WXxpBsA8YU++YdRlGHPpKnhCtYLnBzD4Q5h+05GMIHismNZP1aGpE9s01FuP8eaDDkZUba7oSpn03AA77DBw4/2ZreSbqo96Z6WwiG09KeZvxFtEIk98EQtmiExB2fwsK3/JIxIBCoZHh4SzERcslxxGgzdppd6NhhSh7g523zhiihLaTAPNXBovGm5wcKOU9uWe+pUWEbwV04E+809aVbkJOdYBCtIf8M91meqpupA8jK38uquePHEFvpNr5UmY0qUlJCoqTvoqg9XgrfJVjlPEmYknj/QjQzkA4k19y8njsyEjnYOBL6tsztg6Igl+NZXjBAPuAzxCsfHOtWw1WM5gANwqOL0V9f7+14yST3HwweqjHRj4xky6ritxK+ujfc= hackens@hackens-desktop"

View file

@ -1,6 +1,7 @@
{ pkgs, ... }: {
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
nixfmt
nixfmt-rfc-style
git
(neovim.override {
vimAlias = true;

View file

@ -5,8 +5,7 @@
{ config, pkgs, ... }:
{
imports =
[
imports = [
./_bootloader.nix
./_networking.nix
./_ssh.nix
@ -16,6 +15,7 @@
./matterbridge.nix
./nginx.nix
./orga
./snipe-it.nix
./secrets
./static-sites.nix
./legacy-redir.nix
@ -38,4 +38,3 @@
system.stateVersion = "22.11"; # Did you read the comment?
}

View file

@ -38,5 +38,8 @@
};
};
};
networking.nameservers = [ "1.1.1.1" "8.8.8.8" ];
networking.nameservers = [
"1.1.1.1"
"8.8.8.8"
];
}

View file

@ -1,11 +1,18 @@
{ ... }: {
{ ... }:
{
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.openssh.settings.PasswordAuthentication = false;
services.openssh.ports = [ 22 2222 ];
services.openssh.ports = [
22
2222
];
# Open ports in the firewall. (In fact not needed)
networking.firewall.allowedTCPPorts = [ 22 2222 ];
networking.firewall.allowedTCPPorts = [
22
2222
];
# Mosh <3
programs.mosh.enable = true;

View file

@ -1,12 +1,12 @@
{ ... }: {
{ ... }:
{
users = {
mutableUsers = false;
users = {
rlahfa = {
isNormalUser = true;
extraGroups = [ "wheel" ];
hashedPassword =
"$6$y/I6nKCMYUku7$91vTR5kYz4nHyhbuA/j6kPsD8Vfo/Rg7ri6Ympftra9V6emOt/mPg0AScECtYjSIxretvfQ3sPUF1Ho0IWx381";
hashedPassword = "$6$y/I6nKCMYUku7$91vTR5kYz4nHyhbuA/j6kPsD8Vfo/Rg7ri6Ympftra9V6emOt/mPg0AScECtYjSIxretvfQ3sPUF1Ho0IWx381";
openssh.authorizedKeys.keyFiles = [ ../../pubkeys/raito.keys ];
};
gdoriathdohler = {
@ -17,8 +17,7 @@
mdebray = {
isNormalUser = true;
extraGroups = [ "wheel" ];
hashedPassword =
"$6$ujz06kXa4TgvPAbF$NaXkDuOUpf3.fBRh7JuygtS0V2U/Bz4N3DpbOznO.md44xEdlKwPH/pSbL9CQJBhI5kodaKZeSaoCyhzybBPA/";
hashedPassword = "$6$ujz06kXa4TgvPAbF$NaXkDuOUpf3.fBRh7JuygtS0V2U/Bz4N3DpbOznO.md44xEdlKwPH/pSbL9CQJBhI5kodaKZeSaoCyhzybBPA/";
openssh.authorizedKeys.keyFiles = [ ../../pubkeys/sinavir.keys ];
};
ecoppens = {

View file

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: {
{
config,
pkgs,
lib,
...
}:
{
services.nginx.virtualHosts."hackens.org" = {
enableACME = true;

View file

@ -0,0 +1,91 @@
{
pkgs,
lib,
config,
...
}:
let
src = pkgs.fetchgit {
url = "https://git.rz.ens.wtf/HackENS/gestiojeux.git";
rev = "HEAD";
hash = "sha256-ly786xct9U4hdsHr7NLl23smnOfE891au9/GXqxpFb4=";
};
in
{
imports =
[
];
systemd.services.django-gestiohackens.serviceConfig = {
DynamicUser = lib.mkForce false;
User = "django-gestiohackens";
SupplementaryGroups = [ "nginx" ];
};
users.users.django-gestiohackens = {
group = "django-gestiohackens";
isSystemUser = true;
};
users.groups.django-gestiohackens = { };
services.nginx = {
enable = true;
recommendedProxySettings = true;
virtualHosts."inventaire.hackens.org" = {
enableACME = true;
forceSSL = true;
locations = {
"/" = {
proxyPass = "http://localhost:51667";
};
"/media/".alias = "/var/lib/django-gestiohackens/media/";
"/static".root = config.services.django.gestiohackens.staticAssets;
};
};
};
services.django.gestiohackens = {
inherit src;
enable = true;
mainModule = "gestiojeux";
port = 51667;
settings = {
DEBUG = false;
CSRF_COOKIE_SECURE = true;
AUTHENS_ALLOW_STAFF = true;
SESSION_COOKIE_SECURE = true;
MEDIA_URL = "media/";
ALLOWED_HOSTS = [ "inventaire.hackens.org" ];
DATABASES = {
"default" = {
"ENGINE" = "django.db.backends.sqlite3";
"NAME" = "/var/lib/django-gestiohackens/db.sqlite3";
};
};
HAYSTACK_CONNECTIONS = {
"default" = {
"ENGINE" = "haystack.backends.whoosh_backend.WhooshEngine";
"PATH" = "/var/lib/django-gestiohackens/whoosh_index";
};
};
MEDIA_ROOT = "/var/lib/django-gestiohackens/media";
};
extraPackages = ps: [
ps.django-autoslug
ps.loadcredential
ps.django-cleanup
ps.django-haystack
ps.django-markdownx
ps.django-tables2
ps.pillow
ps.whoosh
ps.markdown-icons
ps.authens
ps.qrcode
ps.pillow
# Django haystack is drunk
ps.setuptools
];
secrets = {
SECRET_KEY = config.age.secrets.django-gestiohackens.path;
};
};
}

View file

@ -1,32 +1,39 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
imports =
[
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "uhci_hcd" "ahci" "virtio_pci" "virtio_blk" ];
boot.initrd.availableKernelModules = [
"uhci_hcd"
"ahci"
"virtio_pci"
"virtio_blk"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{
fileSystems."/" = {
device = "/dev/disk/by-uuid/8deb32c9-ee6a-4de8-94da-239c8ec509a2";
fsType = "btrfs";
};
fileSystems."/boot" =
{
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/0795-75ED";
fsType = "vfat";
};
swapDevices =
[{ device = "/dev/disk/by-uuid/bd7c1c01-ce31-4db3-9c06-70716020e24a"; }];
swapDevices = [ { device = "/dev/disk/by-uuid/bd7c1c01-ce31-4db3-9c06-70716020e24a"; } ];
}

View file

@ -1,6 +1,7 @@
{ lib
, python3
, fetchFromGitHub
{
lib,
python3,
fetchFromGitHub,
}:
python3.pkgs.buildPythonApplication rec {

View file

@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
let
port = 52187;
configFile = pkgs.writeText "metterbridge.toml" ''
@ -37,7 +42,6 @@ in
${pkgs.matterbridge}/bin/matterbridge -conf ${configFile}
'';
serviceConfig = {
User = "matterbridge";
Group = "matterbridge";

View file

@ -1,12 +0,0 @@
{ lib, fetchgit, pythoncas, django, ldap, buildPythonPackage }:
buildPythonPackage rec {
pname = "authens";
version = "v0.1b5";
doCheck = false;
src = fetchgit {
url = "https://git.eleves.ens.fr/klub-dev-ens/authens.git";
rev = "58747e57b30b47f36a0ed3e7c80850ed7f1edbf9";
hash = "sha256-R0Nw212/BOPHfpspT5wzxtji1vxZ/JOuwr00naklWE8=";
};
propagatedBuildInputs = [ django ldap pythoncas ];
}

View file

@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
let
src = pkgs.fetchgit {
url = "https://git.rz.ens.wtf/HackENS/hackens-orga.git";
@ -7,7 +12,8 @@ let
};
in
{
imports = [
imports =
[
];
services.nginx = {
enable = true;
@ -38,8 +44,8 @@ in
};
};
};
extraPackages = p: let pythoncas = (p.callPackage ./python-cas.nix { }); in [
(p.callPackage ./authens.nix { inherit pythoncas; })
extraPackages = p: [
p.authens
];
secrets = {
SECRET_KEY = config.age.secrets.django.path;

View file

@ -1,4 +1,5 @@
{ pkgs, ... }: {
{ pkgs, ... }:
{
environment.systemPackages = [
pkgs.vim
];

View file

@ -24,7 +24,8 @@ in
extraFlags = [ "--storage.tsdb.retention.size=2GB" ];
rules = [ ''
rules = [
''
groups:
- name: Chrony
rules:
@ -35,7 +36,8 @@ in
chrony_tracking_root_dispersion_seconds
+
(0.5 * chrony_tracking_root_delay_seconds)
''];
''
];
scrapeConfigs = [
{

View file

@ -1,7 +1,15 @@
{ ... }: {
{ ... }:
{
age.secrets."django" = {
file = ./django.age;
};
age.secrets."snipeit" = {
file = ./snipeit.age;
owner = "snipeit";
};
age.secrets."django-gestiohackens" = {
file = ./django-gestiohackens.age;
};
age.secrets."matterbridge-env" = {
file = ./matterbridge-env.age;
owner = "matterbridge";

View file

@ -0,0 +1,28 @@
age-encryption.org/v1
-> ssh-ed25519 JGx7Ng bMdvEX7j6bw5GNBohOahx43feq2/5/j/sm4+gLBCqls
SJAb40fN72h2/e6TFxKyF270xGtBq5EICpQB7Oe6KnU
-> ssh-ed25519 kXobKQ P1Ve/+t8nPrzu0qBL0EVnVH8X8f7/O93pH5ImPGnfVU
cG2dTLsKuY0mJhApuRw4ShlcpjPHfbobN+wxnpW42qE
-> ssh-ed25519 7hZk0g 7cPMy1bOSScXdk5xUiBrWM1noZ7QA9td+ffAlJGuKDg
2GrbxwLERVZgMAsAxhxVkEt2dAwv3lK2tmi+feDi9Bw
-> ssh-rsa krWCLQ
raDB1S2KgNXYYjYQoReSNbsMPBt8qUerW2I5Tiewco5Ao/iGuQPfaMxtuHPvk82r
VIpznCS6ZyEFkyFKCC/rnzgeTmH8LDAuGPSjCFOicq7STjhVqgjdaERkw4s6UxRN
WTQVhuVpRaN8abdxMknQG+1WpkdmlOQG6n+B7JN/Z5AgM4kE891CH+WJcaPetDwO
/wC6+Na3EkgJS2XrK++IveWGmRRy+CZdRNe/NzxNCV2wp+w1BJohHttq7gRc2F7z
58r6GzViXSAZ39QfKMO5e1MrkZHfzshc74jpkMnLWK9QXWsbTbkYJzeYf7wWCm9F
STRR5xQJIZdOEYKNsIfb6Q
-> ssh-ed25519 /vwQcQ gYKVPzT6ZXSc9xfuulV/57pIM1NXJ9IlLF/kJMRMWGw
4FiYaBIoC1hmYayoWUfomIHg2ibtHsBtyYMzMs8OcSA
-> ssh-ed25519 0R97PA GKMaGC4HmLhIL3pNEqiYqZ8a04CYgKt13IcRsJwQ2l8
/8ePse2mnztxXGJrDLpr1yUcnyrm9AUQgUWV4fUcmXk
-> ssh-ed25519 cvTB5g CBw8+xqz9S9S5t7/TY7oz21WdhIqtWNv0WAbU16bayk
cUmHOQsoyaXkWVwYK9fK+CoAvYtDGcYF+JV3GgxzPYI
-> ssh-ed25519 Wu8JLQ VRDbadjqSTsmF/gkFe/Fg9OcxOFJDur0NJhexgObJy0
C1/W8PbucQUpYfVomvK0S/JIrHOcdGfpmru7hbvLdGY
-> ssh-ed25519 EIt1vA SlgOWnU5N7XUX/tpp2cOH+7d1fl6qjy5R4D8lyTr004
UBNV6PrfOB1jRV+GATefjpv1KEGyP06cKD741xzS8Gc
-> ssh-ed25519 X51wxg h1LfGf2RiFSAaUbLjAivqkX/f0rvxAO905NUYCrX7gk
ppAwL7fboGHlPptL2uQU5nBUI1FXCs6Ds3TMzG8WKxA
--- XgL6A4y8r8g55SKB86IIv+vb3Yo3ovpH+KQURMAtwg4
"Ú<> b.äcb¾Er<45>÷¹š·{»¦Öl(Ó§PßÄ2…e#ùòõ”3¾<33>ÏC‡P¹…˜I0ÔÜ¥S@ʪëQ¸ÝYæ'5…<35>µ

View file

@ -1,20 +1,46 @@
let
lib = (import <nixpkgs> { }).lib;
readpubkeys = user:
builtins.filter (k: k != "")
(lib.splitString "\n" (builtins.readFile (../../../pubkeys + "/${user}.keys")));
readpubkeys =
user:
builtins.filter (k: k != "") (
lib.splitString "\n" (builtins.readFile (../../../pubkeys + "/${user}.keys"))
);
in
{
"matterbridge-env.age".publicKeys = (readpubkeys "sinavir")
++ (readpubkeys "hackens-host") ++ (readpubkeys "raito")
++ (readpubkeys "gdd") ++ (readpubkeys "backslash");
"django.age".publicKeys = (readpubkeys "sinavir")
++ (readpubkeys "hackens-host") ++ (readpubkeys "raito")
++ (readpubkeys "gdd") ++ (readpubkeys "backslash");
"wg-key.age".publicKeys = (readpubkeys "sinavir")
++ (readpubkeys "hackens-host") ++ (readpubkeys "raito")
++ (readpubkeys "gdd") ++ (readpubkeys "backslash");
"prometheus-webconf".publicKeys = (readpubkeys "sinavir")
++ (readpubkeys "hackens-host") ++ (readpubkeys "raito")
++ (readpubkeys "gdd") ++ (readpubkeys "backslash");
"matterbridge-env.age".publicKeys =
(readpubkeys "sinavir")
++ (readpubkeys "hackens-host")
++ (readpubkeys "raito")
++ (readpubkeys "gdd")
++ (readpubkeys "backslash");
"snipeit.age".publicKeys =
(readpubkeys "sinavir")
++ (readpubkeys "hackens-host")
++ (readpubkeys "raito")
++ (readpubkeys "gdd")
++ (readpubkeys "backslash");
"django.age".publicKeys =
(readpubkeys "sinavir")
++ (readpubkeys "hackens-host")
++ (readpubkeys "raito")
++ (readpubkeys "gdd")
++ (readpubkeys "backslash");
"django-gestiohackens.age".publicKeys =
(readpubkeys "sinavir")
++ (readpubkeys "hackens-host")
++ (readpubkeys "raito")
++ (readpubkeys "gdd")
++ (readpubkeys "backslash");
"wg-key.age".publicKeys =
(readpubkeys "sinavir")
++ (readpubkeys "hackens-host")
++ (readpubkeys "raito")
++ (readpubkeys "gdd")
++ (readpubkeys "backslash");
"prometheus-webconf".publicKeys =
(readpubkeys "sinavir")
++ (readpubkeys "hackens-host")
++ (readpubkeys "raito")
++ (readpubkeys "gdd")
++ (readpubkeys "backslash");
}

View file

@ -0,0 +1,29 @@
age-encryption.org/v1
-> ssh-ed25519 JGx7Ng 6OHSOGM9Q4Us9F0dbVCiwWKzse3pRYAgJpAA6IPIdnQ
HqD9hdgqQqM3ZrivBDdYGHXtWF2XF/twsWw+vgsMvFQ
-> ssh-ed25519 kXobKQ PPSORbXqcXh4nyJp9zSiZsPj4M43xnYQTQOwStxRh2A
I3y7+s74YH5clRMT2yqt4EHNF008zVX8qJmymoGZrFM
-> ssh-ed25519 7hZk0g g6OU5HYXe3oc5gwSpHwChaLFxJ367vqOCGUKUOHvvGE
r4/WjMwACs6L8XPdun9C2MlOoBh/osc/16z344C8gTU
-> ssh-rsa krWCLQ
GBk11DEIlkEuqQ8IYRohr86rOGzr9Wh9SMxc5ukxpj1mLtiJhurGS98kpFO1Ybsa
6ik+mxl4OmQqKwsJFFqrOeOg2R4ORwoldDPZT0LB/DoQyVS5DzS6JRjxskvrmows
X7QLfeMZ9HYgpi5wsN++E3a3Kka/ulBAfksw4g+LquZwCP3FBKN/DEwsGCMuWnKW
SkYIBgiEDWCMB4W7QuafDR4sw19e9V06BTqghpjDaxHpG36srA3sfL3X/i6gjgz8
nV/Hu19qVCLNf08Z+0T3qF4LWLKCFZkZFizttGao5cb6t4Kw/kiLsudPmvVjne6n
jVq5JSrZiSNA0SgJ1cK3dg
-> ssh-ed25519 /vwQcQ 8YA7/bMsUIr5Y/EzZbfeamwmeXD5EwQ6oO7PWiziO3k
tvGAoGnGPCMPgaZ61dWQ/5I3tiVLYkEJGb4D/OfCzYY
-> ssh-ed25519 0R97PA we+Q49vxyES8lHcdsJfDs3RsPvZh097G7jGEpHPCLHk
vlq2ylTC8//Bv4rVaBGesTr7SUd7s7To93FSrz45+4Y
-> ssh-ed25519 cvTB5g EIqyNfE/A1e4lICBqgwviXlM73GL6YH8ADqfIVCGe0U
ajHEiVrEAPk0bxNkbXX6FWDXeom8inTUamq/ToI7Kbg
-> ssh-ed25519 Wu8JLQ +4eSVyk9FMUBjgi65ukfx6MFNr3DomHcONPo71QsrTc
/4Pr60oSZmSneQcUXffq+wEJCt2zHRC1pkn/l6onwog
-> ssh-ed25519 EIt1vA 3M3zoHSBceyiQDLRkeGOjRHLkljrc2xRMOlhZy8Gs0g
C21xBrCwuskiZXSo+Ucl3HDChAO9V2sauGSCdj+2pwI
-> ssh-ed25519 X51wxg EhYdCmwgYWBHj3QAatGYlcX5qMQJaFlwkzyspQLfiTY
L0aeN67YVWuY5aSdQLi1qwyJ3TcwSH/Fs+hAFLZL/DE
--- gUY9ofxPOoMCmNT+HJvc3j83MPBoO1KnxW5UCfsNZ78
­Š!T°{˜ KWÆ<57>L
¢Uðƒ(q>.¾+ÏSG¤ãð [¯+j¿rý}ׄ„<E2809E>¾¥ý.d¢c…„âZeW¸&m}t}

View file

@ -0,0 +1,22 @@
{ config, ... }:
{
services.snipe-it = {
enable = true;
appKeyFile = config.age.secrets."snipeit".path;
config = {
APP_LOCALE = "fr-FR";
APP_TIMEZONE = "Europe/Paris";
};
database = {
createLocally = true;
user = "snipeit";
};
user = "snipeit";
group = "snipeit";
hostName = "inventaire.hackens.org";
nginx = {
enableACME = true;
forceSSL = true;
};
};
}

View file

@ -24,5 +24,8 @@ in
};
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
networking.firewall.allowedTCPPorts = [
80
443
];
}

View file

@ -37,5 +37,8 @@
proxyWebsockets = true;
};
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
networking.firewall.allowedTCPPorts = [
80
443
];
}

View file

@ -3,7 +3,8 @@
lib,
pkgs,
...
}: {
}:
{
systemd.network = {
enable = true;
networks = {
@ -12,15 +13,12 @@
address = [
"10.10.10.1/24"
];
routes = [{
routeConfig = {
routes = [
{
Destination = "10.10.10.0/24";
Scope = "link";
};
}];
networkConfig = {
IPForward = true;
};
}
];
};
};
netdevs = {
@ -35,37 +33,33 @@
};
wireguardPeers = [
{ #hackens-desktop
wireguardPeerConfig = {
{
# hackens-desktop
AllowedIPs = [
"10.10.10.3/32"
];
PublicKey = "h4Nf+e4JIjqOMuM5JtLN298BF/fym9fWKGtRZmS5MVA=";
};
}
{ #bakham (AGB)
wireguardPeerConfig = {
{
# bakham (AGB)
AllowedIPs = [
"10.10.10.5/32"
];
PublicKey = "JpUHFiavhlQfiHfOdUffQP3HLLeStttheACCaqlXAF8=";
};
}
{ #soyouzpanda
wireguardPeerConfig = {
{
# soyouzpanda
AllowedIPs = [
"10.10.10.11/32"
];
PublicKey = "/xjWqkiyHY93wqo/Apj5SHP8UaXF4mKQRVwylKC2wy8=";
};
}
{ #sinavir
wireguardPeerConfig = {
{
# sinavir
AllowedIPs = [
"10.10.10.12/32"
];
PublicKey = "kmc3PexCMKm1Tg8WUDbHaOkcWLl8KUh52CtrDOODf0M=";
};
}
];
};

View file

@ -4,9 +4,11 @@
pkgs,
modulesPath,
...
}: let
launchpad =
pkgs.python3.withPackages ( ps: [ (ps.callPackage ./launchpad.nix { lpminimk3 = ps.callPackage ./lpminimk3.nix {}; })]);
}:
let
launchpad = pkgs.python3.withPackages (ps: [
(ps.callPackage ./launchpad.nix { lpminimk3 = ps.callPackage ./lpminimk3.nix { }; })
]);
in
{
imports = [
@ -21,7 +23,6 @@ in
nix.settings.substituters = lib.mkForce [ ];
networking.hostName = "rigel"; # Define your hostname.
# Set your time zone.
@ -34,7 +35,10 @@ in
systemd.services.launchpad = {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
path = [ launchpad pkgs.unixtools.ping ];
path = [
launchpad
pkgs.unixtools.ping
];
script = ''
while ! ping -n -w 1 -c 1 10.1.1.2 &> /dev/null
do

View file

@ -1,4 +1,5 @@
{pkgs, ...}: {
{ pkgs, ... }:
{
boot.loader.grub.enable = false;
boot.loader.generic-extlinux-compatible.enable = true;
}

View file

@ -1,9 +1,10 @@
{ lib
, buildPythonPackage
, fetchgit
, poetry
, lpminimk3
, python-osc
{
lib,
buildPythonPackage,
fetchgit,
poetry,
lpminimk3,
python-osc,
}:
buildPythonPackage rec {

View file

@ -1,9 +1,10 @@
{ lib
, buildPythonPackage
, fetchgit
, poetry-core
, lpminimk3
, python-osc
{
lib,
buildPythonPackage,
fetchgit,
poetry-core,
lpminimk3,
python-osc,
}:
buildPythonPackage rec {

View file

@ -1,11 +1,12 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, setuptools
, wheel
, jsonschema
, python-rtmidi
, websockets
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
wheel,
jsonschema,
python-rtmidi,
websockets,
}:
buildPythonPackage rec {

View file

@ -3,7 +3,8 @@
lib,
pkgs,
...
}: {
}:
{
networking.useDHCP = false;
networking.firewall.allowedUDPPorts = [ 67 ];

View file

@ -6,9 +6,16 @@
nodes,
name,
...
}: {
}:
{
nix.settings = {
trusted-users = ["root" "@wheel"];
extra-experimental-features = ["nix-command" "flakes"];
trusted-users = [
"root"
"@wheel"
];
extra-experimental-features = [
"nix-command"
"flakes"
];
};
}

View file

@ -3,7 +3,8 @@
pkgs,
lib,
...
}: {
}:
{
environment.systemPackages = with pkgs; [
sqlite-web
dhcpdump

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
services.openssh.enable = true;
services.openssh.settings.PasswordAuthentication = true;
}

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
users.mutableUsers = false;
users.users.root = {
openssh.authorizedKeys.keyFiles = [

@ -0,0 +1 @@
Subproject commit 5bb68f24b539db1d9591ea320436b9dbdd2dc354

View file

@ -27,7 +27,10 @@ let
tags = [ "server" ];
targetPort = 22;
};
imports = [agenix djangonix];
imports = [
agenix
djangonix
];
};
};

View file

@ -3,22 +3,26 @@ let
data = builtins.fromJSON (builtins.readFile ./sources.json);
version = data.version;
mkSource = spec:
assert spec ? type; let
mkSource =
spec:
assert spec ? type;
let
path =
if spec.type == "Git"
then mkGitSource spec
else if spec.type == "GitRelease"
then mkGitSource spec
else if spec.type == "PyPi"
then mkPyPiSource spec
else if spec.type == "Channel"
then mkChannelSource spec
else builtins.throw "Unknown source type ${spec.type}";
if spec.type == "Git" then
mkGitSource spec
else if spec.type == "GitRelease" then
mkGitSource spec
else if spec.type == "PyPi" then
mkPyPiSource spec
else if spec.type == "Channel" then
mkChannelSource spec
else
builtins.throw "Unknown source type ${spec.type}";
in
spec // { outPath = path; };
mkGitSource = {
mkGitSource =
{
repository,
revision,
url ? null,
@ -28,8 +32,7 @@ let
assert repository ? type;
# At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository
# In the latter case, there we will always be an url to the tarball
if url != null
then
if url != null then
(builtins.fetchTarball {
inherit url;
sha256 = hash; # FIXME: check nix version & use SRI hashes
@ -42,7 +45,8 @@ let
# hash = hash;
};
mkPyPiSource = {
mkPyPiSource =
{
url,
hash,
...
@ -52,7 +56,8 @@ let
sha256 = hash;
};
mkChannelSource = {
mkChannelSource =
{
url,
hash,
...
@ -62,6 +67,7 @@ let
sha256 = hash;
};
in
if version == 3
then builtins.mapAttrs (_: mkSource) data.pins
else throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"
if version == 3 then
builtins.mapAttrs (_: mkSource) data.pins
else
throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"

View file

@ -8,9 +8,9 @@
"repo": "agenix"
},
"branch": "main",
"revision": "c2fc0762bbe8feb06a2e59a364fa81b3a57671c9",
"url": "https://github.com/ryantm/agenix/archive/c2fc0762bbe8feb06a2e59a364fa81b3a57671c9.tar.gz",
"hash": "1lpkwinlax40b7xgzspbkm9rsi4a1x48hxhixnni4irxxwnav0ah"
"revision": "f6291c5935fdc4e0bef208cfc0dcab7e3f7a1c41",
"url": "https://github.com/ryantm/agenix/archive/f6291c5935fdc4e0bef208cfc0dcab7e3f7a1c41.tar.gz",
"hash": "1x8nd8hvsq6mvzig122vprwigsr3z2skanig65haqswn7z7amsvg"
},
"disko": {
"type": "Git",
@ -20,9 +20,9 @@
"repo": "disko"
},
"branch": "master",
"revision": "1bbdb06f14e2621290b250e631cf3d8948e4d19b",
"url": "https://github.com/nix-community/disko/archive/1bbdb06f14e2621290b250e631cf3d8948e4d19b.tar.gz",
"hash": "15qbjnr8gfp0ybd4m0b6fn6bhwmdag1ybn5i217qjy55hrp8zhan"
"revision": "c61e50b63ad50dda5797b1593ad7771be496efbb",
"url": "https://github.com/nix-community/disko/archive/c61e50b63ad50dda5797b1593ad7771be496efbb.tar.gz",
"hash": "1nnz89hsiz0pf73g3b4072fv28z9mrqr14h2347iwf6xhj1d9zhi"
},
"djangonix": {
"type": "Git",
@ -31,9 +31,9 @@
"url": "https://git.dgnum.eu/mdebray/djangonix.git"
},
"branch": "master",
"revision": "5ea9469cc2169c0cd72ea2f5a05fc46f2ad39a9e",
"revision": "a61afb48e2478c47360a8efea6f835c3b0f5f503",
"url": null,
"hash": "1wfmr1h2j5i9yrzgczj5gk9fxq26jg90840f9glazfwylki5mp3x"
"hash": "0a0hnkyhvr6am484m7lg46040icbxzydnycaa1a2hclfnpgrxrdk"
},
"dns.nix": {
"type": "GitRelease",
@ -45,10 +45,10 @@
"pre_releases": false,
"version_upper_bound": null,
"release_prefix": null,
"version": "v1.1.2",
"revision": "c7b9645da9c0ddce4f9de4ef27ec01bb8108039a",
"url": "https://api.github.com/repos/kirelagin/dns.nix/tarball/v1.1.2",
"hash": "1b95dh15zl0qaf9fvvvvqlambm3plndpy24wwlib0sy4d0zq6y0h"
"version": "v1.2.0",
"revision": "a3196708a56dee76186a9415c187473b94e6cbae",
"url": "https://api.github.com/repos/kirelagin/dns.nix/tarball/v1.2.0",
"hash": "011b6ahj4qcf7jw009qgbf6k5dvjmgls88khwzgjr9kxlgbypb90"
},
"nixos-unstable": {
"type": "Git",
@ -58,9 +58,9 @@
"repo": "nixpkgs"
},
"branch": "nixos-unstable",
"revision": "051f920625ab5aabe37c920346e3e69d7d34400e",
"url": "https://github.com/NixOS/nixpkgs/archive/051f920625ab5aabe37c920346e3e69d7d34400e.tar.gz",
"hash": "08lin51g5x2vv89rs6vmqxnyy8pfysh0wdp6mdxw6l86dpm2rbg2"
"revision": "9357f4f23713673f310988025d9dc261c20e70c6",
"url": "https://github.com/NixOS/nixpkgs/archive/9357f4f23713673f310988025d9dc261c20e70c6.tar.gz",
"hash": "0mr3vfnl8h0214ml7l5hsaq2g9174r3ra0hzcvlqk9kg024siwbf"
}
},
"version": 3

View file

@ -0,0 +1,15 @@
diff --git a/authens/views.py b/authens/views.py
index 0478861..b1c93e9 100644
--- a/authens/views.py
+++ b/authens/views.py
@@ -138,8 +138,8 @@ class LogoutView(auth_views.LogoutView):
else:
self.cas_connected = False
- def get_next_page(self):
- next_page = super().get_next_page()
+ def get_success_url(self):
+ next_page = super().get_success_url()
if self.cas_connected:
cas_client = get_cas_client(self.request)

24
pkgs/authens/default.nix Normal file
View file

@ -0,0 +1,24 @@
{
python-cas,
django,
ldap,
buildPythonPackage,
}:
buildPythonPackage rec {
pname = "authens";
version = "v0.1b5";
doCheck = false;
patches = [
./01-get-success_url.patch
];
src = builtins.fetchGit {
url = "https://git.eleves.ens.fr/klub-dev-ens/authens.git";
#rev = "master";
#sha256 = "sha256-R0Nw212/BOPHfpspT5wzxtji1vxZ/JOuwr00naklWE8=";
};
propagatedBuildInputs = [
django
ldap
python-cas
];
}

View file

@ -0,0 +1,39 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
wheel,
django,
}:
buildPythonPackage rec {
pname = "django-autoslug";
version = "1.9.9";
pyproject = true;
src = fetchFromGitHub {
owner = "justinmayer";
repo = "django-autoslug";
rev = "v${version}";
hash = "sha256-IRLY4VaKYXVkSgU/zdY+PSmGrcFB2FlE5L7j0FqisRM=";
};
nativeBuildInputs = [
setuptools
wheel
];
propagatedBuildInputs = [ django ];
# Requires DJANGO_SETTINGS_MODULE
# pythonImportsCheck = [ "autoslug" ];
meta = with lib; {
description = "AutoSlugField for Django";
homepage = "https://github.com/justinmayer/django-autoslug/";
changelog = "https://github.com/justinmayer/django-autoslug/blob/${src.rev}/CHANGELOG.rst";
license = licenses.lgpl3Only;
maintainers = with maintainers; [ thubrecht ];
};
}

View file

@ -0,0 +1,34 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
wheel,
}:
buildPythonPackage rec {
pname = "loadcredential";
version = "1.2";
pyproject = true;
src = fetchFromGitHub {
owner = "Tom-Hubrecht";
repo = "loadcredential";
rev = "v${version}";
hash = "sha256-rNWFD89h1p1jYWLcfzsa/w8nK3bR4aVJsUPx0UtZnIw=";
};
build-system = [
setuptools
wheel
];
pythonImportsCheck = [ "loadcredential" ];
meta = {
description = "A simple python package to read credentials passed through systemd's LoadCredential, with a fallback on env variables ";
homepage = "https://github.com/Tom-Hubrecht/loadcredential";
license = lib.licenses.mit;
maintainers = [ ]; # with lib.maintainers; [ thubrecht ];
};
}

View file

@ -0,0 +1,42 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
unittestCheckHook,
setuptools,
wheel,
markdown,
}:
buildPythonPackage rec {
pname = "markdown-icons";
version = "3.1";
pyproject = true;
src = fetchFromGitHub {
owner = "Tom-Hubrecht";
repo = "markdown-icons";
rev = "v${version}";
hash = "sha256-EZY/gyyZ5axInBfvsWLrDeTLDD+m18qSpf5XrVKLOaM=";
};
nativeBuildInputs = [
setuptools
wheel
];
nativeCheckInputs = [ unittestCheckHook ];
propagatedBuildInputs = [ markdown ];
pythonImportsCheck = [ "iconfonts" ];
meta = with lib; {
description = "Easily display icon fonts in markdown";
homepage = "https://github.com/MadLittleMods/markdown-icons";
license = licenses.free;
maintainers = with maintainers; [ thubrecht ];
mainProgram = "markdown-icons";
platforms = platforms.all;
};
}

View file

@ -1 +1,14 @@
[]
[
(final: prev: {
python3 = prev.python3.override {
packageOverrides = self: _: {
loadcredential = self.callPackage ./loadcredential { };
authens = self.callPackage ./authens { };
python-cas = self.callPackage ./python-cas { };
django-autoslug = self.callPackage ./django-autoslug { };
markdown-icons = self.callPackage ./markdown-icons { };
};
};
})
]

View file

@ -1,4 +1,10 @@
{ lib, requests, lxml, six, buildPythonPackage, fetchFromGitHub }:
{
requests,
lxml,
six,
buildPythonPackage,
fetchFromGitHub,
}:
buildPythonPackage rec {
pname = "python-cas";
version = "1.6.0";
@ -9,5 +15,9 @@ buildPythonPackage rec {
rev = "v1.6.0";
sha512 = "sha512-qnYzgwELUij2EdqA6H17q8vnNUsfI7DkbZSI8CCIGfXOM+cZ7vsWe7CJxzsDUw73sBPB4+zzpLxvb7tpm/IDeg==";
};
propagatedBuildInputs = [ requests lxml six ];
propagatedBuildInputs = [
requests
lxml
six
];
}