summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseth <[email protected]>2024-07-06 04:02:35 -0400
committerseth <[email protected]>2024-07-06 04:12:41 -0400
commit8875ad5fb466944667e5171035aa8f5c01675e93 (patch)
treee453699bbfcc7b8fb566490c8930e60c6adac07b
parentc3ad734168ea13fde1e2f6ec3fbdccf78f72aada (diff)
tree-wide: alejandra -> nixfmt
-rw-r--r--default.nix56
-rw-r--r--flake.nix98
-rw-r--r--pkgs/check-pr/package.nix2
-rw-r--r--pkgs/clippy-sarif/package.nix11
-rw-r--r--pkgs/flat-manager-client/package.nix16
-rw-r--r--pkgs/flat-manager/package.nix11
-rw-r--r--pkgs/nixgc/package.nix7
-rw-r--r--pkgs/papa/package.nix13
-rw-r--r--pkgs/treefetch/package.nix2
-rw-r--r--templates/basic/flake.nix69
-rw-r--r--templates/default.nix10
-rw-r--r--templates/full/default.nix15
-rw-r--r--templates/full/flake.nix7
-rw-r--r--templates/full/nix/default.nix8
-rw-r--r--templates/full/nix/derivation.nix2
-rw-r--r--templates/full/nix/packages.nix24
-rw-r--r--templates/full/nix/shell.nix20
-rw-r--r--templates/nixos/flake.nix53
18 files changed, 217 insertions, 207 deletions
diff --git a/default.nix b/default.nix
index 54817c3..86d2c78 100644
--- a/default.nix
+++ b/default.nix
@@ -1,32 +1,38 @@
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
- {
- pkgs ?
- import nixpkgs {
- config = {};
- overlays = [];
- inherit system;
- },
- lib ? pkgs.lib,
- nixpkgs ? (fetchTarball {
+{
+ pkgs ? import nixpkgs {
+ config = { };
+ overlays = [ ];
+ inherit system;
+ },
+ lib ? pkgs.lib,
+ nixpkgs ? (
+ fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/${lock.nodes.nixpkgs.locked.rev}.tar.gz";
sha256 = lock.nodes.nixpkgs.locked.narHash;
- }),
- system ? builtins.currentSystem,
- }: let
- inherit (pkgs) callPackage;
- in
- lib.fix (final:
- lib.packagesFromDirectoryRecursive {
- inherit callPackage;
- directory = ./pkgs;
- }
- // {
- clippy-sarif = callPackage ./pkgs/clippy-sarif/package.nix {inherit (final) clippy-sarif;};
+ }
+ ),
+ system ? builtins.currentSystem,
+}:
+let
+ inherit (pkgs) callPackage;
+in
+lib.fix (
+ final:
+ lib.packagesFromDirectoryRecursive {
+ inherit callPackage;
+ directory = ./pkgs;
+ }
+ // {
+ clippy-sarif = callPackage ./pkgs/clippy-sarif/package.nix { inherit (final) clippy-sarif; };
- flat-manager = callPackage ./pkgs/flat-manager/package.nix {inherit (final) flat-manager;};
- flat-manager-client = callPackage ./pkgs/flat-manager-client/package.nix {inherit (final) flat-manager;};
+ flat-manager = callPackage ./pkgs/flat-manager/package.nix { inherit (final) flat-manager; };
+ flat-manager-client = callPackage ./pkgs/flat-manager-client/package.nix {
+ inherit (final) flat-manager;
+ };
- papa = callPackage ./pkgs/papa/package.nix {inherit (final) papa;};
- })
+ papa = callPackage ./pkgs/papa/package.nix { inherit (final) papa; };
+ }
+)
diff --git a/flake.nix b/flake.nix
index 5775907..458337b 100644
--- a/flake.nix
+++ b/flake.nix
@@ -2,8 +2,8 @@
description = "getchoo's nix expressions";
nixConfig = {
- extra-substituters = ["https://getchoo.cachix.org"];
- extra-trusted-public-keys = ["getchoo.cachix.org-1:ftdbAUJVNaFonM0obRGgR5+nUmdLMM+AOvDOSx0z5tE="];
+ extra-substituters = [ "https://getchoo.cachix.org" ];
+ extra-trusted-public-keys = [ "getchoo.cachix.org-1:ftdbAUJVNaFonM0obRGgR5+nUmdLMM+AOvDOSx0z5tE=" ];
};
inputs = {
@@ -12,57 +12,55 @@
flake-checks.url = "github:getchoo/flake-checks";
};
- outputs = {
- nixpkgs,
- flake-checks,
- ...
- }: let
- systems = [
- "x86_64-linux"
- "aarch64-linux"
- "x86_64-darwin"
- "aarch64-darwin"
- ];
+ outputs =
+ { nixpkgs, flake-checks, ... }:
+ let
+ systems = [
+ "x86_64-linux"
+ "aarch64-linux"
+ "x86_64-darwin"
+ "aarch64-darwin"
+ ];
- forAllSystems = fn: nixpkgs.lib.genAttrs systems (sys: fn nixpkgs.legacyPackages.${sys});
- in {
- checks = forAllSystems (pkgs: let
- flake-checks' = flake-checks.lib.mkChecks {
- root = ./.;
- inherit pkgs;
- };
- in {
- inherit
- (flake-checks')
- actionlint
- alejandra
- deadnix
- statix
- ;
- });
+ forAllSystems = fn: nixpkgs.lib.genAttrs systems (sys: fn nixpkgs.legacyPackages.${sys});
+ in
+ {
+ checks = forAllSystems (
+ pkgs:
+ let
+ flake-checks' = flake-checks.lib.mkChecks {
+ root = ./.;
+ inherit pkgs;
+ };
+ in
+ {
+ inherit (flake-checks') actionlint deadnix statix;
+ }
+ );
- packages = forAllSystems (
- {
- lib,
- pkgs,
- system,
- ...
- }: let
- /*
- this filters out packages that may be broken or not supported
- on the current system. packages that have no `broken` or `platforms`
- meta attribute are assumed to be valid
- */
- isValid = _: v:
- lib.elem pkgs.system (v.meta.platforms or [pkgs.system]) && !(v.meta.broken or false);
+ packages = forAllSystems (
+ {
+ lib,
+ pkgs,
+ system,
+ ...
+ }:
+ let
+ /*
+ this filters out packages that may be broken or not supported
+ on the current system. packages that have no `broken` or `platforms`
+ meta attribute are assumed to be valid
+ */
+ isValid =
+ _: v: lib.elem pkgs.system (v.meta.platforms or [ pkgs.system ]) && !(v.meta.broken or false);
- pkgs' = lib.filterAttrs isValid (import ./. {inherit pkgs;});
- in
- pkgs' // {default = pkgs'.treefetch;}
- );
+ pkgs' = lib.filterAttrs isValid (import ./. { inherit pkgs; });
+ in
+ pkgs' // { default = pkgs'.treefetch; }
+ );
- formatter = forAllSystems (pkgs: pkgs.alejandra);
+ formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
- templates = import ./templates;
- };
+ templates = import ./templates;
+ };
}
diff --git a/pkgs/check-pr/package.nix b/pkgs/check-pr/package.nix
index fca30b1..3c5961b 100644
--- a/pkgs/check-pr/package.nix
+++ b/pkgs/check-pr/package.nix
@@ -1,4 +1,4 @@
-{writeShellApplication}:
+{ writeShellApplication }:
writeShellApplication {
name = "check-pr";
text = ''
diff --git a/pkgs/clippy-sarif/package.nix b/pkgs/clippy-sarif/package.nix
index a9fa10c..e180b12 100644
--- a/pkgs/clippy-sarif/package.nix
+++ b/pkgs/clippy-sarif/package.nix
@@ -18,20 +18,21 @@ rustPlatform.buildRustPackage rec {
};
cargoSha256 = "sha256-F3NrqkqLdvMRIuozCMMqwlrrf5QrnmcEhy4TGSzPhiU=";
- cargoBuildFlags = ["--package" pname];
+ cargoBuildFlags = [
+ "--package"
+ pname
+ ];
cargoTestFlags = cargoBuildFlags;
passthru = {
- tests.version = testers.testVersion {
- package = clippy-sarif;
- };
+ tests.version = testers.testVersion { package = clippy-sarif; };
};
meta = with lib; {
mainProgram = "clippy-sarif";
description = "A CLI tool to convert clippy diagnostics into SARIF";
homepage = "https://psastras.github.io/sarif-rs";
- maintainers = with maintainers; [getchoo];
+ maintainers = with maintainers; [ getchoo ];
license = licenses.mit;
inherit (clippy.meta) platforms;
};
diff --git a/pkgs/flat-manager-client/package.nix b/pkgs/flat-manager-client/package.nix
index f41e744..0390a90 100644
--- a/pkgs/flat-manager-client/package.nix
+++ b/pkgs/flat-manager-client/package.nix
@@ -15,8 +15,8 @@ stdenvNoCC.mkDerivation (finalAttrs: {
tenacity
];
- nativeBuildInputs = [python3.pkgs.wrapPython];
- buildInputs = [(python3.withPackages (lib.const finalAttrs.pythonPath))];
+ nativeBuildInputs = [ python3.pkgs.wrapPython ];
+ buildInputs = [ (python3.withPackages (lib.const finalAttrs.pythonPath)) ];
installPhase = ''
runHook preInstall
@@ -26,16 +26,14 @@ stdenvNoCC.mkDerivation (finalAttrs: {
postFixup = ''
makeWrapperArgs+=(
- --prefix GI_TYPELIB_PATH : ${lib.makeSearchPath "lib/girepository-1.0" [ostree]}
+ --prefix GI_TYPELIB_PATH : ${lib.makeSearchPath "lib/girepository-1.0" [ ostree ]}
)
wrapPythonPrograms $out/bin $out "$pythonPath"
'';
- meta =
- flat-manager.meta
- // {
- mainProgram = "flat-manager-client";
- description = flat-manager.meta.description + " (Client)";
- };
+ meta = flat-manager.meta // {
+ mainProgram = "flat-manager-client";
+ description = flat-manager.meta.description + " (Client)";
+ };
})
diff --git a/pkgs/flat-manager/package.nix b/pkgs/flat-manager/package.nix
index 4326c83..ad0026a 100644
--- a/pkgs/flat-manager/package.nix
+++ b/pkgs/flat-manager/package.nix
@@ -22,8 +22,13 @@ rustPlatform.buildRustPackage {
cargoHash = "sha256-xdJYSVH7l31/LpgS615D7kcvjxILFPMiVWDDvmm/3VE=";
- nativeBuildInputs = [pkg-config];
- buildInputs = [glib openssl ostree postgresql];
+ nativeBuildInputs = [ pkg-config ];
+ buildInputs = [
+ glib
+ openssl
+ ostree
+ postgresql
+ ];
meta = with lib; {
mainProgram = "flat-manager";
@@ -35,7 +40,7 @@ rustPlatform.buildRustPackage {
'';
homepage = "https://github.com/flatpak/flat-manager";
changelog = "https://github.com/flatpak/flat-manager/releases/tag/${flat-manager.version}";
- maintainers = with maintainers; [getchoo];
+ maintainers = with maintainers; [ getchoo ];
platforms = platforms.linux;
};
}
diff --git a/pkgs/nixgc/package.nix b/pkgs/nixgc/package.nix
index 9e25bd7..9d8e230 100644
--- a/pkgs/nixgc/package.nix
+++ b/pkgs/nixgc/package.nix
@@ -9,7 +9,10 @@
writeShellApplication {
name = "nixgc";
- runtimeInputs = [nix fd];
+ runtimeInputs = [
+ nix
+ fd
+ ];
text = ''
fd . /nix/var/nix/profiles /home/*/.local/state/nix/profiles -d 3 -t symlink -E '*-link' | while read -r profile; do
@@ -19,7 +22,7 @@ writeShellApplication {
meta = with lib; {
description = "nix-collect-garbage, but with nix profile";
- maintainers = [maintainers.getchoo];
+ maintainers = [ maintainers.getchoo ];
platforms = platforms.linux;
};
}
diff --git a/pkgs/papa/package.nix b/pkgs/papa/package.nix
index e8b5a97..61c465e 100644
--- a/pkgs/papa/package.nix
+++ b/pkgs/papa/package.nix
@@ -27,8 +27,11 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-t2c/eaQLEKLzJEvyY35Kithon5K5Bes3OWmQgExigzI=";
- nativeBuildInputs = [pkg-config installShellFiles];
- buildInputs = [openssl];
+ nativeBuildInputs = [
+ pkg-config
+ installShellFiles
+ ];
+ buildInputs = [ openssl ];
postInstall = ''
installShellCompletion --cmd papa \
@@ -38,9 +41,9 @@ rustPlatform.buildRustPackage rec {
'';
passthru = {
- tests.version = testers.testVersion {package = papa;};
+ tests.version = testers.testVersion { package = papa; };
- updateScript = nix-update-script {};
+ updateScript = nix-update-script { };
libthermite = fetchFromGitHub {
owner = "AnActualEmerald";
@@ -56,7 +59,7 @@ rustPlatform.buildRustPackage rec {
changelog = "https://github.com/AnActualEmerald/papa/releases/tag/v${src.version}";
mainProgram = "papa";
license = licenses.mit;
- maintainers = with maintainers; [getchoo];
+ maintainers = with maintainers; [ getchoo ];
platforms = platforms.unix;
};
}
diff --git a/pkgs/treefetch/package.nix b/pkgs/treefetch/package.nix
index dd8283a..2dec75f 100644
--- a/pkgs/treefetch/package.nix
+++ b/pkgs/treefetch/package.nix
@@ -21,7 +21,7 @@ rustPlatform.buildRustPackage {
longDescription = "A comfy and fast system fetch tool made in Rust. Tested to be much faster than neofetch and pfetch.";
homepage = "https://github.com/angelofallars/treefetch";
license = licenses.gpl3;
- maintainers = with maintainers; [getchoo];
+ maintainers = with maintainers; [ getchoo ];
platforms = platforms.unix;
};
}
diff --git a/templates/basic/flake.nix b/templates/basic/flake.nix
index 53ab44b..1840cb1 100644
--- a/templates/basic/flake.nix
+++ b/templates/basic/flake.nix
@@ -5,48 +5,41 @@
nixpkgs.url = "nixpkgs/nixos-unstable";
};
- outputs = {
- self,
- nixpkgs,
- ...
- }: let
- systems = [
- "x86_64-linux"
- "aarch64-linux"
- "x86_64-darwin"
- "aarch64-darwin"
- ];
+ outputs =
+ { self, nixpkgs, ... }:
+ let
+ systems = [
+ "x86_64-linux"
+ "aarch64-linux"
+ "x86_64-darwin"
+ "aarch64-darwin"
+ ];
- forAllSystems = fn: nixpkgs.lib.genAttrs systems (sys: fn nixpkgs.legacyPackages.${sys});
- version = self.shortRev or self.dirtyShortRev or "unknown";
- in {
- devShells = forAllSystems ({
- pkgs,
- system,
- ...
- }: {
- default = pkgs.mkShell {
- packages = with pkgs; [
- bash
- ];
+ forAllSystems = fn: nixpkgs.lib.genAttrs systems (sys: fn nixpkgs.legacyPackages.${sys});
+ version = self.shortRev or self.dirtyShortRev or "unknown";
+ in
+ {
+ devShells = forAllSystems (
+ { pkgs, system, ... }:
+ {
+ default = pkgs.mkShell {
+ packages = with pkgs; [ bash ];
- inputsFrom = [self.packages.${system}.hello];
- };
- });
+ inputsFrom = [ self.packages.${system}.hello ];
+ };
+ }
+ );
- formatter = forAllSystems (pkgs: pkgs.alejandra);
+ formatter = forAllSystems (pkgs: pkgs.alejandra);
- packages = forAllSystems ({
- pkgs,
- system,
- ...
- }: {
- hello = pkgs.callPackage ./. {inherit version;};
- default = self.packages.${system}.hello;
- });
+ packages = forAllSystems (
+ { pkgs, system, ... }:
+ {
+ hello = pkgs.callPackage ./. { inherit version; };
+ default = self.packages.${system}.hello;
+ }
+ );
- overlays.default = _: prev: {
- hello = prev.callPackage ./. {inherit version;};
+ overlays.default = _: prev: { hello = prev.callPackage ./. { inherit version; }; };
};
- };
}
diff --git a/templates/default.nix b/templates/default.nix
index 349f9df..1c67349 100644
--- a/templates/default.nix
+++ b/templates/default.nix
@@ -9,8 +9,8 @@ let
inherit description;
};
in
- builtins.mapAttrs toTemplate {
- basic = "minimal boilerplate for my flakes";
- full = "big template for complex flakes (using flake-parts)";
- nixos = "minimal boilerplate for flake-based nixos configuration";
- }
+builtins.mapAttrs toTemplate {
+ basic = "minimal boilerplate for my flakes";
+ full = "big template for complex flakes (using flake-parts)";
+ nixos = "minimal boilerplate for flake-based nixos configuration";
+}
diff --git a/templates/full/default.nix b/templates/full/default.nix
index 5804660..6466507 100644
--- a/templates/full/default.nix
+++ b/templates/full/default.nix
@@ -1,10 +1,9 @@
-(import
- (let
+(import (
+ let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
- fetchTarball {
- url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
- sha256 = lock.nodes.flake-compat.locked.narHash;
- })
- {src = ./.;})
-.defaultNix
+ fetchTarball {
+ url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
+ sha256 = lock.nodes.flake-compat.locked.narHash;
+ }
+) { src = ./.; }).defaultNix
diff --git a/templates/full/flake.nix b/templates/full/flake.nix
index b9be66c..9d33ecb 100644
--- a/templates/full/flake.nix
+++ b/templates/full/flake.nix
@@ -15,9 +15,10 @@
};
};
- outputs = inputs:
- inputs.flake-parts.lib.mkFlake {inherit inputs;} {
- imports = [./nix];
+ outputs =
+ inputs:
+ inputs.flake-parts.lib.mkFlake { inherit inputs; } {
+ imports = [ ./nix ];
systems = [
"x86_64-linux"
diff --git a/templates/full/nix/default.nix b/templates/full/nix/default.nix
index c0457fd..66bb711 100644
--- a/templates/full/nix/default.nix
+++ b/templates/full/nix/default.nix
@@ -4,7 +4,9 @@
./packages.nix
];
- perSystem = {pkgs, ...}: {
- formatter = pkgs.alejandra;
- };
+ perSystem =
+ { pkgs, ... }:
+ {
+ formatter = pkgs.alejandra;
+ };
}
diff --git a/templates/full/nix/derivation.nix b/templates/full/nix/derivation.nix
index 043b140..ac18240 100644
--- a/templates/full/nix/derivation.nix
+++ b/templates/full/nix/derivation.nix
@@ -1 +1 @@
-{hello}: hello
+{ hello }: hello
diff --git a/templates/full/nix/packages.nix b/templates/full/nix/packages.nix
index 562823e..e48cdde 100644
--- a/templates/full/nix/packages.nix
+++ b/templates/full/nix/packages.nix
@@ -1,18 +1,18 @@
-{self, ...}: let
+{ self, ... }:
+let
version = self.shortRev or self.dirtyShortRev or "unknown";
-in {
+in
+{
flake.overlays.default = _: prev: {
- hello = prev.callPackage ./derivation.nix {inherit version;};
+ hello = prev.callPackage ./derivation.nix { inherit version; };
};
- perSystem = {
- pkgs,
- self',
- ...
- }: {
- package = {
- hello = pkgs.callPackage ./derivation.nix {inherit version;};
- default = self'.packages.hello;
+ perSystem =
+ { pkgs, self', ... }:
+ {
+ package = {
+ hello = pkgs.callPackage ./derivation.nix { inherit version; };
+ default = self'.packages.hello;
+ };
};
- };
}
diff --git a/templates/full/nix/shell.nix b/templates/full/nix/shell.nix
index 66cd1a4..680c875 100644
--- a/templates/full/nix/shell.nix
+++ b/templates/full/nix/shell.nix
@@ -1,17 +1,13 @@
{
- perSystem = {
- pkgs,
- self',
- ...
- }: {
- devShells = {
- default = pkgs.mkShell {
- packages = [
- self'.formatter
- ];
+ perSystem =
+ { pkgs, self', ... }:
+ {
+ devShells = {
+ default = pkgs.mkShell {
+ packages = [ self'.formatter ];
- inputsFrom = [self'.packages.hello];
+ inputsFrom = [ self'.packages.hello ];
+ };
};
};
- };
}
diff --git a/templates/nixos/flake.nix b/templates/nixos/flake.nix
index 235ce27..1ae27dc 100644
--- a/templates/nixos/flake.nix
+++ b/templates/nixos/flake.nix
@@ -9,31 +9,36 @@
};
};
- outputs = {nixpkgs, ...} @ inputs: let
- systems = [
- "x86_64-linux"
- "aarch64-linux"
- "x86_64-darwin"
- "aarch64-darwin"
- ];
+ outputs =
+ { nixpkgs, ... }@inputs:
+ let
+ systems = [
+ "x86_64-linux"
+ "aarch64-linux"
+ "x86_64-darwin"
+ "aarch64-darwin"
+ ];
- forAllSystems = fn: nixpkgs.lib.genAttrs systems (sys: fn nixpkgs.legacyPackages.${sys});
- in {
- nixosConfigurations.myComputer = nixpkgs.lib.nixosSystem {
- system = "x86_64-linux";
- modules = [./configuration.nix];
- specialArgs = {inherit inputs;};
- };
-
- devShells = forAllSystems (pkgs: {
- default = pkgs.mkShellNoCC {
- packages = with pkgs; [
- just
- fzf
- ];
+ forAllSystems = fn: nixpkgs.lib.genAttrs systems (sys: fn nixpkgs.legacyPackages.${sys});
+ in
+ {
+ nixosConfigurations.myComputer = nixpkgs.lib.nixosSystem {
+ system = "x86_64-linux";
+ modules = [ ./configuration.nix ];
+ specialArgs = {
+ inherit inputs;
+ };
};
- });
- formatter = forAllSystems (pkgs: pkgs.alejandra);
- };
+ devShells = forAllSystems (pkgs: {
+ default = pkgs.mkShellNoCC {
+ packages = with pkgs; [
+ just
+ fzf
+ ];
+ };
+ });
+
+ formatter = forAllSystems (pkgs: pkgs.alejandra);
+ };
}