flake works

This commit is contained in:
Denis Lehmann 2021-04-21 12:27:33 +02:00
parent 39203d5279
commit a2f710c263
3 changed files with 26 additions and 48 deletions

View file

@ -178,4 +178,5 @@ if __name__ == "__main__":
print("profile '{}' applied".format(args.profile))
else:
parser.error("either set a profile or --iterate")
print("either set a profile or the --iterate flag")
exit(1)

View file

@ -18,18 +18,21 @@
packages.rzr =
pkgs.python3Packages.buildPythonApplication {
pkgs.python3Packages.buildPythonApplication rec {
name = "rzr";
src = self;
buildPhase = ''
'';
installPhase = ''
ls -l
exit 1
'';
nativeBuildInputs = with pkgs; [
wrapGAppsHook
];
propagatedBuildInputs = with pkgs; [
python3Packages.colour
python3Packages.openrazer
python3Packages.toml
];
};
defaultPackage = self.packages.${system}.rzr;
@ -39,7 +42,20 @@
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
python3
python3Packages.pip
python3Packages.virtualenv
python3Packages.colour
python3Packages.openrazer
python3Packages.toml
];
shellHook = ''
if [ ! -d .venv ]; then
python -m venv .venv
fi
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
'';
};
}

View file

@ -1,39 +0,0 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
buildInputs = with pkgs; [
python3
python3Packages.virtualenv
python3Packages.colour
python3Packages.openrazer
python3Packages.toml
];
shellHook = ''
function log_header {
echo -ne "==> \e[32m\e[1m$1\e[0m\n"
}
function log_subheader {
echo -ne "--> \e[33m\e[1m$1\e[0m\n"
}
function log {
echo -ne " $1\n"
}
echo ""
log_header "python_environment"
if [ ! -d .venv ]; then
python -m venv .venv
fi
source .venv/bin/activate
log_subheader "upgrading pip"
pip install --upgrade pip
echo ""
if [ -s requirements.txt ]; then
log_subheader "found requirements.txt, installing packages"
pip install -r requirements.txt
echo ""
fi
log_header "package versions"
log "$(python --version)"
log "$(pip --version)"
'';
}