2022-08-28 05:58:42 +02:00
|
|
|
{
|
|
|
|
description = "Dibbler samspleisebod";
|
|
|
|
|
2024-11-15 02:34:52 +01:00
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable-small";
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
devenv.url = "github:cachix/devenv";
|
|
|
|
};
|
2022-08-28 05:58:42 +02:00
|
|
|
|
2024-11-15 02:34:52 +01:00
|
|
|
nixConfig = {
|
|
|
|
extra-trusted-public-keys = [
|
|
|
|
"devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
|
|
|
|
];
|
|
|
|
extra-substituters = [
|
|
|
|
"https://devenv.cachix.org"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs = { self, ... } @ inputs:
|
|
|
|
inputs.flake-utils.lib.eachDefaultSystem (system: let
|
|
|
|
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
|
|
|
inherit (pkgs) lib;
|
2023-08-29 18:32:49 +02:00
|
|
|
in {
|
2024-11-15 02:34:52 +01:00
|
|
|
|
2023-08-29 18:32:49 +02:00
|
|
|
packages = {
|
|
|
|
default = self.packages.${system}.dibbler;
|
2024-11-15 02:34:52 +01:00
|
|
|
|
2024-11-15 00:21:53 +01:00
|
|
|
dibbler = pkgs.python311Packages.callPackage ./nix/dibbler.nix { };
|
2024-11-15 02:34:52 +01:00
|
|
|
skrot-vm = self.nixosConfigurations.skrot.config.system.build.vm;
|
2022-08-28 09:39:07 +02:00
|
|
|
|
2024-11-15 02:34:52 +01:00
|
|
|
# devenv cruft
|
|
|
|
devenv-up = self.devShells.${system}.default.config.procfileScript;
|
|
|
|
devenv-test = self.devShells.${system}.default.config.test;
|
2023-08-29 18:32:49 +02:00
|
|
|
};
|
2023-08-30 00:02:17 +02:00
|
|
|
|
|
|
|
devShells = {
|
|
|
|
default = self.devShells.${system}.dibbler;
|
2024-11-15 02:34:52 +01:00
|
|
|
dibbler = inputs.devenv.lib.mkShell {
|
|
|
|
inherit inputs pkgs;
|
|
|
|
modules = [({ config, ... }: {
|
|
|
|
# https://devenv.sh/reference/options/
|
|
|
|
|
|
|
|
enterShell = ''
|
|
|
|
if [[ ! -f config.ini ]]; then
|
|
|
|
cp -v example-config.ini config.ini
|
|
|
|
fi
|
|
|
|
|
|
|
|
export REPO_ROOT=$(realpath .) # used by mkPythonEditablePackage
|
|
|
|
export DIBBLER_CONFIG_FILE=$(realpath config.ini)
|
|
|
|
export DIBBLER_DATABASE_URL=postgresql://dibbler:hunter2@/dibbler?host=${config.env.PGHOST}
|
|
|
|
'';
|
|
|
|
|
|
|
|
packages = [
|
|
|
|
|
|
|
|
/* self.packages.${system}.dibbler */
|
|
|
|
(pkgs.python311Packages.mkPythonEditablePackage {
|
|
|
|
inherit (self.packages.${system}.dibbler)
|
|
|
|
pname version
|
|
|
|
build-system dependencies;
|
|
|
|
scripts = (lib.importTOML ./pyproject.toml).project.scripts;
|
|
|
|
root = "$REPO_ROOT";
|
|
|
|
})
|
|
|
|
|
|
|
|
pkgs.python311Packages.black
|
|
|
|
pkgs.ruff
|
|
|
|
];
|
|
|
|
|
|
|
|
services.postgres = {
|
|
|
|
enable = true;
|
|
|
|
initialDatabases = [
|
|
|
|
{
|
|
|
|
name = "dibbler";
|
|
|
|
user = "dibbler";
|
|
|
|
pass = "hunter2";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
})];
|
2023-08-30 00:02:17 +02:00
|
|
|
};
|
|
|
|
};
|
2024-11-15 02:34:52 +01:00
|
|
|
|
2023-08-29 18:32:49 +02:00
|
|
|
})
|
2023-01-29 03:53:13 +01:00
|
|
|
|
2023-08-29 18:32:49 +02:00
|
|
|
//
|
2023-01-29 03:53:13 +01:00
|
|
|
|
2023-08-29 18:32:49 +02:00
|
|
|
{
|
|
|
|
# Note: using the module requires that you have applied the
|
|
|
|
# overlay first
|
|
|
|
nixosModules.default = import ./nix/module.nix;
|
2023-01-29 03:53:13 +01:00
|
|
|
|
2023-08-29 18:32:49 +02:00
|
|
|
images.skrot = self.nixosConfigurations.skrot.config.system.build.sdImage;
|
2022-08-28 09:39:07 +02:00
|
|
|
|
2024-11-15 02:34:52 +01:00
|
|
|
nixosConfigurations.skrot = inputs.nixpkgs.lib.nixosSystem {
|
2022-08-28 09:39:07 +02:00
|
|
|
system = "aarch64-linux";
|
|
|
|
modules = [
|
2024-11-15 02:34:52 +01:00
|
|
|
(inputs.nixpkgs + "/nixos/modules/installer/sd-card/sd-image-aarch64.nix")
|
2022-08-28 09:39:07 +02:00
|
|
|
self.nixosModules.default
|
|
|
|
({...}: {
|
|
|
|
system.stateVersion = "22.05";
|
2023-01-29 03:53:13 +01:00
|
|
|
|
2022-08-28 09:39:07 +02:00
|
|
|
networking = {
|
|
|
|
hostName = "skrot";
|
|
|
|
domain = "pvv.ntnu.no";
|
2023-01-29 03:23:33 +01:00
|
|
|
nameservers = [ "129.241.0.200" "129.241.0.201" ];
|
|
|
|
defaultGateway = "129.241.210.129";
|
|
|
|
interfaces.eth0 = {
|
|
|
|
useDHCP = false;
|
2023-01-29 03:53:13 +01:00
|
|
|
ipv4.addresses = [{
|
|
|
|
address = "129.241.210.235";
|
|
|
|
prefixLength = 25;
|
|
|
|
}];
|
2023-01-29 03:23:33 +01:00
|
|
|
};
|
2022-08-28 09:39:07 +02:00
|
|
|
};
|
2023-01-29 03:23:33 +01:00
|
|
|
# services.resolved.enable = true;
|
|
|
|
# systemd.network.enable = true;
|
|
|
|
# systemd.network.networks."30-network" = {
|
|
|
|
# matchConfig.Name = "*";
|
|
|
|
# DHCP = "no";
|
|
|
|
# address = [ "129.241.210.235/25" ];
|
|
|
|
# gateway = [ "129.241.210.129" ];
|
|
|
|
# };
|
2022-08-28 09:39:07 +02:00
|
|
|
})
|
|
|
|
];
|
|
|
|
};
|
2024-11-15 02:34:52 +01:00
|
|
|
|
2022-08-28 09:39:07 +02:00
|
|
|
};
|
2022-08-28 05:58:42 +02:00
|
|
|
}
|