Skip to content

Commit c83f2b8

Browse files
committed
Merge branch 'blueprint'
2 parents fa8a4a5 + 7391736 commit c83f2b8

18 files changed

+164
-244
lines changed

.envrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
# Used by https://direnv.net
3+
4+
# Automatically reload when this file changes
5+
watch_file lib/devshell.nix
6+
7+
# Load `nix develop`
8+
use flake
9+
10+
# Extend the environment with per-user overrides
11+
source_env_if_exists .envrc.local

flake.lock

Lines changed: 17 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 20 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -1,163 +1,31 @@
11
{
2-
description = "Stryke Force Website built using uv2nix";
2+
description = "Simple flake with a devshell";
33

4+
# Add all your dependencies here
45
inputs = {
5-
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-24.11";
67

7-
pyproject-nix = {
8-
url = "github:nix-community/pyproject.nix";
9-
inputs.nixpkgs.follows = "nixpkgs";
10-
};
8+
blueprint.url = "github:numtide/blueprint";
9+
blueprint.inputs.nixpkgs.follows = "nixpkgs";
1110

12-
uv2nix = {
13-
url = "github:adisbladis/uv2nix";
14-
inputs.pyproject-nix.follows = "pyproject-nix";
15-
inputs.nixpkgs.follows = "nixpkgs";
16-
};
11+
pyproject-nix.url = "github:nix-community/pyproject.nix";
12+
pyproject-nix.inputs.nixpkgs.follows = "nixpkgs";
1713

18-
pyproject-build-systems = {
19-
url = "github:pyproject-nix/build-system-pkgs";
20-
inputs.pyproject-nix.follows = "pyproject-nix";
21-
inputs.uv2nix.follows = "uv2nix";
22-
inputs.nixpkgs.follows = "nixpkgs";
23-
};
24-
flake-utils.url = "github:numtide/flake-utils";
14+
uv2nix.url = "github:adisbladis/uv2nix";
15+
uv2nix.inputs.pyproject-nix.follows = "pyproject-nix";
16+
uv2nix.inputs.nixpkgs.follows = "nixpkgs";
17+
18+
pyproject-build-systems.url = "github:pyproject-nix/build-system-pkgs";
19+
pyproject-build-systems.inputs.pyproject-nix.follows = "pyproject-nix";
20+
pyproject-build-systems.inputs.uv2nix.follows = "uv2nix";
21+
pyproject-build-systems.inputs.nixpkgs.follows = "nixpkgs";
2522
};
2623

24+
# Load the blueprint
2725
outputs =
28-
{
29-
self,
30-
nixpkgs,
31-
flake-utils,
32-
uv2nix,
33-
pyproject-nix,
34-
pyproject-build-systems,
35-
...
36-
}:
37-
flake-utils.lib.eachDefaultSystem (
38-
system:
39-
let
40-
pkgs = nixpkgs.legacyPackages.${system};
41-
inherit (nixpkgs) lib;
42-
43-
python = pkgs.python312;
44-
45-
workspace = uv2nix.lib.workspace.loadWorkspace { workspaceRoot = ./.; };
46-
overlay = workspace.mkPyprojectOverlay {
47-
sourcePreference = "wheel";
48-
};
49-
50-
pythonSet =
51-
let
52-
baseSet = pkgs.callPackage pyproject-nix.build.packages {
53-
inherit python;
54-
stdenv = pkgs.stdenv.override {
55-
targetPlatform = pkgs.stdenv.targetPlatform // {
56-
# allow downloading of opencv-python wheel
57-
darwinSdkVersion = "15.2";
58-
};
59-
};
60-
};
61-
62-
pillowHeifOverrides = import ./lib/overrides-pillow-heif.nix { inherit pkgs; };
63-
psycopgOverrides = import ./lib/overrides-psycopg.nix { inherit pkgs; };
64-
opencvOverrides = import ./lib/overrides-opencv.nix { inherit pkgs; };
65-
strykeforceOverrides = import ./lib/overrides-strykeforce.nix {
66-
inherit lib pkgs workspace;
67-
nixosModule = self.nixosModules.default;
68-
};
69-
tbaApiOverrides = import ./lib/overrides-tba-api-v3client.nix { inherit pkgs; };
70-
in
71-
baseSet.overrideScope (
72-
lib.composeManyExtensions [
73-
pyproject-build-systems.overlays.default
74-
overlay
75-
pillowHeifOverrides
76-
psycopgOverrides
77-
opencvOverrides
78-
strykeforceOverrides
79-
tbaApiOverrides
80-
]
81-
);
82-
83-
inherit (pkgs) writeShellApplication;
84-
85-
in
86-
{
87-
checks = pythonSet.website.passthru.tests;
88-
89-
packages = {
90-
venv = pythonSet.mkVirtualEnv "strykeforce-env" workspace.deps.default;
91-
92-
static = import ./lib/static.nix {
93-
inherit pkgs pythonSet;
94-
inherit (self.packages.${system}) venv;
95-
};
96-
97-
manage = import ./lib/manage.nix {
98-
inherit pkgs;
99-
inherit (self.packages.${system}) venv;
100-
inherit (self.packages.${system}) static;
101-
};
102-
103-
manage-old = writeShellApplication {
104-
name = "strykeforce-manage";
105-
106-
text = ''
107-
export DJANGO_SETTINGS_MODULE=website.settings.production
108-
export SECRET_KEY=notsecret
109-
export TBA_READ_KEY=
110-
export EMAIL_HOST_USER=
111-
export EMAIL_HOST_PASSWORD=
112-
export STATIC_ROOT=${self.packages.${system}.static}
113-
exec ${self.packages.${system}.venv}/bin/strykeforce-manage "$@"
114-
'';
115-
};
116-
117-
# refresh venv for Pycharm with: nix build .#venv -o venv
118-
default = self.packages.${system}.venv;
119-
};
120-
121-
apps = {
122-
default = {
123-
type = "app";
124-
program = "${self.packages.${system}.manage}/bin/strykeforce-manage";
125-
};
126-
};
127-
128-
devShells.default =
129-
let
130-
pkgs = nixpkgs.legacyPackages.${system};
131-
packages = with pkgs; [
132-
cachix
133-
just
134-
nil
135-
nix-output-monitor
136-
nixfmt-rfc-style
137-
nodejs
138-
postgresql.dev
139-
pre-commit
140-
python
141-
tailwindcss
142-
uv2nix.packages.${system}.uv-bin
143-
watchman
144-
];
145-
in
146-
pkgs.mkShell {
147-
inherit packages;
148-
shellHook = ''
149-
unset PYTHONPATH
150-
export UV_PYTHON_DOWNLOADS=never
151-
'';
152-
};
153-
}
154-
)
155-
// {
156-
nixosModules.strykeforce = import ./lib/module.nix self;
157-
nixosModules.default = self.nixosModules.strykeforce;
158-
159-
nixosConfigurations.container = import ./lib/container.nix {
160-
inherit self nixpkgs;
161-
};
26+
inputs:
27+
inputs.blueprint {
28+
inherit inputs;
29+
prefix = "lib";
16230
};
16331
}

lib/container.nix

Lines changed: 0 additions & 24 deletions
This file was deleted.

lib/devshell.nix

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
flake,
3+
perSystem,
4+
pkgs,
5+
}:
6+
pkgs.mkShell {
7+
packages = with pkgs; [
8+
(flake.lib.python pkgs)
9+
cachix
10+
just
11+
nil
12+
nix-output-monitor
13+
nixfmt-rfc-style
14+
nodejs
15+
postgresql.dev
16+
pre-commit
17+
tailwindcss
18+
perSystem.uv2nix.uv-bin
19+
watchman
20+
];
21+
22+
env = {
23+
UV_PYTHON_DOWNLOADS = "never";
24+
};
25+
26+
shellHook = ''
27+
unset PYTHONPATH
28+
'';
29+
}

lib/lib/default.nix

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{ flake, inputs, ... }:
2+
let
3+
workspace = inputs.uv2nix.lib.workspace.loadWorkspace { workspaceRoot = ../../.; };
4+
5+
overlay = workspace.mkPyprojectOverlay {
6+
sourcePreference = "wheel";
7+
};
8+
9+
python = pkgs: pkgs.python312;
10+
11+
pythonSets =
12+
pkgs:
13+
let
14+
baseSet = pkgs.callPackage inputs.pyproject-nix.build.packages {
15+
python = python pkgs;
16+
stdenv = pkgs.stdenv.override {
17+
targetPlatform = pkgs.stdenv.targetPlatform // {
18+
# allow downloading of opencv-python wheel
19+
darwinSdkVersion = "15.2";
20+
};
21+
};
22+
};
23+
24+
pillowHeifOverrides = import ./overrides/overrides-pillow-heif.nix { inherit pkgs; };
25+
psycopgOverrides = import ./overrides/overrides-psycopg.nix { inherit pkgs; };
26+
opencvOverrides = import ./overrides/overrides-opencv.nix { inherit pkgs; };
27+
strykeforceOverrides = import ./overrides/overrides-strykeforce.nix {
28+
inherit flake pkgs workspace;
29+
};
30+
tbaApiOverrides = import ./overrides/overrides-tba-api-v3client.nix { inherit pkgs; };
31+
in
32+
baseSet.overrideScope (
33+
inputs.nixpkgs.lib.composeManyExtensions [
34+
inputs.pyproject-build-systems.overlays.default
35+
overlay
36+
pillowHeifOverrides
37+
psycopgOverrides
38+
opencvOverrides
39+
strykeforceOverrides
40+
tbaApiOverrides
41+
]
42+
);
43+
in
44+
{
45+
46+
inherit
47+
overlay
48+
python
49+
pythonSets
50+
workspace
51+
;
52+
53+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)