Merge pull request 'switch from alejandra -> nixpkgs-fmt' (#12) from formatting into main

Reviewed-on: #12
This commit is contained in:
Mic92 2023-07-21 09:15:48 +00:00
commit fb394f29ae
11 changed files with 64 additions and 65 deletions

View File

@ -1,16 +1,15 @@
{ { self
self, , inputs
inputs, , ...
...
}: { }: {
imports = [ imports = [
inputs.treefmt-nix.flakeModule inputs.treefmt-nix.flakeModule
]; ];
perSystem = {pkgs, ...}: { perSystem = { pkgs, ... }: {
treefmt.projectRootFile = "flake.nix"; treefmt.projectRootFile = "flake.nix";
treefmt.flakeCheck = true; treefmt.flakeCheck = true;
treefmt.flakeFormatter = true; treefmt.flakeFormatter = true;
treefmt.programs.alejandra.enable = true; treefmt.programs.nixpkgs-fmt.enable = true;
treefmt.programs.shellcheck.enable = true; treefmt.programs.shellcheck.enable = true;
}; };
} }

View File

@ -1,4 +1,4 @@
{self, ...}: { { self, ... }: {
flake.packages.x86_64-linux = { flake.packages.x86_64-linux = {
inherit inherit
(self.nixosConfigurations.installer.config.formats) (self.nixosConfigurations.installer.config.formats)

View File

@ -1,4 +1,4 @@
{self, ...}: { { self, ... }: {
pre-commit.settings.hooks.alejandra.enable = true; pre-commit.settings.hooks.alejandra.enable = true;
pre-commit.settings.hooks.shellcheck.enable = true; pre-commit.settings.hooks.shellcheck.enable = true;
} }

View File

@ -11,13 +11,12 @@
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = inputs @ {flake-parts, ...}: outputs = inputs @ { flake-parts, ... }:
flake-parts.lib.mkFlake {inherit inputs;} ({ flake-parts.lib.mkFlake { inherit inputs; } ({ lib
lib, , config
config, , self
self, , ...
... }: {
}: {
systems = lib.systems.flakeExposed; systems = lib.systems.flakeExposed;
imports = [ imports = [
./flake-parts/packages.nix ./flake-parts/packages.nix

View File

@ -1,8 +1,7 @@
{ { config
config, , lib
lib, , pkgs
pkgs, , ...
...
}: { }: {
options.hidden-announce = { options.hidden-announce = {
enable = lib.mkEnableOption "hidden-announce"; enable = lib.mkEnableOption "hidden-announce";
@ -32,9 +31,9 @@
}; };
systemd.services.hidden-ssh-announce = { systemd.services.hidden-ssh-announce = {
description = "irc announce hidden ssh"; description = "irc announce hidden ssh";
after = ["tor.service" "network-online.target"]; after = [ "tor.service" "network-online.target" ];
wants = ["tor.service"]; wants = [ "tor.service" ];
wantedBy = ["multi-user.target"]; wantedBy = [ "multi-user.target" ];
serviceConfig = { serviceConfig = {
# ${pkgs.tor}/bin/torify # ${pkgs.tor}/bin/torify
ExecStart = pkgs.writers.writeDash "announce-hidden-service" '' ExecStart = pkgs.writers.writeDash "announce-hidden-service" ''

View File

@ -1,8 +1,7 @@
{ { config
config, , lib
lib, , pkgs
pkgs, , ...
...
}: { }: {
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"d /var/shared 0777 root root - -" "d /var/shared 0777 root root - -"

View File

@ -4,7 +4,7 @@
symlinkJoin { symlinkJoin {
name = "clan"; name = "clan";
paths = [ paths = [
(writers.writePython3Bin "clan" {} ./clan.py) (writers.writePython3Bin "clan" { } ./clan.py)
(writers.writePython3Bin "clan-admin" { flakeIgnore = [ "E501" ]; } ./clan-admin.py) (writers.writePython3Bin "clan-admin" { flakeIgnore = [ "E501" ]; } ./clan-admin.py)
]; ];
} }

View File

@ -1,7 +1,7 @@
{ { lib
lib, , buildGoModule
buildGoModule, , fetchFromGitHub
fetchFromGitHub, ,
}: }:
buildGoModule rec { buildGoModule rec {
pname = "go-ssb"; pname = "go-ssb";
@ -17,7 +17,7 @@ buildGoModule rec {
vendorHash = "sha256-ZytuWFre7Cz6Qt01tLQoPEuNzDIyoC938OkdIrU8nZo="; vendorHash = "sha256-ZytuWFre7Cz6Qt01tLQoPEuNzDIyoC938OkdIrU8nZo=";
ldflags = ["-s" "-w"]; ldflags = [ "-s" "-w" ];
# take very long # take very long
doCheck = false; doCheck = false;
@ -26,6 +26,6 @@ buildGoModule rec {
description = "Go implementation of ssb (work in progress)"; description = "Go implementation of ssb (work in progress)";
homepage = "https://github.com/ssbc/go-ssb"; homepage = "https://github.com/ssbc/go-ssb";
license = licenses.mit; license = licenses.mit;
maintainers = with maintainers; []; maintainers = with maintainers; [ ];
}; };
} }

View File

@ -1,11 +1,11 @@
{ { pkgs ? import <nixpkgs> { }
pkgs ? import <nixpkgs> {}, , lib ? pkgs.lib
, python3 ? pkgs.python3
lib ? pkgs.lib, , ruff ? pkgs.ruff
python3 ? pkgs.python3, , runCommand ? pkgs.runCommand
ruff ? pkgs.ruff, ,
runCommand ? pkgs.runCommand, }:
}: let let
pyproject = builtins.fromTOML (builtins.readFile ./pyproject.toml); pyproject = builtins.fromTOML (builtins.readFile ./pyproject.toml);
name = pyproject.project.name; name = pyproject.project.name;
@ -37,14 +37,14 @@
]; ];
propagatedBuildInputs = propagatedBuildInputs =
dependencies dependencies
++ []; ++ [ ];
passthru.tests = {inherit check;}; passthru.tests = { inherit check; };
passthru.devDependencies = devDependencies; passthru.devDependencies = devDependencies;
}; };
checkPython = python3.withPackages (ps: devDependencies ++ dependencies); checkPython = python3.withPackages (ps: devDependencies ++ dependencies);
check = runCommand "${name}-check" {} '' check = runCommand "${name}-check" { } ''
cp -r ${src} ./src cp -r ${src} ./src
chmod +w -R ./src chmod +w -R ./src
cd src cd src
@ -59,4 +59,4 @@
''; '';
in in
package package

View File

@ -1,10 +1,12 @@
{ {
perSystem = {pkgs, ...}: let perSystem = { pkgs, ... }:
pyproject = builtins.fromTOML (builtins.readFile ./pyproject.toml); let
name = pyproject.project.name; pyproject = builtins.fromTOML (builtins.readFile ./pyproject.toml);
package = pkgs.callPackage ./default.nix {}; name = pyproject.project.name;
in { package = pkgs.callPackage ./default.nix { };
# packages.${name} = package; in
checks.python-template = package.tests.check; {
}; # packages.${name} = package;
checks.python-template = package.tests.check;
};
} }

View File

@ -1,7 +1,8 @@
{ { pkgs ? import <nixpkgs> { }
pkgs ? import <nixpkgs> {}, , system ? builtins.currentSystem
system ? builtins.currentSystem, ,
}: let }:
let
lib = pkgs.lib; lib = pkgs.lib;
python3 = pkgs.python3; python3 = pkgs.python3;
package = import ./default.nix { package = import ./default.nix {
@ -9,11 +10,11 @@
}; };
pythonWithDeps = python3.withPackages ( pythonWithDeps = python3.withPackages (
ps: ps:
package.propagatedBuildInputs package.propagatedBuildInputs
++ package.devDependencies ++ package.devDependencies
++ [ ++ [
ps.pip ps.pip
] ]
); );
checkScript = pkgs.writeScriptBin "check" '' checkScript = pkgs.writeScriptBin "check" ''
nix build -f . tests.check -L "$@" nix build -f . tests.check -L "$@"
@ -43,4 +44,4 @@
''; '';
}; };
in in
devShell devShell