chore: add flake
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
10
.gitignore
vendored
10
.gitignore
vendored
@@ -16,3 +16,13 @@ target/
|
|||||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
#.idea/
|
#.idea/
|
||||||
|
|
||||||
|
# ---> Nix
|
||||||
|
# Ignore build outputs from performing a nix-build or `nix build` command
|
||||||
|
result
|
||||||
|
result-*
|
||||||
|
|
||||||
|
# Ignore automatically generated direnv output
|
||||||
|
.direnv
|
||||||
|
|
||||||
|
.cargo/
|
||||||
|
72
flake.lock
generated
Normal file
72
flake.lock
generated
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"lib": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"treefmt-nix": [
|
||||||
|
"treefmt-nix"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1758632667,
|
||||||
|
"narHash": "sha256-C0aBPv8vqTI1QNVhygZxL0f49UERx2UejVdtyz67jhs=",
|
||||||
|
"ref": "refs/heads/main",
|
||||||
|
"rev": "5e0737c20f3c265dbff604170a6433cc1e1a4b41",
|
||||||
|
"revCount": 8,
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.karaolidis.com/karaolidis/nix-lib.git"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.karaolidis.com/karaolidis/nix-lib.git"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1760284886,
|
||||||
|
"narHash": "sha256-TK9Kr0BYBQ/1P5kAsnNQhmWWKgmZXwUQr4ZMjCzWf2c=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "cf3f5c4def3c7b5f1fc012b3d839575dbe552d43",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"lib": "lib",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"treefmt-nix": "treefmt-nix"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"treefmt-nix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1760120816,
|
||||||
|
"narHash": "sha256-gq9rdocpmRZCwLS5vsHozwB6b5nrOBDNc2kkEaTXHfg=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "treefmt-nix",
|
||||||
|
"rev": "761ae7aff00907b607125b2f57338b74177697ed",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "treefmt-nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
92
flake.nix
Executable file
92
flake.nix
Executable file
@@ -0,0 +1,92 @@
|
|||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
|
treefmt-nix = {
|
||||||
|
url = "github:numtide/treefmt-nix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
lib = {
|
||||||
|
# FIXME: https://github.com/NixOS/nix/issues/12281
|
||||||
|
url = "git+https://git.karaolidis.com/karaolidis/nix-lib.git";
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.follows = "nixpkgs";
|
||||||
|
treefmt-nix.follows = "treefmt-nix";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
inputs:
|
||||||
|
{
|
||||||
|
overlays.default =
|
||||||
|
final: prev:
|
||||||
|
let
|
||||||
|
pkgs = final;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
fujicli = pkgs.rustPlatform.buildRustPackage {
|
||||||
|
pname = "fujicli";
|
||||||
|
version = "0.1.0";
|
||||||
|
|
||||||
|
src = ./.;
|
||||||
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// (
|
||||||
|
let
|
||||||
|
system = "x86_64-linux";
|
||||||
|
|
||||||
|
pkgs = import inputs.nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
overlays = [
|
||||||
|
inputs.lib.overlays.default
|
||||||
|
inputs.self.overlays.default
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
treefmt = inputs.treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
devShells.${system}.default = pkgs.mkShell {
|
||||||
|
packages = with pkgs; [
|
||||||
|
cargo
|
||||||
|
rustc
|
||||||
|
rustfmt
|
||||||
|
clippy
|
||||||
|
cargo-udeps
|
||||||
|
cargo-outdated
|
||||||
|
];
|
||||||
|
|
||||||
|
shellHook = ''
|
||||||
|
TOP="$(git rev-parse --show-toplevel)"
|
||||||
|
export CARGO_HOME="$TOP/.cargo"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
packages.${system} = with pkgs; {
|
||||||
|
default = fujicli;
|
||||||
|
inherit fujicli;
|
||||||
|
};
|
||||||
|
|
||||||
|
formatter.${system} = treefmt.config.build.wrapper;
|
||||||
|
|
||||||
|
checks.${system} =
|
||||||
|
let
|
||||||
|
packages = pkgs.lib.mapAttrs' (
|
||||||
|
name: pkgs.lib.nameValuePair "package-${name}"
|
||||||
|
) inputs.self.packages.${system};
|
||||||
|
|
||||||
|
devShells = pkgs.lib.mapAttrs' (
|
||||||
|
name: pkgs.lib.nameValuePair "devShell-${name}"
|
||||||
|
) inputs.self.devShells.${system};
|
||||||
|
|
||||||
|
formatter.formatting = treefmt.config.build.check inputs.self;
|
||||||
|
in
|
||||||
|
packages // devShells // formatter;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
15
treefmt.nix
Executable file
15
treefmt.nix
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
projectRootFile = "flake.nix";
|
||||||
|
|
||||||
|
programs = {
|
||||||
|
nixfmt = {
|
||||||
|
enable = true;
|
||||||
|
strict = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
rustfmt.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
settings.global.excludes = [ ".envrc" ];
|
||||||
|
}
|
Reference in New Issue
Block a user