Add nixfmt to nix devShell, reformat flake.nix, Ignore flake.lock

This commit is contained in:
Bobbe
2026-02-20 17:34:26 +01:00
parent d5b7e74f31
commit 0303516fa0
2 changed files with 26 additions and 13 deletions

1
.gitignore vendored
View File

@@ -9,3 +9,4 @@ hosts-*
/node_modules/
/package-lock.json
/yarn.lock
/flake.lock

View File

@@ -1,15 +1,18 @@
{
description = "Unified hosts file with base extensions.";
outputs = { self, nixpkgs, ... }@inputs:
outputs =
{
self,
nixpkgs,
...
}:
let
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.platforms.unix;
nixpkgsFor = forAllSystems (system: import nixpkgs {
inherit system;
});
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
in
{
nixosModule = { config, ... }:
nixosModule =
{ config, ... }:
let
inherit (nixpkgs) lib;
cfg = config.networking.stevenBlackHosts;
@@ -35,21 +38,30 @@
config = lib.mkIf cfg.enable {
networking.extraHosts =
let
orig = builtins.readFile ("${self}/" + (lib.optionalString (alternatesList != []) alternatesPath) + "hosts");
orig = builtins.readFile (
"${self}/" + (lib.optionalString (alternatesList != [ ]) alternatesPath) + "hosts"
);
ipv6 = builtins.replaceStrings [ "0.0.0.0" ] [ "::" ] orig;
in
lib.mkAfter (orig + (lib.optionalString cfg.enableIPv6 ("\n" + ipv6)));
};
};
devShells = forAllSystems (system:
let pkgs = nixpkgsFor.${system}; in
devShells = forAllSystems (
system:
let
pkgs = nixpkgsFor.${system};
in
{
default = pkgs.mkShell {
buildInputs = with pkgs; [
python3
python3Packages.flake8
python3Packages.requests
packages = with pkgs; [
nixfmt
(python3.withPackages (
pythonPackages: with pythonPackages; [
flake8
requests
]
))
];
};
}