Compare commits

...

9 commits

19 changed files with 220 additions and 65 deletions

18
.helix/languages.toml Normal file
View file

@ -0,0 +1,18 @@
[[language]]
name = "nix"
language-servers = ["nixd", "typos-lsp"]
[[language]]
name = "markdown"
language-servers = ["marksman", "markdown-oxide", "typos-lsp"]
[[language]]
name = "toml"
language-servers = ["taplo", "typos-lsp"]
[[language]]
name = "git-ignore"
language-servers = ["typos-lsp"]
[language-server.typos-lsp]
command = "typos-lsp"

21
.typos.toml Normal file
View file

@ -0,0 +1,21 @@
[files]
ignore-global = true
ignore-parent = true
ignore-hidden = false
ignore-files = true
ignore-vcs = true
extend-exclude = ["secrets/", ".git/", "public-key.txt"]
[default]
check-filename = true
check-file = true
unicode = true
extend-ignore-re = [
# Line ignore with trailling `(#|//) spellchecker: disable-line`
"(?Rm)^.*(#|//)\\s*spellchecker: disable-line$",
# Line block with `# spellchecker: <on|off>`
"(?s)(#|//)\\s*spellchecker: off.*?\\n\\s*(#|//)\\s*spellchecker: on",
]
extend-ignore-identifiers-re = ["als", "Paket", "ConfiguratioN", "StructurE"]
[default.extend-identifiers]

View file

@ -1,18 +0,0 @@
words = [
"akun",
"configuratio",
"fuzzel",
"gdm",
"ghostty",
"kde",
"niri",
"nixo",
"nixos",
"nixpkgs",
"ovelrays",
"pkgs",
"sddm",
"specialisation",
"structur",
"tytonidae",
]

View file

@ -180,6 +180,7 @@
packages = with pkgs; [ packages = with pkgs; [
nixd nixd
typos typos
typos-lsp
just just
nvfetcher nvfetcher
]; ];

View file

@ -21,7 +21,7 @@ in {
example = pkgs.wluam; example = pkgs.wluam;
default = pkgs.wluma; default = pkgs.wluma;
description = '' description = ''
pakcage of wluma package of wluma
''; '';
}; };
}; };

View file

@ -50,7 +50,7 @@ in {
description = '' description = ''
A file which JSON configurations for juicity client. See the {option}`settings` option for more information. A file which JSON configurations for juicity client. See the {option}`settings` option for more information.
Note: this file will override {options}`settings` option, which is recommanded. Note: this file will override {options}`settings` option, which is recommended.
''; '';
}; };
allowedOpenFirewallPorts = lib.mkOption { allowedOpenFirewallPorts = lib.mkOption {
@ -95,7 +95,7 @@ in {
description = '' description = ''
A file which JSON configurations for juicity server. See the {option}`settings` option for more information. A file which JSON configurations for juicity server. See the {option}`settings` option for more information.
Note: this file will override {options}`settings` option, which is recommanded. Note: this file will override {options}`settings` option, which is recommended.
''; '';
}; };
allowedOpenFirewallPorts = lib.mkOption { allowedOpenFirewallPorts = lib.mkOption {

View file

@ -4,7 +4,7 @@
... ...
}: let }: let
srcs = pkgs.callPackage ./_sources/generated.nix {}; srcs = pkgs.callPackage ./_sources/generated.nix {};
callPackage = fn: args: pkgs.lib.callPackageWith (pkgs // {inherit inputs srcs callPackage;}) fn args; callPackage = pkgs.lib.callPackageWith (pkgs // {inherit inputs srcs callPackage;});
in in
{ {
pinentry-selector = callPackage ./pinentry-selector.nix {}; pinentry-selector = callPackage ./pinentry-selector.nix {};

View file

@ -8,6 +8,7 @@
runtime = callPackage ./runtime.nix {}; runtime = callPackage ./runtime.nix {};
runtimeInputs = ( runtimeInputs = (
with pkgs; [ with pkgs; [
nixfmt-rfc-style
idris2Packages.idris2Lsp idris2Packages.idris2Lsp
lua-language-server lua-language-server
bash-language-server bash-language-server

View file

@ -11,7 +11,7 @@
src = grammar.src; src = grammar.src;
# sourceRoot = "source"; # sourceRoot = "source";
dontConfigue = true; dontConfigure = true;
FLAGS = [ FLAGS = [
"-Isrc" "-Isrc"

View file

@ -18,14 +18,38 @@
}; };
in { in {
formatter = pkgs.alejandra; formatter = pkgs.alejandra;
checks = {
inherit (self.packages.${system}) default;
};
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
inputsFrom = [] ++ (builtins.attrValues self.checks.${system});
packages = with pkgs; [ packages = with pkgs; [
clang-tools clang-tools
gcc
xmake
]; ];
}; };
packages = rec {
cxx-demo = pkgs.stdenv.mkDerivation {
pname = "cxx-demo";
version = "unstable";
src = ./.;
strictDeps = true;
nativeBuildInputs = with pkgs; [
xmake
gnumake
];
preConfigure = ''
xmake config -m release
xmake project -k xmakefile
'';
env = {
INSTALLDIR = "${placeholder "out"}";
NIX_DEBUG = 1;
V = 1;
D = 1;
};
};
default = cxx-demo;
};
}); });
nixConfig = { nixConfig = {
keepOutputs = true; keepOutputs = true;

View file

@ -0,0 +1,25 @@
[advisories]
ignore = [] # advisory IDs to ignore e.g. ["RUSTSEC-2019-0001", ...]
informational_warnings = [
"unmaintained",
] # warn for categories of informational advisories
severity_threshold = "low" # CVSS severity ("none", "low", "medium", "high", "critical")
[database]
url = "https://github.com/RustSec/advisory-db.git"
fetch = true
stale = false
[output]
deny = ["unmaintained"] # exit on error if unmaintained dependencies are found
format = "terminal" # "terminal" (human readable report) or "json"
quiet = false # Only print information on error
show_tree = true
[target]
arch = ["x86_64"]
os = ["linux", "windows"]
[yanked]
enabled = true
update_index = true

View file

@ -1,3 +1,3 @@
watch_file rust-toolchain.toml watch_file rust-toolchain.toml nix/*.nix
use flake use flake

View file

@ -0,0 +1,17 @@
edition = "2024"
merge_derives = true
newline_style = "Unix"
reorder_imports = true
reorder_modules = true
use_field_init_shorthand = true
use_try_shorthand = true
# unstable_features = true
# format_code_in_doc_comments = true
# format_macro_bodies = true
# format_strings = true
# float_literal_trailing_zero = "IfNoPostfix"
# imports_granularity = "Crate"
# overflow_delimited_expr = true
# reorder_impl_items = true
# group_imports = "StdExternalCrate"
# wrap_comments = true

View file

@ -3,11 +3,11 @@
"advisory-db": { "advisory-db": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1746689539, "lastModified": 1747937073,
"narHash": "sha256-rVUs0CjpuO7FKVHecsuMaYiUr8iKscsgeo/b2XlnPmQ=", "narHash": "sha256-52H8P6jAHEwRvg7rXr4Z7h1KHZivO8T1Z9tN6R0SWJg=",
"owner": "rustsec", "owner": "rustsec",
"repo": "advisory-db", "repo": "advisory-db",
"rev": "796d034fbcb1c5bc83c0d0912dc31eb4e34458bf", "rev": "bccf313a98c034573ac4170e6271749113343d97",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -18,11 +18,11 @@
}, },
"crane": { "crane": {
"locked": { "locked": {
"lastModified": 1746291859, "lastModified": 1748047550,
"narHash": "sha256-DdWJLA+D5tcmrRSg5Y7tp/qWaD05ATI4Z7h22gd1h7Q=", "narHash": "sha256-t0qLLqb4C1rdtiY8IFRH5KIapTY/n3Lqt57AmxEv9mk=",
"owner": "ipetkov", "owner": "ipetkov",
"repo": "crane", "repo": "crane",
"rev": "dfd9a8dfd09db9aad544c4d3b6c47b12562544a5", "rev": "b718a78696060df6280196a6f992d04c87a16aef",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -51,11 +51,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1746300365, "lastModified": 1747958103,
"narHash": "sha256-thYTdWqCRipwPRxWiTiH1vusLuAy0okjOyzRx4hLWh4=", "narHash": "sha256-qmmFCrfBwSHoWw7cVK4Aj+fns+c54EBP8cGqp/yK410=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "f21e4546e3ede7ae34d12a84602a22246b31f7e0", "rev": "fe51d34885f7b5e3e7b59572796e1bcb427eccb1",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -81,11 +81,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1746326315, "lastModified": 1748140821,
"narHash": "sha256-IDqSls/r6yBfdOBRSMQ/noTUoigmsKnTQ7TqpsBtN4Y=", "narHash": "sha256-GZcjWLQtDifSYMd1ueLDmuVTcQQdD5mONIBTqABooOk=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "dd280c436961ec5adccf0135efe5b66a23d84497", "rev": "476b2ba7dc99ddbf70b1f45357dbbdbdbdfb4422",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -31,12 +31,17 @@
inherit (pkgs) lib; inherit (pkgs) lib;
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
overlays = [(import rust-overlay)]; overlays = [
(import rust-overlay)
(final: prev: {
lib = prev.lib // (import ./nix/lib.nix prev.lib);
})
];
}; };
rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain; craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
srcFilters = path: type: srcFilters = path: type:
builtins.any (suffix: lib.hasSuffix suffix path) [ builtins.any (lib.flip lib.hasSuffix path) [
".sql" ".sql"
".diff" ".diff"
".md" ".md"
@ -50,26 +55,24 @@
}; };
basicArgs = { basicArgs = {
inherit src; inherit src;
pname = "rust-demo";
strictDeps = true; strictDeps = true;
}; };
cargoArtifacts = craneLib.buildDepsOnly basicArgs; nativeBuildInputs = [];
buildInputs = [];
genInputs = lib.genInputsWith pkgs;
commonArgs = commonArgs =
basicArgs basicArgs
// { // {
inherit cargoArtifacts; cargoArtifacts = self.packages.${system}.cargo-artifacts;
nativeBuildInputs = with pkgs; []; buildInputs = genInputs buildInputs;
buildInputs = nativeBuildInputs = genInputs nativeBuildInputs;
(with pkgs; [])
++ lib.optional pkgs.stdenv.buildPlatform.isDarwin (with pkgs; [
darwin.apple_sdk.frameworks.Security
]);
env = {};
}; };
in { in {
formatter = pkgs.alejandra; formatter = pkgs.alejandra;
checks = { checks = {
inherit (self.packages.${system}) default; package = self.packages.${system}.default.overrideAttrs {
doCheck = true;
};
clippy = craneLib.cargoClippy (commonArgs clippy = craneLib.cargoClippy (commonArgs
// { // {
cargoClippyExtraArgs = "--all-targets -- --deny warnings"; cargoClippyExtraArgs = "--all-targets -- --deny warnings";
@ -84,31 +87,30 @@
// { // {
partitions = 1; partitions = 1;
partitionType = "count"; partitionType = "count";
nativeBuildInputs = [];
cargoNextestExtraArgs = "--no-tests pass"; cargoNextestExtraArgs = "--no-tests pass";
env = { env = {
CARGO_PROFILE = "dev"; CARGO_PROFILE = "dev";
}; };
}); });
}; };
packages = rec { packages = let
rust-demo = craneLib.buildPackage (commonArgs callPackage = lib.callPackageWith (pkgs // {inherit craneLib callPackage;});
// { packageArgs = {
inherit inherit lib basicArgs buildInputs nativeBuildInputs;
(craneLib.crateNameFromCargoToml { };
cargoToml = "${toString src}/Cargo.toml"; importWithArgs = with lib; flip import packageArgs;
}) in rec {
; cargo-artifacts = callPackage (importWithArgs ./nix/cargo-artifacts.nix) {};
doCheck = false; rust-demo = callPackage (importWithArgs ./nix/package.nix) {
nativeBuildInputs = []; cargoArtifacts = cargo-artifacts;
buildInputs = []; };
});
default = rust-demo; default = rust-demo;
}; };
apps.default = flake-utils.lib.mkApp { apps.default = flake-utils.lib.mkApp {
drv = self.packages."${system}".default; drv = self.packages."${system}".default;
}; };
devShells.default = craneLib.devShell { devShells.default = craneLib.devShell {
checks = self.checks.${system};
packages = with pkgs; [ packages = with pkgs; [
rust-analyzer rust-analyzer
cargo-audit cargo-audit

View file

@ -0,0 +1,20 @@
{
lib,
basicArgs,
buildInputs,
nativeBuildInputs,
}: let
f = {
craneLib,
lib,
...
} @ args: let
genInputs = lib.genInputsWith args;
in
craneLib.buildDepsOnly (basicArgs
// {
buildInputs = genInputs buildInputs;
nativeBuildInputs = genInputs nativeBuildInputs;
});
in
with lib; setFunctionArgs f ((functionArgs f) // (genFunctionArgs (buildInputs ++ nativeBuildInputs)))

View file

@ -0,0 +1,13 @@
{
flip,
pipe,
splitString,
head,
listToAttrs,
nameValuePair,
getAttrFromPath,
...
}: {
genFunctionArgs = flip pipe [(map (flip pipe [(splitString ".") head (flip nameValuePair false)])) listToAttrs];
genInputsWith = pkgs: map (flip pipe [(splitString ".") (flip getAttrFromPath pkgs)]);
}

View file

@ -0,0 +1,30 @@
{
lib,
basicArgs,
buildInputs,
nativeBuildInputs,
}: let
f = {
craneLib,
lib,
cargoArtifacts,
...
} @ args: let
genInputs = lib.genInputsWith args;
in
craneLib.buildPackage (basicArgs
// {
inherit
(craneLib.crateNameFromCargoToml {
cargoToml = "${toString basicArgs.src}/Cargo.toml";
})
pname
version
;
inherit cargoArtifacts;
buildInputs = genInputs buildInputs;
nativeBuildInputs = genInputs nativeBuildInputs;
doCheck = false;
});
in
with lib; setFunctionArgs f ((functionArgs f) // (genFunctionArgs (buildInputs ++ nativeBuildInputs)))

View file

@ -1,3 +1,4 @@
[toolchain] [toolchain]
channel = "stable" channel = "stable"
profile = "default" profile = "default"
components = ["rust-src"]