initial commit

This commit is contained in:
Callum Leslie 2025-09-10 11:29:31 +01:00
commit acf1a07132
Signed by: cleslie
GPG key ID: D382C4AFEECEAA90
6 changed files with 209 additions and 0 deletions

2
.envrc Normal file
View file

@ -0,0 +1,2 @@
#!/usr/bin/env bash
use flake

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
release
.pre-commit-config.yaml
.direnv

121
flake.lock generated Normal file
View file

@ -0,0 +1,121 @@
{
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1747046372,
"narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1757239681,
"narHash": "sha256-E9spYi9lxm2f1zWQLQ7xQt8Xs2nWgr1T4QM7ZjLFphM=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "ab82ab08d6bf74085bd328de2a8722c12d97bd9d",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1757034884,
"narHash": "sha256-PgLSZDBEWUHpfTRfFyklmiiLBE1i1aGCtz4eRA3POao=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ca77296380960cd497a765102eeb1356eb80fed0",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"git-hooks": "git-hooks",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

71
flake.nix Normal file
View file

@ -0,0 +1,71 @@
{
description = "C's Nix Packages";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils = {
url = "github:numtide/flake-utils";
inputs.systems.url = "github:nix-systems/default-linux";
};
git-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
nixpkgs,
flake-utils,
git-hooks,
...
}:
flake-utils.lib.eachDefaultSystem
(system: let
pkgs = nixpkgs.legacyPackages.${system};
inherit (nixpkgs) lib;
scenics = import ./pkgs {
inherit pkgs lib;
};
git-hook-check = git-hooks.lib.${system}.run {
src = ./.;
hooks = {
alejandra.enable = true;
deadnix.enable = true;
statix.enable = true;
flake-checker.enable = true;
end-of-file-fixer.enable = true;
check-merge-conflicts.enable = true;
trim-trailing-whitespace.enable = true;
actionlint.enable = true;
check-yaml.enable = true;
check-toml.enable = false;
check-json.enable = false;
typos.enable = true;
shellcheck.enable = true;
shfmt.enable = true;
};
};
in {
packages = scenics;
checks = {
git-hook = git-hook-check;
};
devShells.default = pkgs.mkShell {
inherit (git-hook-check) shellHook;
buildInputs = with pkgs; [nix-init alejandra];
};
formatter = pkgs.alejandra;
})
// {
overlays.default = import ./overlay.nix;
};
}

3
overlay.nix Normal file
View file

@ -0,0 +1,3 @@
final: _: {
scenics = final.callPackages ./pkgs {};
}

9
pkgs/default.nix Normal file
View file

@ -0,0 +1,9 @@
{
pkgs,
lib,
}:
# ./default.nix gets included as default, so remove it from the final package set
builtins.removeAttrs (lib.packagesFromDirectoryRecursive {
inherit (pkgs) callPackage;
directory = ./.;
}) ["default"]