add flake dev shell

This commit is contained in:
Jonas Heinrich 2025-09-19 13:48:32 +02:00
parent af31ea1abb
commit c56689893b
2 changed files with 87 additions and 73 deletions

6
flake.lock generated
View file

@ -2,11 +2,11 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1756886854, "lastModified": 1758070117,
"narHash": "sha256-6tooT142NLcFjt24Gi4B0G1pgWLvfw7y93sYEfSHlLI=", "narHash": "sha256-uLwwHFCZnT1c3N3biVe/0hCkag2GSrf9+M56+Okf+WY=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "0e6684e6c5755325f801bda1751a8a4038145d7d", "rev": "e9b7f2ff62b35f711568b1f0866243c7c302028d",
"type": "github" "type": "github"
}, },
"original": { "original": {

154
flake.nix
View file

@ -3,83 +3,97 @@
inputs.nixpkgs.url = "nixpkgs/nixos-25.05"; inputs.nixpkgs.url = "nixpkgs/nixos-25.05";
outputs = { self, nixpkgs, ... }@inputs: outputs =
let { self, nixpkgs, ... }@inputs:
pkgs = nixpkgs.legacyPackages.x86_64-linux; let
start = pkgs = nixpkgs.legacyPackages.x86_64-linux;
pkgs.writeShellScriptBin "start" '' start = pkgs.writeShellScriptBin "start" ''
set -e set -e
export NIXPKGS_ALLOW_INSECURE=1 export NIXPKGS_ALLOW_INSECURE=1
export QEMU_NET_OPTS="hostfwd=tcp::8080-:80" export QEMU_NET_OPTS="hostfwd=tcp::8080-:80"
${pkgs.nixos-shell}/bin/nixos-shell --flake . ${pkgs.nixos-shell}/bin/nixos-shell --flake .
''; '';
in { in
nixosConfigurations.vm = nixpkgs.lib.nixosSystem { {
system = "x86_64-linux"; nixosConfigurations.vm = nixpkgs.lib.nixosSystem {
specialArgs.inputs = inputs; system = "x86_64-linux";
pkgs = import nixpkgs { specialArgs.inputs = inputs;
overlays = [ pkgs = import nixpkgs {
(self: super: { overlays = [
froide-govplan = super.froide-govplan.overrideAttrs (oldAttrs: rec { (self: super: {
src = ./.; froide-govplan = super.froide-govplan.overrideAttrs (oldAttrs: rec {
postInstall = oldAttrs.postInstall + '' src = ./.;
rm -r $out/${pkgs.python3.sitePackages}/froide_govplan/templates postInstall = oldAttrs.postInstall + ''
ln -sf /var/lib/froide-govplan/templates $out/${pkgs.python3.sitePackages}/froide_govplan/templates rm -r $out/${pkgs.python3.sitePackages}/froide_govplan/templates
cp -r froide_govplan/static $out/${pkgs.python3.sitePackages}/froide_govplan/ ln -sf /var/lib/froide-govplan/templates $out/${pkgs.python3.sitePackages}/froide_govplan/templates
''; cp -r froide_govplan/static $out/${pkgs.python3.sitePackages}/froide_govplan/
}); '';
});
pythonPackagesExtensions = super.pythonPackagesExtensions ++ [
(
python-final: python-prev: {
moto = python-prev.moto.overridePythonAttrs (oldAttrs: { doCheck = false; });
}
)
];
pythonPackagesExtensions = super.pythonPackagesExtensions ++ [
(python-final: python-prev: {
moto = python-prev.moto.overridePythonAttrs (oldAttrs: {
doCheck = false;
});
})
];
}) })
];
};
modules = [
(
{
lib,
config,
pkgs,
...
}:
{
virtualisation = {
memorySize = 8000;
diskSize = 4096;
cores = 4;
};
disabledModules = [ "services/web-apps/froide-govplan.nix" ];
imports = [ ./froide-govplan.nix ];
services.froide-govplan = {
enable = true;
package = pkgs.froide-govplan;
settings = {
DEBUG = lib.mkForce true;
CSRF_TRUSTED_ORIGINS = [ "http://localhost:8080" ];
};
};
nixos-shell.mounts.extraMounts = {
"/var/lib/froide-govplan/templates" = {
target = /home/onny/projects/verwaltungstracker/froide_govplan/templates;
cache = "none";
};
};
system.stateVersion = "25.05";
services.getty.autologinUser = "root";
}
)
]; ];
}; };
modules = [
({ lib, config, pkgs, ... }: {
virtualisation = { devShells.x86_64-linux.default = pkgs.mkShell {
memorySize = 8000; packages = [pkgs.python3Packages.mastodon-py ] ++ pkgs.froide-govplan.dependencies;
diskSize = 4096; shellHook = ''
cores = 4; export GDAL_LIBRARY_PATH="${pkgs.gdal}/lib/libgdal.so"
}; export GEOS_LIBRARY_PATH="${pkgs.geos}/lib/libgeos_c.so"
'';
};
disabledModules = [ "services/web-apps/froide-govplan.nix" ]; packages = { inherit start; };
defaultPackage.x86_64-linux = start;
imports = [ ./froide-govplan.nix ];
services.froide-govplan = {
enable = true;
package = pkgs.froide-govplan;
settings = {
DEBUG = lib.mkForce true;
CSRF_TRUSTED_ORIGINS = [ "http://localhost:8080" ];
};
};
nixos-shell.mounts.extraMounts = {
"/var/lib/froide-govplan/templates" = {
target = /home/onny/projects/verwaltungstracker/froide_govplan/templates;
cache = "none";
};
};
system.stateVersion = "25.05";
services.getty.autologinUser = "root";
})
];
}; };
packages = { inherit start; };
defaultPackage.x86_64-linux = start;
};
} }