Skip to content

Commit 4cc35c2

Browse files
committed
Fix build issue
Applying vlaci#152
1 parent 17de7eb commit 4cc35c2

9 files changed

+574
-452
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,9 @@ venv.bak/
109109

110110
# pre-commit
111111
.pre-commit-cache
112+
113+
# direnv
114+
/.direnv
115+
116+
# Nix
117+
result

flake.lock

+98-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+44-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,57 @@
11
{
22
inputs = {
3-
flake-utils.url = "github:numtide/flake-utils";
3+
flake-utils.url = github:numtide/flake-utils;
4+
5+
poetry2nix = {
6+
url = github:nix-community/poetry2nix;
7+
inputs.flake-utils.follows = "flake-utils";
8+
inputs.nixpkgs.follows = "nixpkgs";
9+
inputs.nix-github-actions.follows = "nix-github-actions";
10+
inputs.treefmt-nix.follows = "treefmt-nix";
11+
inputs.systems.follows = "systems";
12+
};
13+
14+
15+
# Unused but allows downstream to override versions and avoids duplicates
16+
17+
nix-github-actions = {
18+
url = github:nix-community/nix-github-actions;
19+
inputs.nixpkgs.follows = "nixpkgs";
20+
};
21+
22+
systems.url = github:nix-systems/default;
23+
24+
treefmt-nix = {
25+
url = github:numtide/treefmt-nix;
26+
inputs.nixpkgs.follows = "nixpkgs";
27+
};
428
};
529

6-
outputs = { self, flake-utils, nixpkgs }: (flake-utils.lib.eachDefaultSystem (
30+
outputs = { self, nixpkgs, ... }@inputs: (inputs.flake-utils.lib.eachDefaultSystem (
731
system:
832
let
933
pkgs = nixpkgs.legacyPackages.${system};
10-
openconnect-sso = (import ./nix { inherit pkgs; }).openconnect-sso;
34+
poetry2nix = inputs.poetry2nix.lib.mkPoetry2Nix { inherit pkgs; };
35+
36+
openconnect-pkgs = import ./nix {
37+
inherit pkgs poetry2nix;
38+
sources = null; # make sure we don't mix flakes and Niv
39+
};
1140
in
1241
{
13-
packages = { inherit openconnect-sso; };
14-
defaultPackage = openconnect-sso;
42+
packages = rec {
43+
inherit (openconnect-pkgs) openconnect-sso;
44+
45+
default = openconnect-sso;
46+
};
47+
48+
devShells.default = openconnect-pkgs.shell;
1549
}
1650
) // {
17-
overlay = import ./overlay.nix;
51+
overlays = rec {
52+
default = openconnect-sso;
53+
54+
openconnect-sso = import ./overlay.nix;
55+
};
1856
});
1957
}

nix/default.nix

+10-16
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
{ sources ? import ./sources.nix
2-
, pkgs ? import <nixpkgs> {
3-
overlays = [ (import "${sources.poetry2nix}/overlay.nix") ];
4-
}
2+
, pkgs ? import <nixpkgs> { }
3+
, poetry2nix ? import sources.poetry2nix { inherit pkgs; }
54
}:
65

76
let
8-
qtLibsFor = with pkgs.lib; dep:
9-
let
10-
qtbase = head (filter (d: getName d.name == "qtbase") dep.nativeBuildInputs);
11-
version = splitVersion qtbase.version;
12-
majorMinor = concatStrings (take 2 version);
13-
in
14-
pkgs."libsForQt${majorMinor}";
7+
inherit (pkgs) python3Packages qt6Packages;
158

16-
inherit (qtLibsFor pkgs.python3Packages.pyqt5) callPackage;
17-
pythonPackages = pkgs.python3Packages;
18-
19-
openconnect-sso = callPackage ./openconnect-sso.nix { inherit (pkgs) python3Packages; };
9+
openconnect-sso = qt6Packages.callPackage ./openconnect-sso.nix { inherit poetry2nix; };
2010

2111
shell = pkgs.mkShell {
2212
buildInputs = with pkgs; [
@@ -29,7 +19,7 @@ let
2919
nixpkgs-fmt # To format Nix source files
3020
poetry # Dependency manager for Python
3121
] ++ (
32-
with pythonPackages; [
22+
with python3Packages; [
3323
pre-commit # To check coding style during commit
3424
]
3525
) ++ (
@@ -59,7 +49,11 @@ let
5949
"\${qtWrapperArgs[@]}"
6050
];
6151
unpackPhase = ":";
62-
nativeBuildInputs = [ pkgs.qt5.wrapQtAppsHook ];
52+
53+
nativeBuildInputs = [
54+
qt6Packages.wrapQtAppsHook
55+
];
56+
6357
installPhase = ''
6458
mkdir -p $out/bin
6559
cat > $out/bin/wrap-qt <<'EOF'

nix/openconnect-sso.nix

+44-11
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,65 @@
11
{ lib
2+
, stdenv
23
, openconnect
34
, python3
45
, python3Packages
56
, poetry2nix
6-
, substituteAll
7+
, qt6Packages
78
, wrapQtAppsHook
89
}:
910

11+
# Nixpkgs' qutebrowser derivation is a good reference to check if something breaks
12+
1013
poetry2nix.mkPoetryApplication {
11-
src = lib.cleanSource ../.;
12-
pyproject = ../pyproject.toml;
13-
poetrylock = ../poetry.lock;
14+
projectDir = ../.;
1415
python = python3;
15-
buildInputs = [ wrapQtAppsHook ];
16-
propagatedBuildInputs = [ openconnect ];
1716

18-
dontWrapQtApps = true;
19-
makeWrapperArgs = [
20-
"\${qtWrapperArgs[@]}"
17+
# Skip dev-dependencies (doesn't seem to work, but doesn't hurt)
18+
groups = [ ];
19+
checkGroups = [ ];
20+
21+
buildInputs = [
22+
python3Packages.setuptools
23+
];
24+
25+
nativeBuildInputs = [
26+
wrapQtAppsHook
2127
];
2228

23-
preferWheels = true;
29+
propagatedBuildInputs = [
30+
openconnect
31+
] ++ lib.optional (stdenv.isLinux) qt6Packages.qtwayland;
32+
33+
dontWrapQtApps = true;
34+
preFixup = ''
35+
makeWrapperArgs+=(
36+
# Force the app to use QT_PLUGIN_PATH values from wrapper
37+
--unset QT_PLUGIN_PATH
38+
"''${qtWrapperArgs[@]}"
39+
# avoid persistant warning on starup
40+
--set QT_STYLE_OVERRIDE Fusion
41+
)
42+
'';
43+
44+
# preferWheels = true;
2445

2546
overrides = [
2647
poetry2nix.defaultPoetryOverrides
2748
(
2849
self: super: {
29-
inherit (python3Packages) cryptography pyqt6 pyqt6-sip pyqt6-webengine six more-itertools;
50+
inherit (python3Packages)
51+
cryptography
52+
more-itertools
53+
pyqt6
54+
pyqt6-sip
55+
pyqt6-webengine
56+
pysocks
57+
requests
58+
six;
59+
60+
coverage-enable-subprocess = super.coverage-enable-subprocess.overridePythonAttrs (old: {
61+
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.setuptools ];
62+
});
3063
}
3164
)
3265
];

nix/sources.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55
"homepage": "https://github.com/nmattia/niv",
66
"owner": "nmattia",
77
"repo": "niv",
8-
"rev": "351d8bc316bf901a81885bab5f52687ec8ccab6e",
9-
"sha256": "1yzhz7ihkh6p2sxhp3amqfbmm2yqzaadqqii1xijymvl8alw5rrr",
8+
"rev": "7b76374b2b44152bfbf41fcb60162c2ce9182e7a",
9+
"sha256": "1ql11hzgxdahj9x0b20b70izcmayb22rinrg82kgp5z19bvpsgrp",
1010
"type": "tarball",
11-
"url": "https://github.com/nmattia/niv/archive/351d8bc316bf901a81885bab5f52687ec8ccab6e.tar.gz",
11+
"url": "https://github.com/nmattia/niv/archive/7b76374b2b44152bfbf41fcb60162c2ce9182e7a.tar.gz",
1212
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
1313
},
1414
"poetry2nix": {
15-
"branch": "1.41.0",
15+
"branch": "master",
1616
"description": "Convert poetry projects to nix automagically [maintainer=@adisbladis] ",
1717
"homepage": "",
1818
"owner": "nix-community",
1919
"repo": "poetry2nix",
20-
"rev": "585f19cce38a7f75d5bc567b17060ec45bc63ed0",
21-
"sha256": "0dj2a1wzcyilrc9fmfffx6d3bgq7zpawjadd7rphkkq8imh18y6a",
20+
"rev": "0b2bff39e9bd4e6db3208e09c276ca83a063b370",
21+
"sha256": "0qs6y567yqirhys5a9mz1zqppig33pr70kcka4j10vn62p9qi0z4",
2222
"type": "tarball",
23-
"url": "https://github.com/nix-community/poetry2nix/archive/585f19cce38a7f75d5bc567b17060ec45bc63ed0.tar.gz",
23+
"url": "https://github.com/nix-community/poetry2nix/archive/0b2bff39e9bd4e6db3208e09c276ca83a063b370.tar.gz",
2424
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
2525
}
2626
}

overlay.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
final: prev: {
2-
inherit (prev.callPackage ./nix { pkgs = final; }) openconnect-sso;
2+
inherit (import ./nix { pkgs = prev; }) openconnect-sso;
33
}

0 commit comments

Comments
 (0)