-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
1,154 additions
and
632 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,8 @@ stregsystem/*-tokens.json.bak | |
|
||
# ignore default log file location | ||
stregsystem.log | ||
|
||
# nix | ||
.direnv | ||
.envrc | ||
result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,16 @@ For Ubuntu with virtual envs: | |
5. ??? | ||
6. Profit | ||
|
||
For systems running the Nix package manager: | ||
1. Configure Nix to use nix-command and flakes | ||
- `echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf` | ||
2. Start shell | ||
- `nix develop` | ||
2. Or run the system | ||
- `nix run . testserver stregsystem/fixtures/testdata.json` | ||
3. ??? | ||
4. Profit | ||
|
||
For Mac users with virtual envs: | ||
1. Install python3.11 with pip | ||
- `brew install [email protected]` | ||
|
@@ -43,7 +53,6 @@ For Mac users with virtual envs: | |
5. ??? | ||
6. Profit | ||
|
||
|
||
Using Testdata | ||
-------- | ||
In order to simplify development for all, we have included a test fixture. | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
description = "F-klubbens Stregsystem"; | ||
|
||
# define nixpkgs version to use | ||
inputs = { | ||
nixpkgs.url = "nixpkgs/nixos-24.05"; | ||
}; | ||
|
||
outputs = { self, nixpkgs }: let | ||
system = "x86_64-linux"; | ||
pkgs = import nixpkgs { inherit system; }; | ||
|
||
dependencies = import ./nix-support { inherit pkgs; }; | ||
|
||
in { | ||
# Define the shell, here we're just setting the packages required for the devshell | ||
devShells.${system}.default = pkgs.mkShell { | ||
packages = (dependencies pkgs.python311Packages) ++ [pkgs.mailhog pkgs.black]; | ||
}; | ||
|
||
# Default package for the stregsystem | ||
packages.${system}.default = let | ||
env = pkgs.python311.withPackages dependencies; | ||
in pkgs.stdenv.mkDerivation { | ||
pname = "stregsystemet"; | ||
version = "latest"; | ||
src = ./.; | ||
|
||
installPhase = '' | ||
mkdir -p $out/bin | ||
mkdir -p $out/share/stregsystemet | ||
cp local.cfg.skel local.cfg | ||
echo "${env.interpreter} $out/share/stregsystemet/manage.py \$@" > $out/bin/stregsystemet | ||
sed -i '1 i #!${pkgs.bash}/bin/bash' $out/bin/stregsystemet | ||
chmod +x $out/bin/stregsystemet | ||
sed -i '1d' manage.py | ||
cp ./* $out/share/stregsystemet -r | ||
''; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{pkgs}: let | ||
# Based on requirements.txt, determine dependencies to fetch from nixpkgs | ||
requirements = ../requirements.txt; | ||
# Read file and split it into lines | ||
lines = pkgs.lib.lists.remove "" (pkgs.lib.strings.splitString "\n" (builtins.readFile requirements)); | ||
packages = map (pkg: builtins.elemAt (pkgs.lib.strings.splitString "==" pkg) 0) lines; | ||
filteredPackages = builtins.filter (pkg: pkg != "Django-Select2") packages; | ||
in py: [(pkgs.callPackage ./django-select2.nix { inherit pkgs py; })] ++ map (pkg: py.${pkgs.lib.toLower pkg}) filteredPackages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{pkgs, py}: | ||
|
||
py.buildPythonPackage { | ||
pname = "Django-Select2"; | ||
version = "8.1.2"; | ||
src = pkgs.fetchurl { | ||
url = "https://files.pythonhosted.org/packages/7f/af/2fc371e1dea6686b588ab9cd445e55b63248a525f8c90550767a42dd77bb/django_select2-8.1.2.tar.gz"; | ||
sha256 = "sha256-9EaF7hw5CQqt4B4+vCVnAvBWIPPHijwmhECtmmYHCHY="; | ||
}; | ||
format = "pyproject"; | ||
doCheck = false; | ||
buildInputs = []; | ||
checkInputs = []; | ||
nativeBuildInputs = []; | ||
propagatedBuildInputs = [ | ||
py.django-appconf | ||
py.flit-scm | ||
]; | ||
} | ||
|
Oops, something went wrong.