Skip to content

Commit d999b23

Browse files
committed
flake: split outputs into a separate file
1 parent 675a9c3 commit d999b23

File tree

2 files changed

+93
-69
lines changed

2 files changed

+93
-69
lines changed

flake.nix

Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -15,73 +15,5 @@
1515
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs-unstable";
1616
};
1717

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

flake/outputs.nix

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
{
2+
self,
3+
nixpkgs,
4+
nixpkgs-unstable,
5+
androidPkgs,
6+
flake-compat,
7+
treefmt,
8+
treefmt-nix,
9+
...
10+
}@inputs:
11+
let
12+
pkgs = import ./../pkgs/default.nix { inherit inputs; };
13+
14+
treeFmt = treefmt-nix.lib.evalModule pkgs ./../treefmt.nix;
15+
pythonForUpdaterScripts = pkgs.python3.withPackages (
16+
p: with p; [
17+
mypy
18+
flake8
19+
pytest
20+
]
21+
);
22+
in
23+
{
24+
# robotnixSystem evaluates a robotnix configuration
25+
lib.robotnixSystem = configuration: import ./../default.nix { inherit configuration pkgs; };
26+
27+
defaultTemplate = {
28+
path = ./../template;
29+
description = "A basic robotnix configuration";
30+
};
31+
32+
nixosModule = import ./../nixos; # Contains all robotnix nixos modules
33+
nixosModules.attestation-server = import ./../nixos/attestation-server/module.nix;
34+
35+
packages.x86_64-linux = {
36+
manual = (import ./../docs { inherit pkgs; }).manual;
37+
gitRepo = pkgs.gitRepo;
38+
};
39+
40+
devShell.x86_64-linux = pkgs.mkShell {
41+
name = "robotnix-scripts";
42+
inputsFrom = [ treeFmt.config.build.devShell ];
43+
nativeBuildInputs = with pkgs; [
44+
pythonForUpdaterScripts
45+
gitRepo
46+
nix-prefetch-git
47+
curl
48+
pup
49+
jq
50+
wget
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+
}

0 commit comments

Comments
 (0)