Setup flake to produce project.

pull/3/head
Joshua Potter 2022-01-09 09:38:13 -05:00
parent 794ed592c9
commit bdc34adea0
4 changed files with 1366 additions and 5 deletions

1234
Cargo.nix Normal file

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,7 @@ packages:
- $HOME/.bash_profile
- $HOME/.bashrc
home-manager:
- $HOME/.config/nixpkgs/flake.nix
- $HOME/.config/nixpkgs/home.nix
homesync:
- $HOME/.homesync.yml

View File

@ -1,5 +1,26 @@
{
"nodes": {
"cargo2nix": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1638423893,
"narHash": "sha256-+NTV613zwK1G4UIKrj0gh1fYDvi85qO0wxy6h11azuY=",
"owner": "cargo2nix",
"repo": "cargo2nix",
"rev": "ae8a5e699f57b446f9507b97a3c97a4e9fe06aa3",
"type": "github"
},
"original": {
"owner": "cargo2nix",
"ref": "master",
"repo": "cargo2nix",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1638122382,
@ -15,7 +36,38 @@
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1638122382,
"narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1638109994,
"narHash": "sha256-OpA37PTiPMIqoRJbufbl5rOLII7HeeGcA0yl7FoyCIE=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "a284564b7f75ac4db73607db02076e8da9d42c9d",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "release-21.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1640572776,
"narHash": "sha256-pWMTubBy1Ep31iuQ5lEKW2mjSHWEvcbvy9uHVch2764=",
@ -33,8 +85,58 @@
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
"cargo2nix": "cargo2nix",
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2",
"rust-overlay": "rust-overlay_2"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": [
"cargo2nix",
"flake-utils"
],
"nixpkgs": [
"cargo2nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1638152159,
"narHash": "sha256-Q0UHsm36cCxk16I/bF1rHJHxjIflESKk2ej76P39j90=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "d9a664513558376595e838b21348cdac0ba3115e",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"rust-overlay_2": {
"inputs": {
"flake-utils": [
"flake-utils"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1641696140,
"narHash": "sha256-Q7bQ0MSq201ah4Q+3SznEmMR4Kn9pY6ta8pL6KAjZ78=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "a1b1977429de5d69a332dd87700ffb00525335f9",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
}
},

View File

@ -4,13 +4,37 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
flake-utils.url = "github:numtide/flake-utils";
cargo2nix.url = "github:cargo2nix/cargo2nix/master";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
};
outputs = { self, nixpkgs, flake-utils }:
outputs = { self, nixpkgs, flake-utils, cargo2nix, rust-overlay }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in {
pkgs = import nixpkgs {
inherit system;
overlays = [
(import "${cargo2nix}/overlay") rust-overlay.overlay
];
};
rustPkgs = pkgs.rustBuilder.makePackageSet' {
rustChannel = "1.56.1";
packageFun = import ./Cargo.nix;
};
in rec {
packages = {
homesync = (rustPkgs.workspace.homesync {}).bin;
};
defaultPackage = packages.homesync;
devShell = with pkgs; mkShell {
buildInputs = [
cargo