mirror of
https://github.com/StevenBlack/hosts.git
synced 2026-07-01 02:36:52 +00:00
Add nixfmt to nix devShell, reformat flake.nix, Ignore flake.lock
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -9,3 +9,4 @@ hosts-*
|
|||||||
/node_modules/
|
/node_modules/
|
||||||
/package-lock.json
|
/package-lock.json
|
||||||
/yarn.lock
|
/yarn.lock
|
||||||
|
/flake.lock
|
||||||
|
|||||||
38
flake.nix
38
flake.nix
@@ -1,15 +1,18 @@
|
|||||||
{
|
{
|
||||||
description = "Unified hosts file with base extensions.";
|
description = "Unified hosts file with base extensions.";
|
||||||
outputs = { self, nixpkgs, ... }@inputs:
|
outputs =
|
||||||
|
{
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.platforms.unix;
|
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.platforms.unix;
|
||||||
|
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
|
||||||
nixpkgsFor = forAllSystems (system: import nixpkgs {
|
|
||||||
inherit system;
|
|
||||||
});
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
nixosModule = { config, ... }:
|
nixosModule =
|
||||||
|
{ config, ... }:
|
||||||
let
|
let
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
cfg = config.networking.stevenBlackHosts;
|
cfg = config.networking.stevenBlackHosts;
|
||||||
@@ -35,21 +38,30 @@
|
|||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
networking.extraHosts =
|
networking.extraHosts =
|
||||||
let
|
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;
|
ipv6 = builtins.replaceStrings [ "0.0.0.0" ] [ "::" ] orig;
|
||||||
in
|
in
|
||||||
lib.mkAfter (orig + (lib.optionalString cfg.enableIPv6 ("\n" + ipv6)));
|
lib.mkAfter (orig + (lib.optionalString cfg.enableIPv6 ("\n" + ipv6)));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
devShells = forAllSystems (system:
|
devShells = forAllSystems (
|
||||||
let pkgs = nixpkgsFor.${system}; in
|
system:
|
||||||
|
let
|
||||||
|
pkgs = nixpkgsFor.${system};
|
||||||
|
in
|
||||||
{
|
{
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
buildInputs = with pkgs; [
|
packages = with pkgs; [
|
||||||
python3
|
nixfmt
|
||||||
python3Packages.flake8
|
(python3.withPackages (
|
||||||
python3Packages.requests
|
pythonPackages: with pythonPackages; [
|
||||||
|
flake8
|
||||||
|
requests
|
||||||
|
]
|
||||||
|
))
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user