Prefer builtins.path
Thanks to the Nix anti-patterns documented here... https://nix.dev/anti-patterns/language.html#reproducability-referencing-top-level-directory-with ...I'm cleaning up some of my Nix expressions. Read the article for more context.
This commit is contained in:
		
							parent
							
								
									155dff562a
								
							
						
					
					
						commit
						e4ddc3ba75
					
				
					 12 changed files with 13 additions and 15 deletions
				
			
		|  | @ -2,7 +2,7 @@ | ||||||
| 
 | 
 | ||||||
| pkgs.stdenv.mkDerivation { | pkgs.stdenv.mkDerivation { | ||||||
|   name = "typescript"; |   name = "typescript"; | ||||||
|   srcs = ./.; |   srcs = builtins.path { path = ./.; name = "typescript"; }; | ||||||
|   buildInputs = with pkgs; [ |   buildInputs = with pkgs; [ | ||||||
|     nodejs |     nodejs | ||||||
|     # Exposes lscpu for parcel.js |     # Exposes lscpu for parcel.js | ||||||
|  |  | ||||||
|  | @ -12,9 +12,7 @@ let | ||||||
|   # This is the systemd service unit |   # This is the systemd service unit | ||||||
|   service = pkgs.stdenv.mkDerivation { |   service = pkgs.stdenv.mkDerivation { | ||||||
|     name = "url-blocker"; |     name = "url-blocker"; | ||||||
|     src = ./.; |     src = builtins.path { path = ./.; name = "url-blocker"; }; | ||||||
|     buildInputs = with pkgs; [ |  | ||||||
|     ]; |  | ||||||
|     buildPhase = '' |     buildPhase = '' | ||||||
|     ${ghc}/bin/ghc Main.hs |     ${ghc}/bin/ghc Main.hs | ||||||
|   ''; |   ''; | ||||||
|  |  | ||||||
|  | @ -3,7 +3,7 @@ | ||||||
| pkgs.stdenv.mkDerivation { | pkgs.stdenv.mkDerivation { | ||||||
|   name = "blog.wpcarro.dev"; |   name = "blog.wpcarro.dev"; | ||||||
|   buildInputs = with pkgs; [ hugo ]; |   buildInputs = with pkgs; [ hugo ]; | ||||||
|   src = ./.; |   src = builtins.path { path = ./.; name = "blog"; }; | ||||||
|   buildPhase = '' |   buildPhase = '' | ||||||
|     mkdir -p $out |     mkdir -p $out | ||||||
|     ${pkgs.hugo}/bin/hugo --minify --destination $out |     ${pkgs.hugo}/bin/hugo --minify --destination $out | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| 
 | 
 | ||||||
| pkgs.stdenv.mkDerivation { | pkgs.stdenv.mkDerivation { | ||||||
|   name = "typescript"; |   name = "typescript"; | ||||||
|   srcs = ./.; |   srcs = builtins.path { path = ./.; name = "day-of-week-habits"; }; | ||||||
|   buildInputs = with pkgs; [ |   buildInputs = with pkgs; [ | ||||||
|     nodejs |     nodejs | ||||||
|     # Exposes lscpu for parcel.js |     # Exposes lscpu for parcel.js | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| 
 | 
 | ||||||
| pkgs.stdenv.mkDerivation { | pkgs.stdenv.mkDerivation { | ||||||
|   name = "wpcarro.dev"; |   name = "wpcarro.dev"; | ||||||
|   src = ./.; |   src = builtins.path { path = ./.; name = "website"; }; | ||||||
|   installPhase = '' |   installPhase = '' | ||||||
|     mkdir -p $out |     mkdir -p $out | ||||||
|     cp $src/index.html $out |     cp $src/index.html $out | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| 
 | 
 | ||||||
| pkgs.stdenv.mkDerivation { | pkgs.stdenv.mkDerivation { | ||||||
|   name = "goals-webpage"; |   name = "goals-webpage"; | ||||||
|   src = ./.; |   src = builtins.path { path = ./.; name = "goals"; }; | ||||||
|   buildInputs = with pkgs; [ |   buildInputs = with pkgs; [ | ||||||
|     nodejs |     nodejs | ||||||
|     # Exposes lscpu for parcel.js |     # Exposes lscpu for parcel.js | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| 
 | 
 | ||||||
| pkgs.stdenv.mkDerivation { | pkgs.stdenv.mkDerivation { | ||||||
|   name = "typescript"; |   name = "typescript"; | ||||||
|   srcs = ./.; |   srcs = builtins.path { path = ./.; name = "habitgarden"; }; | ||||||
|   buildInputs = with pkgs; [ |   buildInputs = with pkgs; [ | ||||||
|     nodejs |     nodejs | ||||||
|     # Exposes lscpu for parcel.js |     # Exposes lscpu for parcel.js | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| 
 | 
 | ||||||
| pkgs.stdenv.mkDerivation { | pkgs.stdenv.mkDerivation { | ||||||
|   name = "habits-webpage"; |   name = "habits-webpage"; | ||||||
|   src = ../../org; |   src = builtins.path { path ../../org; name = "org"; }; | ||||||
|   buildInputs = []; |   buildInputs = []; | ||||||
|   buildPhase = '' |   buildPhase = '' | ||||||
|     ${pkgs.pandoc}/bin/pandoc $src/habits.org -o index.html |     ${pkgs.pandoc}/bin/pandoc $src/habits.org -o index.html | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ let | ||||||
|   pkgs = import <nixpkgs> {}; |   pkgs = import <nixpkgs> {}; | ||||||
| in pkgs.stdenv.mkDerivation { | in pkgs.stdenv.mkDerivation { | ||||||
|   name = "ideal-website"; |   name = "ideal-website"; | ||||||
|   srcs = ./.; |   src = builtins.path { path = ./.; name = "contentful"; }; | ||||||
|   buildInputs = with pkgs; [ |   buildInputs = with pkgs; [ | ||||||
|     nodejs |     nodejs | ||||||
|     # Exposes lscpu for parcel.js |     # Exposes lscpu for parcel.js | ||||||
|  |  | ||||||
|  | @ -3,7 +3,7 @@ | ||||||
| pkgs.stdenv.mkDerivation { | pkgs.stdenv.mkDerivation { | ||||||
|   name = "covid-uk"; |   name = "covid-uk"; | ||||||
|   buildInputs = []; |   buildInputs = []; | ||||||
|   src = ./.; |   src = builtins.path { path = ./.; name = "covid-uk"; }; | ||||||
|   # TODO(wpcarro): Need to run `yarn install` somehow. |   # TODO(wpcarro): Need to run `yarn install` somehow. | ||||||
|   # TODO(wpcarro): Need to run `npx tailwindcss build styles.css -o output.css`. |   # TODO(wpcarro): Need to run `npx tailwindcss build styles.css -o output.css`. | ||||||
|   buildPhase = '' |   buildPhase = '' | ||||||
|  |  | ||||||
|  | @ -3,7 +3,7 @@ | ||||||
| pkgs.stdenv.mkDerivation { | pkgs.stdenv.mkDerivation { | ||||||
|   name = "covid-uk"; |   name = "covid-uk"; | ||||||
|   buildInputs = []; |   buildInputs = []; | ||||||
|   src = ./.; |   src = builtins.path { path = ./.; name = "sandbox"; }; | ||||||
|   buildPhase = '' |   buildPhase = '' | ||||||
|     mkdir -p $out |     mkdir -p $out | ||||||
|     cp $src/index.html $out |     cp $src/index.html $out | ||||||
|  |  | ||||||
|  | @ -43,7 +43,7 @@ let | ||||||
|   mainDotElm = mkDerivation { |   mainDotElm = mkDerivation { | ||||||
|     name = "elm-app-0.1.0"; |     name = "elm-app-0.1.0"; | ||||||
|     srcs = ./elm-srcs.nix; |     srcs = ./elm-srcs.nix; | ||||||
|     src = ./.; |     src = builtins.path { path = ./.; name = "learnpianochords"; }; | ||||||
|     targets = ["Main"]; |     targets = ["Main"]; | ||||||
|     srcdir = "./src"; |     srcdir = "./src"; | ||||||
|     outputJavaScript = true; |     outputJavaScript = true; | ||||||
|  | @ -51,7 +51,7 @@ let | ||||||
| in stdenv.mkDerivation { | in stdenv.mkDerivation { | ||||||
|   name = "learn-piano-chords"; |   name = "learn-piano-chords"; | ||||||
|   buildInputs = []; |   buildInputs = []; | ||||||
|   src = ./.; |   src = builtins.path { path = ./.; name = "learnpianochords"; }; | ||||||
|   buildPhase = '' |   buildPhase = '' | ||||||
|     mkdir -p $out |     mkdir -p $out | ||||||
|     cp index.html output.css ${mainDotElm}/Main.min.js $out |     cp index.html output.css ${mainDotElm}/Main.min.js $out | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue