Configure project

main
Elnu 1 year ago
parent 3c2a423301
commit b7b441a933

@ -1,5 +1,5 @@
{
"rust-analyzer.linkedProjects": [
"./helloworld/Cargo.toml",
"./dyesub-tool/Cargo.toml",
]
}

2
Cargo.lock generated

@ -3,5 +3,5 @@
version = 3
[[package]]
name = "helloworld"
name = "dyesub-tool"
version = "0.1.0"

@ -1,2 +1,2 @@
[workspace]
members = ["helloworld"]
members = ["dyesub-tool"]

@ -1,5 +1,5 @@
[package]
name = "helloworld"
name = "dyesub-tool"
version = "0.1.0"
edition = "2021"

@ -0,0 +1,96 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1691899779,
"narHash": "sha256-IBf4KVr/UQJlzrqB2/IHtlvmwsvyIVLPerSzCPU/6Xk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "100a1550b0e7a64b960c625b656f9229bdef5f87",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1681358109,
"narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1691979003,
"narHash": "sha256-kT7FB6+wiTPzXtzNdQJmBGyFGM3/9QvjDTF5YK3eYTs=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "ce646c4052c4979078a1ed263bc6e8c1a14c0d07",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

@ -1,30 +1,18 @@
/*
TODO
1. Find and replace "helloworld" with your package name for **ALL FILES IN REPOSITORY**
2. Add a flake description that describes the workspace on line 27
3. Add a package description on line 70
4. (optional) uncomment `nativeBuildInputs` and `buildInputs` on lines 43 and 44 if you need openssl
5. (optional) set your project homepage, license, and maintainers list on lines 48-51
6. (optional) uncomment the NixOS module and update it for your needs
7. Delete this comment block
*/
/*
Some utility commands:
- `nix flake update --commit-lock-file`
- `nix flake lock update-input <input>`
- `nix build .#helloworld`
- `nix run .#helloworld`
- `nix build .#dyesub-tool`
- `nix run .#dyesub-tool`
Updating `cargoHash`:
- Set `cargoHash` to an empty string
- run `nix run .#helloworld`
- run `nix run .#dyesub-tool`
- Update `cargoHash` with correct hash from output
rust-project TODO: write shell script for automatically updating `cargoHash`
*/
{
description = "";
description = "A tool for generating dye sublimation transfer sheet SVGs for Japanese thumb shift keycaps.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
@ -40,15 +28,12 @@ rust-project TODO: write shell script for automatically updating `cargoHash`
};
rustSettings = with pkgs; {
src = ./.;
#nativeBuildInputs = [ pkg-config ];
#buildInputs = [ openssl ];
cargoHash = nixpkgs.lib.fakeHash;
};
meta = with nixpkgs.lib; {
#homepage = "https://example.com";
#license = [ licenses.gpl3 ];
license = [ licenses.gpl3 ];
platforms = [ system ];
#maintainers = with maintainers; [ ];
maintainers = with maintainers; [ elnudev ];
};
in {
devShells.${system}.default = with pkgs; mkShell {
@ -58,57 +43,19 @@ rust-project TODO: write shell script for automatically updating `cargoHash`
})
bacon
];
inputsFrom = with self.packages.${system}; [ helloworld ];
inputsFrom = with self.packages.${system}; [ dyesub-tool ];
};
packages.${system} = {
helloworld = pkgs.rustPlatform.buildRustPackage (rustSettings // {
pname = "helloworld";
default = self.packages.${system}.dyesub-tool;
dyesub-tool = pkgs.rustPlatform.buildRustPackage (rustSettings // {
pname = "dyesub-tool";
version = "0.1.0";
buildAndTestSubdir = "helloworld";
cargoHash = "sha256-+TaGIiKf+Pz2bTABeG8aCZz0/ZTCKl5398+qbas4Nvo=";
buildAndTestSubdir = "dyesub-tool";
cargoHash = "sha256-hFxEu/sPAxrjOpXqSPDucOqmgsOjb6YBxnWeVl4MV74=";
meta = meta // {
description = "";
description = "A tool for generating dye sublimation transfer sheet SVGs for Japanese thumb shift keycaps.";
};
});
};
/*
nixosModules.default = { config, ... }: let
lib = nixpkgs.lib;
in {
options.services.helloworld = {
enable = lib.mkEnableOption (lib.mdDoc "helloworld service");
package = lib.mkOption {
type = lib.types.package;
default = self.packages.${system}.helloworld;
defaultText = "pkgs.helloworld";
description = lib.mdDoc ''
The helloworld package that should be used.
'';
};
port = lib.mkOption {
type = lib.types.port;
default = 8000;
description = lib.mdDoc ''
The port at which to run.
'';
};
};
config.systemd.services.helloworld = let
cfg = config.services.helloworld;
pkg = self.packages.${system}.helloworld;
in lib.mkIf cfg.enable {
description = pkg.meta.description;
after = [ "network.target" ];
wantedBy = [ "network.target" ];
serviceConfig = {
ExecStart = ''
${cfg.package}/bin/helloworld --port ${builtins.toString cfg.port}
'';
Restart = "always";
DynamicUser = true;
};
};
};
*/
};
}

Loading…
Cancel
Save