File tree Expand file tree Collapse file tree 5 files changed +99
-27
lines changed
Expand file tree Collapse file tree 5 files changed +99
-27
lines changed Original file line number Diff line number Diff line change 1111 # Docs
1212 docs = pkgs . callPackage ./docs { inherit modules-docs ; } ;
1313
14+ # Tests
15+ tests = import ./tests { inherit pkgs system ; } ;
16+
1417 # Evaluate the devshell module
1518 eval = import ./modules pkgs ;
1619
Original file line number Diff line number Diff line change 1+ { system ? builtins . currentSystem
2+ , pkgs ? import ( import ../nix/nixpkgs.nix ) { inherit system ; }
3+ } :
4+ let
5+ devshell = import ../. { inherit pkgs ; } ;
6+ attrs = { inherit pkgs devshell ; } ;
7+ in
8+ { recurseForDerivations = true ; }
9+ // ( import ./devshell.nix attrs )
10+ // ( import ./git-hooks.nix attrs )
11+ // ( import ./modules-docs.nix attrs )
12+ // { }
Original file line number Diff line number Diff line change 1+ { pkgs , devshell } :
2+ {
3+ # Basic devshell usage
4+ devshell-1 =
5+ let
6+ shell = devshell . mkShell {
7+ devshell . name = "devshell-1" ;
8+ devshell . packages = [ pkgs . git ] ;
9+ } ;
10+ in
11+ pkgs . runCommand "devshell-1" { } ''
12+ # Load the devshell
13+ source ${ shell }
14+
15+ # Sets an environment variable that points to the buildEnv
16+ [[ -n $DEVSHELL_DIR ]]
17+
18+ # Points DEVSHELL_ROOT to the project root
19+ [[ $PWD == "$DEVSHELL_ROOT" ]]
20+
21+ # Adds packages to the PATH
22+ type -p git
23+
24+ touch $out
25+ '' ;
26+ }
Original file line number Diff line number Diff line change 1+ { pkgs , devshell } :
2+ {
3+ # Basic git.hooks module tests
4+ git-hooks-1 =
5+ let
6+ shell1 = devshell . mkShell {
7+ devshell . name = "git-hooks-1a" ;
8+ git . hooks . enable = true ;
9+ git . hooks . pre-commit . text = ''
10+ #!${ pkgs . bash } /bin/bash
11+ echo "PRE-COMMIT"
12+ '' ;
13+ } ;
14+
15+ shell2 = devshell . mkShell {
16+ devshell . name = "git-hooks-1b" ;
17+ git . hooks . enable = true ;
18+ } ;
19+ in
20+ pkgs . runCommand "git-hooks-1" { nativeBuildInputs = [ pkgs . git ] ; } ''
21+ git init
22+
23+ # The hook doesn't exist yet
24+ [[ ! -L .git/hooks/pre-commit ]]
25+
26+ # Load the devshell
27+ source ${ shell1 }
28+
29+ # The hook has been install
30+ [[ -L .git/hooks/pre-commit ]]
31+
32+ # The hook outputs what we want
33+ [[ $(.git/hooks/pre-commit) == "PRE-COMMIT" ]]
34+
35+ # Load the new config
36+ source ${ shell2 }
37+
38+ # The hook should have been uninstalled
39+ [[ ! -L .git/hooks/pre-commit ]]
40+
41+ touch $out
42+ '' ;
43+ }
Original file line number Diff line number Diff line change 1- { system ? builtins . currentSystem } :
2- let
3- nixpkgs = import ../nix/nixpkgs.nix ;
1+ { pkgs , devshell } :
2+ {
3+ modules-docs-1 =
4+ let
5+ shell = devshell . mkShell {
6+ devshell . name = "modules-docs" ;
7+ } ;
8+ in
9+ pkgs . runCommand "modules-docs-1" { } ''
10+ # The Markdown gets generated and is a derivation
11+ [[ ${ toString shell . config . modules-docs . markdown } == /nix/store/* ]]
412
5- pkgs = import nixpkgs {
6- config = { } ;
7- overlays = [ ] ;
8- } ;
13+ echo "Markdown has been generated"
914
10- configuration = with pkgs . lib ; {
11- config . modules-docs . baseURL = "https://example.com" ;
12-
13- options . test = mkOption {
14- type = types . str ;
15- default = "XXX" ;
16- description = ''
17- This is a description.
18- '' ;
19- } ;
20- } ;
21-
22- module = pkgs . lib . evalModules {
23- modules = [ ../modules/modules-docs.nix configuration ] ;
24- specialArgs = {
25- modulesPath = builtins . toString ../modules ;
26- } ;
27- } ;
28- in
29- module
15+ touch $out
16+ '' ;
17+ }
You can’t perform that action at this time.
0 commit comments