-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2 package stregsystemet #3
Conversation
…e system is functional at this stage but needs more configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's your review! Should ask before this is merged, has Stregsystemet been shown to successfully run when built from this?
pkgs/development/django-select2.nix
Outdated
@@ -0,0 +1,34 @@ | |||
{pkgs ? import <nixpkgs> {}, lib ? pkgs.lib}: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's bad practice to not pin Nixpkgs, as the version on one system might not match that on another.
What we should do is create a flake.nix
that imports Nixpkgs and uses pkgs.callPacakge
to provide the packages in each file. This would also make ? pkgs.lib
redundant.
{pkgs ? import <nixpkgs> {}, lib ? pkgs.lib}: | |
{pkgs, lib}: |
pkgs/stregsystemet.nix
Outdated
pkgs ? import <nixpkgs> {}, | ||
fetchFromGitHub ? pkgs.fetchFromGitHub, | ||
lib ? pkgs.lib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
pkgs ? import <nixpkgs> {}, | |
fetchFromGitHub ? pkgs.fetchFromGitHub, | |
lib ? pkgs.lib | |
pkgs, | |
fetchFromGitHub, | |
lib |
pkgs/stregsystemet.nix
Outdated
fetchFromGitHub ? pkgs.fetchFromGitHub, | ||
lib ? pkgs.lib | ||
}: | ||
with lib; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unnecessary, and it works fine without. It's also poor practice, as it can make it hard to tell when something from lib
is being used.
with lib; |
pkgs/stregsystemet.nix
Outdated
django-select2 = pkgs: pkgs.callPackage ./development/django-select2.nix {}; | ||
env = (pkgs.python3.withPackages (pythonPackages: with pythonPackages; [ | ||
(django-select2 pkgs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have pkgs
, no need to have it passed in via a function.
django-select2 = pkgs: pkgs.callPackage ./development/django-select2.nix {}; | |
env = (pkgs.python3.withPackages (pythonPackages: with pythonPackages; [ | |
(django-select2 pkgs) | |
django-select2 = pkgs.callPackage ./development/django-select2.nix {}; | |
env = (pkgs.python3.withPackages (pythonPackages: with pythonPackages; [ | |
django-select2 |
pkgs/stregsystemet.nix
Outdated
pkgs.stdenv.mkDerivation rec { | ||
pname = "stregsystemet"; | ||
version = "2.4.5"; | ||
|
||
src = pkgs.fetchFromGitHub { | ||
owner = "f-klubben"; | ||
repo = "stregsystemet"; | ||
rev = "v${version}"; | ||
sha256 = "sha256-dd3TnyH7+iFH1rZFOZcWw+66Jh4S6DeU67cPTwJIJLY="; | ||
}; | ||
|
||
installPhase = '' | ||
mkdir -p $out/bin | ||
mkdir -p $out/usr/share/stregsystemet | ||
cat > local.cfg << EOF | ||
[general] | ||
|
||
[debug] | ||
|
||
[database] | ||
|
||
[hostnames] | ||
1=192.168.122.202 | ||
EOF | ||
sed -i '1 i #!${env.interpreter}' manage.py | ||
|
||
cp ./* $out/usr/share/stregsystemet -r | ||
ln -s $out/usr/share/stregsystemet/manage.py $out/bin/stregsystemet | ||
#mkdir -p /opt/stregsystemet | ||
#touch /opt/stregsystemet/data.json | ||
#touch /opt/stregsystemet/db.sqlite3 | ||
''; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be doable more cleanly with buildPythonApplication
. I'm certainly a bit weary of the non-standard use of /usr/share
inside a derivation.
@TobiasSN sure i'll look at the suggestions and test it within a few days |
Contains a basic NixOS setup, as well as other basic scaffolding. Co-authored-by: Tobias SN <[email protected]>
Contains a basic NixOS setup, as well as other basic scaffolding. Co-authored-by: Tobias SN <[email protected]>
options seem to be better suited for a seperate issue