Skip to content

Commit 0157d3f

Browse files
committed
flake: split outputs into a separate file
1 parent 8508a2d commit 0157d3f

File tree

2 files changed

+94
-68
lines changed

2 files changed

+94
-68
lines changed

flake.nix

Lines changed: 1 addition & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -13,72 +13,5 @@
1313
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs-unstable";
1414
};
1515

16-
outputs =
17-
{
18-
self,
19-
nixpkgs,
20-
nixpkgs-unstable,
21-
androidPkgs,
22-
flake-compat,
23-
treefmt-nix,
24-
...
25-
}@inputs:
26-
let
27-
pkgs = import ./pkgs/default.nix { inherit inputs; };
28-
29-
treeFmt = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
30-
pythonForUpdaterScripts = pkgs.python3.withPackages (
31-
p: with p; [
32-
mypy
33-
flake8
34-
pytest
35-
]
36-
);
37-
in
38-
{
39-
# robotnixSystem evaluates a robotnix configuration
40-
lib.robotnixSystem = configuration: import ./default.nix { inherit configuration pkgs; };
41-
42-
defaultTemplate = {
43-
path = ./template;
44-
description = "A basic robotnix configuration";
45-
};
46-
47-
nixosModule = import ./nixos; # Contains all robotnix nixos modules
48-
nixosModules.attestation-server = import ./nixos/attestation-server/module.nix;
49-
50-
packages.x86_64-linux = {
51-
manual = (import ./docs { inherit pkgs; }).manual;
52-
gitRepo = pkgs.gitRepo;
53-
};
54-
55-
devShell.x86_64-linux = pkgs.mkShell {
56-
name = "robotnix-scripts";
57-
inputsFrom = [ treeFmt.config.build.devShell ];
58-
nativeBuildInputs = with pkgs; [
59-
pythonForUpdaterScripts
60-
gitRepo
61-
nix-prefetch-git
62-
curl
63-
pup
64-
jq
65-
shellcheck
66-
wget
67-
68-
# For chromium updater script
69-
# python2
70-
cipd
71-
git
72-
73-
cachix
74-
];
75-
PYTHONPATH = ./scripts;
76-
};
77-
78-
formatter.x86_64-linux = treeFmt.config.build.wrapper;
79-
80-
checks.x86_64-linux = {
81-
formatting = treeFmt.config.build.check self;
82-
};
83-
};
16+
outputs = args: import ./flake/outputs.nix args;
8417
}

flake/outputs.nix

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
{
2+
self,
3+
nixpkgs,
4+
nixpkgs-unstable,
5+
androidPkgs,
6+
flake-compat,
7+
treefmt-nix,
8+
...
9+
}@inputs:
10+
let
11+
pkgs = import ./../pkgs/default.nix { inherit inputs; };
12+
13+
treeFmt = treefmt-nix.lib.evalModule pkgs ./../treefmt.nix;
14+
pythonForUpdaterScripts = pkgs.python3.withPackages (
15+
p: with p; [
16+
mypy
17+
flake8
18+
pytest
19+
]
20+
);
21+
in
22+
{
23+
# robotnixSystem evaluates a robotnix configuration
24+
lib.robotnixSystem = configuration: import ./../default.nix { inherit configuration pkgs; };
25+
26+
defaultTemplate = {
27+
path = ./../template;
28+
description = "A basic robotnix configuration";
29+
};
30+
31+
nixosModule = import ./../nixos; # Contains all robotnix nixos modules
32+
nixosModules.attestation-server = import ./../nixos/attestation-server/module.nix;
33+
34+
packages.x86_64-linux = {
35+
manual = (import ./../docs { inherit pkgs; }).manual;
36+
gitRepo = pkgs.gitRepo;
37+
};
38+
39+
devShell.x86_64-linux = pkgs.mkShell {
40+
name = "robotnix-scripts";
41+
inputsFrom = [ treeFmt.config.build.devShell ];
42+
nativeBuildInputs = with pkgs; [
43+
pythonForUpdaterScripts
44+
gitRepo
45+
nix-prefetch-git
46+
curl
47+
pup
48+
jq
49+
wget
50+
yamlfmt
51+
52+
# For chromium updater script
53+
# python2
54+
cipd
55+
git
56+
57+
cachix
58+
];
59+
PYTHONPATH = ./../scripts;
60+
};
61+
62+
formatter.x86_64-linux = treeFmt.config.build.wrapper;
63+
64+
checks.x86_64-linux = {
65+
formatting = treeFmt.config.build.check self;
66+
pytest = pkgs.stdenvNoCC.mkDerivation {
67+
name = "pytest";
68+
src = ./..;
69+
70+
dontBuild = true;
71+
doCheck = true;
72+
73+
nativeBuildInputs = with pkgs; [
74+
pythonForUpdaterScripts
75+
git
76+
gitRepo
77+
nix-prefetch-git
78+
];
79+
checkPhase = ''
80+
NIX_PREFIX="$TMPDIR/nix"
81+
82+
mkdir -p "$NIX_PREFIX"
83+
84+
export NIX_STATE_DIR="$NIX_PREFIX/var/nix"
85+
86+
pytest "$src" \
87+
-p no:cacheprovider \
88+
--junitxml="$out/report.xml"
89+
'';
90+
};
91+
};
92+
93+
}

0 commit comments

Comments
 (0)