Use a nix flake with oxalica/rust-overlay instead of a shell.nix
This commit is contained in:
		
							parent
							
								
									c51feeac77
								
							
						
					
					
						commit
						620b84fd46
					
				
					 5 changed files with 107 additions and 9 deletions
				
			
		
							
								
								
									
										2
									
								
								.envrc
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								.envrc
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1 +1 @@
 | 
			
		|||
use nix
 | 
			
		||||
use flake
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										67
									
								
								flake.lock
									
										
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								flake.lock
									
										
									
										generated
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,67 @@
 | 
			
		|||
{
 | 
			
		||||
  "nodes": {
 | 
			
		||||
    "flake-utils": {
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1614513358,
 | 
			
		||||
        "narHash": "sha256-LakhOx3S1dRjnh0b5Dg3mbZyH0ToC9I8Y2wKSkBaTzU=",
 | 
			
		||||
        "owner": "numtide",
 | 
			
		||||
        "repo": "flake-utils",
 | 
			
		||||
        "rev": "5466c5bbece17adaab2d82fae80b46e807611bf3",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "numtide",
 | 
			
		||||
        "repo": "flake-utils",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "nixpkgs": {
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1617042094,
 | 
			
		||||
        "narHash": "sha256-c8w5/Dz+r8gHIGZs1BHJPSzpP3Sga/BYebRkqBoDANY=",
 | 
			
		||||
        "owner": "nixos",
 | 
			
		||||
        "repo": "nixpkgs",
 | 
			
		||||
        "rev": "310885ec804f9fa0db5c705c7f5d35d415f50564",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "nixos",
 | 
			
		||||
        "ref": "nixos-20.09",
 | 
			
		||||
        "repo": "nixpkgs",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "root": {
 | 
			
		||||
      "inputs": {
 | 
			
		||||
        "flake-utils": "flake-utils",
 | 
			
		||||
        "nixpkgs": "nixpkgs",
 | 
			
		||||
        "rust-overlay": "rust-overlay"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "rust-overlay": {
 | 
			
		||||
      "inputs": {
 | 
			
		||||
        "flake-utils": [
 | 
			
		||||
          "flake-utils"
 | 
			
		||||
        ],
 | 
			
		||||
        "nixpkgs": [
 | 
			
		||||
          "nixpkgs"
 | 
			
		||||
        ]
 | 
			
		||||
      },
 | 
			
		||||
      "locked": {
 | 
			
		||||
        "lastModified": 1617071065,
 | 
			
		||||
        "narHash": "sha256-9JXhxwlc/ZJaO4aZ3cUwQwlK7ZRamjV+BvOTvdXrggs=",
 | 
			
		||||
        "owner": "oxalica",
 | 
			
		||||
        "repo": "rust-overlay",
 | 
			
		||||
        "rev": "38766381042021f547a168ebb3f10305dc6fde08",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      },
 | 
			
		||||
      "original": {
 | 
			
		||||
        "owner": "oxalica",
 | 
			
		||||
        "repo": "rust-overlay",
 | 
			
		||||
        "type": "github"
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "root": "root",
 | 
			
		||||
  "version": 7
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										37
									
								
								flake.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								flake.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,37 @@
 | 
			
		|||
{
 | 
			
		||||
  description = "tlater.net web server";
 | 
			
		||||
 | 
			
		||||
  inputs = {
 | 
			
		||||
    nixpkgs.url = "github:nixos/nixpkgs/nixos-20.09";
 | 
			
		||||
    flake-utils.url = "github:numtide/flake-utils";
 | 
			
		||||
    rust-overlay = {
 | 
			
		||||
      url = "github:oxalica/rust-overlay";
 | 
			
		||||
      inputs = {
 | 
			
		||||
        flake-utils.follows = "flake-utils";
 | 
			
		||||
        nixpkgs.follows = "nixpkgs";
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  outputs = { self, nixpkgs, flake-utils, rust-overlay }@inputs:
 | 
			
		||||
    flake-utils.lib.simpleFlake {
 | 
			
		||||
      inherit self nixpkgs;
 | 
			
		||||
      name = "tlaternet";
 | 
			
		||||
      preOverlays = [ rust-overlay.overlay ];
 | 
			
		||||
 | 
			
		||||
      shell = { pkgs }:
 | 
			
		||||
        let
 | 
			
		||||
          rust_channel =
 | 
			
		||||
            pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
 | 
			
		||||
        in pkgs.mkShell {
 | 
			
		||||
          nativeBuildInputs = with pkgs; [
 | 
			
		||||
            (rust_channel.override {
 | 
			
		||||
              extensions =
 | 
			
		||||
                [ "rust-src" "rust-analysis" "rust-analyzer-preview" ];
 | 
			
		||||
            })
 | 
			
		||||
            pkgconfig
 | 
			
		||||
          ];
 | 
			
		||||
          buildInputs = with pkgs; [ openssl ];
 | 
			
		||||
        };
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										2
									
								
								rust-toolchain.toml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								rust-toolchain.toml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
[toolchain]
 | 
			
		||||
channel = "nightly"
 | 
			
		||||
| 
						 | 
				
			
			@ -1,8 +0,0 @@
 | 
			
		|||
with import <nixpkgs> {};
 | 
			
		||||
 | 
			
		||||
runCommand "www" {
 | 
			
		||||
  buildInputs = [
 | 
			
		||||
    openssl
 | 
			
		||||
    pkg-config
 | 
			
		||||
  ];
 | 
			
		||||
} ""
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue